Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Scene2D/Internals/CompositorHelper.h @ 1814:53f3411bf94b
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 25 May 2021 15:52:38 +0200 |
parents | 9ac2a65d4172 |
children | 3889ae96d2e9 |
rev | line source |
---|---|
585 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1739
9ac2a65d4172
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1598
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
585 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
585 | 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 | |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
15 * Lesser General Public License for more details. |
1596
4fb8fdf03314
removed annoying whitespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1571
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
18 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1596
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
585 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
25 #include "../Scene2D.h" |
848
80829436ce0c
starting to re-implement radiography editor with latest framework
Alain Mazy <alain@mazy.be>
parents:
841
diff
changeset
|
26 #include "../ScenePoint2D.h" |
1571 | 27 |
28 #include <Compatibility.h> // For ORTHANC_OVERRIDE | |
29 | |
841
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
602
diff
changeset
|
30 #include <boost/noncopyable.hpp> |
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
602
diff
changeset
|
31 #include <map> |
266e2b0b9abc
better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents:
602
diff
changeset
|
32 |
585 | 33 namespace OrthancStone |
34 { | |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
35 namespace Internals |
585 | 36 { |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
37 class CompositorHelper : protected Scene2D::IVisitor |
585 | 38 { |
39 public: | |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
40 class ILayerRenderer : public boost::noncopyable |
585 | 41 { |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
42 public: |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
43 virtual ~ILayerRenderer() |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
44 { |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
45 } |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
46 |
888
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
47 virtual void Render(const AffineTransform2D& transform, |
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
48 unsigned int canvasWidth, |
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
49 unsigned int canvasHeight) = 0; |
585 | 50 |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
51 // "Update()" is only called if the type of the layer has not changed |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
52 virtual void Update(const ISceneLayer& layer) = 0; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
53 }; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
54 |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
55 class IRendererFactory : public boost::noncopyable |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
56 { |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
57 public: |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
58 virtual ~IRendererFactory() |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
59 { |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
60 } |
585 | 61 |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
62 virtual ILayerRenderer* Create(const ISceneLayer& layer) = 0; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
63 }; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
64 |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
65 private: |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
66 class Item; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
67 |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
68 typedef std::map<int, Item*> Content; |
585 | 69 |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
70 IRendererFactory& factory_; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
71 Content content_; |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
72 const Scene2D* lastScene_; // This is only a safeguard, don't use it! |
888
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
73 |
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
74 // Only valid during a call to Refresh() |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
75 AffineTransform2D sceneTransform_; |
888
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
76 unsigned int canvasWidth_; |
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
77 unsigned int canvasHeight_; |
6e888cf6a48b
renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
841
diff
changeset
|
78 |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
79 protected: |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
80 virtual void Visit(const Scene2D& scene, |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
81 const ISceneLayer& layer, |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
82 uint64_t layerIdentifier, |
1571 | 83 int depth) ORTHANC_OVERRIDE; |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
84 |
585 | 85 public: |
1571 | 86 explicit CompositorHelper(IRendererFactory& factory) : |
87 factory_(factory), | |
88 lastScene_(NULL), | |
89 canvasWidth_(0), | |
90 canvasHeight_(0) | |
585 | 91 { |
92 } | |
93 | |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
94 ~CompositorHelper(); |
585 | 95 |
1211
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
96 void Refresh(const Scene2D& scene, |
d10d2acb8a02
compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
912
diff
changeset
|
97 unsigned int canvasWidth, |
593
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
98 unsigned int canvasHeight); |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
99 }; |
6bf8f881fcb5
OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
585
diff
changeset
|
100 } |
585 | 101 } |