public static Shape AddToList(SVG svg, List <Shape> list, XmlNode childnode, Shape parent) { if (childnode.NodeType != XmlNodeType.Element) { return(null); } Shape retVal = null; if (childnode.Name == SVGTags.sStyle) { var match = _regexStyle.Match(childnode.InnerText); while (match.Success) { var name = match.Groups[1].Value.Trim(); var value = match.Groups[2].Value; svg.m_styles.Add(name, new List <XmlAttribute>()); foreach (ShapeUtil.Attribute styleitem in XmlUtil.SplitStyle(svg, value)) { svg.m_styles[name].Add(new XmlUtil.StyleItem(childnode, styleitem.Name, styleitem.Value)); } match = match.NextMatch(); } } else if (childnode.Name == SVGTags.sShapeRect) { retVal = new RectangleShape(svg, childnode); } else if (childnode.Name == SVGTags.sFilter) { retVal = new Filter(svg, childnode, parent); } else if (childnode.Name == SVGTags.sFeGaussianBlur) { retVal = new FilterFeGaussianBlur(svg, childnode, parent); } else if (childnode.Name == SVGTags.sShapeCircle) { retVal = new CircleShape(svg, childnode); } else if (childnode.Name == SVGTags.sShapeEllipse) { retVal = new EllipseShape(svg, childnode); } else if (childnode.Name == SVGTags.sShapeLine) { retVal = new LineShape(svg, childnode); } else if (childnode.Name == SVGTags.sShapePolyline) { retVal = new PolylineShape(svg, childnode); } else if (childnode.Name == SVGTags.sShapePolygon) { retVal = new PolygonShape(svg, childnode); } else if (childnode.Name == SVGTags.sShapePath) { retVal = new PathShape(svg, childnode, parent); } else if (childnode.Name == SVGTags.sClipPath) { retVal = new Clip(svg, childnode, parent); } else if (childnode.Name == SVGTags.sShapeGroup || childnode.Name == SVGTags.sSwitch) { retVal = new Group(svg, childnode, parent); } else if (childnode.Name == SVGTags.sShapeUse) { retVal = new UseShape(svg, childnode); } else if (childnode.Name == SVGTags.sShapeImage) { retVal = new ImageShape(svg, childnode); } else if (childnode.Name == SVGTags.sAnimate) { retVal = new Animate(svg, childnode, parent); } else if (childnode.Name == SVGTags.sAnimateColor) { retVal = new AnimateColor(svg, childnode, parent); } else if (childnode.Name == SVGTags.sAnimateMotion) { retVal = new AnimateMotion(svg, childnode, parent); } else if (childnode.Name == SVGTags.sAnimateTransform) { retVal = new AnimateTransform(svg, childnode, parent); } else if (childnode.Name == SVGTags.sText) { retVal = new TextShape(svg, childnode, parent); } else if (childnode.Name == SVGTags.sLinearGradient) { svg.PaintServers.Create(childnode); return(null); } else if (childnode.Name == SVGTags.sRadialGradient) { svg.PaintServers.Create(childnode); return(null); } else if (childnode.Name == SVGTags.sDefinitions) { ReadDefs(svg, list, childnode); return(null); } if (retVal != null) { list.Add(retVal); if (retVal.Id.Length > 0) { svg.AddShape(retVal.Id, retVal); } } return(retVal); }
public static Shape AddToList(SVG svg, List <Shape> list, XmlNode childnode, Shape parent) { if (childnode.NodeType != XmlNodeType.Element) { return(null); } Shape retVal = null; var nodeName = GetNodeName(childnode); if (nodeName == null) { return(null); } if (nodeName == SVGTags.sStyle) { StyleParser.ParseStyle(svg, childnode.InnerText); } else if (nodeName == SVGTags.sShapeRect) { retVal = new RectangleShape(svg, childnode); } else if (nodeName == SVGTags.sFilter) { retVal = new Filter(svg, childnode, parent); } else if (nodeName == SVGTags.sFeGaussianBlur) { retVal = new FilterFeGaussianBlur(svg, childnode, parent); } else if (nodeName == SVGTags.sShapeCircle) { retVal = new CircleShape(svg, childnode); } else if (nodeName == SVGTags.sShapeEllipse) { retVal = new EllipseShape(svg, childnode); } else if (nodeName == SVGTags.sShapeLine) { retVal = new LineShape(svg, childnode); } else if (nodeName == SVGTags.sShapePolyline) { retVal = new PolylineShape(svg, childnode); } else if (nodeName == SVGTags.sShapePolygon) { retVal = new PolygonShape(svg, childnode); } else if (nodeName == SVGTags.sShapePath) { retVal = new PathShape(svg, childnode, parent); } else if (nodeName == SVGTags.sClipPath) { retVal = new Clip(svg, childnode, parent); } else if (nodeName == SVGTags.sShapeGroup) { retVal = new Group(svg, childnode, parent); } else if (nodeName == SVGTags.sSwitch) { retVal = new Group(svg, childnode, parent) { IsSwitch = true } } ; else if (nodeName == SVGTags.sShapeUse) { retVal = new UseShape(svg, childnode); } else if (nodeName == SVGTags.sShapeImage) { retVal = new ImageShape(svg, childnode); } else if (nodeName == SVGTags.sAnimate) { retVal = new Animate(svg, childnode, parent); } else if (nodeName == SVGTags.sAnimateColor) { retVal = new AnimateColor(svg, childnode, parent); } else if (nodeName == SVGTags.sAnimateMotion) { retVal = new AnimateMotion(svg, childnode, parent); } else if (nodeName == SVGTags.sAnimateTransform) { retVal = new AnimateTransform(svg, childnode, parent); } else if (nodeName == SVGTags.sText) { retVal = new TextShape(svg, childnode, parent); } else if (nodeName == SVGTags.sLinearGradient) { svg.PaintServers.Create(svg, childnode); return(null); } else if (nodeName == SVGTags.sRadialGradient) { svg.PaintServers.Create(svg, childnode); return(null); } else if (nodeName == SVGTags.sDefinitions) { ReadDefs(svg, list, childnode); return(null); } else if (nodeName == SVGTags.sSymbol) { retVal = new Group(svg, childnode, parent); } if (retVal != null) { list.Add(retVal); if (retVal.Id.Length > 0) { svg.AddShape(retVal.Id, retVal); } } if (nodeName == SVGTags.sSymbol) { return(null); } return(retVal); }