Mercurial > hg > orthanc-stone
comparison Framework/Scene2DViewport/AngleMeasureTool.h @ 880:9953f16c304d am-dev
Merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 05 Jul 2019 15:33:02 +0200 |
parents | c71ef52602a0 |
children | ac88989817e3 |
comparison
equal
deleted
inserted
replaced
879:12b591d5d63c | 880:9953f16c304d |
---|---|
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(); |
45 | 46 |
46 void SetSide1End(ScenePoint2D start); | 47 void SetSide1End(ScenePoint2D start); |
47 void SetCenter(ScenePoint2D start); | 48 void SetCenter(ScenePoint2D start); |
48 void SetSide2End(ScenePoint2D start); | 49 void SetSide2End(ScenePoint2D start); |
49 | 50 |
51 virtual bool HitTest(ScenePoint2D p) const ORTHANC_OVERRIDE; | |
52 virtual void Highlight(ScenePoint2D p) 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; | |
50 | 57 |
51 virtual bool HitTest(ScenePoint2D p) const ORTHANC_OVERRIDE; | 58 enum AngleHighlightArea |
59 { | |
60 AngleHighlightArea_None, | |
61 AngleHighlightArea_Side1End, | |
62 AngleHighlightArea_Side1, | |
63 AngleHighlightArea_Side2End, | |
64 AngleHighlightArea_Side2, | |
65 AngleHighlightArea_Center | |
66 }; | |
67 | |
68 | |
69 AngleHighlightArea AngleHitTest(ScenePoint2D p) const; | |
52 | 70 |
53 private: | 71 private: |
54 virtual void RefreshScene() ORTHANC_OVERRIDE; | 72 virtual void RefreshScene() ORTHANC_OVERRIDE; |
55 void RemoveFromScene(); | 73 void RemoveFromScene(); |
74 void SetAngleHighlightArea(AngleHighlightArea area); | |
56 | 75 |
57 private: | 76 private: |
58 ScenePoint2D side1End_; | 77 ScenePoint2D side1End_; |
59 ScenePoint2D side2End_; | 78 ScenePoint2D side2End_; |
60 ScenePoint2D center_; | 79 ScenePoint2D center_; |
61 boost::shared_ptr<LayerHolder> layerHolder_; | 80 boost::shared_ptr<LayerHolder> layerHolder_; |
81 AngleHighlightArea angleHighlightArea_; | |
82 }; | |
83 | |
84 class AngleMeasureToolMemento : public MeasureToolMemento | |
85 { | |
86 public: | |
87 ScenePoint2D side1End_; | |
88 ScenePoint2D side2End_; | |
89 ScenePoint2D center_; | |
62 }; | 90 }; |
63 } | 91 } |
64 | 92 |
65 | 93 |