public GroupItem(GroupItem GI) { _GroupItem = new ArrayList(); TypeShape = Nows.Group; Item It; for (int i = 0; i < GI.Count; i++) { It = (Item) GI[i]; switch (It.TypeShape) { case Nows.Line: Line L = (Line) GI[i]; _GroupItem.Add(new Line(L)); break; case Nows.Rec: Rec R = (Rec)GI[i]; _GroupItem.Add(new Rec(R)); break; case Nows.Ellip: case Nows.Pie: Pie P = (Pie)GI[i]; _GroupItem.Add(new Pie(P)); break; case Nows.Group: GroupItem Gr = (GroupItem)GI[i]; _GroupItem.Add(new GroupItem(Gr)); break; } } X1 = GI.X1; X2 = GI.X2; Y1 = GI.Y1; Y2 = GI.Y2; Name = GI.Name; ZOrder = GI.ZOrder; }
private GroupItem ReadGIFromFile(BinaryReader dataIn) { int Count = dataIn.ReadInt32(); Nows TS; GroupItem GI = new GroupItem(); for (int i = 0; i < Count; i++) { TS = (Nows)dataIn.ReadInt32(); switch (TS) { case Nows.Line: GI.Add(ReadLFromFile(dataIn)); break; case Nows.Rec: GI.Add(ReadRFromFile(dataIn)); break; case Nows.Ellip: case Nows.Pie: GI.Add(ReadPFromFile(dataIn, TS)); break; case Nows.Group: GI.Add(ReadGIFromFile(dataIn)); break; } } GI.Name = string.Format("Группа {0}", CurrentPage.GC++); return GI; }
private void tsmiGroup_Click(object sender, EventArgs e) { if (CurrentPage.Selected.Count <= 1) return; GroupItem GI = new GroupItem(); for (int i = CurrentPage.Selected.Count - 1; i >= 0; i--) { Item It = (Item)CurrentPage.Selected[i]; switch (It.TypeShape) { case Nows.Line: Line L = (Line)CurrentPage.Selected[i]; GI.Add(new Line(L)); CurrentPage.Items.RemoveObj(L); CurrentPage.ZOrdCurrent--; break; case Nows.Rec: Rec R = (Rec)CurrentPage.Selected[i]; GI.Add(new Rec(R)); CurrentPage.Items.RemoveObj(R); CurrentPage.ZOrdCurrent--; break; case Nows.Ellip: case Nows.Pie: Pie P = (Pie)CurrentPage.Selected[i]; GI.Add(new Pie(P)); CurrentPage.Items.RemoveObj(P); CurrentPage.ZOrdCurrent--; break; case Nows.Group: GroupItem Gr = (GroupItem)CurrentPage.Selected[i]; GI.Add(new GroupItem(Gr)); CurrentPage.Items.RemoveObj(Gr); CurrentPage.ZOrdCurrent--; break; } } GI.Name = string.Format("Группа {0}", CurrentPage.GC++); CurrentPage.Items.Add(GI); CurrentPage.ZOrdCurrent++; Sort(); CurrentPage.Selected.Clear(); CurrentPage.Selected.Add(GI); tscbAlls.SelectedIndex = GI.ZOrder; CheckEnables(); }
private void WriteGIToFile(BinaryWriter dataOut, GroupItem GI) { Item It; dataOut.Write((int)GI.TypeShape); dataOut.Write(GI.Count); for (int i = 0; i < GI.Count; i++) { It = (Item) GI[i]; switch (It.TypeShape) { case Nows.Line: Line L = (Line)GI[i]; WriteLToFile(dataOut, L); break; case Nows.Rec: Rec R = (Rec)GI[i]; WriteRToFile(dataOut, R); break; case Nows.Ellip: case Nows.Pie: Pie P = (Pie)GI[i]; WritePToFile(dataOut, P); break; case Nows.Group: GroupItem GR = (GroupItem)GI[i]; WriteGIToFile(dataOut, GR); break; } } }
public void Add(GroupItem GI) { _ItemsObj.Add(GI); _GICount++; }