public override object Clone() { // .net does'nt deep copy arraylist. So we will do it XnaDrawPolygon copy = new XnaDrawPolygon(); for (int i = 0; i < _pointArray.Count; i++) { Point pointToCopy = (Point)_pointArray[i]; copy._pointArray.Add(new Point(pointToCopy.X, pointToCopy.Y)); } return(copy); }
XnaDrawObject CreateXnaDrawObject(SvgElement svge) { XnaDrawObject o = null; switch (svge.getElementType()) { case SvgElement._SvgElementType.typeLine: o = XnaDrawLine.Create((SvgLine )svge); break; case SvgElement._SvgElementType.typeRect: o = XnaDrawRectangle.Create((SvgRect )svge); break; case SvgElement._SvgElementType.typeEllipse: o = DrawEllipse.Create((SvgEllipse )svge); break; case SvgElement._SvgElementType.typePolyline: o = XnaDrawPolygon.Create((SvgPolyline )svge); break; case SvgElement._SvgElementType.typeImage: o = DrawImage.Create((SvgImage )svge); break; case SvgElement._SvgElementType.typeText: o = XnaDrawText.Create((SvgText )svge); break; case SvgElement._SvgElementType.typeGroup: o = CreateGroup((SvgGroup )svge); break; case SvgElement._SvgElementType.typePath: o = XnaDrawPath.Create((SvgPath)svge); break; case SvgElement._SvgElementType.typeDesc: Description = ((SvgDesc)svge).Value; break; default: break; } return(o); }
public static XnaDrawPolygon Create(SvgPolyline svg) { try { string s = svg.Points.Trim(); string[] arr = s.Split(' '); var points = new Point[arr.Length]; for (int i = 0; i < arr.Length; i++) { var arrp = arr[i].Split(','); points[i] = new Point((int)ParseSize(arrp[0], Dpi.X), (int)ParseSize(arrp[1], Dpi.Y)); } var dobj = new XnaDrawPolygon(points); dobj.SetStyleFromSvg(svg); return(dobj); } catch (Exception ex) { ErrH.Log("DrawPolygon", "Create", ex.ToString(), ErrH._LogPriority.Info); return(null); } }