changeset 254:abc1c6231947 am-2

cleanup
author am@osimis.io
date Tue, 03 Jul 2018 11:49:02 +0200
parents 8ff70c04c6df
children 65562a28fe05
files Applications/Samples/SimpleViewerApplication.h Framework/Layers/LayerSourceBase.cpp Framework/Layers/LayerSourceBase.h Platforms/Wasm/Defaults.h Platforms/Wasm/build-wasm.sh
diffstat 5 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/SimpleViewerApplication.h	Tue Jul 03 10:48:47 2018 +0200
+++ b/Applications/Samples/SimpleViewerApplication.h	Tue Jul 03 11:49:02 2018 +0200
@@ -194,6 +194,7 @@
       OrthancStone::WidgetViewport*                wasmViewport1_;
       OrthancStone::WidgetViewport*                wasmViewport2_;
 
+      IStatusBar*                     statusBar_;
       OrthancFrameLayerSource*        source_;
       unsigned int                    slice_;
 
@@ -234,7 +235,9 @@
         using namespace OrthancStone;
 
         context_ = context;
+        statusBar_ = &statusBar;
         statusBar.SetMessage("Use the key \"s\" to reinitialize the layout");
+        statusBar.SetMessage("Use the key \"n\" to go to next image in the main viewport");
 
         if (parameters.count("instance1") < 1)
         {
@@ -273,14 +276,16 @@
 
         // sources
         source_ = new OrthancFrameLayerSource(broker_, context_->GetWebService());
+        source_->RegisterObserver(*this);
         source_->LoadFrame(instances_[currentInstanceIndex_], 0);
-        source_->Register(*this);
 
         mainViewport_->AddLayer(source_);
 
         OrthancFrameLayerSource* thumb0 = new OrthancFrameLayerSource(broker_, context_->GetWebService());
+        thumb0->RegisterObserver(*this);
         thumb0->LoadFrame(instances_[0], 0);
         OrthancFrameLayerSource* thumb1 = new OrthancFrameLayerSource(broker_, context_->GetWebService());
+        thumb1->RegisterObserver(*this);
         thumb1->LoadFrame(instances_[1], 0);
 
         thumbnails_[0]->AddLayer(thumb0);
@@ -301,15 +306,16 @@
 
       void NextImage(WorldSceneWidget& widget) {
         assert(context_);
+        statusBar_->SetMessage("displaying next image");
 
         currentInstanceIndex_ = (currentInstanceIndex_ + 1) % instances_.size();
 
         std::auto_ptr<OrthancFrameLayerSource> layer
             (new OrthancFrameLayerSource(broker_, context_->GetWebService()));
+        layer->RegisterObserver(*this);
         layer->LoadFrame(instances_[currentInstanceIndex_], 0);
 
         mainViewport_->ReplaceLayer(0, layer.release());
-        //  source_->LoadFrame("45b7e6bc-168e8ed1-063dc08d-cffd6431-133a276a", 0);
       }
     };
 
--- a/Framework/Layers/LayerSourceBase.cpp	Tue Jul 03 10:48:47 2018 +0200
+++ b/Framework/Layers/LayerSourceBase.cpp	Tue Jul 03 11:49:02 2018 +0200
@@ -78,12 +78,6 @@
   {
     std::auto_ptr<ILayerRenderer> renderer(layer);
     Emit(ILayerSource::LayerReadyMessage(renderer, slice, isError));
-//    LayerReadyFunctor functor(layer, slice, isError);
-//    observers_.Notify(*this, functor);
   }
 
-  void LayerSourceBase::Register(IObserver& observer)
-  {
-    RegisterObserver(observer);
-  }
 }
--- a/Framework/Layers/LayerSourceBase.h	Tue Jul 03 10:48:47 2018 +0200
+++ b/Framework/Layers/LayerSourceBase.h	Tue Jul 03 11:49:02 2018 +0200
@@ -45,7 +45,5 @@
       : ILayerSource(broker)
     {}
 
-  public:
-    virtual void Register(IObserver& observer);
   };
 }
--- a/Platforms/Wasm/Defaults.h	Tue Jul 03 10:48:47 2018 +0200
+++ b/Platforms/Wasm/Defaults.h	Tue Jul 03 11:49:02 2018 +0200
@@ -19,6 +19,8 @@
   
   // C++ methods accessible from JS
   extern void EMSCRIPTEN_KEEPALIVE CreateWasmApplication(ViewportHandle cppViewportHandle);
+  extern void EMSCRIPTEN_KEEPALIVE SetStartupParameter(const char* keyc, const char* value);
+  
 
 #ifdef __cplusplus
 }
--- a/Platforms/Wasm/build-wasm.sh	Tue Jul 03 10:48:47 2018 +0200
+++ b/Platforms/Wasm/build-wasm.sh	Tue Jul 03 11:49:02 2018 +0200
@@ -12,4 +12,4 @@
 
 echo "-- building the web application -- "
 cd $currentDir
-#./build-web.sh
\ No newline at end of file
+./build-web.sh
\ No newline at end of file