Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/ViewportController.h @ 818:e42b491f1fb2
Removed typedefs to shared_ptr by making them explicit. Removed using namespace
directives to make usage more explicit, too.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 29 May 2019 10:51:28 +0200 |
parents | 66ac7a2d1e3a |
children | 2b245953b44b |
comparison
equal
deleted
inserted
replaced
817:68f888812af4 | 818:e42b491f1fb2 |
---|---|
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 | 20 |
21 #pragma once | 21 #pragma once |
22 | 22 |
23 #include "PointerTypes.h" | 23 #include "PredeclaredTypes.h" |
24 | 24 |
25 #include "../Scene2D/Scene2D.h" | 25 #include "../Scene2D/Scene2D.h" |
26 #include "../Scene2D/PointerEvent.h" | 26 #include "../Scene2D/PointerEvent.h" |
27 #include "../Scene2DViewport/IFlexiblePointerTracker.h" | 27 #include "../Scene2DViewport/IFlexiblePointerTracker.h" |
28 | 28 |
71 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, \ | 71 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, \ |
72 SceneTransformChanged, ViewportController); | 72 SceneTransformChanged, ViewportController); |
73 | 73 |
74 ViewportController(MessageBroker& broker); | 74 ViewportController(MessageBroker& broker); |
75 | 75 |
76 Scene2DConstPtr GetScene() const; | 76 boost::shared_ptr<const Scene2D> GetScene() const; |
77 Scene2DPtr GetScene(); | 77 boost::shared_ptr<Scene2D> GetScene(); |
78 | 78 |
79 /** | 79 /** |
80 This method is called by the GUI system and should update/delete the | 80 This method is called by the GUI system and should update/delete the |
81 current tracker | 81 current tracker |
82 */ | 82 */ |
85 /** | 85 /** |
86 This method returns the list of measure tools containing the supplied point | 86 This method returns the list of measure tools containing the supplied point |
87 (in scene coords). A tracker can then be requested from the chosen | 87 (in scene coords). A tracker can then be requested from the chosen |
88 measure tool, if needed | 88 measure tool, if needed |
89 */ | 89 */ |
90 std::vector<MeasureToolPtr> HitTestMeasureTools(ScenePoint2D p); | 90 std::vector<boost::shared_ptr<MeasureTool>> HitTestMeasureTools(ScenePoint2D p); |
91 | 91 |
92 /** | 92 /** |
93 With this method, the object takes ownership of the supplied tracker and | 93 With this method, the object takes ownership of the supplied tracker and |
94 updates it according to user interaction | 94 updates it according to user interaction |
95 */ | 95 */ |
96 void SetActiveTracker(FlexiblePointerTrackerPtr tracker); | 96 void SetActiveTracker(boost::shared_ptr<IFlexiblePointerTracker> tracker); |
97 | 97 |
98 /** Forwarded to the underlying scene */ | 98 /** Forwarded to the underlying scene */ |
99 const AffineTransform2D& GetCanvasToSceneTransform() const; | 99 const AffineTransform2D& GetCanvasToSceneTransform() const; |
100 | 100 |
101 /** Forwarded to the underlying scene */ | 101 /** Forwarded to the underlying scene */ |
113 - then it adds the supplied command at the top of the undo stack | 113 - then it adds the supplied command at the top of the undo stack |
114 | 114 |
115 In other words, when a new command is pushed, all the undone (and not | 115 In other words, when a new command is pushed, all the undone (and not |
116 redone) commands are removed. | 116 redone) commands are removed. |
117 */ | 117 */ |
118 void PushCommand(TrackerCommandPtr command); | 118 void PushCommand(boost::shared_ptr<TrackerCommand> command); |
119 | 119 |
120 /** | 120 /** |
121 Undoes the command at the top of the undo stack, or throws if there is no | 121 Undoes the command at the top of the undo stack, or throws if there is no |
122 command to undo. | 122 command to undo. |
123 You can check "CanUndo" first to protect against extraneous redo. | 123 You can check "CanUndo" first to protect against extraneous redo. |
136 | 136 |
137 /** selfexpl */ | 137 /** selfexpl */ |
138 bool CanRedo() const; | 138 bool CanRedo() const; |
139 | 139 |
140 /** Adds a new measure tool */ | 140 /** Adds a new measure tool */ |
141 void AddMeasureTool(MeasureToolPtr measureTool); | 141 void AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool); |
142 | 142 |
143 /** Removes a measure tool or throws if it cannot be found */ | 143 /** Removes a measure tool or throws if it cannot be found */ |
144 void RemoveMeasureTool(MeasureToolPtr measureTool); | 144 void RemoveMeasureTool(boost::shared_ptr<MeasureTool> measureTool); |
145 | 145 |
146 /** | 146 /** |
147 The square handle side length in *scene* coordinates | 147 The square handle side length in *scene* coordinates |
148 */ | 148 */ |
149 double GetHandleSideLengthS() const; | 149 double GetHandleSideLengthS() const; |
170 double GetAngleTopTextLabelDistanceS() const; | 170 double GetAngleTopTextLabelDistanceS() const; |
171 | 171 |
172 private: | 172 private: |
173 double GetCanvasToSceneFactor() const; | 173 double GetCanvasToSceneFactor() const; |
174 | 174 |
175 std::vector<TrackerCommandPtr> commandStack_; | 175 std::vector<boost::shared_ptr<TrackerCommand>> commandStack_; |
176 | 176 |
177 /** | 177 /** |
178 This is always between >= 0 and <= undoStack_.size() and gives the | 178 This is always between >= 0 and <= undoStack_.size() and gives the |
179 position where the controller is in the undo stack. | 179 position where the controller is in the undo stack. |
180 - If numAppliedCommands_ > 0, one can undo | 180 - If numAppliedCommands_ > 0, one can undo |
181 - If numAppliedCommands_ < numAppliedCommands_.size(), one can redo | 181 - If numAppliedCommands_ < numAppliedCommands_.size(), one can redo |
182 */ | 182 */ |
183 size_t numAppliedCommands_; | 183 size_t numAppliedCommands_; |
184 std::vector<MeasureToolPtr> measureTools_; | 184 std::vector<boost::shared_ptr<MeasureTool>> measureTools_; |
185 Scene2DPtr scene_; | 185 boost::shared_ptr<Scene2D> scene_; |
186 FlexiblePointerTrackerPtr tracker_; | 186 boost::shared_ptr<IFlexiblePointerTracker> tracker_; |
187 | 187 |
188 // this is cached | 188 // this is cached |
189 mutable double canvasToSceneFactor_; | 189 mutable double canvasToSceneFactor_; |
190 }; | 190 }; |
191 } | 191 } |