Beispiel #1
0
        private void ReadShapeAttributes(ShapeVObject vObject, SvgVoShape svg)
        {
            ReadBaseRectangleVObjectAttributes(vObject, svg);

            vObject.Path  = Path.FromPathCommands(svg.Path);
            vObject.Angle = svg.Transform != null?Utils.GetAngle(svg.Transform.Elements[0], svg.Transform.Elements[1]) : 0;

            vObject.FillColor        = svg.GetFillColor(_serializer);
            vObject.BorderColor      = svg.GetBorderColor(_serializer);
            vObject.BorderWidth      = svg.StrokeWidth;
            vObject.FixedBorderWidth = svg.FixedBorderWidth;
        }
Beispiel #2
0
        private void WriteShapeAttributes(SvgVoShape svg, ShapeVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var rect = vObject.Rectangle;

            vObject.Angle = 0;
            svg.Path      = vObject.GetTransformedPath().ToPathCommands();
            vObject.Angle = rect.Angle;

            var m = new Matrix();

            m.RotateAt(rect.Angle, new System.Drawing.PointF(rect.CenterX, rect.CenterY));
            svg.Transform = m;

            var cm = vObject.GetColorManagement(true);

            svg.SetFillColor(vObject.FillColor, ColorManagement.GetPreviewColor(cm, vObject.FillColor), _serializer);
            svg.SetBorderColor(vObject.BorderColor, ColorManagement.GetPreviewColor(cm, vObject.BorderColor), _serializer);
            svg.StrokeWidth      = vObject.BorderWidth;
            svg.FixedBorderWidth = vObject.FixedBorderWidth;
        }
Beispiel #3
0
 internal SvgElement ToSvg(VObject vObject)
 {
     if (vObject is GridVObject)
     {
         var svg = new SvgVoGrid();
         WriteGridAttributes(svg, vObject as GridVObject);
         return(svg);
     }
     else if (vObject is PolylineVObject)
     {
         var svg = new SvgPolyline();
         WritePolylineAttributes(svg, vObject as PolylineVObject);
         return(svg);
     }
     else if (vObject is DashedLineVObject)
     {
         var svg = new SvgVoDashLine();
         WriteDashLineAttributes(svg, vObject as DashedLineVObject);
         return(svg);
     }
     else if (vObject is LineVObject)
     {
         var svg = new SvgLine();
         WriteLineAttributes(svg, vObject as LineVObject);
         return(svg);
     }
     else if (vObject is EllipseVObject)
     {
         var svg = new SvgEllipse();
         WriteEllipseAttributes(svg, vObject as EllipseVObject);
         return(svg);
     }
     else if (vObject is SvgVObject)
     {
         var svg = new SvgVoSvg();
         WriteSvgAttributes(svg, vObject as SvgVObject);
         return(svg);
     }
     else if (vObject is ImageVObject)
     {
         var svg = new SvgVoImage();
         WriteImageAttributes(svg, vObject as ImageVObject);
         return(svg);
     }
     else if (vObject is PlainTextVObject)
     {
         var svg = new SvgVoPlainText();
         WritePlainTextAttributes(svg, vObject as PlainTextVObject);
         return(svg);
     }
     else if (vObject is CurvedTextVObject)
     {
         var svg = new SvgVoCurvedText();
         WriteCurvedTextAttributes(svg, vObject as CurvedTextVObject);
         return(svg);
     }
     else if (vObject is PathBoundedTextVObject)
     {
         var svg = new SvgVoPathBoundedText();
         WritePathBoundedTextAttributes(svg, vObject as PathBoundedTextVObject);
         return(svg);
     }
     else if (vObject is BoundedTextVObject)
     {
         var svg = new SvgVoBoundedText();
         WriteBoundedTextAttributes(svg, vObject as BoundedTextVObject);
         return(svg);
     }
     else if (vObject is AutoScaledTextVObject)
     {
         var svg = new SvgVoAutoScaledText();
         WriteAutoScaledTextAttributes(svg, vObject as AutoScaledTextVObject);
         return(svg);
     }
     else if (vObject is PlaceholderVObject)
     {
         var svg = new SvgVoPlaceholder();
         WritePlaceholderAttributes(svg, vObject as PlaceholderVObject);
         return(svg);
     }
     else if (vObject is RectangleVObject)
     {
         var svg = new SvgVoRectangle();
         WriteRectangleAttributes(svg, vObject as RectangleVObject);
         return(svg);
     }
     else if (vObject is ShapeVObject)
     {
         var svg = new SvgVoShape();
         WriteShapeAttributes(svg, vObject as ShapeVObject);
         return(svg);
     }
     else
     {
         return(null);
     }
 }