Mercurial > hg > orthanc-stone
annotate Applications/BasicApplicationContext.h @ 130:1982d6c1d2ff wasm
IVolumeLoader
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 16 Nov 2017 13:46:03 +0100 |
parents | fcec0ab44054 |
children | e2fe9352f240 |
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 | |
40
7207a407bcd8
shared copyright with osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
31
diff
changeset
|
5 * Copyright (C) 2017 Osimis, 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. | |
16 * | |
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 | |
130 | 24 #include "../../Framework/Viewport/WidgetViewport.h" |
102 | 25 #include "../../Framework/Volumes/ISlicedVolume.h" |
130 | 26 #include "../../Framework/Volumes/IVolumeLoader.h" |
51 | 27 #include "../../Framework/Widgets/IWorldSceneInteractor.h" |
81
8677d95753f8
switching to Oracle in SDL samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
28 #include "../../Platforms/Generic/OracleWebService.h" |
0 | 29 |
30 #include <list> | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
31 #include <boost/thread.hpp> |
0 | 32 |
33 namespace OrthancStone | |
34 { | |
35 class BasicApplicationContext : public boost::noncopyable | |
36 { | |
37 private: | |
130 | 38 typedef std::list<ISlicedVolume*> SlicedVolumes; |
39 typedef std::list<IVolumeLoader*> VolumeLoaders; | |
0 | 40 typedef std::list<IWorldSceneInteractor*> Interactors; |
41 | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
42 static void UpdateThread(BasicApplicationContext* that); |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
43 |
81
8677d95753f8
switching to Oracle in SDL samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
44 Oracle oracle_; |
8677d95753f8
switching to Oracle in SDL samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
45 OracleWebService webService_; |
57 | 46 boost::mutex viewportMutex_; |
47 WidgetViewport viewport_; | |
130 | 48 SlicedVolumes slicedVolumes_; |
49 VolumeLoaders volumeLoaders_; | |
57 | 50 Interactors interactors_; |
51 boost::thread updateThread_; | |
52 bool stopped_; | |
53 unsigned int updateDelay_; | |
0 | 54 |
55 public: | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
56 class ViewportLocker : public boost::noncopyable |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
57 { |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
58 private: |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
59 boost::mutex::scoped_lock lock_; |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
60 IViewport& viewport_; |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
61 |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
62 public: |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
63 ViewportLocker(BasicApplicationContext& that) : |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
64 lock_(that.viewportMutex_), |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
65 viewport_(that.viewport_) |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
66 { |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
67 } |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
68 |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
69 IViewport& GetViewport() const |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
70 { |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
71 return viewport_; |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
72 } |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
73 }; |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
74 |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
75 |
81
8677d95753f8
switching to Oracle in SDL samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
76 BasicApplicationContext(Orthanc::WebServiceParameters& orthanc); |
0 | 77 |
78 ~BasicApplicationContext(); | |
79 | |
80 IWidget& SetCentralWidget(IWidget* widget); // Takes ownership | |
81 | |
81
8677d95753f8
switching to Oracle in SDL samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
82 IWebService& GetWebService() |
0 | 83 { |
81
8677d95753f8
switching to Oracle in SDL samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
69
diff
changeset
|
84 return webService_; |
0 | 85 } |
57 | 86 |
130 | 87 ISlicedVolume& AddSlicedVolume(ISlicedVolume* volume); |
0 | 88 |
130 | 89 IVolumeLoader& AddVolumeLoader(IVolumeLoader* loader); |
0 | 90 |
91 IWorldSceneInteractor& AddInteractor(IWorldSceneInteractor* interactor); | |
92 | |
93 void Start(); | |
94 | |
95 void Stop(); | |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
96 |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
97 void SetUpdateDelay(unsigned int delay) // In milliseconds |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
98 { |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
99 updateDelay_ = delay; |
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
100 } |
0 | 101 }; |
102 } |