comparison OrthancStone/Sources/Scene2DViewport/LineMeasureTool.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/LineMeasureTool.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 "../Scene2D/PolylineSceneLayer.h"
24 #include "../Scene2D/Scene2D.h"
25 #include "../Scene2D/ScenePoint2D.h"
26 #include "../Scene2D/TextSceneLayer.h"
27 #include "MeasureTool.h"
28
29 #include <boost/shared_ptr.hpp>
30 #include <boost/weak_ptr.hpp>
31 #include <boost/enable_shared_from_this.hpp>
32
33 #include <vector>
34 #include <cmath>
35
36 namespace OrthancStone
37 {
38 class LineMeasureTool : public MeasureTool
39 {
40 public:
41 static boost::shared_ptr<LineMeasureTool> Create(boost::shared_ptr<IViewport> viewport);
42
43 ~LineMeasureTool();
44
45 void SetStart(ScenePoint2D start);
46 void SetEnd(ScenePoint2D end);
47 void Set(ScenePoint2D start, ScenePoint2D end);
48
49
50 virtual bool HitTest(ScenePoint2D p) ORTHANC_OVERRIDE;
51 virtual void Highlight(ScenePoint2D p) ORTHANC_OVERRIDE;
52 virtual void ResetHighlightState() ORTHANC_OVERRIDE;
53 virtual boost::shared_ptr<IFlexiblePointerTracker> CreateEditionTracker(const PointerEvent& e) ORTHANC_OVERRIDE;
54 virtual boost::shared_ptr<MeasureToolMemento> GetMemento() const ORTHANC_OVERRIDE;
55 virtual void SetMemento(boost::shared_ptr<MeasureToolMemento>) ORTHANC_OVERRIDE;
56 virtual std::string GetDescription() ORTHANC_OVERRIDE;
57
58 enum LineHighlightArea
59 {
60 LineHighlightArea_None,
61 LineHighlightArea_Start,
62 LineHighlightArea_End,
63 LineHighlightArea_Segment
64 };
65
66
67 LineHighlightArea LineHitTest(ScenePoint2D p);
68
69 private:
70 LineMeasureTool(boost::shared_ptr<IViewport> viewport);
71
72 virtual void RefreshScene() ORTHANC_OVERRIDE;
73 void RemoveFromScene();
74 void SetLineHighlightArea(LineHighlightArea area);
75
76 private:
77
78 private:
79 ScenePoint2D start_;
80 ScenePoint2D end_;
81 boost::shared_ptr<LayerHolder> layerHolder_;
82 int baseLayerIndex_;
83 LineHighlightArea lineHighlightArea_;
84 };
85
86 class LineMeasureToolMemento : public MeasureToolMemento
87 {
88 public:
89 ScenePoint2D start_;
90 ScenePoint2D end_;
91 };
92
93 }
94