annotate OrthancStone/Sources/Scene2D/Internals/CompositorHelper.h @ 1556:8898f8f755c8

typo
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Aug 2020 11:58:47 +0200
parents 244ad1e4e76a
children 85e117739eca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
1270
2d8ab34c8c91 upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
24 #include "../Scene2D.h"
848
80829436ce0c starting to re-implement radiography editor with latest framework
Alain Mazy <alain@mazy.be>
parents: 841
diff changeset
25 #include "../ScenePoint2D.h"
841
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 602
diff changeset
26 #include <boost/noncopyable.hpp>
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 602
diff changeset
27
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 602
diff changeset
28 #include <map>
266e2b0b9abc better error reporting in DicomStructureSetLoader + fixed POST request logic
Benjamin Golinvaux <bgo@osimis.io>
parents: 602
diff changeset
29
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace OrthancStone
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
32 namespace Internals
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 {
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
34 class CompositorHelper : protected Scene2D::IVisitor
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 public:
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
37 class ILayerRenderer : public boost::noncopyable
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
39 public:
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
40 virtual ~ILayerRenderer()
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
41 {
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
42 }
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
43
888
6e888cf6a48b renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 841
diff changeset
44 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
45 unsigned int canvasWidth,
6e888cf6a48b renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 841
diff changeset
46 unsigned int canvasHeight) = 0;
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
48 // "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
49 virtual void Update(const ISceneLayer& layer) = 0;
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
50 };
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
51
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
52 class IRendererFactory : public boost::noncopyable
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 public:
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
55 virtual ~IRendererFactory()
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 }
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
59 virtual ILayerRenderer* Create(const ISceneLayer& layer) = 0;
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
60 };
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
61
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
62 private:
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
63 class Item;
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 typedef std::map<int, Item*> Content;
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
67 IRendererFactory& factory_;
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
68 Content content_;
1211
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
69 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
70
6e888cf6a48b renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 841
diff changeset
71 // Only valid during a call to Refresh()
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
72 AffineTransform2D sceneTransform_;
888
6e888cf6a48b renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 841
diff changeset
73 unsigned int canvasWidth_;
6e888cf6a48b renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 841
diff changeset
74 unsigned int canvasHeight_;
6e888cf6a48b renderers now have access to canvas width/height
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 841
diff changeset
75
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
76 protected:
1211
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
77 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
78 const ISceneLayer& layer,
602
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
79 uint64_t layerIdentifier,
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
80 int depth);
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
81
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 public:
1211
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
83 CompositorHelper(IRendererFactory& factory) :
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
84 factory_(factory),
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
85 lastScene_(NULL)
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 {
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
89 ~CompositorHelper();
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
1211
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 912
diff changeset
91 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
92 unsigned int canvasWidth,
593
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
93 unsigned int canvasHeight);
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
94 };
6bf8f881fcb5 OpenGLBasicPolylineRenderer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 585
diff changeset
95 }
585
b9ce24c606ae TextSceneLayer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }