File: Handle.cs

package info (click to toggle)
quickroute-gps 2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,576 kB
  • sloc: cs: 74,488; makefile: 72; sh: 43
file content (147 lines) | stat: -rw-r--r-- 4,792 bytes parent folder | download | duplicates (3)
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
73
74
75
76
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using System;
using System.Runtime.Serialization;

namespace QuickRoute.BusinessEntities
{
  /// <summary>
  /// Class holding information of the handles used for adjusting the route to the map.
  /// </summary>
  [Serializable]
  public class Handle : IComparable<Handle>
  {
    private GeneralMatrix transformationMatrix;
    private ParameterizedLocation parameterizedLocation;
    private PointD location;
    private IMarkerDrawer markerDrawer;
    private HandleType type;
    /// <summary>
    /// The exact time this handle is bound to (used to prevent rounding errors when e g cutting a route) 
    /// </summary>
    [NonSerialized] private DateTime? time;

    public Handle()
    {
    }

    /// <summary>
    /// Creates a handle based on parameterized location.
    /// </summary>
    /// <param name="parameterizedLocation"></param>
    /// <param name="location"></param>
    /// <param name="transformationMatrix"></param>
    /// <param name="markerDrawer"></param>
    public Handle(ParameterizedLocation parameterizedLocation, PointD location, GeneralMatrix transformationMatrix,
                  IMarkerDrawer markerDrawer)
      : this(parameterizedLocation, location, transformationMatrix, markerDrawer, HandleType.Handle)
    {
    }

    /// <summary>
    /// Creates a handle based on parameterized location.
    /// </summary>
    /// <param name="parameterizedLocation"></param>
    /// <param name="location"></param>
    /// <param name="transformationMatrix"></param>
    /// <param name="markerDrawer"></param>
    /// <param name="type"></param>
    public Handle(ParameterizedLocation parameterizedLocation, PointD location, GeneralMatrix transformationMatrix, IMarkerDrawer markerDrawer, HandleType type)
      : this(parameterizedLocation, null, location, transformationMatrix, markerDrawer, HandleType.Handle)
    {
    }

    /// <summary>
    /// Creates a handle based on parameterized location and time (used to prevent rounding errors when e g cutting a route).
    /// </summary>
    /// <param name="parameterizedLocation"></param>
    /// <param name="time"></param>
    /// <param name="location"></param>
    /// <param name="transformationMatrix"></param>
    /// <param name="markerDrawer"></param>
    public Handle(ParameterizedLocation parameterizedLocation, DateTime? time, PointD location, GeneralMatrix transformationMatrix, IMarkerDrawer markerDrawer)
      : this(parameterizedLocation, time, location, transformationMatrix, markerDrawer, HandleType.Handle)
    {
    }

    /// <summary>
    /// Creates a handle based on parameterized location and time (used to prevent rounding errors when e g cutting a route).
    /// </summary>
    /// <param name="parameterizedLocation"></param>
    /// <param name="time"></param>
    /// <param name="location"></param>
    /// <param name="transformationMatrix"></param>
    /// <param name="markerDrawer"></param>
    /// <param name="type"></param>
    public Handle(ParameterizedLocation parameterizedLocation, DateTime? time, PointD location, GeneralMatrix transformationMatrix, IMarkerDrawer markerDrawer, HandleType type)
    {
      ParameterizedLocation = parameterizedLocation;
      Time = time;
      Location = location;
      TransformationMatrix = transformationMatrix;
      MarkerDrawer = markerDrawer;
      Type = type;
    }

    public GeneralMatrix TransformationMatrix
    {
      get { return transformationMatrix; }
      set { transformationMatrix = value; }
    }

    /// <summary>
    /// The parameterized location of this handle.
    /// </summary>
    public ParameterizedLocation ParameterizedLocation
    {
      get { return parameterizedLocation; }
      set { parameterizedLocation = value; }
    }

    /// <summary>
    /// Location of the handle in original map coordinates.
    /// </summary>
    public PointD Location
    {
      get { return location; }
      set { location = value; }
    }

    /// <summary>
    /// The marker drawer that is used when drawing the handle marker.
    /// </summary>
    public IMarkerDrawer MarkerDrawer
    {
      get { return markerDrawer; }
      set { markerDrawer = value; }
    }

    public HandleType Type
    {
      get { return type; }
      set { type = value; }
    }

    public DateTime? Time
    {
      get { return time; }
      set { time = value; }
    }

    #region IComparable<Handle> Members

    public int CompareTo(Handle other)
    {
      return ParameterizedLocation.CompareTo(other.ParameterizedLocation); 
    }

    #endregion

    public enum HandleType
    {
      StartHandle = -1,
      Handle,
      EndHandle
    }

  }

}