222
|
1 /**
|
|
2 * Stone of Orthanc
|
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
|
|
4 * Department, University Hospital of Liege, Belgium
|
|
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
|
|
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 "../../Framework/Viewport/WidgetViewport.h"
|
|
25 #include "../../Framework/Volumes/ISlicedVolume.h"
|
|
26 #include "../../Framework/Volumes/IVolumeLoader.h"
|
|
27 #include "../../Framework/Widgets/IWorldSceneInteractor.h"
|
|
28 #include "../../Platforms/Generic/OracleWebService.h"
|
|
29
|
|
30 #include <list>
|
|
31 #include <boost/thread.hpp>
|
|
32 #include "../BasicApplicationContext.h"
|
|
33
|
|
34 namespace OrthancStone
|
|
35 {
|
|
36 class BasicSdlApplicationContext : public BasicApplicationContext
|
|
37 {
|
|
38 private:
|
|
39
|
|
40 static void UpdateThread(BasicSdlApplicationContext* that);
|
|
41
|
|
42 Oracle oracle_;
|
|
43 OracleWebService webService_;
|
|
44 boost::mutex viewportMutex_;
|
233
|
45 std::unique_ptr<WidgetViewport> centralViewport_;
|
222
|
46 boost::thread updateThread_;
|
|
47 bool stopped_;
|
|
48 unsigned int updateDelay_;
|
|
49
|
|
50 public:
|
|
51 class ViewportLocker : public boost::noncopyable
|
|
52 {
|
|
53 private:
|
|
54 boost::mutex::scoped_lock lock_;
|
|
55 IViewport& viewport_;
|
|
56
|
|
57 public:
|
|
58 ViewportLocker(BasicSdlApplicationContext& that) :
|
|
59 lock_(that.viewportMutex_),
|
233
|
60 viewport_(*(that.centralViewport_.get()))
|
222
|
61 {
|
|
62 }
|
|
63
|
|
64 IViewport& GetViewport() const
|
|
65 {
|
|
66 return viewport_;
|
|
67 }
|
|
68 };
|
|
69
|
|
70
|
233
|
71 BasicSdlApplicationContext(Orthanc::WebServiceParameters& orthanc, WidgetViewport* centralViewport);
|
222
|
72
|
|
73 virtual ~BasicSdlApplicationContext() {}
|
|
74
|
|
75 virtual IWidget& SetCentralWidget(IWidget* widget); // Takes ownership
|
|
76
|
|
77 virtual IWebService& GetWebService()
|
|
78 {
|
|
79 return webService_;
|
|
80 }
|
|
81
|
|
82 void Start();
|
|
83
|
|
84 void Stop();
|
|
85
|
|
86 void SetUpdateDelay(unsigned int delay) // In milliseconds
|
|
87 {
|
|
88 updateDelay_ = delay;
|
|
89 }
|
|
90 };
|
|
91 }
|