private SvgElement CreateRect(XElement xelement) { var svgElement = new SvgRect(); foreach (var xAttribute in xelement.Attributes()) { var attributeName = xAttribute.Name.LocalName; var attributeValue = xAttribute.Value; switch (attributeName) { case "class": svgElement.Style = GetStyle(attributeValue); break; case "x": svgElement.X = float.Parse(attributeValue); break; case "y": svgElement.Y = float.Parse(attributeValue); break; case "width": svgElement.Width = float.Parse(attributeValue); break; case "height": svgElement.Height = float.Parse(attributeValue); break; case "transform": svgElement.Transform = SvgTransform.Parse(attributeValue); break; } } return(svgElement); }
private SvgElement CreateEllipse(XElement xelement) { var svgElement = new SvgEllipse(); foreach (var xAttribute in xelement.Attributes()) { var attributeName = xAttribute.Name.LocalName; var attributeValue = xAttribute.Value; switch (attributeName) { case "class": svgElement.Style = GetStyle(attributeValue); break; case "cx": svgElement.X = float.Parse(attributeValue); break; case "cy": svgElement.Y = float.Parse(attributeValue); break; case "rx": svgElement.RadiusX = float.Parse(attributeValue); break; case "ry": svgElement.RadiusY = float.Parse(attributeValue); break; case "transform": svgElement.Transform = SvgTransform.Parse(attributeValue); break; } } return(svgElement); }