Mercurial > hg > orthanc-stone
annotate Framework/Widgets/LayerWidget.h @ 166:4f661e2f7b6c wasm
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 22 Feb 2018 19:36:23 +0100 |
parents | e2fe9352f240 |
children | 26e3bfe30e66 |
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" |
66 | 27 |
28 #include <map> | |
29 | |
30 namespace OrthancStone | |
31 { | |
32 class LayerWidget : | |
33 public WorldSceneWidget, | |
77 | 34 private ILayerSource::IObserver |
66 | 35 { |
36 private: | |
37 class Scene; | |
38 | |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
39 typedef std::map<const ILayerSource*, size_t> LayersIndex; |
66 | 40 |
41 bool started_; | |
42 LayersIndex layersIndex_; | |
43 std::vector<ILayerSource*> layers_; | |
44 std::vector<RenderStyle> styles_; | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
45 CoordinateSystem3D slice_; |
66 | 46 std::auto_ptr<Scene> currentScene_; |
47 std::auto_ptr<Scene> pendingScene_; | |
103 | 48 std::vector<bool> changedLayers_; |
66 | 49 |
50 bool LookupLayer(size_t& index /* out */, | |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
51 const ILayerSource& layer) const; |
85 | 52 |
111
7665ccbf33db
rename Extent as Extent2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
53 void GetLayerExtent(Extent2D& extent, |
97
d18dcc963930
separation of the renderers vs. viewport slice
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
96
diff
changeset
|
54 ILayerSource& source) const; |
77 | 55 |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
56 virtual void NotifyGeometryReady(const ILayerSource& source); |
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
57 |
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
58 virtual void NotifyGeometryError(const ILayerSource& source); |
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
59 |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
60 virtual void NotifyContentChange(const ILayerSource& source); |
77 | 61 |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
62 virtual void NotifySliceChange(const ILayerSource& source, |
77 | 63 const Slice& slice); |
64 | |
90
64e60018943f
fix and observer refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
89
diff
changeset
|
65 virtual void NotifyLayerReady(std::auto_ptr<ILayerRenderer>& renderer, |
87
4a541cd4fa83
OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
86
diff
changeset
|
66 const ILayerSource& source, |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
67 const CoordinateSystem3D& slice, |
96
f8bce1bebe01
removal of the NotifyLayerError callback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
90
diff
changeset
|
68 bool isError); |
77 | 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: |
111
7665ccbf33db
rename Extent as Extent2D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
110
diff
changeset
|
73 virtual Extent2D GetSceneExtent(); |
66 | 74 |
112
948f86e61e83
start of SliceLocationSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
75 protected: |
66 | 76 virtual bool RenderScene(CairoContext& context, |
77 const ViewportGeometry& view); | |
78 | |
79 void ResetPendingScene(); | |
80 | |
81 void UpdateLayer(size_t index, | |
82 ILayerRenderer* renderer, | |
121
e66b2c757790
displaying rt-struct
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
119
diff
changeset
|
83 const CoordinateSystem3D& slice); |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
84 |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
85 void InvalidateAllLayers(); |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
86 |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
87 void InvalidateLayer(size_t layer); |
66 | 88 |
89 public: | |
90 LayerWidget(); | |
91 | |
92 virtual ~LayerWidget(); | |
93 | |
94 size_t AddLayer(ILayerSource* layer); // Takes ownership | |
95 | |
89
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
96 size_t GetLayerCount() const |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
97 { |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
98 return layers_.size(); |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
99 } |
f244018a4e4b
BUGGY- trying to remove IVolumeSlicesObserver
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
87
diff
changeset
|
100 |
119
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
112
diff
changeset
|
101 const RenderStyle& GetLayerStyle(size_t layer) const; |
ba83e38cf3ff
rendering of rt-dose
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
112
diff
changeset
|
102 |
66 | 103 void SetLayerStyle(size_t layer, |
104 const RenderStyle& style); | |
105 | |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
106 void SetSlice(const CoordinateSystem3D& slice); |
66 | 107 |
110
53025eecbc95
renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
109
diff
changeset
|
108 const CoordinateSystem3D& GetSlice() const |
85 | 109 { |
110 return slice_; | |
111 } | |
103 | 112 |
113 virtual bool HasUpdateContent() const | |
114 { | |
115 return true; | |
116 } | |
117 | |
118 virtual void UpdateContent(); | |
66 | 119 }; |
120 } |