Example #1
0
        public override void Serialize(XmlDocument dom, XmlElement node)
        {
            base.Serialize(dom, node);

            node.SetAttribute("target", Target.ID);

            if (LayoutData != null)
            {
                node.SetAttribute("cp1_length", LayoutData.CP1.Length.ToString());
                node.SetAttribute("cp1_angle", LayoutData.CP1.Angle.ToString());
                node.SetAttribute("cp2_length", LayoutData.CP2.Length.ToString());
                node.SetAttribute("cp2_angle", LayoutData.CP2.Angle.ToString());
            }

            node.SetAttribute("width", LineWidth.ToString());
            if (!Color.IsEmpty)
            {
                node.SetAttribute("color", ST.ToString(Color));
            }
            node.SetAttribute("line_style", LineStyle.ToString());
            node.SetAttribute("start_cap", StartCap.ToString());
            node.SetAttribute("end_cap", EndCap.ToString());
            node.SetAttribute("text", Text);
            node.SetAttribute("hyperlink", Hyperlink);

            if (!string.IsNullOrEmpty(Remark))
            {
                ST.WriteTextNode(node, "remark", Remark);
            }
        }
Example #2
0
        public override JObject SaveToJsonObject(StiJsonSaveMode mode)
        {
            var jObject = base.SaveToJsonObject(mode);

            if (Brush != null)
            {
                jObject.Add(new JProperty("Brush", SaveBrushToJsonObject(Brush, mode)));
            }
            jObject.Add(new JProperty("Thickness", Thickness));
            jObject.Add(new JProperty("PenStyle", PenStyle.ToString()));
            jObject.Add(new JProperty("Alignment", Alignment.ToString()));
            jObject.Add(new JProperty("StartCap", StartCap.ToString()));
            jObject.Add(new JProperty("EndCap", EndCap.ToString()));

            return(jObject);
        }