Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureCommands.h @ 860:238693c3bc51 am-dev
merge default -> am-dev
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Mon, 24 Jun 2019 14:35:00 +0200 |
parents | e42b491f1fb2 |
children | c71ef52602a0 |
comparison
equal
deleted
inserted
replaced
856:a6e17a5a39e7 | 860:238693c3bc51 |
---|---|
17 * You should have received a copy of the GNU Affero General Public License | 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/>. | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | 19 **/ |
20 #pragma once | 20 #pragma once |
21 | 21 |
22 #include <Framework/Scene2D/Scene2D.h> | 22 #include "../Scene2D/Scene2D.h" |
23 | |
24 // to be moved into Stone | |
25 #include "PredeclaredTypes.h" | |
26 #include "MeasureTool.h" | |
27 #include "LineMeasureTool.h" | |
28 #include "AngleMeasureTool.h" | |
29 | |
23 #include <boost/shared_ptr.hpp> | 30 #include <boost/shared_ptr.hpp> |
24 #include <boost/noncopyable.hpp> | 31 #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 |
32 namespace OrthancStone | 33 namespace OrthancStone |
33 { | 34 { |
34 class TrackerCommand : public boost::noncopyable | 35 class TrackerCommand : public boost::noncopyable |
35 { | 36 { |
36 public: | 37 public: |
37 TrackerCommand(ViewportControllerWPtr controllerW) | 38 TrackerCommand(boost::weak_ptr<ViewportController> controllerW) |
38 : controllerW_(controllerW) | 39 : controllerW_(controllerW) |
39 { | 40 { |
40 | 41 |
41 } | 42 } |
42 virtual void Undo() = 0; | 43 virtual void Undo() = 0; |
43 virtual void Redo() = 0; | 44 virtual void Redo() = 0; |
44 | 45 |
45 protected: | 46 protected: |
46 ViewportControllerPtr GetController(); | 47 boost::shared_ptr<ViewportController> GetController(); |
47 ViewportControllerWPtr controllerW_; | 48 boost::weak_ptr<ViewportController> controllerW_; |
48 }; | 49 }; |
49 | 50 |
50 class CreateMeasureCommand : public TrackerCommand | 51 class CreateMeasureCommand : public TrackerCommand |
51 { | 52 { |
52 public: | 53 public: |
53 CreateMeasureCommand(ViewportControllerWPtr controllerW); | 54 CreateMeasureCommand(boost::weak_ptr<ViewportController> controllerW); |
54 ~CreateMeasureCommand(); | 55 ~CreateMeasureCommand(); |
55 virtual void Undo() ORTHANC_OVERRIDE; | 56 virtual void Undo() ORTHANC_OVERRIDE; |
56 virtual void Redo() ORTHANC_OVERRIDE; | 57 virtual void Redo() ORTHANC_OVERRIDE; |
57 private: | 58 private: |
58 /** Must be implemented by the subclasses that create the actual tool */ | 59 /** Must be implemented by the subclasses that create the actual tool */ |
59 virtual MeasureToolPtr GetMeasureTool() = 0; | 60 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() = 0; |
60 }; | 61 }; |
61 | 62 |
62 class CreateLineMeasureCommand : public CreateMeasureCommand | 63 class CreateLineMeasureCommand : public CreateMeasureCommand |
63 { | 64 { |
64 public: | 65 public: |
65 CreateLineMeasureCommand( | 66 CreateLineMeasureCommand( |
66 MessageBroker& broker, | 67 MessageBroker& broker, |
67 ViewportControllerWPtr controllerW, | 68 boost::weak_ptr<ViewportController> controllerW, |
68 ScenePoint2D point); | 69 ScenePoint2D point); |
69 | 70 |
70 // the starting position is set in the ctor | 71 // the starting position is set in the ctor |
71 void SetEnd(ScenePoint2D scenePos); | 72 void SetEnd(ScenePoint2D scenePos); |
72 | 73 |
73 private: | 74 private: |
74 virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE | 75 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE |
75 { | 76 { |
76 return measureTool_; | 77 return measureTool_; |
77 } | 78 } |
78 LineMeasureToolPtr measureTool_; | 79 boost::shared_ptr<LineMeasureTool> measureTool_; |
79 }; | 80 }; |
80 | 81 |
81 | 82 |
82 class CreateAngleMeasureCommand : public CreateMeasureCommand | 83 class CreateAngleMeasureCommand : public CreateMeasureCommand |
83 { | 84 { |
84 public: | 85 public: |
85 /** Ctor sets end of side 1*/ | 86 /** Ctor sets end of side 1*/ |
86 CreateAngleMeasureCommand( | 87 CreateAngleMeasureCommand( |
87 MessageBroker& broker, | 88 MessageBroker& broker, |
88 ViewportControllerWPtr controllerW, | 89 boost::weak_ptr<ViewportController> controllerW, |
89 ScenePoint2D point); | 90 ScenePoint2D point); |
90 | 91 |
91 /** This method sets center*/ | 92 /** This method sets center*/ |
92 void SetCenter(ScenePoint2D scenePos); | 93 void SetCenter(ScenePoint2D scenePos); |
93 | 94 |
94 /** This method sets end of side 2*/ | 95 /** This method sets end of side 2*/ |
95 void SetSide2End(ScenePoint2D scenePos); | 96 void SetSide2End(ScenePoint2D scenePos); |
96 | 97 |
97 private: | 98 private: |
98 virtual MeasureToolPtr GetMeasureTool() ORTHANC_OVERRIDE | 99 virtual boost::shared_ptr<MeasureTool> GetMeasureTool() ORTHANC_OVERRIDE |
99 { | 100 { |
100 return measureTool_; | 101 return measureTool_; |
101 } | 102 } |
102 AngleMeasureToolPtr measureTool_; | 103 boost::shared_ptr<AngleMeasureTool> measureTool_; |
103 }; | 104 }; |
104 | 105 |
105 } | 106 } |
106 | 107 |