Mercurial > hg > orthanc-stone
comparison OrthancStone/Sources/Scene2D/MacroSceneLayer.h @ 1609:5f5c549499ff
new class MacroSceneLayer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Oct 2020 17:01:29 +0100 |
parents | |
children | b7630b1a0253 |
comparison
equal
deleted
inserted
replaced
1608:646e581e115b | 1609:5f5c549499ff |
---|---|
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 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 #pragma once | |
24 | |
25 #include "ISceneLayer.h" | |
26 | |
27 #include <Compatibility.h> // For ORTHANC_OVERRIDE | |
28 | |
29 #include <vector> | |
30 | |
31 namespace OrthancStone | |
32 { | |
33 /** | |
34 * A "macro layer" is a group of sublayers that are handled as a | |
35 * whole. | |
36 **/ | |
37 class MacroSceneLayer : public ISceneLayer | |
38 { | |
39 private: | |
40 std::vector<ISceneLayer*> layers_; | |
41 uint64_t revision_; | |
42 | |
43 protected: | |
44 void BumpRevision() | |
45 { | |
46 // this is *not* thread-safe!!! => (SJO) no problem, Stone assumes mono-threading | |
47 revision_++; | |
48 } | |
49 | |
50 public: | |
51 MacroSceneLayer() : | |
52 revision_(0) | |
53 { | |
54 } | |
55 | |
56 virtual ~MacroSceneLayer() | |
57 { | |
58 Clear(); | |
59 } | |
60 | |
61 void Clear(); | |
62 | |
63 void Reserve(size_t size) | |
64 { | |
65 layers_.reserve(size); | |
66 } | |
67 | |
68 void AddLayer(ISceneLayer* layer); // takes ownership | |
69 | |
70 size_t GetSize() const | |
71 { | |
72 return layers_.size(); | |
73 } | |
74 | |
75 virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; | |
76 | |
77 virtual Type GetType() const ORTHANC_OVERRIDE | |
78 { | |
79 return Type_Macro; | |
80 } | |
81 | |
82 virtual bool GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE; | |
83 | |
84 virtual uint64_t GetRevision() const ORTHANC_OVERRIDE | |
85 { | |
86 return revision_; | |
87 } | |
88 }; | |
89 } |