Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/Paths/SvgPathSegCurvetoCubicRel.cs @ 12829

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

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

File size: 3.4 KB
Line 
1using System;
2using System.Text;
3
4namespace SharpVectors.Dom.Svg
5{
6    /// <summary>
7    /// Summary description for SvgPathSegCurvetoCubicRel.
8    /// </summary>
9    public sealed class SvgPathSegCurvetoCubicRel : SvgPathSegCurvetoCubic, ISvgPathSegCurvetoCubicRel
10    {
11        #region constructors
12        internal SvgPathSegCurvetoCubicRel(double x, double y, double x1, double y1, double x2, double y2)
13            : base(SvgPathSegType.CurveToCubicRel)
14        {
15            this.x = x;
16            this.y = y;
17            this.x1 = x1;
18            this.y1 = y1;
19            this.x2 = x2;
20            this.y2 = y2;
21        }
22        #endregion
23
24        #region ISvgPathSegCurvetoCubicRel Members
25
26        private double x;
27        public double X
28        {
29            get { return x; }
30            set { x = value; }
31        }
32
33        private double y;
34        public double Y
35        {
36            get { return y; }
37            set { y = value; }
38        }
39
40        private double x1;
41        public double X1
42        {
43            get { return x1; }
44            set { x1 = value; }
45        }
46
47        private double y1;
48        public double Y1
49        {
50            get { return y1; }
51            set { y1 = value; }
52        }
53
54        private double x2;
55        public double X2
56        {
57            get { return x2; }
58            set { x2 = value; }
59        }
60
61        private double y2;
62        public double Y2
63        {
64            get { return y2; }
65            set { y2 = value; }
66        }
67        #endregion
68
69        #region Public Methods
70
71        public override SvgPointF AbsXY
72        {
73            get
74            {
75                SvgPathSeg prevSeg = PreviousSeg;
76                SvgPointF prevPoint;
77                if (prevSeg == null) prevPoint = new SvgPointF(0, 0);
78                else prevPoint = prevSeg.AbsXY;
79
80                return new SvgPointF(prevPoint.X + X, prevPoint.Y + Y);
81            }
82        }
83
84        public override SvgPointF CubicX1Y1
85        {
86            get
87            {
88                SvgPathSeg prevSeg = PreviousSeg;
89                SvgPointF prevPoint;
90                if (prevSeg == null) prevPoint = new SvgPointF(0, 0);
91                else prevPoint = prevSeg.AbsXY;
92
93                return new SvgPointF(prevPoint.X + X1, prevPoint.Y + Y1);
94            }
95        }
96
97        public override SvgPointF CubicX2Y2
98        {
99            get
100            {
101                SvgPathSeg prevSeg = PreviousSeg;
102                SvgPointF prevPoint;
103                if (prevSeg == null) prevPoint = new SvgPointF(0, 0);
104                else prevPoint = prevSeg.AbsXY;
105
106                return new SvgPointF(prevPoint.X + X2, prevPoint.Y + Y2);
107            }
108        }
109
110        public override string PathText
111        {
112            get
113            {
114                StringBuilder sb = new StringBuilder();
115                sb.Append(PathSegTypeAsLetter);
116                sb.Append(X1);
117                sb.Append(",");
118                sb.Append(Y1);
119                sb.Append(",");
120                sb.Append(X2);
121                sb.Append(",");
122                sb.Append(Y2);
123                sb.Append(",");
124                sb.Append(X);
125                sb.Append(",");
126                sb.Append(Y);
127
128                return sb.ToString();
129            }
130        }
131
132        #endregion
133    }
134}
Note: See TracBrowser for help on using the repository browser.