Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/MeasureTool.h @ 866:c71ef52602a0 toa2019062501
Added the ability to edit existing measuring tools (demo not updated yet)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 25 Jun 2019 17:54:46 +0200 |
parents | a29c13497557 |
children | 0aff28f15ea2 |
comparison
equal
deleted
inserted
replaced
865:a29c13497557 | 866:c71ef52602a0 |
---|---|
33 #include <vector> | 33 #include <vector> |
34 #include <cmath> | 34 #include <cmath> |
35 | 35 |
36 namespace OrthancStone | 36 namespace OrthancStone |
37 { | 37 { |
38 class IFlexiblePointerTracker; | |
39 class MeasureToolMemento; | |
40 | |
38 class MeasureTool : public IObserver | 41 class MeasureTool : public IObserver |
39 { | 42 { |
40 public: | 43 public: |
41 virtual ~MeasureTool(); | 44 virtual ~MeasureTool(); |
42 | 45 |
69 It is assumed that if the pointer position leads to this function returning | 72 It is assumed that if the pointer position leads to this function returning |
70 true, then a click at that position will return a tracker to edit the | 73 true, then a click at that position will return a tracker to edit the |
71 measuring tool | 74 measuring tool |
72 */ | 75 */ |
73 virtual bool HitTest(ScenePoint2D p) const = 0; | 76 virtual bool HitTest(ScenePoint2D p) const = 0; |
77 | |
78 /** | |
79 This method must return a memento the captures the tool state (not including | |
80 the highlighting state | |
81 */ | |
82 virtual boost::shared_ptr<MeasureToolMemento> GetMemento() const = 0; | |
83 | |
84 /** | |
85 This method must apply the supplied memento (this requires RTTI to check | |
86 the type) | |
87 */ | |
88 virtual void SetMemento(boost::shared_ptr<MeasureToolMemento>) = 0; | |
89 | |
90 /** | |
91 This must create an edition tracker suitable for the supplied click position, | |
92 or an empty pointer if no hit test (although this should have been checked | |
93 first) | |
94 */ | |
95 virtual boost::shared_ptr<IFlexiblePointerTracker> CreateEditionTracker(const PointerEvent& e) = 0; | |
74 | 96 |
75 /** | 97 /** |
76 Will change the measuring tool to provide visual feedback on the GUI | 98 Will change the measuring tool to provide visual feedback on the GUI |
77 element that is in the pointer hit zone | 99 element that is in the pointer hit zone |
78 */ | 100 */ |
114 | 136 |
115 private: | 137 private: |
116 boost::weak_ptr<ViewportController> controllerW_; | 138 boost::weak_ptr<ViewportController> controllerW_; |
117 bool enabled_; | 139 bool enabled_; |
118 }; | 140 }; |
141 | |
142 class MeasureToolMemento | |
143 { | |
144 public: | |
145 virtual ~MeasureToolMemento() {}; | |
146 }; | |
147 | |
119 } | 148 } |
120 | 149 |
121 extern void TrackerSample_SetInfoDisplayMessage( | 150 extern void TrackerSample_SetInfoDisplayMessage( |
122 std::string key, std::string value); | 151 std::string key, std::string value); |