Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShellContextMenu"/> class.
        /// </summary>
        ///
        /// <param name="items">
        /// The items to which the context menu should refer.
        /// </param>
        /// <param name="svgio"></param>
        /// <param name="view">The ShellView the ContextMenu is associated with</param>
        public ShellContextMenu(IListItemEx[] items, SVGIO svgio = SVGIO.SVGIO_SELECTION, ShellView view = null)
        {
            this._ShellView = view;

            if (svgio == SVGIO.SVGIO_BACKGROUND)
            {
                Initialize(items[0]);
            }
            else
            {
                Initialize(items);
            }
        }
Ejemplo n.º 3
0
        void ILogicForCommand.load(string filename)
        {
            Tuple<List<SVGShape>, int, int> fromfile = SVGIO.import(filename);
            Figures.clear();
            CurientFigures.Clear();
            foreach (SVGShape item in fromfile.Item1)
            {
                if (item is SVGCircle)
                {

                }
                if (item is SVGEllipse)
                {

                }
                if (item is SVGRect)
                {
                    SVGRect fig = (SVGRect)item;
                    Interfaces.Point downleft = new Interfaces.Point(fig.rx - fig.width / 2.0, fig.ry - fig.height / 2.0);
                    Interfaces.Point upright = new Interfaces.Point(fig.rx + fig.width / 2.0, fig.ry + fig.height / 2.0);
                    Figures.addNewFigure(new VectorGraphicsEditor.Rectangle(downleft, upright, fig.stroke, fig.fill)
                }
                if (item is SVGPolygon)
                {
                    SVGPolygon fig = (SVGPolygon)item;
                    if (fig.points.Count == 3)
                    {
                        Figures.addNewFigure(new VectorGraphicsEditor.Triangle(fig.points[0], fig.points[1], fig.points[2], fig.stroke, fig.fill));
                    }
                    else
                    {
                        List<List<Segment>> list = new List<List<Segment>>();
                        list.Add(PointToSegment(fig.points));
                        Figures.addNewFigure(new VectorGraphicsEditor.Mutant(list, fig.stroke, fig.fill, 1.0));
                    }
                }
                if (item is SVGPath)
                {

                }
            }
        }
Ejemplo n.º 4
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");
        }
Ejemplo n.º 5
0
 internal ShellItemCollection(ShellBrowser shellBrowser, SVGIO opt)
 {
     this.shellBrowser = shellBrowser;
     option            = opt;
 }
Ejemplo n.º 6
0
    /// <summary>
    /// Initializes a new instance of the <see cref="ShellContextMenu"/> class.
    /// </summary>
    /// 
    /// <param name="items">
    /// The items to which the context menu should refer.
    /// </param>
    /// <param name="svgio"></param>
    /// <param name="view">The ShellView the ContextMenu is associated with</param>
    public ShellContextMenu(IListItemEx[] items, SVGIO svgio = SVGIO.SVGIO_SELECTION, ShellView view = null) {
      this._ShellView = view;

      if (svgio == SVGIO.SVGIO_BACKGROUND)
        Initialize(items[0]);
      else
        Initialize(items);
    }