Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2DViewport/LayerHolder.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/LayerHolder.h@2a11bbf7f6b0 |
children | 8563ea5d8ae4 |
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 "PredeclaredTypes.h" | |
24 | |
25 #include <boost/noncopyable.hpp> | |
26 #include <boost/weak_ptr.hpp> | |
27 #include <boost/shared_ptr.hpp> | |
28 | |
29 namespace OrthancStone | |
30 { | |
31 class PolylineSceneLayer; | |
32 class TextSceneLayer; | |
33 | |
34 /** | |
35 This class holds the indices of a set a layer and supplies | |
36 getters to the concrete layer objects. Sounds very ad hoc, and it is. | |
37 */ | |
38 class LayerHolder : public boost::noncopyable | |
39 { | |
40 public: | |
41 /** | |
42 This ctor merely stores the scene and layer counts. No layer creation | |
43 performed at this time | |
44 */ | |
45 LayerHolder( | |
46 boost::shared_ptr<IViewport> viewport, | |
47 int polylineLayerCount, int textLayerCount, int infoTextCount = 0); | |
48 | |
49 /** | |
50 This actually creates the layers | |
51 */ | |
52 void CreateLayers(); | |
53 | |
54 /** | |
55 This creates the layers if they are not created yet. Can be useful in | |
56 some scenarios | |
57 */ | |
58 void CreateLayersIfNeeded(); | |
59 | |
60 /** | |
61 Whether the various text and polylines layers have all been created or | |
62 none at all | |
63 */ | |
64 bool AreLayersCreated() const; | |
65 | |
66 /** | |
67 This removes the layers from the scene | |
68 */ | |
69 void DeleteLayers(); | |
70 | |
71 /** | |
72 This removes the layers from the scene if they are already created | |
73 */ | |
74 void DeleteLayersIfNeeded(); | |
75 | |
76 /** | |
77 Please note that the returned pointer belongs to the scene.Don't you dare | |
78 storing or deleting it, you fool! | |
79 | |
80 This throws if the index is not valid or if the layers are not created or | |
81 have been deleted | |
82 */ | |
83 PolylineSceneLayer* GetPolylineLayer(int index = 0); | |
84 | |
85 /** | |
86 Please note that the returned pointer belongs to the scene. Don't you dare | |
87 storing or deleting it, you fool! | |
88 | |
89 This throws if the index is not valid or if the layers are not created or | |
90 have been deleted | |
91 */ | |
92 TextSceneLayer* GetTextLayer(int index = 0); | |
93 | |
94 //TextSceneLayer* GetTextLayer(int index = 0); | |
95 | |
96 private: | |
97 int GetPolylineLayerIndex(int index = 0); | |
98 int GetTextLayerIndex(int index = 0); | |
99 int GetInfoTextLayerIndex(int index = 0); | |
100 | |
101 int textLayerCount_; | |
102 int polylineLayerCount_; | |
103 int infoTextCount_; | |
104 boost::shared_ptr<IViewport> viewport_; | |
105 int baseLayerIndex_; | |
106 }; | |
107 } | |
108 |