Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/Paths/SvgPathSegLinetoRel.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: 1.3 KB
Line 
1using System;
2using System.Text;
3
4namespace SharpVectors.Dom.Svg
5{
6    public sealed class SvgPathSegLinetoRel : SvgPathSegLineto, ISvgPathSegLinetoRel
7    {
8        private double x;
9        private double y;
10
11        public SvgPathSegLinetoRel(double x, double y)
12            : base(SvgPathSegType.LineToRel)
13        {
14            this.x = x;
15            this.y = y;
16        }
17
18        public double X
19        {
20            get { return x; }
21            set { x = value; }
22        }
23
24        public double Y
25        {
26            get { return y; }
27            set { y = value; }
28        }
29
30        public override SvgPointF AbsXY
31        {
32            get
33            {
34                SvgPathSeg prevSeg = PreviousSeg;
35                SvgPointF prevPoint;
36                if (prevSeg == null) prevPoint = new SvgPointF(0, 0);
37                else prevPoint = prevSeg.AbsXY;
38                return new SvgPointF(prevPoint.X + X, prevPoint.Y + Y);
39            }
40        }
41
42        public override string PathText
43        {
44            get
45            {
46                StringBuilder sb = new StringBuilder();
47                sb.Append(PathSegTypeAsLetter);
48                sb.Append(X);
49                sb.Append(",");
50                sb.Append(Y);
51
52                return sb.ToString();
53            }
54        }
55    }
56}
Note: See TracBrowser for help on using the repository browser.