Exemplo n.º 1
0
 public static DrawObject Create(SvgImage svg)
 {
     try
     {
         DrawImage dobj;
         if (string.IsNullOrEmpty(svg.Id))
         {
             dobj = new DrawImage(svg.HRef, ParseSize(svg.X, Dpi.X),
                                  ParseSize(svg.Y, Dpi.Y),
                                  ParseSize(svg.Width, Dpi.X),
                                  ParseSize(svg.Height, Dpi.Y));
         }
         else
         {
             var di = new DrawImage();
             if (!di.FillFromSvg(svg))
             {
                 return(null);
             }
             dobj = di;
         }
         return(dobj);
     }
     catch (Exception ex)
     {
         ErrH.Log("DrawImage", "Create", ex.ToString(), ErrH._LogPriority.Info);
         return(null);
     }
 }
Exemplo n.º 2
0
        DrawObject CreateDrawObject(SvgElement svge)
        {
            DrawObject o = null;

            switch (svge.getElementType())
            {
            case SvgElement._SvgElementType.typeLine:
                o = DrawLine.Create((SvgLine )svge);
                break;

            case SvgElement._SvgElementType.typeRect:
                o = DrawRectangle.Create((SvgRect )svge);
                break;

            case SvgElement._SvgElementType.typeEllipse:
                o = DrawEllipse.Create((SvgEllipse )svge);
                break;

            case SvgElement._SvgElementType.typePolyline:
                o = DrawPolygon.Create((SvgPolyline )svge);
                break;

            case SvgElement._SvgElementType.typeImage:
                o = DrawImage.Create((SvgImage )svge);
                break;

            case SvgElement._SvgElementType.typeText:
                o = DrawText.Create((SvgText )svge);
                break;

            case SvgElement._SvgElementType.typeGroup:
                o = CreateGroup((SvgGroup )svge);
                break;

            case SvgElement._SvgElementType.typePath:
                o = DrawPath.Create((SvgPath)svge);
                break;

            case SvgElement._SvgElementType.typeDesc:
                Description = ((SvgDesc)svge).Value;
                break;

            default:
                break;
            }
            return(o);
        }