Example #1
0
        public override AbstractStyleElement Clone()
        {
            AbstractStyleElement clone = new StyleElementCurved(v);

            clone.Bind(this);
            return(clone);
        }
Example #2
0
        public void ReadXml(XmlReader xmlReader)
        {
            styleElements.Clear();

            xmlReader.ReadStartElement();       // <ToolPreset Key="ToolName"> or <DrawingStyle>
            while (xmlReader.NodeType == XmlNodeType.Element)
            {
                AbstractStyleElement styleElement = null;
                string key = xmlReader.GetAttribute("Key");

                switch (xmlReader.Name)
                {
                case "Color":
                    styleElement = new StyleElementColor(xmlReader);
                    break;

                case "FontSize":
                    styleElement = new StyleElementFontSize(xmlReader);
                    break;

                case "PenSize":
                    styleElement = new StyleElementPenSize(xmlReader);
                    break;

                case "LineSize":
                    styleElement = new StyleElementLineSize(xmlReader);
                    break;

                case "LineShape":
                    styleElement = new StyleElementLineShape(xmlReader);
                    break;

                case "Arrows":
                    styleElement = new StyleElementLineEnding(xmlReader);
                    break;

                case "TrackShape":
                    styleElement = new StyleElementTrackShape(xmlReader);
                    break;

                case "GridDivisions":
                    styleElement = new StyleElementGridDivisions(xmlReader);
                    break;

                case "Curved":
                    styleElement = new StyleElementCurved(xmlReader);
                    break;

                default:
                    log.ErrorFormat("Could not import style element \"{0}\"", xmlReader.Name);
                    log.ErrorFormat("Content was: {0}", xmlReader.ReadOuterXml());
                    break;
                }

                if (styleElement != null)
                {
                    styleElements.Add(key, styleElement);
                }
            }

            xmlReader.ReadEndElement();
        }