Mercurial > hg > orthanc-stone
annotate Framework/Scene2D/Scene2D.h @ 608:357e744c56cc
Removed MSVC specific code (option already available thru Orthanc cmake)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 30 Apr 2019 07:54:01 +0200 |
parents | d9c0a66304cb |
children | 500c3f70b6c2 |
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" | |
26 | |
27 #include <map> | |
28 | |
29 namespace OrthancStone | |
30 { | |
31 class Scene2D : public boost::noncopyable | |
32 { | |
33 public: | |
34 class IVisitor : public boost::noncopyable | |
35 { | |
36 public: | |
37 virtual ~IVisitor() | |
38 { | |
39 } | |
40 | |
41 virtual void Visit(const ISceneLayer& layer, | |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
42 uint64_t layerIdentifier, |
582 | 43 int depth) = 0; |
44 }; | |
45 | |
46 private: | |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
47 class Item; |
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
48 |
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
49 typedef std::map<int, Item*> Content; |
582 | 50 |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
51 Content content_; |
582 | 52 AffineTransform2D sceneToCanvas_; |
53 AffineTransform2D canvasToScene_; | |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
54 uint64_t layerCounter_; |
582 | 55 |
56 Scene2D(const Scene2D& other); | |
57 | |
58 public: | |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
59 Scene2D() : |
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
60 layerCounter_(0) |
582 | 61 { |
62 } | |
63 | |
64 ~Scene2D(); | |
65 | |
66 Scene2D* Clone() const | |
67 { | |
68 return new Scene2D(*this); | |
69 } | |
70 | |
71 void SetLayer(int depth, | |
72 ISceneLayer* layer); // Takes ownership | |
73 | |
74 void DeleteLayer(int depth); | |
75 | |
602
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
76 bool HasLayer(int depth) const; |
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
77 |
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
78 ISceneLayer& GetLayer(int depth) const; |
03c4b998fcd0
display scene positions in the basic sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
600
diff
changeset
|
79 |
606
d9c0a66304cb
Scene2D::ReleaseLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
602
diff
changeset
|
80 ISceneLayer* ReleaseLayer(int depth); |
d9c0a66304cb
Scene2D::ReleaseLayer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
602
diff
changeset
|
81 |
600
6129b1e5ba42
BasicScene SDL sample
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
582
diff
changeset
|
82 void Apply(IVisitor& visitor) const; |
582 | 83 |
84 const AffineTransform2D& GetSceneToCanvasTransform() const | |
85 { | |
86 return sceneToCanvas_; | |
87 } | |
88 | |
89 const AffineTransform2D& GetCanvasToSceneTransform() const | |
90 { | |
91 return canvasToScene_; | |
92 } | |
93 | |
94 void SetSceneToCanvasTransform(const AffineTransform2D& transform); | |
95 | |
96 void FitContent(unsigned int canvasWidth, | |
97 unsigned int canvasHeight); | |
98 }; | |
99 } |