public UserFigure(string srcname, FiguresList.FigureList srclist, Pen pens, int x1, int y1, int x2, int y2) : base(pens, x1, y1, x2, y2) { Primitives = new FiguresList.FigureList(); SourceFigures = new FiguresList.FigureList(); for (int i = 0; i < srclist.Size(); i++) { SourceFigures.Add(srclist.Item(i).Copy()); } for (int i = 0; i < srclist.Size(); i++) { Primitives.Add(srclist.Item(i).Copy()); } Name = srcname; GetEdgeCoordinates(); GetRelativeCoords(); }
private void BackStep() { if (FigList.Size() > 0) { grRez.Clear(Color.Transparent); grMajor.Clear(Color.Transparent); FigList.Remove(FigList.Last); FigList.PrintList(lboxFigures); FigList.DrawAll(grRez); grMajor.DrawImage(Layers[1], 0, 0); pictureBox1.Refresh(); BackSteps++; if (BackSteps == 3) { btnBack.Enabled = false; } } }
public void SaveFiguresList(FileStream fs, FiguresList.FigureList figs) { SerialFiguresList SerFigsList = new SerialFiguresList(); for (int i = 0; i < figs.Size(); i++) { SerialFigure serfig = new SerialFigure(figs.Item(i)); SerFigsList.Add(serfig); } formatter.Serialize(fs, SerFigsList); }
public FiguresList.FigureList TransformToFullList(FiguresList.FigureList srclist) { var Rezlist = new FiguresList.FigureList(); for (int i = 0; i < srclist.Size(); i++) { if (srclist.Item(i) is UserFigure) { for (int j = 0; j < ((UserFigure)srclist.Item(i)).Primitives.Size(); j++) { Rezlist.Add(((UserFigure)srclist.Item(i)).Primitives.Item(j)); } } else { Rezlist.Add(srclist.Item(i)); } } return(Rezlist); }
public FiguresList.FigureList TransformOneFigureToPrimitives(FiguresList.FigureList srclist, int index) { var Rezlist = new FiguresList.FigureList(); for (int i = 0; i < srclist.Size(); i++) { if (i == index) { for (int j = 0; j < ((UserFigure)srclist.Item(i)).Primitives.Size(); j++) { Rezlist.Add(((UserFigure)srclist.Item(i)).Primitives.Item(j)); } } else { Rezlist.Add(srclist.Item(i)); } } return(Rezlist); }
public void SaveFiguresList(FileStream fs, FiguresList.FigureList figs) { //var usrfigslist = new FiguresList.FigureList(); var serfigslist = new SerialFiguresList(); for (int i = 0; i < figs.Size(); i++) { var serfig = new SerialFigure(figs.Item(i)); serfigslist.Add(serfig); if (figs.Item(i) is UserFigure) { for (int j = 0; j < ((UserFigure)figs.Item(i)).SourceFigures.Size(); j++) { ((UserFigure)figs.Item(i)).SourceFigures.Item(j).isUserFigure = true; serfig = new SerialFigure(((UserFigure)figs.Item(i)).SourceFigures.Item(j)); serfigslist.Add(serfig); } } } formatter.Serialize(fs, serfigslist); }