comparison Framework/Scene2DViewport/AngleMeasureTool.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 ac88989817e3
comparison
equal deleted inserted replaced
865:a29c13497557 866:c71ef52602a0
28 #include "../Scene2D/PolylineSceneLayer.h" 28 #include "../Scene2D/PolylineSceneLayer.h"
29 #include "../Scene2D/TextSceneLayer.h" 29 #include "../Scene2D/TextSceneLayer.h"
30 30
31 #include <boost/shared_ptr.hpp> 31 #include <boost/shared_ptr.hpp>
32 #include <boost/weak_ptr.hpp> 32 #include <boost/weak_ptr.hpp>
33 #include <boost/enable_shared_from_this.hpp>
33 34
34 #include <vector> 35 #include <vector>
35 #include <cmath> 36 #include <cmath>
36 37
37 namespace OrthancStone 38 namespace OrthancStone
38 { 39 {
39 class AngleMeasureTool : public MeasureTool 40 class AngleMeasureTool : public MeasureTool, public boost::enable_shared_from_this<AngleMeasureTool>
40 { 41 {
41 public: 42 public:
42 AngleMeasureTool(MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW); 43 AngleMeasureTool(MessageBroker& broker, boost::weak_ptr<ViewportController> controllerW);
43 44
44 ~AngleMeasureTool(); 45 ~AngleMeasureTool();
48 void SetSide2End(ScenePoint2D start); 49 void SetSide2End(ScenePoint2D start);
49 50
50 virtual bool HitTest(ScenePoint2D p) const ORTHANC_OVERRIDE; 51 virtual bool HitTest(ScenePoint2D p) const ORTHANC_OVERRIDE;
51 virtual void Highlight(ScenePoint2D p) ORTHANC_OVERRIDE; 52 virtual void Highlight(ScenePoint2D p) ORTHANC_OVERRIDE;
52 virtual void ResetHighlightState() ORTHANC_OVERRIDE; 53 virtual void ResetHighlightState() ORTHANC_OVERRIDE;
54 virtual boost::shared_ptr<IFlexiblePointerTracker> CreateEditionTracker(const PointerEvent& e) ORTHANC_OVERRIDE;
55 virtual boost::shared_ptr<MeasureToolMemento> GetMemento() const ORTHANC_OVERRIDE;
56 virtual void SetMemento(boost::shared_ptr<MeasureToolMemento>) ORTHANC_OVERRIDE;
53 57
54 enum AngleHighlightArea 58 enum AngleHighlightArea
55 { 59 {
56 AngleHighlightArea_None, 60 AngleHighlightArea_None,
57 AngleHighlightArea_Side1End, 61 AngleHighlightArea_Side1End,
74 ScenePoint2D side2End_; 78 ScenePoint2D side2End_;
75 ScenePoint2D center_; 79 ScenePoint2D center_;
76 boost::shared_ptr<LayerHolder> layerHolder_; 80 boost::shared_ptr<LayerHolder> layerHolder_;
77 AngleHighlightArea angleHighlightArea_; 81 AngleHighlightArea angleHighlightArea_;
78 }; 82 };
83
84 class AngleMeasureToolMemento : public MeasureToolMemento
85 {
86 public:
87 ScenePoint2D side1End_;
88 ScenePoint2D side2End_;
89 ScenePoint2D center_;
90 };
79 } 91 }
80 92
81 93