Mercurial > hg > orthanc-stone
comparison Applications/BasicApplicationContext.h @ 221:d7b2590744f8 am
wip: building applications reusable in SDL and WASM
author | am@osimis.io |
---|---|
date | Mon, 11 Jun 2018 14:01:02 +0200 |
parents | fccffbf99ba1 |
children | 84844649a8fd |
comparison
equal
deleted
inserted
replaced
219:26e3bfe30e66 | 221:d7b2590744f8 |
---|---|
33 namespace OrthancStone | 33 namespace OrthancStone |
34 { | 34 { |
35 class BasicApplicationContext : public boost::noncopyable | 35 class BasicApplicationContext : public boost::noncopyable |
36 { | 36 { |
37 private: | 37 private: |
38 typedef std::list<ISlicedVolume*> SlicedVolumes; | |
39 typedef std::list<IVolumeLoader*> VolumeLoaders; | |
40 typedef std::list<IWorldSceneInteractor*> Interactors; | |
41 | 38 |
42 static void UpdateThread(BasicApplicationContext* that); | 39 static void UpdateThread(BasicApplicationContext* that); |
40 | |
43 | 41 |
44 Oracle oracle_; | 42 Oracle oracle_; |
45 OracleWebService webService_; | 43 OracleWebService webService_; |
46 boost::mutex viewportMutex_; | 44 boost::mutex viewportMutex_; |
47 WidgetViewport viewport_; | 45 WidgetViewport centralViewport_; |
48 SlicedVolumes slicedVolumes_; | |
49 VolumeLoaders volumeLoaders_; | |
50 Interactors interactors_; | |
51 boost::thread updateThread_; | 46 boost::thread updateThread_; |
52 bool stopped_; | 47 bool stopped_; |
53 unsigned int updateDelay_; | 48 unsigned int updateDelay_; |
54 | 49 |
55 public: | 50 public: |
60 IViewport& viewport_; | 55 IViewport& viewport_; |
61 | 56 |
62 public: | 57 public: |
63 ViewportLocker(BasicApplicationContext& that) : | 58 ViewportLocker(BasicApplicationContext& that) : |
64 lock_(that.viewportMutex_), | 59 lock_(that.viewportMutex_), |
65 viewport_(that.viewport_) | 60 viewport_(that.centralViewport_) |
66 { | 61 { |
67 } | 62 } |
68 | 63 |
69 IViewport& GetViewport() const | 64 IViewport& GetViewport() const |
70 { | 65 { |
73 }; | 68 }; |
74 | 69 |
75 | 70 |
76 BasicApplicationContext(Orthanc::WebServiceParameters& orthanc); | 71 BasicApplicationContext(Orthanc::WebServiceParameters& orthanc); |
77 | 72 |
78 ~BasicApplicationContext(); | 73 virtual ~BasicApplicationContext() {} |
79 | 74 |
80 IWidget& SetCentralWidget(IWidget* widget); // Takes ownership | 75 IWidget& SetCentralWidget(IWidget* widget); // Takes ownership |
81 | 76 |
82 IWebService& GetWebService() | 77 IWebService& GetWebService() |
83 { | 78 { |
84 return webService_; | 79 return webService_; |
85 } | 80 } |
86 | 81 |
87 ISlicedVolume& AddSlicedVolume(ISlicedVolume* volume); | |
88 | |
89 IVolumeLoader& AddVolumeLoader(IVolumeLoader* loader); | |
90 | |
91 IWorldSceneInteractor& AddInteractor(IWorldSceneInteractor* interactor); | |
92 | |
93 void Start(); | 82 void Start(); |
94 | 83 |
95 void Stop(); | 84 void Stop(); |
96 | 85 |
97 void SetUpdateDelay(unsigned int delay) // In milliseconds | 86 void SetUpdateDelay(unsigned int delay) // In milliseconds |