comparison Samples/Common/MeasureTrackers.h @ 644:f939f449482c

Ongoing tracker work.
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 10 May 2019 16:15:55 +0200
parents 500c3f70b6c2
children 1e9ed656318e
comparison
equal deleted inserted replaced
634:6a144a45b2d8 644:f939f449482c
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 "../../Framework/Scene2D/IPointerTracker.h" 23 #include "IFlexiblePointerTracker.h"
24 #include "../../Framework/Scene2D/Scene2D.h" 24 #include "../../Framework/Scene2D/Scene2D.h"
25 #include "../../Framework/Scene2D/PointerEvent.h"
25 26
26 #include "MeasureTools.h" 27 #include "MeasureTools.h"
27 #include "MeasureCommands.h" 28 #include "MeasureCommands.h"
28 29
29 #include <vector> 30 #include <vector>
30 31
31 namespace OrthancStone 32 namespace OrthancStone
32 { 33 {
33 class CreateMeasureTracker : public IPointerTracker 34 class CreateMeasureTracker : public IFlexiblePointerTracker
34 { 35 {
35 public: 36 public:
36 virtual void Update(const PointerEvent& e) ORTHANC_OVERRIDE; 37 virtual void Cancel() ORTHANC_OVERRIDE;
37 virtual void Release() ORTHANC_OVERRIDE; 38 virtual bool IsActive() const ORTHANC_OVERRIDE;
38 protected: 39 protected:
39 CreateMeasureTracker( 40 CreateMeasureTracker(
40 Scene2D& scene, 41 Scene2D& scene,
41 std::vector<TrackerCommandPtr>& undoStack, 42 std::vector<TrackerCommandPtr>& undoStack,
42 std::vector<MeasureToolPtr>& measureTools); 43 std::vector<MeasureToolPtr>& measureTools);
43 44
44 ~CreateMeasureTracker(); 45 ~CreateMeasureTracker();
45 46
47 protected:
48 Scene2D& scene_;
49 CreateMeasureCommandPtr command_;
50 bool active_;
46 private: 51 private:
47 Scene2D& scene_;
48 std::vector<TrackerCommandPtr>& undoStack_; 52 std::vector<TrackerCommandPtr>& undoStack_;
49 std::vector<MeasureToolPtr>& measureTools_; 53 std::vector<MeasureToolPtr>& measureTools_;
50 bool commitResult_; 54 bool commitResult_;
51
52 protected:
53 CreateMeasureCommandPtr command_;
54 }; 55 };
55 56
56 class CreateLineMeasureTracker : public CreateMeasureTracker
57 {
58 public:
59 /**
60 When you create this tracker, you need to supply it with the undo stack
61 where it will store the commands that perform the actual measure tool
62 creation and modification.
63 In turn, a container for these commands to store the actual measuring
64 must be supplied, too
65 */
66 CreateLineMeasureTracker(
67 Scene2D& scene,
68 std::vector<TrackerCommandPtr>& undoStack,
69 std::vector<MeasureToolPtr>& measureTools,
70 const PointerEvent& e);
71
72 ~CreateLineMeasureTracker();
73 };
74 } 57 }