Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2D/AnnotationsSceneLayer.h @ 1804:5a872e69c74f
reorganization
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 20 May 2021 14:48:51 +0200 |
parents | |
children | 0840a25c6d41 |
comparison
equal
deleted
inserted
replaced
1803:d1849468729b | 1804:5a872e69c74f |
---|---|
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-2021 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 Lesser 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 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with this program. If not, see | |
19 * <http://www.gnu.org/licenses/>. | |
20 **/ | |
21 | |
22 | |
23 #include "../Messages/IObservable.h" | |
24 #include "Scene2D.h" | |
25 #include "../Scene2DViewport/IFlexiblePointerTracker.h" | |
26 | |
27 namespace OrthancStone | |
28 { | |
29 class AnnotationsSceneLayer : public IObservable | |
30 { | |
31 public: | |
32 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, AnnotationAddedMessage, AnnotationsSceneLayer); | |
33 ORTHANC_STONE_DEFINE_ORIGIN_MESSAGE(__FILE__, __LINE__, AnnotationRemovedMessage, AnnotationsSceneLayer); | |
34 | |
35 enum Tool | |
36 { | |
37 Tool_Edit, | |
38 Tool_None, | |
39 Tool_Segment, | |
40 Tool_Angle, | |
41 Tool_Circle, | |
42 Tool_Erase | |
43 }; | |
44 | |
45 private: | |
46 class GeometricPrimitive; | |
47 class Handle; | |
48 class Segment; | |
49 class Circle; | |
50 class Arc; | |
51 class Text; | |
52 | |
53 class Annotation; | |
54 class SegmentAnnotation; | |
55 class AngleAnnotation; | |
56 class CircleAnnotation; | |
57 | |
58 class EditPrimitiveTracker; | |
59 class CreateSegmentOrCircleTracker; | |
60 class CreateAngleTracker; | |
61 class EraseTracker; | |
62 | |
63 typedef std::set<GeometricPrimitive*> GeometricPrimitives; | |
64 typedef std::set<Annotation*> Annotations; | |
65 typedef std::set<size_t> SubLayers; | |
66 | |
67 Tool activeTool_; | |
68 size_t macroLayerIndex_; | |
69 size_t polylineSubLayer_; | |
70 GeometricPrimitives primitives_; | |
71 Annotations annotations_; | |
72 SubLayers subLayersToRemove_; | |
73 | |
74 void AddAnnotation(Annotation* annotation); | |
75 | |
76 void DeleteAnnotation(Annotation* annotation); | |
77 | |
78 void DeletePrimitive(GeometricPrimitive* primitive); | |
79 | |
80 void TagSubLayerToRemove(size_t subLayerIndex); | |
81 | |
82 public: | |
83 AnnotationsSceneLayer(size_t macroLayerIndex); | |
84 | |
85 ~AnnotationsSceneLayer() | |
86 { | |
87 Clear(); | |
88 } | |
89 | |
90 void Clear(); | |
91 | |
92 void SetActiveTool(Tool tool) | |
93 { | |
94 activeTool_ = tool; | |
95 } | |
96 | |
97 Tool GetActiveTool() const | |
98 { | |
99 return activeTool_; | |
100 } | |
101 | |
102 void Render(Scene2D& scene); | |
103 | |
104 bool ClearHover(); | |
105 | |
106 bool SetMouseHover(const ScenePoint2D& p /* expressed in canvas coordinates */, | |
107 const Scene2D& scene); | |
108 | |
109 IFlexiblePointerTracker* CreateTracker(const ScenePoint2D& p /* expressed in canvas coordinates */, | |
110 const Scene2D& scene); | |
111 | |
112 void Serialize(Json::Value& target) const; | |
113 | |
114 void Unserialize(const Json::Value& serialized); | |
115 }; | |
116 } |