File: MoveHandleAction.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 (57 lines) | stat: -rw-r--r-- 1,190 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
using QuickRoute.BusinessEntities;

namespace QuickRoute.BusinessEntities.Actions
{
  public class MoveHandleAction : IAction 
  {
    private Handle handle;
    private Session session;
    private PointD oldLocation;
    private PointD newLocation;

    public MoveHandleAction(Handle handle, Session session, PointD oldLocation)
    {
      this.handle = handle;
      this.session = session;
      this.oldLocation = oldLocation;
      this.newLocation = handle.Location; 
    }

    public Handle Handle
    {
      get { return handle; }
      set { handle = value; }
    }

    public Session Session
    {
      get { return session; }
      set { session = value; }
    }

    public PointD OldLocation
    {
      get { return oldLocation; }
      set { oldLocation = value; }
    }

    public PointD NewLocation
    {
      get { return newLocation; }
      set { newLocation = value; }
    }

    public void Execute()
    {
      handle.Location = newLocation;
      session.UpdateHandle(handle);
    }

    public void Undo()
    {
      handle.Location = oldLocation;
      session.UpdateHandle(handle);
    }

  }
}