Пример #1
0
        internal static List <Shape> Parse(SVG svg, XmlNode node)
        {
            var vb = node.Attributes.GetNamedItem("viewBox");

            if (vb != null)
            {
                var cord = vb.Value.Split(' ');
                var cult = CultureInfo.InvariantCulture;
                svg.ViewBox = new Rect(double.Parse(cord[0], cult), double.Parse(cord[1], cult), double.Parse(cord[2], cult), double.Parse(cord[3], cult));
            }

            svg.Size = new Size(XmlUtil.AttrValue(node, "width", 300), XmlUtil.AttrValue(node, "height", 150));

            var lstElements = new List <Shape>();

            if (node == null || (node.Name != SVGTags.sSvg && node.Name != SVGTags.sPattern))
            {
                throw new FormatException("Not a valide SVG node");
            }
            foreach (XmlNode childnode in node.ChildNodes)
            {
                Group.AddToList(svg, lstElements, childnode, null);
            }
            return(lstElements);
        }