annotate Applications/Sdl/BasicSdlApplicationContext.h @ 236:f73d722d98c8 am

renamed folder
author am@osimis.io
date Tue, 19 Jun 2018 16:06:32 +0200
parents 68856534f005
children 092db46c6291
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
222
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
1 /**
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
6 *
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
11 *
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
16 *
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
19 **/
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
20
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
21
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
22 #pragma once
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
23
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
24 #include "../../Framework/Viewport/WidgetViewport.h"
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
25 #include "../../Framework/Volumes/ISlicedVolume.h"
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
26 #include "../../Framework/Volumes/IVolumeLoader.h"
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
27 #include "../../Framework/Widgets/IWorldSceneInteractor.h"
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
28 #include "../../Platforms/Generic/OracleWebService.h"
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
29
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
30 #include <list>
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
31 #include <boost/thread.hpp>
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
32 #include "../BasicApplicationContext.h"
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
33
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
34 namespace OrthancStone
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
35 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
36 class BasicSdlApplicationContext : public BasicApplicationContext
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
37 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
38 private:
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
39
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
40 static void UpdateThread(BasicSdlApplicationContext* that);
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
41
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
42 Oracle oracle_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
43 OracleWebService webService_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
44 boost::mutex viewportMutex_;
233
68856534f005 added layout to VSOL, SDL & wasm working
am@osimis.io
parents: 222
diff changeset
45 std::unique_ptr<WidgetViewport> centralViewport_;
222
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
46 boost::thread updateThread_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
47 bool stopped_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
48 unsigned int updateDelay_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
49
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
50 public:
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
51 class ViewportLocker : public boost::noncopyable
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
52 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
53 private:
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
54 boost::mutex::scoped_lock lock_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
55 IViewport& viewport_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
56
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
57 public:
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
58 ViewportLocker(BasicSdlApplicationContext& that) :
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
59 lock_(that.viewportMutex_),
233
68856534f005 added layout to VSOL, SDL & wasm working
am@osimis.io
parents: 222
diff changeset
60 viewport_(*(that.centralViewport_.get()))
222
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
61 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
62 }
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
63
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
64 IViewport& GetViewport() const
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
65 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
66 return viewport_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
67 }
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
68 };
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
69
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
70
233
68856534f005 added layout to VSOL, SDL & wasm working
am@osimis.io
parents: 222
diff changeset
71 BasicSdlApplicationContext(Orthanc::WebServiceParameters& orthanc, WidgetViewport* centralViewport);
222
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
72
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
73 virtual ~BasicSdlApplicationContext() {}
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
74
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
75 virtual IWidget& SetCentralWidget(IWidget* widget); // Takes ownership
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
76
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
77 virtual IWebService& GetWebService()
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
78 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
79 return webService_;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
80 }
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
81
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
82 void Start();
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
83
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
84 void Stop();
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
85
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
86 void SetUpdateDelay(unsigned int delay) // In milliseconds
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
87 {
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
88 updateDelay_ = delay;
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
89 }
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
90 };
84844649a8fd continued: reusable applications
am@osimis.io
parents:
diff changeset
91 }