Example #1
0
        private void ReadImageAttributes(ImageVObject vObject, SvgVoImage svg)
        {
            ReadContentAttributes(vObject, svg);

            var internalStorageImageId = svg.Src;

            if (internalStorageImageId != null && _fileStorage.FileExists(internalStorageImageId))
            {
                string vObjectStorageId = internalStorageImageId;
                using (var imageStream = _fileStorage.GetReadStream(internalStorageImageId))
                    Configuration.FileCache.AddFileWithId(vObjectStorageId, imageStream, true);

                vObject.LoadImage(vObjectStorageId, false, false);
            }
        }
Example #2
0
        private void WriteImageAttributes(SvgVoImage svg, ImageVObject vObject)
        {
            WriteContentAttributes(svg, vObject);

            var fileId = vObject.SourceFileId;

            if (fileId != null && Configuration.FileCache.FileExists(fileId))
            {
                if (!_fileStorage.FileExists(fileId))
                {
                    using (var fileStream = Configuration.FileCache.GetReadStream(fileId, true))
                        _fileStorage.AddFileWithId(fileId, fileStream);
                }

                svg.Src = fileId;
            }
        }
Example #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);
     }
 }