Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2DViewport/MeasureTool.h @ 1576:92fca2b3ba3d
sanitizing the handling of canvas size
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Sep 2020 16:40:30 +0200 |
parents | 85e117739eca |
children | 8563ea5d8ae4 |
comparison
equal
deleted
inserted
replaced
1575:e4a52cbbdd70 | 1576:92fca2b3ba3d |
---|---|
40 | 40 |
41 class MeasureTool : public ObserverBase<MeasureTool> | 41 class MeasureTool : public ObserverBase<MeasureTool> |
42 { | 42 { |
43 private: | 43 private: |
44 bool enabled_; | 44 bool enabled_; |
45 | |
46 | |
47 protected: | |
48 explicit MeasureTool(boost::shared_ptr<IViewport> viewport); | |
49 | |
50 void PostConstructor(); | |
51 | |
52 /** | |
53 The measuring tool may exist in a standalone fashion, without any available | |
54 scene (because the controller is dead or dying). This call allows to check | |
55 before accessing the scene. | |
56 */ | |
57 bool IsSceneAlive() const; | |
58 | |
59 /** | |
60 This is the meat of the tool: this method must [create (if needed) and] | |
61 update the layers and their data according to the measure tool kind and | |
62 current state. This is repeatedly called during user interaction | |
63 */ | |
64 virtual void RefreshScene() = 0; | |
65 | |
66 /** | |
67 enabled_ is not accessible by subclasses because there is a state machine | |
68 that we do not wanna mess with | |
69 */ | |
70 bool IsEnabled() const; | |
71 | |
72 /** | |
73 Protected to allow sub-classes to use this weak pointer in factory methods | |
74 (pass them to created objects) | |
75 */ | |
76 boost::shared_ptr<IViewport> viewport_; | |
77 | |
45 | 78 |
46 public: | 79 public: |
47 virtual ~MeasureTool() | 80 virtual ~MeasureTool() |
48 { | 81 { |
49 } | 82 } |
112 | 145 |
113 /** | 146 /** |
114 A description of the measuring tool, useful in debug logs | 147 A description of the measuring tool, useful in debug logs |
115 */ | 148 */ |
116 virtual std::string GetDescription() = 0; | 149 virtual std::string GetDescription() = 0; |
117 | |
118 protected: | |
119 explicit MeasureTool(boost::shared_ptr<IViewport> viewport); | |
120 | |
121 void PostConstructor(); | |
122 | |
123 /** | |
124 The measuring tool may exist in a standalone fashion, without any available | |
125 scene (because the controller is dead or dying). This call allows to check | |
126 before accessing the scene. | |
127 */ | |
128 bool IsSceneAlive() const; | |
129 | |
130 /** | |
131 This is the meat of the tool: this method must [create (if needed) and] | |
132 update the layers and their data according to the measure tool kind and | |
133 current state. This is repeatedly called during user interaction | |
134 */ | |
135 virtual void RefreshScene() = 0; | |
136 | |
137 /** | |
138 enabled_ is not accessible by subclasses because there is a state machine | |
139 that we do not wanna mess with | |
140 */ | |
141 bool IsEnabled() const; | |
142 | |
143 /** | |
144 Protected to allow sub-classes to use this weak pointer in factory methods | |
145 (pass them to created objects) | |
146 */ | |
147 boost::shared_ptr<IViewport> viewport_; | |
148 }; | 150 }; |
149 | 151 |
150 class MeasureToolMemento | 152 class MeasureToolMemento |
151 { | 153 { |
152 public: | 154 public: |