Mercurial > hg > orthanc-stone
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 |
rev | line source |
---|---|
582 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium | |
6 * | |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
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 | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "ISceneLayer.h" | |
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 | 29 #include <map> |
30 | |
31 namespace OrthancStone | |
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 | 34 { |
35 public: | |
36 class IVisitor : public boost::noncopyable | |
37 { | |
38 public: | |
39 virtual ~IVisitor() | |
40 { | |
41 } | |
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 | 46 int depth) = 0; |
47 }; | |
48 | |
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 | 53 |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
54 Content content_; |
582 | 55 AffineTransform2D sceneToCanvas_; |
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 | 58 |
59 Scene2D(const Scene2D& other); | |
60 | |
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 | 63 { |
64 } | |
65 | |
66 ~Scene2D(); | |
67 | |
68 Scene2D* Clone() const | |
69 { | |
70 return new Scene2D(*this); | |
71 } | |
72 | |
73 void SetLayer(int depth, | |
74 ISceneLayer* layer); // Takes ownership | |
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 | 79 void DeleteLayer(int depth); |
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 | 102 |
103 const AffineTransform2D& GetSceneToCanvasTransform() const | |
104 { | |
105 return sceneToCanvas_; | |
106 } | |
107 | |
108 const AffineTransform2D& GetCanvasToSceneTransform() const | |
109 { | |
110 return canvasToScene_; | |
111 } | |
112 | |
113 void SetSceneToCanvasTransform(const AffineTransform2D& transform); | |
114 | |
115 void FitContent(unsigned int canvasWidth, | |
116 unsigned int canvasHeight); | |
117 }; | |
118 } |