public void LinesRemove(Line2DGroup toRemove) { foreach (Line2D t in toRemove.lines) { lines.Remove(t); } }
public void LinesAdd(Line2DGroup old) { foreach (Line2D t in old.lines) { lines.Add(t); } old.lines.Clear(); }
public void chosenGroup() { bool OK = false; if (ListOfGroups != null && ListOfGroups.Count > 0) { foreach (Line2DGroup gr in ListOfGroups) { if (gr.lines.Contains(ChosenLine)) { ChosenGroup = gr; OK = true; } } } if (!OK) { ChosenGroup = null; } }
public void MakeDreamHouse() { lines.Add(new Line2D(0, 0, 0, 0, 0, 40)); //DA lines.Add(new Line2D(0, 0, 0, 40, 0, 0)); //DC lines.Add(new Line2D(0, 0, 40, 40, 0, 40)); //AB lines.Add(new Line2D(40, 0, 0, 40, 0, 40)); //CB lines.Add(new Line2D(0, 0, 40, 0, 50, 40)); //AE lines.Add(new Line2D(40, 0, 40, 40, 50, 40)); //BF lines.Add(new Line2D(40, 0, 0, 40, 50, 0)); //CK lines.Add(new Line2D(0, 0, 0, 0, 50, 0)); //DL lines.Add(new Line2D(0, 50, 40, 40, 50, 40)); //EF lines.Add(new Line2D(0, 50, 40, 0, 50, 0)); //EL lines.Add(new Line2D(40, 50, 0, 0, 50, 0)); //KL lines.Add(new Line2D(40, 50, 0, 40, 50, 40)); //KF lines.Add(new Line2D(0, 50, 40, 20, 80, 40)); //EG lines.Add(new Line2D(40, 50, 40, 20, 80, 40)); //EG lines.Add(new Line2D(40, 50, 0, 20, 80, 0)); //KH lines.Add(new Line2D(0, 50, 0, 20, 80, 0)); //LH lines.Add(new Line2D(20, 80, 40, 20, 80, 0)); //GH ChosenGroup = new Line2DGroup(lines); ListOfGroups.Add(ChosenGroup); DrawAllLines(); }
private void btn_Group_Click(object sender, EventArgs e) { if (ChosenGroupOfLines.Count > 0) { List <Line2D> gr = new List <Line2D>(); var tmp = ChosenGroupOfLines.ToArray(); foreach (Line2D l2d in tmp) { if (!gr.Contains(l2d)) { gr.Add(l2d); } } foreach (Line2D l2d in tmp) { foreach (Line2DGroup l2dgr in ListOfGroups) { if (l2dgr.lines.Contains(l2d)) { foreach (Line2D line2 in l2dgr.lines) { if (!ChosenGroupOfLines.Contains(line2)) { //ChosenGroupOfLines.Add(line2); gr.Add(line2); } } } } } ChosenGroupOfLines = gr; Line2DGroup lgr = new Line2DGroup(ChosenGroupOfLines);//ChosenGroupOfLines ListOfGroups.Add(lgr); ChosenGroupOfLines.Clear(); } }