Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/Paths/SvgPathSegCurvetoCubicSmoothAbs.cs @ 12762

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

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

File size: 2.6 KB
Line 
1using System;
2using System.Text;
3
4namespace SharpVectors.Dom.Svg
5{
6    public sealed class SvgPathSegCurvetoCubicSmoothAbs : SvgPathSegCurvetoCubic, ISvgPathSegCurvetoCubicSmoothAbs
7    {
8        #region constructors
9       
10        internal SvgPathSegCurvetoCubicSmoothAbs(double x, double y, double x2, double y2)
11            : base(SvgPathSegType.CurveToCubicSmoothAbs)
12        {
13            this.x = x;
14            this.y = y;
15            this.x2 = x2;
16            this.y2 = y2;
17        }
18
19        #endregion
20
21        #region ISvgPathSegCurvetoCubicSmoothAbs Members
22
23        private double x;
24        public double X
25        {
26            get { return x; }
27            set { x = value; }
28        }
29
30        private double y;
31        public double Y
32        {
33            get { return y; }
34            set { y = value; }
35        }
36
37        private double x2;
38        public double X2
39        {
40            get { return x2; }
41            set { x2 = value; }
42        }
43
44        private double y2;
45        public double Y2
46        {
47            get { return y2; }
48            set { y2 = value; }
49        }
50        #endregion
51
52        #region Public Methods
53
54        public override SvgPointF AbsXY
55        {
56            get
57            {
58                return new SvgPointF(x, y);
59            }
60        }
61
62        public override SvgPointF CubicX1Y1
63        {
64            get
65            {
66                SvgPathSeg prevSeg = PreviousSeg;
67                if (prevSeg == null || !(prevSeg is SvgPathSegCurvetoCubic))
68                {
69                    return prevSeg.AbsXY;
70                }
71                else
72                {
73                    SvgPointF prevXY = prevSeg.AbsXY;
74                    SvgPointF prevX2Y2 = ((SvgPathSegCurvetoCubic)prevSeg).CubicX2Y2;
75
76                    return new SvgPointF(2 * prevXY.X - prevX2Y2.X, 2 * prevXY.Y - prevX2Y2.Y);
77                }
78            }
79        }
80
81        public override SvgPointF CubicX2Y2
82        {
83            get
84            {
85                return new SvgPointF(x2, y2);
86            }
87        }
88
89        public override string PathText
90        {
91            get
92            {
93                StringBuilder sb = new StringBuilder();
94                sb.Append(PathSegTypeAsLetter);
95                sb.Append(X2);
96                sb.Append(",");
97                sb.Append(Y2);
98                sb.Append(",");
99                sb.Append(X);
100                sb.Append(",");
101                sb.Append(Y);
102
103                return sb.ToString();
104            }
105        }
106
107        #endregion
108    }
109}
Note: See TracBrowser for help on using the repository browser.