Mercurial > hg > orthanc-stone
annotate Applications/Samples/SampleApplicationBase.h @ 436:04711a2e12cd am-vsol-upgrade
fix crop + export photometric interpretation correctly
author | am@osimis.io |
---|---|
date | Thu, 06 Dec 2018 11:53:37 +0100 |
parents | c7fdc8bac581 |
children | b70e9be013e4 |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
134
4cff7b1ed31d
upgrade to year 2018
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 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. | |
0 | 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 | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
295
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
16 * |
47 | 17 * You should have received a copy of the GNU Affero General Public License |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
288 | 24 #include "../../Applications/IStoneApplication.h" |
336
c7fdc8bac581
creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
25 #include "../../Framework/Widgets/WorldSceneWidget.h" |
326 | 26 |
27 #if ORTHANC_ENABLE_WASM==1 | |
28 #include "../../Platforms/Wasm/WasmPlatformApplicationAdapter.h" | |
29 #include "../../Platforms/Wasm/Defaults.h" | |
30 #endif | |
31 | |
32 #if ORTHANC_ENABLE_QT==1 | |
33 #include "Qt/SampleMainWindow.h" | |
34 #include "Qt/SampleMainWindowWithButtons.h" | |
35 #endif | |
0 | 36 |
37 namespace OrthancStone | |
38 { | |
39 namespace Samples | |
40 { | |
288 | 41 class SampleApplicationBase : public IStoneApplication |
0 | 42 { |
307 | 43 protected: |
44 BaseCommandBuilder commandBuilder_; | |
336
c7fdc8bac581
creating GrayscaleBitmapStack
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
326
diff
changeset
|
45 WorldSceneWidget* mainWidget_; // ownership is transfered to the application context |
326 | 46 |
0 | 47 public: |
288 | 48 virtual void Initialize(StoneApplicationContext* context, |
285
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
49 IStatusBar& statusBar, |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
50 const boost::program_options::variables_map& parameters) |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
51 { |
295
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
52 } |
285
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
53 |
0 | 54 virtual std::string GetTitle() const |
55 { | |
56 return "Stone of Orthanc - Sample"; | |
57 } | |
242 | 58 |
326 | 59 virtual BaseCommandBuilder& GetCommandBuilder() {return commandBuilder_;} |
60 | |
61 virtual void Finalize() {} | |
62 virtual IWidget* GetCentralWidget() {return mainWidget_;} | |
63 | |
64 #if ORTHANC_ENABLE_WASM==1 | |
65 // default implementations for a single canvas named "canvas" in the HTML and an emtpy WasmApplicationAdapter | |
66 | |
67 virtual void InitializeWasm() | |
68 { | |
69 AttachWidgetToWasmViewport("canvas", mainWidget_); | |
70 } | |
71 | |
72 virtual WasmPlatformApplicationAdapter* CreateWasmApplicationAdapter(MessageBroker& broker) | |
73 { | |
74 return new WasmPlatformApplicationAdapter(broker, *this); | |
75 } | |
76 #endif | |
77 | |
78 }; | |
79 | |
80 // this application actually works in Qt and WASM | |
81 class SampleSingleCanvasWithButtonsApplicationBase : public SampleApplicationBase | |
82 { | |
83 public: | |
285
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
84 virtual void OnPushButton1Clicked() {} |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
85 virtual void OnPushButton2Clicked() {} |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
86 virtual void OnTool1Clicked() {} |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
87 virtual void OnTool2Clicked() {} |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
88 |
295
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
89 virtual void GetButtonNames(std::string& pushButton1, |
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
90 std::string& pushButton2, |
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
91 std::string& tool1, |
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
92 std::string& tool2 |
b04b13810540
unified CMakeLists.txt into a single file for WASM/Native + bootstrap Command (to rework) + doc
am@osimis.io
parents:
288
diff
changeset
|
93 ) { |
285
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
94 pushButton1 = "action1"; |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
95 pushButton2 = "action2"; |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
96 tool1 = "tool1"; |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
97 tool2 = "tool2"; |
3c190e2bb3af
refactoring: ApplicationRunner + app hierarchy
am@osimis.io
parents:
274
diff
changeset
|
98 } |
242 | 99 |
326 | 100 #if ORTHANC_ENABLE_QT==1 |
101 virtual QStoneMainWindow* CreateQtMainWindow() { | |
102 return new SampleMainWindowWithButtons(dynamic_cast<OrthancStone::NativeStoneApplicationContext&>(*context_), *this); | |
103 } | |
104 #endif | |
105 | |
106 }; | |
307 | 107 |
326 | 108 // this application actually works in SDL and WASM |
109 class SampleSingleCanvasApplicationBase : public SampleApplicationBase | |
110 { | |
111 public: | |
112 | |
113 #if ORTHANC_ENABLE_QT==1 | |
114 virtual QStoneMainWindow* CreateQtMainWindow() { | |
115 return new SampleMainWindow(dynamic_cast<OrthancStone::NativeStoneApplicationContext&>(*context_), *this); | |
116 } | |
117 #endif | |
221
d7b2590744f8
wip: building applications reusable in SDL and WASM
am@osimis.io
parents:
134
diff
changeset
|
118 }; |
0 | 119 } |
120 } |