public void Draw_main_rect(string[] point_gr1, string[] point_gr2, Color[] color, int k0, int k1, int k2, int j) { //у,х, ширина, висота var shapes = new Main_figures(gr); var left_limit_x = gr.Width / 2; var left_limit_y = 0.55 * gr.Height; var right_limit_x = left_limit_x + (8 * gr.Height) / 21; var right_limit_y = left_limit_y + (8 * gr.Height) / 21; var count = 0; double cord; if (k1 != 0) { cord = Convert.ToDouble(point_gr2[j + 3]) - Convert.ToDouble(point_gr2[j + 1]); } else { cord = 0; } shapes.Draw_Rect(left_limit_x, left_limit_y + k1 * (Convert.ToDouble(point_gr2[j + 1]) - left_limit_y) + k2 * (Convert.ToDouble(point_gr2[point_gr2.Length - 2]) - left_limit_y), Convert.ToDouble(point_gr1[0]) - left_limit_x, k2 * (right_limit_y - Convert.ToDouble(point_gr2[point_gr2.Length - 2])) + k1 * cord + k0 * (Convert.ToDouble(point_gr2[1]) - left_limit_y), color[count++], 1); for (int i = 0; i < point_gr1.Length - 3; i = i + 2) { shapes.Draw_Rect(Convert.ToDouble(point_gr1[i]), left_limit_y + (k1 * (Convert.ToDouble(point_gr2[j + 1]) - left_limit_y) + k2 * (Convert.ToDouble(point_gr2[point_gr2.Length - 2]) - left_limit_y)), Convert.ToDouble(point_gr1[i + 2]) - Convert.ToDouble(point_gr1[i]), k2 * (right_limit_y - Convert.ToDouble(point_gr2[point_gr2.Length - 2])) + k1 * cord + k0 * (Convert.ToDouble(point_gr2[1]) - left_limit_y), color[count++], 1); } shapes.Draw_Rect(Convert.ToDouble(point_gr1[point_gr1.Length - 3]), left_limit_y + k1 * (Convert.ToDouble(point_gr2[j + 1]) - left_limit_y) + k2 * (Convert.ToDouble(point_gr2[point_gr2.Length - 2]) - left_limit_y), right_limit_x - Convert.ToDouble(point_gr1[point_gr1.Length - 3]), k2 * (right_limit_y - Convert.ToDouble(point_gr2[point_gr2.Length - 2])) + k1 * cord + k0 * (Convert.ToDouble(point_gr2[1]) - left_limit_y), color[count], 1); }
public void Rect_Area(List <Class_point> list_point1, List <Class_point> list_point2, int count_cord1, int count_cord2, Canvas gr) { var shapes = new Main_figures(gr); Color[] colors; var p1_str = Function_Split(list_point1, 1); var p2_str = Function_Split(list_point2, 1); var list_criteria1 = Function_Split(list_point1, 0); var list_criteria2 = Function_Split(list_point2, 0); for (int i = 0; i <= count_cord2; i++) { colors = Name_area(0, count_cord1, i + 1, gr.Width * 0.5, gr.Height * 0.55); if (i == 0) { Draw_main_rect(list_criteria1, list_criteria2, colors, 1, 0, 0, 0); } else if (i == count_cord2) { Draw_main_rect(list_criteria1, list_criteria2, colors, 0, 0, 1, 0); } else { Draw_main_rect(list_criteria1, list_criteria2, colors, 0, 1, 0, 2 * (i - 1)); } } var x = ((p1_str.Length - 1) / 2 < 4) ? Convert.ToDouble(p1_str[4]) : Convert.ToDouble(p1_str[2]); var y = ((p2_str.Length - 1) / 2 < 4) ? Convert.ToDouble(p2_str[5]) : Convert.ToDouble(p2_str[3]); var x1 = Convert.ToDouble(p1_str[0]); var x2 = Convert.ToDouble(p1_str[2]); var y1 = Convert.ToDouble(p2_str[1]); var y2 = Convert.ToDouble(p2_str[3]); if (x1 > x2 && y1 > y2) { shapes.Draw_Rect(x2, y2, x - Convert.ToDouble(p1_str[0]), y - Convert.ToDouble(p2_str[1]), Colors.Red, 0.3); } else if (x1 > x2 && y1 < y2) { shapes.Draw_Rect(x2, y1, x - Convert.ToDouble(p1_str[0]), y - Convert.ToDouble(p2_str[1]), Colors.Red, 0.3); } else if (x1 < x2 && y1 < y2) { shapes.Draw_Rect(x1, y1, x - Convert.ToDouble(p1_str[0]), y - Convert.ToDouble(p2_str[1]), Colors.Red, 0.3); } else if (x1 < x2 && y1 > y2) { shapes.Draw_Rect(x1, y2, x - Convert.ToDouble(p1_str[0]), y - Convert.ToDouble(p2_str[1]), Colors.Red, 0.3); } var name_gr1 = Name_level_danger(list_criteria1, p1_str, list_point1, 0); var name_gr2 = Name_level_danger(list_criteria2, p2_str, list_point2, 1); danger_level.Text = Namearea(name_gr2 + name_gr1); }
public Color[] Name_area(int left_lim, int right_lim, int select_index, double l, double h) { var str_name = String.Empty; var shapes = new Main_figures(gr); int count = right_lim - left_lim - 1; Color[] color = new Color[count]; count = 0; var gr_table2 = list_gr2[select_index]; for (int i = left_lim + 1; i < right_lim; i++) { var gr_table1 = list_gr1[i]; str_name = gr_table2.Name + gr_table1.Name; switch (Convert.ToInt32(str_name)) { case 55: case 45: case 54: color[count++] = Colors.DimGray; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 600, Name_Oblast_ST[4], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 590, 40, 40, Colors.DimGray, 1); break; case 44: case 53: color[count++] = Colors.Gray; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 550, Name_Oblast_ST[3], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 540, 40, 40, Colors.Gray, 1); break; case 43: case 52: case 51: color[count++] = Colors.DarkGray; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 500, Name_Oblast_ST[2], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 490, 40, 40, Colors.DarkGray, 1); break; case 42: case 34: case 35: color[count++] = Colors.Silver; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 450, Name_Oblast_ST[1], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 440, 40, 40, Colors.Silver, 1); break; default: color[count++] = Colors.Gainsboro; shapes.Text(l + (koef * h) / 10.5 * 12 - 20, 400, Name_Oblast_ST[0], Convert.ToInt32(0.5 * (koef * h) / 10.5)); shapes.Draw_Rect(l + (koef * h) / 10.5 * 12 - 65, 390, 40, 40, Colors.Gainsboro, 1); break; } str_name = str_name.First().ToString(); } return(color); }