1 | using System;
|
---|
2 | using System.Xml;
|
---|
3 | using System.Text;
|
---|
4 | using System.Collections.Generic;
|
---|
5 |
|
---|
6 | namespace SharpVectors.Dom.Svg
|
---|
7 | {
|
---|
8 | /// <summary>
|
---|
9 | /// The implementation of the ISvgTextPathElement interface corresponds to the 'textPath' element.
|
---|
10 | /// </summary>
|
---|
11 | public sealed class SvgTextPathElement : SvgTextContentElement, ISvgTextPathElement
|
---|
12 | {
|
---|
13 | #region Private Fields
|
---|
14 |
|
---|
15 | private SvgUriReference svgURIReference;
|
---|
16 |
|
---|
17 | #endregion
|
---|
18 |
|
---|
19 | #region Constructors and Destructor
|
---|
20 |
|
---|
21 | public SvgTextPathElement(string prefix, string localname, string ns, SvgDocument doc)
|
---|
22 | : base(prefix, localname, ns, doc)
|
---|
23 | {
|
---|
24 | svgURIReference = new SvgUriReference(this);
|
---|
25 | }
|
---|
26 |
|
---|
27 | #endregion
|
---|
28 |
|
---|
29 | #region ISvgTextPathElement Members
|
---|
30 |
|
---|
31 | public ISvgAnimatedLength StartOffset
|
---|
32 | {
|
---|
33 | get
|
---|
34 | {
|
---|
35 | return new SvgAnimatedLength(this, "startOffset",
|
---|
36 | SvgLengthDirection.Horizontal, "0%");
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | public ISvgAnimatedEnumeration Method
|
---|
41 | {
|
---|
42 | get
|
---|
43 | {
|
---|
44 | SvgTextPathMethod pathMethod = SvgTextPathMethod.Align;
|
---|
45 | if (this.GetAttribute("method") == "stretch")
|
---|
46 | {
|
---|
47 | pathMethod = SvgTextPathMethod.Stretch;
|
---|
48 | }
|
---|
49 |
|
---|
50 | return new SvgAnimatedEnumeration((ushort)pathMethod);
|
---|
51 | }
|
---|
52 | }
|
---|
53 |
|
---|
54 | public ISvgAnimatedEnumeration Spacing
|
---|
55 | {
|
---|
56 | get
|
---|
57 | {
|
---|
58 | SvgTextPathSpacing pathSpacing = SvgTextPathSpacing.Exact;
|
---|
59 | if (this.GetAttribute("spacing") == "auto")
|
---|
60 | {
|
---|
61 | pathSpacing = SvgTextPathSpacing.Auto;
|
---|
62 | }
|
---|
63 |
|
---|
64 | return new SvgAnimatedEnumeration((ushort)pathSpacing);
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | #endregion
|
---|
69 |
|
---|
70 | #region ISvgUriReference Members
|
---|
71 |
|
---|
72 | public ISvgAnimatedString Href
|
---|
73 | {
|
---|
74 | get
|
---|
75 | {
|
---|
76 | return svgURIReference.Href;
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | public XmlElement ReferencedElement
|
---|
81 | {
|
---|
82 | get
|
---|
83 | {
|
---|
84 | return svgURIReference.ReferencedNode as XmlElement;
|
---|
85 | }
|
---|
86 | }
|
---|
87 |
|
---|
88 | #endregion
|
---|
89 | }
|
---|
90 | }
|
---|