コード例 #1
0
 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();
 }
コード例 #2
0
 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;
         }
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }