Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2DViewport/AngleMeasureTool.h @ 1512:244ad1e4e76a
reorganization of folders
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Jul 2020 16:21:02 +0200 |
parents | Framework/Scene2DViewport/AngleMeasureTool.h@ab81ee8fce1f |
children | 85e117739eca |
comparison
equal
deleted
inserted
replaced
1511:9dfeee74c1e6 | 1512:244ad1e4e76a |
---|---|
1 /** | |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 #pragma once | |
22 | |
23 #include "MeasureTool.h" | |
24 | |
25 #include "../Scene2DViewport/LayerHolder.h" | |
26 #include "../Scene2D/Scene2D.h" | |
27 #include "../Scene2D/ScenePoint2D.h" | |
28 #include "../Scene2D/PolylineSceneLayer.h" | |
29 #include "../Scene2D/TextSceneLayer.h" | |
30 | |
31 #include <boost/shared_ptr.hpp> | |
32 #include <boost/weak_ptr.hpp> | |
33 #include <boost/enable_shared_from_this.hpp> | |
34 | |
35 #include <vector> | |
36 #include <cmath> | |
37 | |
38 namespace OrthancStone | |
39 { | |
40 class AngleMeasureTool : public MeasureTool | |
41 { | |
42 public: | |
43 static boost::shared_ptr<AngleMeasureTool> Create(boost::shared_ptr<IViewport> viewport); | |
44 | |
45 ~AngleMeasureTool(); | |
46 | |
47 void SetSide1End(ScenePoint2D start); | |
48 void SetCenter(ScenePoint2D start); | |
49 void SetSide2End(ScenePoint2D start); | |
50 | |
51 virtual bool HitTest(ScenePoint2D p) 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; | |
57 virtual std::string GetDescription() ORTHANC_OVERRIDE; | |
58 | |
59 enum AngleHighlightArea | |
60 { | |
61 AngleHighlightArea_None, | |
62 AngleHighlightArea_Side1End, | |
63 AngleHighlightArea_Side1, | |
64 AngleHighlightArea_Side2End, | |
65 AngleHighlightArea_Side2, | |
66 AngleHighlightArea_Center | |
67 }; | |
68 | |
69 | |
70 AngleHighlightArea AngleHitTest(ScenePoint2D p) const; | |
71 | |
72 private: | |
73 AngleMeasureTool(boost::shared_ptr<IViewport> viewport); | |
74 | |
75 virtual void RefreshScene() ORTHANC_OVERRIDE; | |
76 void RemoveFromScene(); | |
77 void SetAngleHighlightArea(AngleHighlightArea area); | |
78 | |
79 private: | |
80 ScenePoint2D side1End_; | |
81 ScenePoint2D side2End_; | |
82 ScenePoint2D center_; | |
83 boost::shared_ptr<LayerHolder> layerHolder_; | |
84 AngleHighlightArea angleHighlightArea_; | |
85 }; | |
86 | |
87 class AngleMeasureToolMemento : public MeasureToolMemento | |
88 { | |
89 public: | |
90 ScenePoint2D side1End_; | |
91 ScenePoint2D side2End_; | |
92 ScenePoint2D center_; | |
93 }; | |
94 } | |
95 | |
96 |