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