예제 #1
0
파일: logic.cs 프로젝트: Tomilina95/Sources
 void ILogicForCommand.save(string filename)
 {
     List<SVGShape> ShapeList = new List<SVGShape>();
     IFigure buf;
     for (int i = 0; i < Figures.Count; i++)
     {
         buf = Figures.getFigure(i);
         Tuple<IEnumerable<trTriangle>, IEnumerable<ILineContainer>> triangulation;
         triangulation = buf.NewTriangulation(1.0);
         if (buf is VectorGraphicsEditor.Rectangle)
         {
             List<Interfaces.Point> points = (List<Interfaces.Point>)triangulation.Item2;
             Interfaces.Point min = findMinPoint(points);
             Interfaces.Point max = findMaxPoint(points);
             double xh, yh;
             xh = (max.X - min.X);
             yh = (max.Y - min.Y);
             ShapeList.Add(new SVGRect(min.X + xh / 2.0, min.Y + yh / 2.0, xh, yh, buf.FillColor, buf.LineColor));
         }
         if (buf is VectorGraphicsEditor.Triangle)
         {
             ShapeList.Add(new SVGPolygon((List<Interfaces.Point>)triangulation.Item2, buf.FillColor, buf.LineColor));
         }
         if (buf is VectorGraphicsEditor.Mutant)
         {
             ShapeList.Add(new SVGPolygon((List<Interfaces.Point>)triangulation.Item2, buf.FillColor, buf.LineColor));
         }
     }
     SVGIO.export(ShapeList, filename, 800, 600);
 }
예제 #2
0
        static void Main(string[] args)
        {
            var circle = new SVGCircle(new Point(250.0, 550.0), 20.0,
                                       new Color(100, 255, 56, 0),
                                       new Color(0, 0, 0, 0),
                                       2
                                       );

            var ellipse = new SVGEllipse(new Point(450.0, 550.0), 20.0, 10.0,
                                         new Color(100, 255, 56, 0),
                                         new Color(0, 0, 0, 0),
                                         2
                                         );

            var points = new List <Point>()
            {
                new Point(70, 5), new Point(90, 41), new Point(136, 48),
                new Point(103, 80), new Point(111, 126), new Point(70, 105), new Point(29, 126), new Point(36, 80), new Point(5, 48), new Point(48, 41)
            };

            var pathdata = new List <Point>()
            {
                new Point(200, 100), new Point(250, 210), new Point(16, 210)
            };

            var path = new SVGPath(pathdata, new Color(255, 100, 56, 0), new Color(0, 0, 0, 0), 2);

            var polygon = new SVGPolygon(points, new Color(100, 255, 56, 0), new Color(0, 0, 0, 0), 2);

            var rect = new SVGRect(50.0, 20.0, 50.0, 20.0, new Color(100, 255, 56, 0), new Color(0, 0, 0, 0), 2);

            SVGIO.export(new List <SVGShape>()
            {
                polygon, ellipse, circle, rect, path
            }, "Z:\\Sources\\VectorGraphicsEditor\\IO Tests\\output\\mix.svg", 1000, 1001);

            // SVGIO.import("Z:\\Sources\\VectorGraphicsEditor\\IO Tests\\output\\Freesample.svg");
        }