Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/MacroSceneLayer.h @ 1793:c5e6379b9cd0
fix build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 17 May 2021 17:23:54 +0200 |
parents | 9b650ab68d4c |
children | 20a0aba0ede5 |
rev | line source |
---|---|
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1611
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * License along with this program. If not, see |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #pragma once |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "ISceneLayer.h" |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include <Compatibility.h> // For ORTHANC_OVERRIDE |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
1793 | 29 #include <deque> |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 namespace OrthancStone |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 /** |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 * A "macro layer" is a group of sublayers that are handled as a |
1791
9b650ab68d4c
replaced unneeded use of boost::share_ptr for MeasureCommand mementos by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
35 * whole, and that share the same depth in the scene. |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 **/ |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 class MacroSceneLayer : public ISceneLayer |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 private: |
1793 | 40 // A deque is used because we need to quickly add new layers, and |
41 // to randomly access the layers | |
42 std::deque<ISceneLayer*> layers_; | |
43 uint64_t revision_; | |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 protected: |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 void BumpRevision() |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 // this is *not* thread-safe!!! => (SJO) no problem, Stone assumes mono-threading |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 revision_++; |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 } |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 public: |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 MacroSceneLayer() : |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 revision_(0) |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 } |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 virtual ~MacroSceneLayer() |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 Clear(); |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 } |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 void Clear(); |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
1793 | 65 size_t AddLayer(ISceneLayer* layer); // takes ownership |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 size_t GetSize() const |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 return layers_.size(); |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 } |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1610
diff
changeset
|
72 const ISceneLayer& GetLayer(size_t i) const; |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1610
diff
changeset
|
73 |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
74 virtual ISceneLayer* Clone() const ORTHANC_OVERRIDE; |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
75 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 virtual Type GetType() const ORTHANC_OVERRIDE |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
77 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
78 return Type_Macro; |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
79 } |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 |
1610
b7630b1a0253
ISceneLayer::GetBoundingBox() returns void
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1609
diff
changeset
|
81 virtual void GetBoundingBox(Extent2D& target) const ORTHANC_OVERRIDE; |
1609
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
82 |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 virtual uint64_t GetRevision() const ORTHANC_OVERRIDE |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 { |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 return revision_; |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 } |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 }; |
5f5c549499ff
new class MacroSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 } |