annotate Framework/Scene2D/Scene2D.h @ 1233:f621b57c9f37 broker

fix warning
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 09 Dec 2019 17:48:14 +0100
parents d10d2acb8a02
children 0ca50d275b9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "ISceneLayer.h"
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../Toolbox/AffineTransform2D.h"
736
c0fcb2757b0a enforce relative includes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 700
diff changeset
26 #include "../Messages/IObservable.h"
c0fcb2757b0a enforce relative includes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 700
diff changeset
27 #include "../Messages/IMessage.h"
654
462a5074f914 Turned the scene into an observable to be able to dynamically react to
Benjamin Golinvaux <bgo@osimis.io>
parents: 632
diff changeset
28
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <map>
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 namespace OrthancStone
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
700
059e1fd05fd6 Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents: 699
diff changeset
33 class Scene2D : public boost::noncopyable
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 public:
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 class IVisitor : public boost::noncopyable
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 public:
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 virtual ~IVisitor()
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 }
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
1211
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 736
diff changeset
43 virtual void Visit(const Scene2D& scene,
d10d2acb8a02 compositors do not keep a reference to the scene anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 736
diff changeset
44 const ISceneLayer& layer,
602
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
45 uint64_t layerIdentifier,
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 int depth) = 0;
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 };
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 private:
602
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
50 class Item;
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
51
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
52 typedef std::map<int, Item*> Content;
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
602
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
54 Content content_;
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 AffineTransform2D sceneToCanvas_;
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 AffineTransform2D canvasToScene_;
602
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
57 uint64_t layerCounter_;
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 Scene2D(const Scene2D& other);
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 public:
700
059e1fd05fd6 Introduced the ViewportController that sits between the application and the
Benjamin Golinvaux <bgo@osimis.io>
parents: 699
diff changeset
62 Scene2D() : layerCounter_(0)
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 }
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ~Scene2D();
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 Scene2D* Clone() const
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return new Scene2D(*this);
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 void SetLayer(int depth,
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 ISceneLayer* layer); // Takes ownership
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
76 /**
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
77 Removes the layer at specified depth and deletes the underlying object
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
78 */
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 void DeleteLayer(int depth);
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
602
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
81 bool HasLayer(int depth) const;
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
82
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
83 ISceneLayer& GetLayer(int depth) const;
03c4b998fcd0 display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 600
diff changeset
84
632
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
85 /**
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
86 Returns the minimum depth among all layers or 0 if there are no layers
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
87 */
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
88 int GetMinDepth() const;
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
89
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
90 /**
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
91 Returns the minimum depth among all layers or 0 if there are no layers
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
92 */
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
93 int GetMaxDepth() const;
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
94
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
95 /**
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
96 Removes the layer at specified depth and transfers the object
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
97 ownership to the caller
500c3f70b6c2 - Added a ClearAllChains method to PolylineSceneLayer --> revision must change
Benjamin Golinvaux <bgo@osimis.io>
parents: 606
diff changeset
98 */
606
d9c0a66304cb Scene2D::ReleaseLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 602
diff changeset
99 ISceneLayer* ReleaseLayer(int depth);
d9c0a66304cb Scene2D::ReleaseLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 602
diff changeset
100
600
6129b1e5ba42 BasicScene SDL sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 582
diff changeset
101 void Apply(IVisitor& visitor) const;
582
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 const AffineTransform2D& GetSceneToCanvasTransform() const
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 return sceneToCanvas_;
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 }
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 const AffineTransform2D& GetCanvasToSceneTransform() const
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 return canvasToScene_;
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 void SetSceneToCanvasTransform(const AffineTransform2D& transform);
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 void FitContent(unsigned int canvasWidth,
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 unsigned int canvasHeight);
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 };
e36e69a380a5 Scene2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 }