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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Stone of Orthanc
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #pragma once
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "WorldSceneWidget.h"
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <map>
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 namespace OrthancStone
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 {
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 class LayerWidget :
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 public WorldSceneWidget,
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
34 private ILayerSource::IObserver
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 private:
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 class Scene;
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 86
diff changeset
39 typedef std::map<const ILayerSource*, size_t> LayersIndex;
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 bool started_;
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 LayersIndex layersIndex_;
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 std::vector<ILayerSource*> layers_;
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 std::auto_ptr<Scene> currentScene_;
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 std::auto_ptr<Scene> pendingScene_;
103
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
48 std::vector<bool> changedLayers_;
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
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
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
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
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
61
87
4a541cd4fa83 OrthancVolumeImageLoader
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 86
diff changeset
62 virtual void NotifySliceChange(const ILayerSource& source,
77
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
63 const Slice& slice);
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
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
f5f54ed8d307 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 66
diff changeset
69
103
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
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
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
112
948f86e61e83 start of SliceLocationSource
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 111
diff changeset
75 protected:
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 virtual bool RenderScene(CairoContext& context,
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 const ViewportGeometry& view);
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 void ResetPendingScene();
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 void UpdateLayer(size_t index,
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 public:
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 LayerWidget();
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 virtual ~LayerWidget();
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 size_t AddLayer(ILayerSource* layer); // Takes ownership
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 void SetLayerStyle(size_t layer,
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 const RenderStyle& style);
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 109
diff changeset
106 void SetSlice(const CoordinateSystem3D& slice);
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
110
53025eecbc95 renamed SliceGeometry as CoordinateSystem3D
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 109
diff changeset
108 const CoordinateSystem3D& GetSlice() const
85
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
109 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
110 return slice_;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 78
diff changeset
111 }
103
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
112
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
113 virtual bool HasUpdateContent() const
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
114 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
115 return true;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
116 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
117
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 97
diff changeset
118 virtual void UpdateContent();
66
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 };
298f375dcb68 LayerWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 }