//--------------------------------------------------------------- public Cluster_Pos(Deck[] deck_GA, int r_deck_No, int r_row, int r_column, Cluster_Inf c_inf) { p_row = r_row; p_column = r_column; p_deck_No = r_deck_No; Calc_Center(deck_GA, c_inf); }
public ClusterList(Cluster_Inf form_cluster, Cluster_Pos c_position) { name = form_cluster.Name; width = form_cluster.Width; height = form_cluster.Height; position_deck_No = c_position.P_deck_No; p_row = c_position.P_row; p_column = c_position.P_column; center_x = c_position.center_X; center_y = c_position.center_Y; zone = c_position.Zone; }
public void Calc_Center(Deck[] deck_GA, Cluster_Inf c_inf) { if (p_deck_No == 0) { for (int i = 0; i < c_inf.Height; i++)//We put the cluster information of the grid line-by-line { for (int j = 0; j < c_inf.Width; j++) { if (HasString(c_inf.Name, "VALVE") == true) { deck_GA[0].grids[p_row + i, p_column + j].Valve = true; } else { deck_GA[0].grids[p_row + i, p_column + j].Module = true; } } } //To calculate the center coordinate double cluster_x = c_inf.Width; double cluster_y = c_inf.Height; center_x = deck_GA[0].grids[p_row, p_column].Vertexes[0].P.X + cluster_x / 2 * deck_GA[0].g_size - deck_GA[0].g_size; center_y = deck_GA[0].grids[p_row, p_column].Vertexes[0].P.Y + cluster_y / 2 * deck_GA[0].g_size - deck_GA[0].g_size; //-----------Zone of judgment ---------------------------------------- if (center_x >= 64 & center_x <= 152 & center_y <= 136) { zone = "A"; } else if (center_x >= 152 & center_y >= 136 & center_y <= 192) { zone = "B"; } else if (center_x >= 64 & center_x <= 152 & center_y >= 192) { zone = "C"; } else if (center_x <= 64 & center_y >= 136 & center_y <= 192) { zone = "D"; } //--------------------------------------------------------------- } if (p_deck_No == 1) { for (int i = 0; i < c_inf.Height; i++)//Go put one to the grid line-by-line { for (int j = 0; j < c_inf.Width; j++) { if (HasString(c_inf.Name, "VALVE") == true) { deck_GA[1].grids[p_row + i, p_column + j].Valve = true; } else { deck_GA[1].grids[p_row + i, p_column + j].Module = true; } } } //To calculate the center coordinate double cluster_x = c_inf.Width; double cluster_y = c_inf.Height; center_x = deck_GA[1].grids[p_row, p_column].Vertexes[0].P.X + cluster_x / 2 * deck_GA[1].g_size - deck_GA[1].g_size; center_y = deck_GA[1].grids[p_row, p_column].Vertexes[0].P.Y + cluster_y / 2 * deck_GA[1].g_size - deck_GA[1].g_size; //-----------Zone of judgment---------------------------------------- if (center_x >= 64 & center_x <= 152 & center_y <= 136) { zone = "A"; } else if (center_x >= 152 & center_y >= 136 & center_y <= 192) { zone = "B"; } else if (center_x >= 64 & center_x <= 152 & center_y >= 192) { zone = "C"; } else if (center_x <= 64 & center_y >= 136 & center_y <= 192) { zone = "D"; } //--------------------------------------------------------------- } if (p_deck_No == 2) { for (int i = 0; i < c_inf.Height; i++)//Go put one to the grid line-by-line { for (int j = 0; j < c_inf.Width; j++) { if (HasString(c_inf.Name, "VALVE") == true) { deck_GA[2].grids[p_row + i, p_column + j].Valve = true; } else { deck_GA[2].grids[p_row + i, p_column + j].Module = true; } } } //To calculate the center coordinate double cluster_x = c_inf.Width; double cluster_y = c_inf.Height; center_x = deck_GA[2].grids[p_row, p_column].Vertexes[0].P.X + cluster_x / 2 * deck_GA[2].g_size - deck_GA[2].g_size; center_y = deck_GA[2].grids[p_row, p_column].Vertexes[0].P.Y + cluster_y / 2 * deck_GA[2].g_size - deck_GA[2].g_size; //-----------Zone of judgment---------------------------------------- if (center_x >= 40 & center_x <= 160 & center_y <= 128) { zone = "A"; } else if (center_x >= 160 & center_y >= 128 & center_y <= 216) { zone = "B"; } else if (center_x >= 40 & center_x <= 160 & center_y >= 216) { zone = "C"; } else if (center_x <= 40 & center_y >= 128 & center_y <= 216) { zone = "D"; } //--------------------------------------------------------------- } if (p_deck_No == 3) { for (int i = 0; i < c_inf.Height; i++)//Go put one to the grid line-by-line { for (int j = 0; j < c_inf.Width; j++) { if (HasString(c_inf.Name, "VALVE") == true) { deck_GA[3].grids[p_row + i, p_column + j].Valve = true; } else { deck_GA[3].grids[p_row + i, p_column + j].Module = true; } } } //To calculate the center coordinate double cluster_x = c_inf.Width; double cluster_y = c_inf.Height; center_x = deck_GA[3].grids[p_row, p_column].Vertexes[0].P.X + cluster_x / 2 * deck_GA[3].g_size - deck_GA[3].g_size; center_y = deck_GA[3].grids[p_row, p_column].Vertexes[0].P.Y + cluster_y / 2 * deck_GA[3].g_size - deck_GA[3].g_size; //-----------Zone of judgment---------------------------------------- if (center_x >= 40 & center_x <= 160 & center_y <= 128) { zone = "A"; } else if (center_x >= 160 & center_y >= 128 & center_y <= 216) { zone = "B"; } else if (center_x >= 40 & center_x <= 160 & center_y >= 216) { zone = "C"; } else if (center_x <= 40 & center_y >= 128 & center_y <= 216) { zone = "D"; } //--------------------------------------------------------------- } }