Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/Internals/MacroLayerRenderer.cpp @ 2025:8ff083f67628
back to mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 05 Dec 2022 08:19:49 +0100 |
parents | 7053b8a0aaec |
children | 07964689cb0b |
rev | line source |
---|---|
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Stone of Orthanc |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1871
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium |
7053b8a0aaec
upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1870
diff
changeset
|
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * This program is free software: you can redistribute it and/or |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * the License, or (at your option) any later version. |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, but |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * License along with this program. If not, see |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "MacroLayerRenderer.h" |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 #include "../MacroSceneLayer.h" |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 namespace OrthancStone |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 namespace Internals |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 void MacroLayerRenderer::Clear() |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 for (size_t i = 0; i < renderers_.size(); i++) |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 assert(renderers_[i] != NULL); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 delete renderers_[i]; |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 renderers_.clear(); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 void MacroLayerRenderer::Render(const AffineTransform2D& transform, |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 unsigned int canvasWidth, |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 unsigned int canvasHeight) |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 for (size_t i = 0; i < renderers_.size(); i++) |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
48 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
49 assert(renderers_[i] != NULL); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
50 renderers_[i]->Render(transform, canvasWidth, canvasHeight); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
54 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
55 void MacroLayerRenderer::Update(const ISceneLayer& layer) |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
56 { |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 const MacroSceneLayer& macro = dynamic_cast<const MacroSceneLayer&>(layer); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 Clear(); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 renderers_.reserve(macro.GetSize()); |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 for (size_t i = 0; i < macro.GetSize(); i++) |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 { |
1797
013dec434a84
creation of segment or circle measures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
65 if (macro.HasLayer(i)) |
013dec434a84
creation of segment or circle measures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
66 { |
013dec434a84
creation of segment or circle measures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
67 renderers_.push_back(factory_.Create(macro.GetLayer(i))); |
013dec434a84
creation of segment or circle measures
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1739
diff
changeset
|
68 } |
1611
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
69 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
70 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
71 } |
787db80a5a1b
new class MacroLayerRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
72 } |