SvgMarker.cs 2.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml;
using System.Xml.Serialization;
using System.Drawing.Drawing2D;

namespace Svg
{
    [SvgElement("marker")]
    public class SvgMarker : SvgVisualElement, ISvgViewPort
    {
    	private SvgOrient _svgOrient = new SvgOrient();

        [SvgAttribute("refX")]
        public virtual SvgUnit RefX
        {
            get { return this.Attributes.GetAttribute<SvgUnit>("refX"); }
            set { this.Attributes["refX"] = value; }
        }

        [SvgAttribute("refY")]
        public virtual SvgUnit RefY
        {
            get { return this.Attributes.GetAttribute<SvgUnit>("refY"); }
            set { this.Attributes["refY"] = value; }
        }


		[SvgAttribute("orient")]
		public virtual SvgOrient Orient
		{
			get { return _svgOrient; }
			set { _svgOrient = value; }
		}


		[SvgAttribute("overflow")]
		public virtual SvgOverflow Overflow
		{
			get { return this.Attributes.GetAttribute<SvgOverflow>("overflow"); }
			set { this.Attributes["overflow"] = value; }
		}


		[SvgAttribute("viewBox")]
		public virtual SvgViewBox ViewBox
		{
			get { return this.Attributes.GetAttribute<SvgViewBox>("viewBox"); }
			set { this.Attributes["viewBox"] = value; }
		}


		[SvgAttribute("preserveAspectRatio")]
		public virtual SvgAspectRatio AspectRatio
		{
			get { return this.Attributes.GetAttribute<SvgAspectRatio>("preserveAspectRatio"); }
			set { this.Attributes["preserveAspectRatio"] = value; }
		}


		public override System.Drawing.Drawing2D.GraphicsPath Path
        {
            get
            {
            	var path = this.Children.FirstOrDefault(x => x is SvgPath);
				if (path != null)
	            	return (path as SvgPath).Path;
				return null;
            }
73
74
75
76
            protected set
            {
                // No-op
            }
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
        }

        public override System.Drawing.RectangleF Bounds
        {
            get
            {
            	var path = this.Path;
				if (path != null)
					return path.GetBounds();
				return new System.Drawing.RectangleF();
            }
        }

		//protected internal override void RenderStroke(SvgRenderer renderer)
		//{
		//    this.PushTransforms(renderer);

		//    SvgElement parent = element._parent;
		//    element._parent = this;
		//    element.RenderElement(renderer);
		//    element._parent = parent;

		//    this.PopTransforms(renderer);
		//}


		public override SvgElement DeepCopy()
		{
			return DeepCopy<SvgMarker>();
		}

		public override SvgElement DeepCopy<T>()
		{
			var newObj = base.DeepCopy<T>() as SvgMarker;
			newObj.RefX = this.RefX;
			newObj.RefY = this.RefY;
			newObj.Orient = this.Orient;
			newObj.ViewBox = this.ViewBox;
			newObj.Overflow = this.Overflow;
			newObj.AspectRatio = this.AspectRatio;

			return newObj;
		}
    }
}