annotate Applications/Samples/SimpleViewerApplication.h @ 279:8f5d7495076d am-2

SimpleViewer sample working in SDL, Qt and WASM
author am@osimis.io
date Mon, 27 Aug 2018 15:40:13 +0200
parents dc1beee33134
children 300d8b8c48b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
1 /**
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
6 *
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
11 *
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
16 *
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
19 **/
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
20
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
21
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
22 #pragma once
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
23
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
24 #include "SampleApplicationBase.h"
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
25
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
26 #include "../../Framework/Layers/OrthancFrameLayerSource.h"
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
27 #include "../../Framework/Widgets/LayerWidget.h"
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
28 #include "../../Framework/Widgets/LayoutWidget.h"
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 249
diff changeset
29 #include "../../Framework/Messages/IObserver.h"
258
e5a9b3d03478 first very basic version of SmartLoader
am@osimis.io
parents: 257
diff changeset
30 #include "../../Framework/SmartLoader.h"
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
31
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
32 #include <Core/Logging.h>
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
33
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
34 namespace OrthancStone
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
35 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
36 namespace Samples
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
37 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
38 class SimpleViewerApplication :
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
39 public SampleApplicationBase,
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 249
diff changeset
40 public IObserver
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
41 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
42 private:
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
43 class ThumbnailInteractor : public IWorldSceneInteractor
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
44 {
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
45 private:
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
46 SimpleViewerApplication& application_;
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
47 public:
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
48 ThumbnailInteractor(SimpleViewerApplication& application) :
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
49 application_(application)
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
50 {
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
51 }
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
52
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
53 virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& widget,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
54 const ViewportGeometry& view,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
55 MouseButton button,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
56 double x,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
57 double y,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
58 IStatusBar* statusBar)
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
59 {
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
60 if (button == MouseButton_Left)
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
61 {
279
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
62 statusBar->SetMessage("selected thumbnail " + widget.GetName());
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
63 std::string seriesId = widget.GetName().substr(strlen("thumbnail-series-"));
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
64 application_.SelectSeriesInMainViewport(seriesId);
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
65 }
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
66 return NULL;
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
67 }
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
68 virtual void MouseOver(CairoContext& context,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
69 WorldSceneWidget& widget,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
70 const ViewportGeometry& view,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
71 double x,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
72 double y,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
73 IStatusBar* statusBar)
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
74 {}
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
75
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
76 virtual void MouseWheel(WorldSceneWidget& widget,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
77 MouseWheelDirection direction,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
78 KeyboardModifiers modifiers,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
79 IStatusBar* statusBar)
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
80 {}
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
81
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
82 virtual void KeyPressed(WorldSceneWidget& widget,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
83 char key,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
84 KeyboardModifiers modifiers,
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
85 IStatusBar* statusBar)
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
86 {};
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
87
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
88 };
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
89
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
90 class Interactor : public IWorldSceneInteractor
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
91 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
92 private:
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
93 SimpleViewerApplication& application_;
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
94
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
95 public:
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
96 Interactor(SimpleViewerApplication& application) :
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
97 application_(application)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
98 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
99 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
100
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
101 virtual IWorldSceneMouseTracker* CreateMouseTracker(WorldSceneWidget& widget,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
102 const ViewportGeometry& view,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
103 MouseButton button,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
104 double x,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
105 double y,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
106 IStatusBar* statusBar)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
107 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
108 return NULL;
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
109 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
110
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
111 virtual void MouseOver(CairoContext& context,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
112 WorldSceneWidget& widget,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
113 const ViewportGeometry& view,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
114 double x,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
115 double y,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
116 IStatusBar* statusBar)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
117 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
118 if (statusBar != NULL)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
119 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
120 Vector p = dynamic_cast<LayerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y);
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
121
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
122 char buf[64];
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
123 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)",
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
124 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0);
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
125 statusBar->SetMessage(buf);
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
126 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
127 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
128
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
129 virtual void MouseWheel(WorldSceneWidget& widget,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
130 MouseWheelDirection direction,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
131 KeyboardModifiers modifiers,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
132 IStatusBar* statusBar)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
133 {
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
134 // int scale = (modifiers & KeyboardModifiers_Control ? 10 : 1);
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
135
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
136 // switch (direction)
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
137 // {
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
138 // case MouseWheelDirection_Up:
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
139 // application_.OffsetSlice(-scale);
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
140 // break;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
141
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
142 // case MouseWheelDirection_Down:
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
143 // application_.OffsetSlice(scale);
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
144 // break;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
145
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
146 // default:
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
147 // break;
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
148 // }
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
149 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
150
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
151 virtual void KeyPressed(WorldSceneWidget& widget,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
152 char key,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
153 KeyboardModifiers modifiers,
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
154 IStatusBar* statusBar)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
155 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
156 switch (key)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
157 {
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
158 case 's':
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
159 widget.SetDefaultView();
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
160 break;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
161
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
162 default:
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
163 break;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
164 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
165 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
166 };
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
167
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
168
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
169 std::unique_ptr<Interactor> interactor_;
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
170 std::unique_ptr<ThumbnailInteractor> thumbnailInteractor_;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
171 LayoutWidget* mainLayout_;
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
172 LayoutWidget* thumbnailsLayout_;
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
173 LayerWidget* mainWidget_;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
174 std::vector<LayerWidget*> thumbnails_;
279
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
175 std::map<std::string, std::vector<std::string>> instancesIdsPerSeriesId_;
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
176
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
177 unsigned int currentInstanceIndex_;
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
178 OrthancStone::WidgetViewport* wasmViewport1_;
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
179 OrthancStone::WidgetViewport* wasmViewport2_;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
180
254
abc1c6231947 cleanup
am@osimis.io
parents: 253
diff changeset
181 IStatusBar* statusBar_;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
182 unsigned int slice_;
258
e5a9b3d03478 first very basic version of SmartLoader
am@osimis.io
parents: 257
diff changeset
183 std::unique_ptr<SmartLoader> smartLoader_;
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
184 std::unique_ptr<OrthancApiClient> orthancApiClient_;
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 249
diff changeset
185
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
186 public:
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 249
diff changeset
187 SimpleViewerApplication(MessageBroker& broker) :
258
e5a9b3d03478 first very basic version of SmartLoader
am@osimis.io
parents: 257
diff changeset
188 IObserver(broker),
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
189 mainLayout_(NULL),
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
190 currentInstanceIndex_(0),
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
191 wasmViewport1_(NULL),
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 249
diff changeset
192 wasmViewport2_(NULL),
258
e5a9b3d03478 first very basic version of SmartLoader
am@osimis.io
parents: 257
diff changeset
193 slice_(0)
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
194 {
267
89d02de83c03 added declaretion of messages handled/emitted
am@osimis.io
parents: 266
diff changeset
195 DeclareIgnoredMessage(MessageType_Widget_ContentChanged);
89d02de83c03 added declaretion of messages handled/emitted
am@osimis.io
parents: 266
diff changeset
196 DeclareHandledMessage(MessageType_Widget_GeometryChanged);
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
197
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
198 DeclareHandledMessage(MessageType_OrthancApi_GetStudyIds_Ready);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
199 DeclareHandledMessage(MessageType_OrthancApi_GetStudy_Ready);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
200 DeclareHandledMessage(MessageType_OrthancApi_GetSeries_Ready);
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
201 }
251
192e6e349e69 first usage of new message system (in SDL only)
am@osimis.io
parents: 249
diff changeset
202
237
b4642964c355 SimpleViewer demo running both with SDL and Wasm
am@osimis.io
parents: 235
diff changeset
203 virtual void Finalize() {}
b4642964c355 SimpleViewer demo running both with SDL and Wasm
am@osimis.io
parents: 235
diff changeset
204 virtual IWidget* GetCentralWidget() {return mainLayout_;}
b4642964c355 SimpleViewer demo running both with SDL and Wasm
am@osimis.io
parents: 235
diff changeset
205
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
206 virtual void DeclareStartupOptions(boost::program_options::options_description& options)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
207 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
208 boost::program_options::options_description generic("Sample options");
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
209 generic.add_options()
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
210 ("studyId", boost::program_options::value<std::string>(),
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
211 "Orthanc ID of the study")
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
212 ;
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
213
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
214 options.add(generic);
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
215 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
216
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
217 virtual void Initialize(BasicApplicationContext* context,
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
218 IStatusBar& statusBar,
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
219 const boost::program_options::variables_map& parameters)
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
220 {
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
221 using namespace OrthancStone;
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
222
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
223 context_ = context;
254
abc1c6231947 cleanup
am@osimis.io
parents: 253
diff changeset
224 statusBar_ = &statusBar;
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
225
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
226 {// initialize viewports and layout
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
227 mainLayout_ = new LayoutWidget("main-layout");
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
228 mainLayout_->SetPadding(10);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
229 mainLayout_->SetBackgroundCleared(true);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
230 mainLayout_->SetBackgroundColor(0, 0, 0);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
231 mainLayout_->SetHorizontal();
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
232
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
233 thumbnailsLayout_ = new LayoutWidget("thumbnail-layout");
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
234 thumbnailsLayout_->SetPadding(10);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
235 thumbnailsLayout_->SetBackgroundCleared(true);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
236 thumbnailsLayout_->SetBackgroundColor(50, 50, 50);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
237 thumbnailsLayout_->SetVertical();
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
238
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
239 mainWidget_ = new LayerWidget(broker_, "main-viewport");
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
240 mainWidget_->RegisterObserver(*this);
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
241
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
242 // hierarchy
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
243 mainLayout_->AddWidget(thumbnailsLayout_);
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
244 mainLayout_->AddWidget(mainWidget_);
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
245
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
246 // sources
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
247 smartLoader_.reset(new SmartLoader(broker_, context_->GetWebService()));
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
248 smartLoader_->SetImageQuality(SliceImageQuality_FullPam);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
249
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
250 mainLayout_->SetTransmitMouseOver(true);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
251 interactor_.reset(new Interactor(*this));
273
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
252 mainWidget_->SetInteractor(*interactor_);
f21ba2468570 force all Widgets to have a name to ease debugging
am@osimis.io
parents: 271
diff changeset
253 thumbnailInteractor_.reset(new ThumbnailInteractor(*this));
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
254 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
255
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
256 statusBar.SetMessage("Use the key \"s\" to reinitialize the layout");
254
abc1c6231947 cleanup
am@osimis.io
parents: 253
diff changeset
257 statusBar.SetMessage("Use the key \"n\" to go to next image in the main viewport");
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
258
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
259 orthancApiClient_.reset(new OrthancApiClient(broker_, context_->GetWebService()));
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
260
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
261 if (parameters.count("studyId") < 1)
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
262 {
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
263 LOG(WARNING) << "The study ID is missing, will take the first studyId found in Orthanc";
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
264 orthancApiClient_->ScheduleGetStudyIds(*this);
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
265 }
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
266 else
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
267 {
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
268 SelectStudy(parameters["studyId"].as<std::string>());
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
269 }
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
270 }
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
271
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
272 void OnStudyListReceived(const Json::Value& response)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
273 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
274 if (response.isArray() && response.size() > 1)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
275 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
276 SelectStudy(response[0].asString());
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
277 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
278 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
279 void OnStudyReceived(const Json::Value& response)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
280 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
281 if (response.isObject() && response["Series"].isArray())
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
282 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
283 for (size_t i=0; i < response["Series"].size(); i++)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
284 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
285 orthancApiClient_->ScheduleGetSeries(*this, response["Series"][(int)i].asString());
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
286 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
287 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
288 }
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
289
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
290 void OnSeriesReceived(const Json::Value& response)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
291 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
292 if (response.isObject() && response["Instances"].isArray() && response["Instances"].size() > 0)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
293 {
279
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
294 // keep track of all instances IDs
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
295 const std::string& seriesId = response["ID"].asString();
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
296 instancesIdsPerSeriesId_[seriesId] = std::vector<std::string>();
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
297 for (size_t i = 0; i < response["Instances"].size(); i++)
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
298 {
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
299 const std::string& instanceId = response["Instances"][static_cast<int>(i)].asString();
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
300 instancesIdsPerSeriesId_[seriesId].push_back(instanceId);
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
301 }
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
302
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
303 // load the first instance in the thumbnail
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
304 LoadThumbnailForSeries(seriesId, instancesIdsPerSeriesId_[seriesId][0]);
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
305
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
306 // if this is the first thumbnail loaded, load the first instance in the mainWidget
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
307 if (mainWidget_->GetLayerCount() == 0)
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
308 {
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
309 mainWidget_->AddLayer(smartLoader_->GetFrame(instancesIdsPerSeriesId_[seriesId][0], 0));
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
310 }
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
311 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
312 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
313
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
314 void LoadThumbnailForSeries(const std::string& seriesId, const std::string& instanceId)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
315 {
271
46c5296d867e OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents: 270
diff changeset
316 LOG(INFO) << "Loading thumbnail for series " << seriesId;
46c5296d867e OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents: 270
diff changeset
317 LayerWidget* thumbnailWidget = new LayerWidget(broker_, "thumbnail-series-" + seriesId);
46c5296d867e OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents: 270
diff changeset
318 thumbnails_.push_back(thumbnailWidget);
46c5296d867e OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents: 270
diff changeset
319 thumbnailsLayout_->AddWidget(thumbnailWidget);
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
320 thumbnailWidget->RegisterObserver(*this);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
321 thumbnailWidget->AddLayer(smartLoader_->GetFrame(instanceId, 0));
279
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
322 thumbnailWidget->SetInteractor(*thumbnailInteractor_);
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
323 }
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
324
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
325 void SelectStudy(const std::string& studyId)
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
326 {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
327 orthancApiClient_->ScheduleGetStudy(*this, studyId);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
328 }
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
329
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
330 virtual void HandleMessage(IObservable& from, const IMessage& message) {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
331 switch (message.GetType()) {
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
332 case MessageType_Widget_GeometryChanged:
271
46c5296d867e OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents: 270
diff changeset
333 LOG(INFO) << "Widget geometry ready: " << dynamic_cast<LayerWidget&>(from).GetName();
270
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
334 dynamic_cast<LayerWidget&>(from).SetDefaultView();
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
335 break;
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
336 case MessageType_OrthancApi_GetStudyIds_Ready:
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
337 OnStudyListReceived(dynamic_cast<const OrthancApiClient::GetJsonResponseReadyMessage&>(message).response_);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
338 break;
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
339 case MessageType_OrthancApi_GetSeries_Ready:
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
340 OnSeriesReceived(dynamic_cast<const OrthancApiClient::GetJsonResponseReadyMessage&>(message).response_);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
341 break;
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
342 case MessageType_OrthancApi_GetStudy_Ready:
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
343 OnStudyReceived(dynamic_cast<const OrthancApiClient::GetJsonResponseReadyMessage&>(message).response_);
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
344 break;
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
345 default:
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
346 VLOG("unhandled message type" << message.GetType());
2d64f4d39610 backup (work in progress)
am@osimis.io
parents: 268
diff changeset
347 }
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
348 }
237
b4642964c355 SimpleViewer demo running both with SDL and Wasm
am@osimis.io
parents: 235
diff changeset
349
274
dc1beee33134 split SdlApplication into NativeApplication and SdlApplication
am@osimis.io
parents: 273
diff changeset
350 #if ORTHANC_ENABLE_WASM==1
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
351 virtual void InitializeWasm() {
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
352
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
353 AttachWidgetToWasmViewport("canvas", thumbnailsLayout_);
274
dc1beee33134 split SdlApplication into NativeApplication and SdlApplication
am@osimis.io
parents: 273
diff changeset
354 AttachWidgetToWasmViewport("canvas2", mainWidget_);
242
092db46c6291 improved SDL/Wasm unification
am@osimis.io
parents: 237
diff changeset
355 }
237
b4642964c355 SimpleViewer demo running both with SDL and Wasm
am@osimis.io
parents: 235
diff changeset
356 #endif
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
357
279
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
358 void SelectSeriesInMainViewport(const std::string& seriesId)
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
359 {
8f5d7495076d SimpleViewer sample working in SDL, Qt and WASM
am@osimis.io
parents: 274
diff changeset
360 mainWidget_->ReplaceLayer(0, smartLoader_->GetFrame(instancesIdsPerSeriesId_[seriesId][0], 0));
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
361 }
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
362 };
249
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
363
54c7284b0eff merged useful changes from branch am
am@osimis.io
parents: 245
diff changeset
364
235
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
365 }
ce4405d98b92 Added SimpleViewerApplication (working in SDL)
am@osimis.io
parents:
diff changeset
366 }