DrawObject CreateGroup(SvgGroup svg) { DrawObject o = null; SvgElement child = svg.getChild(); if (child != null) { AddFromSvg(child); } return(o); }
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); }
// ************** Read from SVG public void AddFromSvg(SvgElement ele) { while (ele != null) { DrawObject o = CreateDrawObject(ele); if (o != null) { Add(o); } SvgElement child = ele.getChild(); while (child != null) { AddFromSvg(child); child = child.getNext(); } ele = ele.getNext(); } }
public void ResizeCommand(DrawObject obj, PointF old, PointF newP, int handle) { var cmd = new ResizeCommand(obj, old, newP, handle); _undoRedo.AddCommand(cmd); }