Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureTool.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 | 9b126de2cde2 |
comparison
equal
deleted
inserted
replaced
1304:b7fa67bf87fa | 1305:a5326ce4f24b |
---|---|
73 | 73 |
74 It is assumed that if the pointer position leads to this function returning | 74 It is assumed that if the pointer position leads to this function returning |
75 true, then a click at that position will return a tracker to edit the | 75 true, then a click at that position will return a tracker to edit the |
76 measuring tool | 76 measuring tool |
77 */ | 77 */ |
78 virtual bool HitTest(ScenePoint2D p) const = 0; | 78 virtual bool HitTest(ScenePoint2D p) = 0; |
79 | 79 |
80 /** | 80 /** |
81 This method must return a memento the captures the tool state (not including | 81 This method must return a memento the captures the tool state (not including |
82 the highlighting state | 82 the highlighting state |
83 */ | 83 */ |
111 A description of the measuring tool, useful in debug logs | 111 A description of the measuring tool, useful in debug logs |
112 */ | 112 */ |
113 virtual std::string GetDescription() = 0; | 113 virtual std::string GetDescription() = 0; |
114 | 114 |
115 protected: | 115 protected: |
116 MeasureTool(boost::weak_ptr<ViewportController> controllerW); | 116 MeasureTool(IViewport& viewport); |
117 | 117 |
118 /** | 118 /** |
119 The measuring tool may exist in a standalone fashion, without any available | 119 The measuring tool may exist in a standalone fashion, without any available |
120 scene (because the controller is dead or dying). This call allows to check | 120 scene (because the controller is dead or dying). This call allows to check |
121 before accessing the scene. | 121 before accessing the scene. |
127 update the layers and their data according to the measure tool kind and | 127 update the layers and their data according to the measure tool kind and |
128 current state. This is repeatedly called during user interaction | 128 current state. This is repeatedly called during user interaction |
129 */ | 129 */ |
130 virtual void RefreshScene() = 0; | 130 virtual void RefreshScene() = 0; |
131 | 131 |
132 boost::shared_ptr<const ViewportController> GetController() const; | |
133 boost::shared_ptr<ViewportController> GetController(); | |
134 | |
135 /** | 132 /** |
136 enabled_ is not accessible by subclasses because there is a state machine | 133 enabled_ is not accessible by subclasses because there is a state machine |
137 that we do not wanna mess with | 134 that we do not wanna mess with |
138 */ | 135 */ |
139 bool IsEnabled() const; | 136 bool IsEnabled() const; |
140 | 137 |
138 /** | |
139 Protected to allow sub-classes to use this weak pointer in factory methods | |
140 (pass them to created objects) | |
141 */ | |
142 IViewport& viewport_; | |
143 | |
144 | |
141 private: | 145 private: |
142 boost::weak_ptr<ViewportController> controllerW_; | |
143 bool enabled_; | 146 bool enabled_; |
144 }; | 147 }; |
145 | 148 |
146 class MeasureToolMemento | 149 class MeasureToolMemento |
147 { | 150 { |