Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureCommands.h @ 1305:a5326ce4f24b broker
Trackers and measuring tools now use the viewport instead of ViewportController, so that proper locks can be used
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 04 Mar 2020 09:45:38 +0100 |
parents | 7ec8fea061b9 |
children | ab81ee8fce1f |
comparison
equal
deleted
inserted
replaced
1304:b7fa67bf87fa | 1305:a5326ce4f24b |
---|---|
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 "../Scene2D/Scene2D.h" | 22 #include "../Viewport/IViewport.h" |
23 | 23 |
24 // to be moved into Stone | 24 // to be moved into Stone |
25 #include "PredeclaredTypes.h" | 25 #include "PredeclaredTypes.h" |
26 #include "MeasureTool.h" | 26 #include "MeasureTool.h" |
27 #include "LineMeasureTool.h" | 27 #include "LineMeasureTool.h" |
33 namespace OrthancStone | 33 namespace OrthancStone |
34 { | 34 { |
35 class MeasureCommand : public boost::noncopyable | 35 class MeasureCommand : public boost::noncopyable |
36 { | 36 { |
37 public: | 37 public: |
38 MeasureCommand(boost::weak_ptr<ViewportController> controllerW) | 38 MeasureCommand(IViewport& viewport) : viewport_(viewport) |
39 : controllerW_(controllerW) | 39 {} |
40 { | |
41 | |
42 } | |
43 virtual void Undo() = 0; | 40 virtual void Undo() = 0; |
44 virtual void Redo() = 0; | 41 virtual void Redo() = 0; |
45 | 42 |
46 virtual ~MeasureCommand() {}; | 43 virtual ~MeasureCommand() {}; |
47 | 44 |
48 protected: | 45 protected: |
49 boost::shared_ptr<ViewportController> GetController(); | 46 IViewport& viewport_; |
50 | |
51 private: | |
52 boost::weak_ptr<ViewportController> controllerW_; | |
53 }; | 47 }; |
54 | 48 |
55 class CreateMeasureCommand : public MeasureCommand | 49 class CreateMeasureCommand : public MeasureCommand |
56 { | 50 { |
57 public: | 51 public: |
58 CreateMeasureCommand(boost::weak_ptr<ViewportController> controllerW); | 52 CreateMeasureCommand(IViewport& viewport); |
59 virtual ~CreateMeasureCommand(); | 53 virtual ~CreateMeasureCommand(); |
60 virtual void Undo() ORTHANC_OVERRIDE; | 54 virtual void Undo() ORTHANC_OVERRIDE; |
61 virtual void Redo() ORTHANC_OVERRIDE; | 55 virtual void Redo() ORTHANC_OVERRIDE; |
62 private: | 56 private: |
63 /** Must be implemented by the subclasses that create the actual tool */ | 57 /** Must be implemented by the subclasses that create the actual tool */ |
65 }; | 59 }; |
66 | 60 |
67 class EditMeasureCommand : public MeasureCommand | 61 class EditMeasureCommand : public MeasureCommand |
68 { | 62 { |
69 public: | 63 public: |
70 EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::weak_ptr<ViewportController> controllerW); | 64 EditMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, IViewport& viewport); |
71 virtual ~EditMeasureCommand(); | 65 virtual ~EditMeasureCommand(); |
72 virtual void Undo() ORTHANC_OVERRIDE; | 66 virtual void Undo() ORTHANC_OVERRIDE; |
73 virtual void Redo() ORTHANC_OVERRIDE; | 67 virtual void Redo() ORTHANC_OVERRIDE; |
74 | 68 |
75 /** This memento is the original object state */ | 69 /** This memento is the original object state */ |
86 }; | 80 }; |
87 | 81 |
88 class DeleteMeasureCommand : public MeasureCommand | 82 class DeleteMeasureCommand : public MeasureCommand |
89 { | 83 { |
90 public: | 84 public: |
91 DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, boost::weak_ptr<ViewportController> controllerW); | 85 DeleteMeasureCommand(boost::shared_ptr<MeasureTool> measureTool, IViewport& viewport); |
92 virtual ~DeleteMeasureCommand(); | 86 virtual ~DeleteMeasureCommand(); |
93 virtual void Undo() ORTHANC_OVERRIDE; | 87 virtual void Undo() ORTHANC_OVERRIDE; |
94 virtual void Redo() ORTHANC_OVERRIDE; | 88 virtual void Redo() ORTHANC_OVERRIDE; |
95 | 89 |
96 /** This memento is the original object state */ | 90 /** This memento is the original object state */ |