Mercurial > hg > orthanc-stone
diff Applications/Samples/SimpleViewerApplication.h @ 246:5470b15f7cf2 am
first usage of boost::signals2
author | am@osimis.io |
---|---|
date | Tue, 26 Jun 2018 13:55:17 +0200 |
parents | e802578e1554 |
children | 3d523c9a8f0d |
line wrap: on
line diff
--- a/Applications/Samples/SimpleViewerApplication.h Wed Jun 20 15:59:52 2018 +0200 +++ b/Applications/Samples/SimpleViewerApplication.h Tue Jun 26 13:55:17 2018 +0200 @@ -109,6 +109,10 @@ case 's': widget.SetDefaultView(); break; + case 'n': + application_.NextImage(widget); + //widget.SetDefaultView(); + break; default: break; @@ -182,7 +186,12 @@ mainLayout_->SetDefaultView(); } - + + void OnGeometryReady(const ILayerSource& source) + { + mainLayout_->SetDefaultView(); + } + virtual void NotifyGeometryError(const ILayerSource& source) { } @@ -292,7 +301,8 @@ // sources source_ = new OrthancFrameLayerSource(context_->GetWebService()); source_->LoadFrame(instances_[currentInstanceIndex_], 0); - source_->Register(*this); +// source_->Register(*this); + source_->SignalGeometryReady.connect(boost::bind(&SimpleViewerApplication::OnGeometryReady, this, _1)); mainViewport_->AddLayer(source_); @@ -316,6 +326,19 @@ AttachWidgetToWasmViewport("canvas2", mainViewport_); } #endif + void NextImage(WorldSceneWidget& widget) { + assert(context_); + + currentInstanceIndex_ = (currentInstanceIndex_ + 1) % instances_.size(); + + std::auto_ptr<OrthancFrameLayerSource> layer + (new OrthancFrameLayerSource(context_->GetWebService())); + layer->LoadFrame(instances_[currentInstanceIndex_], 0); + + mainViewport_->ReplaceLayer(0, layer.release()); + // source_->LoadFrame("45b7e6bc-168e8ed1-063dc08d-cffd6431-133a276a", 0); + } + }; } }