1 | using System;
|
---|
2 |
|
---|
3 | namespace SharpVectors.Dom.Svg
|
---|
4 | {
|
---|
5 | public sealed class SvgMarkerElement : SvgStyleableElement, ISvgMarkerElement
|
---|
6 | {
|
---|
7 | public SvgMarkerElement(string prefix, string localname, string ns, SvgDocument doc)
|
---|
8 | : base(prefix, localname, ns, doc)
|
---|
9 | {
|
---|
10 | svgExternalResourcesRequired = new SvgExternalResourcesRequired(this);
|
---|
11 | svgFitToViewBox = new SvgFitToViewBox(this);
|
---|
12 | }
|
---|
13 |
|
---|
14 | #region ISvgElement Members
|
---|
15 |
|
---|
16 | /// <summary>
|
---|
17 | /// Gets a value indicating whether this SVG element is renderable.
|
---|
18 | /// </summary>
|
---|
19 | /// <value>
|
---|
20 | /// This is <see langword="'true"/> if the element is renderable; otherwise,
|
---|
21 | /// it is <see langword="false"/>.
|
---|
22 | /// </value>
|
---|
23 | public override bool IsRenderable
|
---|
24 | {
|
---|
25 | get
|
---|
26 | {
|
---|
27 | return false;
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | /// <summary>
|
---|
32 | /// Gets a value providing a hint on the rendering defined by this element.
|
---|
33 | /// </summary>
|
---|
34 | /// <value>
|
---|
35 | /// An enumeration of the <see cref="SvgRenderingHint"/> specifying the rendering hint.
|
---|
36 | /// This will always return <see cref="SvgRenderingHint.Containment"/>
|
---|
37 | /// </value>
|
---|
38 | public override SvgRenderingHint RenderingHint
|
---|
39 | {
|
---|
40 | get
|
---|
41 | {
|
---|
42 | return SvgRenderingHint.Containment;
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|
46 | #endregion
|
---|
47 |
|
---|
48 | #region ISvgMarkerElement Members
|
---|
49 |
|
---|
50 | /// <summary>
|
---|
51 | /// Sets the value of attribute orient to 'auto'.
|
---|
52 | /// </summary>
|
---|
53 | public void SetOrientToAuto()
|
---|
54 | {
|
---|
55 | orientType = null;
|
---|
56 | SetAttribute("orient", "auto");
|
---|
57 | }
|
---|
58 |
|
---|
59 | /// <summary>
|
---|
60 | /// Sets the value of attribute orient to the given angle.
|
---|
61 | /// </summary>
|
---|
62 | /// <param name="angle"> The angle value to use for attribute orient.</param>
|
---|
63 | public void SetOrientToAngle(ISvgAngle angle)
|
---|
64 | {
|
---|
65 | orientType = null;
|
---|
66 | SetAttribute("orient", angle.ValueAsString);
|
---|
67 | orientAngle = new SvgAnimatedAngle(angle);
|
---|
68 | }
|
---|
69 |
|
---|
70 | private ISvgAnimatedLength refX;
|
---|
71 | /// <summary>
|
---|
72 | /// Corresponds to attribute refX on the given 'marker' element.
|
---|
73 | /// </summary>
|
---|
74 | public ISvgAnimatedLength RefX
|
---|
75 | {
|
---|
76 | get
|
---|
77 | {
|
---|
78 | if(refX == null)
|
---|
79 | {
|
---|
80 | refX = new SvgAnimatedLength(this, "refX", SvgLengthDirection.Horizontal, "0");
|
---|
81 | }
|
---|
82 | return refX;
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | private ISvgAnimatedLength refY;
|
---|
87 | /// <summary>
|
---|
88 | /// Corresponds to attribute refY on the given 'marker' element.
|
---|
89 | /// </summary>
|
---|
90 | public ISvgAnimatedLength RefY
|
---|
91 | {
|
---|
92 | get
|
---|
93 | {
|
---|
94 | if(refY == null)
|
---|
95 | {
|
---|
96 | refY = new SvgAnimatedLength(this, "refY", SvgLengthDirection.Vertical, "0");
|
---|
97 | }
|
---|
98 | return refY;
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | private ISvgAnimatedEnumeration markerUnits;
|
---|
103 | /// <summary>
|
---|
104 | /// Corresponds to attribute markerUnits on the given 'marker' element.
|
---|
105 | /// </summary>
|
---|
106 | public ISvgAnimatedEnumeration MarkerUnits
|
---|
107 | {
|
---|
108 | get
|
---|
109 | {
|
---|
110 | if(markerUnits == null)
|
---|
111 | {
|
---|
112 | SvgMarkerUnit type = SvgMarkerUnit.Unknown;
|
---|
113 | switch(GetAttribute("markerUnits"))
|
---|
114 | {
|
---|
115 | case "userSpaceOnUse":
|
---|
116 | type = SvgMarkerUnit.UserSpaceOnUse;
|
---|
117 | break;
|
---|
118 | case "":
|
---|
119 | case "strokeWidth":
|
---|
120 | type = SvgMarkerUnit.StrokeWidth;
|
---|
121 | break;
|
---|
122 | }
|
---|
123 | markerUnits = new SvgAnimatedEnumeration((ushort)type);
|
---|
124 | }
|
---|
125 | return markerUnits;
|
---|
126 | }
|
---|
127 | }
|
---|
128 |
|
---|
129 | private ISvgAnimatedLength markerWidth;
|
---|
130 | /// <summary>
|
---|
131 | /// Corresponds to attribute markerWidth on the given 'marker' element
|
---|
132 | /// </summary>
|
---|
133 | public ISvgAnimatedLength MarkerWidth
|
---|
134 | {
|
---|
135 | get
|
---|
136 | {
|
---|
137 | if(markerWidth == null)
|
---|
138 | {
|
---|
139 | markerWidth = new SvgAnimatedLength(this, "markerWidth", SvgLengthDirection.Horizontal, "3");
|
---|
140 | }
|
---|
141 | return markerWidth;
|
---|
142 | }
|
---|
143 | }
|
---|
144 |
|
---|
145 | private ISvgAnimatedLength markerHeight;
|
---|
146 | /// <summary>
|
---|
147 | /// Corresponds to attribute markerHeight on the given 'marker' element.
|
---|
148 | /// </summary>
|
---|
149 | public ISvgAnimatedLength MarkerHeight
|
---|
150 | {
|
---|
151 | get
|
---|
152 | {
|
---|
153 | if(markerHeight == null)
|
---|
154 | {
|
---|
155 | markerHeight = new SvgAnimatedLength(this, "markerHeight", SvgLengthDirection.Vertical, "3");
|
---|
156 | }
|
---|
157 | return markerHeight;
|
---|
158 | }
|
---|
159 | }
|
---|
160 |
|
---|
161 | private ISvgAnimatedEnumeration orientType;
|
---|
162 | /// <summary>
|
---|
163 | /// Corresponds to attribute orient on the given 'marker' element. One of the Marker Orientation Types defined above.
|
---|
164 | /// </summary>
|
---|
165 | public ISvgAnimatedEnumeration OrientType
|
---|
166 | {
|
---|
167 | get
|
---|
168 | {
|
---|
169 | if(orientType == null)
|
---|
170 | {
|
---|
171 | if(GetAttribute("orient") == "auto")
|
---|
172 | {
|
---|
173 | orientType = new SvgAnimatedEnumeration((ushort)SvgMarkerOrient.Auto);
|
---|
174 | }
|
---|
175 | else
|
---|
176 | {
|
---|
177 | orientType = new SvgAnimatedEnumeration((ushort)SvgMarkerOrient.Angle);
|
---|
178 | }
|
---|
179 | }
|
---|
180 | return orientType;
|
---|
181 | }
|
---|
182 | }
|
---|
183 |
|
---|
184 | public ISvgAnimatedAngle orientAngle;
|
---|
185 | /// <summary>
|
---|
186 | /// Corresponds to attribute orient on the given 'marker' element. If markerUnits is SVG_MARKER_ORIENT_ANGLE, the angle value for attribute orient; otherwise, it will be set to zero.
|
---|
187 | /// </summary>
|
---|
188 | public ISvgAnimatedAngle OrientAngle
|
---|
189 | {
|
---|
190 | get
|
---|
191 | {
|
---|
192 | if(orientAngle == null)
|
---|
193 | {
|
---|
194 | if(OrientType.AnimVal.Equals(SvgMarkerOrient.Angle))
|
---|
195 | {
|
---|
196 | orientAngle = new SvgAnimatedAngle(GetAttribute("orient"), "0");
|
---|
197 | }
|
---|
198 | else
|
---|
199 | {
|
---|
200 | orientAngle = new SvgAnimatedAngle("0", "0");
|
---|
201 | }
|
---|
202 | }
|
---|
203 | return orientAngle;
|
---|
204 | }
|
---|
205 | }
|
---|
206 | #endregion
|
---|
207 |
|
---|
208 | #region ISvgFitToViewBox Members
|
---|
209 |
|
---|
210 | private SvgFitToViewBox svgFitToViewBox;
|
---|
211 | public ISvgAnimatedRect ViewBox
|
---|
212 | {
|
---|
213 | get
|
---|
214 | {
|
---|
215 | return svgFitToViewBox.ViewBox;
|
---|
216 | }
|
---|
217 | }
|
---|
218 |
|
---|
219 | public ISvgAnimatedPreserveAspectRatio PreserveAspectRatio
|
---|
220 | {
|
---|
221 | get
|
---|
222 | {
|
---|
223 | return svgFitToViewBox.PreserveAspectRatio;
|
---|
224 | }
|
---|
225 | }
|
---|
226 |
|
---|
227 | #endregion
|
---|
228 |
|
---|
229 | #region ISvgExternalResourcesRequired Members
|
---|
230 |
|
---|
231 | private SvgExternalResourcesRequired svgExternalResourcesRequired;
|
---|
232 | public ISvgAnimatedBoolean ExternalResourcesRequired
|
---|
233 | {
|
---|
234 | get
|
---|
235 | {
|
---|
236 | return svgExternalResourcesRequired.ExternalResourcesRequired;
|
---|
237 | }
|
---|
238 | }
|
---|
239 |
|
---|
240 | #endregion
|
---|
241 | }
|
---|
242 | }
|
---|