private void AddCurveImplementation(Curve curve) { if (curve == null) { return; } Curvedline curved = new Curvedline(curve); Style style = new Style(curve); XmlNode newNode = null; XmlDocumentFragment fragment = null; string classId = null; //Add the line fragment = base.CreateDocumentFragment(); fragment.InnerXml = curved.ExtractCurve(); newNode = ContainerNode.AppendChild(fragment); //Determine style classId = AddClassImplementation(style.GetStyle(), ""); newNode.Attributes.GetNamedItem("class").InnerText = classId; }
private void AddUseImplementation(string useId, string definitionId, string classId, string style, float x, float y) { XmlElement newElement = null; string key = useId; if (ContainerKey != null && ContainerKey != string.Empty) { key = ContainerKey + "," + useId; } newElement = base.CreateElement("use"); newElement.SetAttribute("id", key); newElement.SetAttribute("href", "http://www.w3.org/1999/xlink", "#" + definitionId); if (classId != "") { newElement.SetAttribute("class", classId); } if (style != "") { newElement.SetAttribute("style", style); } newElement.SetAttribute("x", XmlConvert.ToString(x)); newElement.SetAttribute("y", XmlConvert.ToString(y)); ContainerNode.AppendChild(newElement); SetNode(newElement); }
private XmlNode AddGroupDefinition(string groupId, IContainer container) { XmlElement newElement = null; StringBuilder builder = new StringBuilder(); builder.Append("translate("); builder.Append(XmlConvert.ToString(container.Offset.X)); builder.Append(","); builder.Append(XmlConvert.ToString(container.Offset.Y)); builder.Append(")"); newElement = base.CreateElement("g"); newElement.SetAttribute("id", groupId); newElement.SetAttribute("transform", builder.ToString()); ContainerNode.AppendChild(newElement); return(newElement as XmlNode); }