private SVGPath XNodeToSVGPath(XNode node) { SVGPath sp = null; XElement element = null; XAttribute attribute = null; string id = null; string path = null; try { if (node is XElement) { element = (XElement)node; if (element.HasAttributes) { IEnumerator<XAttribute> itr = null;// = xml.DescendantNodes().GetEnumerator(); itr = element.Attributes().GetEnumerator(); while (itr.MoveNext()) { attribute = itr.Current; if (attribute.Name == "unicode") { id = attribute.Value;//get element value if (id != null) id = Convert.ToInt32(attribute.Value.ToCharArray()[0]).ToString(); } if (attribute.Name == "d") { path = attribute.Value; } } if(id != null && path != null) sp = new SVGPath(id, path); } } else return null; } catch (System.Xml.XmlException xe) { Debug.WriteLine(xe.Message); Debug.WriteLine(xe.StackTrace); } catch (Exception exc) { Debug.WriteLine(exc.Message); Debug.WriteLine(exc.StackTrace); } return sp; }
/** * @name getSymbolDef * * @desc Returns a SymbolDef from the SymbolDefTable that matches the passed in Symbol Id * * @param index String representation of the index number * @return SVGPath */ public SVGPath getSVGPath(int index) { SVGPath returnVal = null; try { if (_TGDefinitions.ContainsKey(index)) returnVal = new SVGPath(_TGDefinitions[index]); } catch (Exception exc) { Debug.WriteLine(exc.Message); Debug.WriteLine(exc.StackTrace); } return returnVal; }
public SVGPath(SVGPath path) { _ID = path._ID; _cg = path._cg.Transform(Matrix3x2.Identity); _bounds = _cg.ComputeBounds(); _ccgFill = CanvasCachedGeometry.CreateFill(_cg); }