Mercurial > hg > orthanc-stone
annotate Framework/Widgets/LayerWidget.h @ 261:58ad26032bd6 am-2
removed unused file
author | am@osimis.io |
---|---|
date | Tue, 17 Jul 2018 14:44:26 +0200 |
parents | 192e6e349e69 |
children | c9cf95b49a86 |
rev | line source |
---|---|
66 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
135
e2fe9352f240
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
121
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
66 | 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 "WorldSceneWidget.h" | |
25 #include "../Layers/ILayerSource.h" | |
111
7665ccbf33db
rename Extent as Extent2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
26 #include "../Toolbox/Extent2D.h" |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
27 #include "../../Framework/Messages/IObserver.h" |
66 | 28 |
29 #include <map> | |
30 | |
31 namespace OrthancStone | |
32 { | |
33 class LayerWidget : | |
34 public WorldSceneWidget, | |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
35 public IObserver |
66 | 36 { |
37 private: | |
38 class Scene; | |
39 | |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
40 typedef std::map<const ILayerSource*, size_t> LayersIndex; |
66 | 41 |
42 bool started_; | |
43 LayersIndex layersIndex_; | |
44 std::vector<ILayerSource*> layers_; | |
45 std::vector<RenderStyle> styles_; | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
46 CoordinateSystem3D slice_; |
66 | 47 std::auto_ptr<Scene> currentScene_; |
48 std::auto_ptr<Scene> pendingScene_; | |
103 | 49 std::vector<bool> changedLayers_; |
66 | 50 |
51 bool LookupLayer(size_t& index /* out */, | |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
52 const ILayerSource& layer) const; |
85 | 53 |
111
7665ccbf33db
rename Extent as Extent2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
54 void GetLayerExtent(Extent2D& extent, |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
55 ILayerSource& source) const; |
77 | 56 |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
57 void OnGeometryReady(const ILayerSource& source); |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
58 |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
59 virtual void OnContentChanged(const ILayerSource& source); |
77 | 60 |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
61 virtual void OnSliceChanged(const ILayerSource& source, |
77 | 62 const Slice& slice); |
63 | |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
64 virtual void OnLayerReady(std::auto_ptr<ILayerRenderer>& renderer, |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
65 const ILayerSource& source, |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
66 const CoordinateSystem3D& slice, |
96
f8bce1bebe01
removal of the NotifyLayerError callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
67 bool isError); |
77 | 68 |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
69 |
103 | 70 void ResetChangedLayers(); |
112
948f86e61e83
start of SliceLocationSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
71 |
948f86e61e83
start of SliceLocationSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
72 public: |
251
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
73 LayerWidget(MessageBroker& broker); |
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
74 |
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
75 virtual void HandleMessage(IObservable& from, const IMessage& message); |
192e6e349e69
first usage of new message system (in SDL only)
am@osimis.io
parents:
219
diff
changeset
|
76 |
111
7665ccbf33db
rename Extent as Extent2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
77 virtual Extent2D GetSceneExtent(); |
66 | 78 |
112
948f86e61e83
start of SliceLocationSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
79 protected: |
66 | 80 virtual bool RenderScene(CairoContext& context, |
81 const ViewportGeometry& view); | |
82 | |
83 void ResetPendingScene(); | |
84 | |
85 void UpdateLayer(size_t index, | |
86 ILayerRenderer* renderer, | |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
87 const CoordinateSystem3D& slice); |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
88 |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
89 void InvalidateAllLayers(); |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
90 |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
91 void InvalidateLayer(size_t layer); |
66 | 92 |
93 public: | |
94 LayerWidget(); | |
95 | |
96 virtual ~LayerWidget(); | |
97 | |
98 size_t AddLayer(ILayerSource* layer); // Takes ownership | |
99 | |
219 | 100 void ReplaceLayer(size_t layerIndex, ILayerSource* layer); // Takes ownership |
101 | |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
102 size_t GetLayerCount() const |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
103 { |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
104 return layers_.size(); |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
105 } |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
106 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
112
diff
changeset
|
107 const RenderStyle& GetLayerStyle(size_t layer) const; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
112
diff
changeset
|
108 |
66 | 109 void SetLayerStyle(size_t layer, |
110 const RenderStyle& style); | |
111 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
112 void SetSlice(const CoordinateSystem3D& slice); |
66 | 113 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
114 const CoordinateSystem3D& GetSlice() const |
85 | 115 { |
116 return slice_; | |
117 } | |
103 | 118 |
119 virtual bool HasUpdateContent() const | |
120 { | |
121 return true; | |
122 } | |
123 | |
124 virtual void UpdateContent(); | |
66 | 125 }; |
126 } |