Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/Shapes/SvgEllipseElement.cs @ 12762

Last change on this file since 12762 was 12762, checked in by aballeit, 9 years ago

#2283 GUI updates, Tree-chart, MCTS Version 2 (prune leaves)

File size: 5.7 KB
Line 
1// <developer>niklas@protocol7.com</developer>
2// <completed>100</completed>
3
4using System;
5using System.Xml;
6
7namespace SharpVectors.Dom.Svg
8{
9    /// <summary>
10    /// The SvgEllipseElement class corresponds to the 'ellipse' element.
11    /// </summary>
12    public sealed class SvgEllipseElement : SvgTransformableElement, ISvgEllipseElement
13    {
14        #region Private Fields
15
16        private ISvgAnimatedLength cx;
17        private ISvgAnimatedLength cy;
18        private ISvgAnimatedLength rx;
19        private ISvgAnimatedLength ry;
20
21        private SvgTests svgTests;
22        private SvgExternalResourcesRequired svgExternalResourcesRequired;
23
24        #endregion
25
26        #region Constructors and Destructor
27
28        public SvgEllipseElement(string prefix, string localname, string ns, SvgDocument doc)
29            : base(prefix, localname, ns, doc)
30        {
31            svgExternalResourcesRequired = new SvgExternalResourcesRequired(this);
32            svgTests = new SvgTests(this);
33        }
34
35        #endregion
36
37        #region Public Methods
38
39        public void Invalidate()
40        {
41        }
42
43        public override void HandleAttributeChange(XmlAttribute attribute)
44        {
45            if (attribute.NamespaceURI.Length == 0)
46            {
47                switch (attribute.LocalName)
48                {
49                    case "cx":
50                        cx = null;
51                        Invalidate();
52                        return;
53                    case "cy":
54                        cy = null;
55                        Invalidate();
56                        return;
57                    case "rx":
58                        rx = null;
59                        Invalidate();
60                        return;
61                    case "ry":
62                        ry = null;
63                        Invalidate();
64                        return;
65                    // Color.attrib, Paint.attrib
66                    case "color":
67                    case "fill":
68                    case "fill-rule":
69                    case "stroke":
70                    case "stroke-dasharray":
71                    case "stroke-dashoffset":
72                    case "stroke-linecap":
73                    case "stroke-linejoin":
74                    case "stroke-miterlimit":
75                    case "stroke-width":
76                    // Opacity.attrib
77                    case "opacity":
78                    case "stroke-opacity":
79                    case "fill-opacity":
80                    // Graphics.attrib
81                    case "display":
82                    case "image-rendering":
83                    case "shape-rendering":
84                    case "text-rendering":
85                    case "visibility":
86                        Invalidate();
87                        break;
88                    case "transform":
89                        Invalidate();
90                        break;
91                }
92
93                base.HandleAttributeChange(attribute);
94            }
95        }
96
97        #endregion
98
99        #region ISvgElement Members
100
101        /// <summary>
102        /// Gets a value providing a hint on the rendering defined by this element.
103        /// </summary>
104        /// <value>
105        /// An enumeration of the <see cref="SvgRenderingHint"/> specifying the rendering hint.
106        /// This will always return <see cref="SvgRenderingHint.Shape"/>
107        /// </value>
108        public override SvgRenderingHint RenderingHint
109        {
110            get
111            {
112                return SvgRenderingHint.Shape;
113            }
114        }
115
116        #endregion
117
118        #region ISvgEllipseElement Members
119
120        public ISvgAnimatedLength Cx
121        {
122            get
123            {
124                if (cx == null)
125                {
126                    cx = new SvgAnimatedLength(this, "cx", SvgLengthDirection.Horizontal, "0");
127                }
128                return cx;
129            }
130        }
131
132        public ISvgAnimatedLength Cy
133        {
134            get
135            {
136                if (cy == null)
137                {
138                    cy = new SvgAnimatedLength(this, "cy", SvgLengthDirection.Vertical, "0");
139                }
140                return cy;
141            }
142
143        }
144
145        public ISvgAnimatedLength Rx
146        {
147            get
148            {
149                if (rx == null)
150                {
151                    rx = new SvgAnimatedLength(this, "rx", SvgLengthDirection.Horizontal, "100");
152                }
153                return rx;
154            }
155
156        }
157
158        public ISvgAnimatedLength Ry
159        {
160            get
161            {
162                if (ry == null)
163                {
164                    ry = new SvgAnimatedLength(this, "ry", SvgLengthDirection.Vertical, "100");
165                }
166                return ry;
167            }
168        }
169
170        #endregion
171
172        #region ISvgExternalResourcesRequired Members
173
174        public ISvgAnimatedBoolean ExternalResourcesRequired
175        {
176            get
177            {
178                return svgExternalResourcesRequired.ExternalResourcesRequired;
179            }
180        }
181
182        #endregion
183
184        #region ISvgTests Members
185
186        public ISvgStringList RequiredFeatures
187        {
188            get { return svgTests.RequiredFeatures; }
189        }
190
191        public ISvgStringList RequiredExtensions
192        {
193            get { return svgTests.RequiredExtensions; }
194        }
195
196        public ISvgStringList SystemLanguage
197        {
198            get { return svgTests.SystemLanguage; }
199        }
200
201        public bool HasExtension(string extension)
202        {
203            return svgTests.HasExtension(extension);
204        }
205
206        #endregion
207    }
208}
Note: See TracBrowser for help on using the repository browser.