Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureCommands.h @ 703:d4d6c5b502b5
Merging refactor-viewport-controller
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sun, 19 May 2019 16:31:56 +0200 |
parents | 059e1fd05fd6 |
children | 28b9e3a54200 |
comparison
equal
deleted
inserted
replaced
696:75deb0acd632 | 703:d4d6c5b502b5 |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 #pragma once | |
21 | |
22 #include <Framework/Scene2D/Scene2D.h> | |
23 #include <boost/shared_ptr.hpp> | |
24 #include <boost/noncopyable.hpp> | |
25 | |
26 // to be moved into Stone | |
27 #include "PointerTypes.h" | |
28 #include "MeasureTools.h" | |
29 #include "LineMeasureTool.h" | |
30 #include "AngleMeasureTool.h" | |
31 | |
32 namespace OrthancStone | |
33 { | |
34 class TrackerCommand : public boost::noncopyable | |
35 { | |
36 public: | |
37 TrackerCommand(ViewportControllerWPtr controllerW) | |
38 : controllerW_(controllerW) | |
39 { | |
40 | |
41 } | |
42 virtual void Undo() = 0; | |
43 virtual void Redo() = 0; | |
44 | |
45 protected: | |
46 ViewportControllerWPtr controllerW_; | |
47 }; | |
48 | |
49 class CreateMeasureCommand : public TrackerCommand | |
50 { | |
51 public: | |
52 CreateMeasureCommand( | |
53 ViewportControllerWPtr controllerW, MeasureToolList& measureTools); | |
54 ~CreateMeasureCommand(); | |
55 virtual void Undo() ORTHANC_OVERRIDE; | |
56 virtual void Redo() ORTHANC_OVERRIDE; | |
57 protected: | |
58 MeasureToolList& measureTools_; | |
59 private: | |
60 /** Must be implemented by the subclasses that create the actual tool */ | |
61 virtual MeasureToolPtr GetMeasureTool() = 0; | |
62 }; | |
63 | |
64 class CreateLineMeasureCommand : public CreateMeasureCommand | |
65 { | |
66 public: | |
67 CreateLineMeasureCommand( | |
68 MessageBroker& broker, | |
69 ViewportControllerWPtr controllerW, | |
70 MeasureToolList& measureTools, | |
71 ScenePoint2D point); | |
72 | |
73 // the starting position is set in the ctor | |
74 void SetEnd(ScenePoint2D scenePos); | |
75 | |
76 private: | |
77 virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE | |
78 { | |
79 return measureTool_; | |
80 } | |
81 LineMeasureToolPtr measureTool_; | |
82 }; | |
83 | |
84 | |
85 class CreateAngleMeasureCommand : public CreateMeasureCommand | |
86 { | |
87 public: | |
88 /** Ctor sets end of side 1*/ | |
89 CreateAngleMeasureCommand( | |
90 MessageBroker& broker, | |
91 ViewportControllerWPtr controllerW, | |
92 MeasureToolList& measureTools, | |
93 ScenePoint2D point); | |
94 | |
95 /** This method sets center*/ | |
96 void SetCenter(ScenePoint2D scenePos); | |
97 | |
98 /** This method sets end of side 2*/ | |
99 void SetSide2End(ScenePoint2D scenePos); | |
100 | |
101 private: | |
102 virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE | |
103 { | |
104 return measureTool_; | |
105 } | |
106 AngleMeasureToolPtr measureTool_; | |
107 }; | |
108 | |
109 } | |
110 |