Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/SharpVectorModel/Paths/SvgPathSegClosePath.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: 1.4 KB
Line 
1using System;
2
3namespace SharpVectors.Dom.Svg
4{
5  /// <summary>
6  /// Summary description for SvgPathSegClosePath.
7  /// </summary>
8  public sealed class SvgPathSegClosePath : SvgPathSeg, ISvgPathSegClosePath
9  {
10    internal SvgPathSegClosePath() : base(SvgPathSegType.ClosePath)
11    {
12    }
13
14        public override SvgPointF AbsXY
15    {
16      get
17      {
18        SvgPathSeg item = this;
19     
20        while(item != null && !(item is SvgPathSegMoveto))
21        {
22          item = item.PreviousSeg;
23        }
24
25        if(item == null)
26        {
27                    return new SvgPointF(0, 0);
28        }
29        else
30        {
31          return item.AbsXY;
32        }
33      }
34    }
35
36        public override double StartAngle
37    {
38      get
39      {
40        SvgPathSeg prevSeg = PreviousSeg;
41                SvgPointF prevPoint;
42        if(prevSeg == null)
43        {
44                    prevPoint = new SvgPointF(0, 0);
45        }
46        else
47        {
48          prevPoint = prevSeg.AbsXY;
49        }
50                SvgPointF curPoint = AbsXY;
51
52                double dx = curPoint.X - prevPoint.X;
53                double dy = curPoint.Y - prevPoint.Y;
54
55                double a = (Math.Atan2(dy, dx) * 180 / Math.PI);
56        a += 270;
57        a %= 360;
58        return a;
59      }
60    }
61
62        public override double EndAngle
63    {
64      get
65      {
66                double a = StartAngle;
67        a += 180;
68        a %= 360;
69        return a;
70      }
71    }
72
73    public override string PathText
74    {
75      get
76      {
77        return "z";
78      }
79    }
80  }
81}
Note: See TracBrowser for help on using the repository browser.