comparison Applications/Samples/SingleFrameApplication.h @ 388:20f149669c1f

renamed LayerWidget as SliceViewerWidget
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 09 Nov 2018 17:26:39 +0100
parents 8eb4fe74000f
children e7a494bdd956
comparison
equal deleted inserted replaced
387:a8b5cf760473 388:20f149669c1f
22 #pragma once 22 #pragma once
23 23
24 #include "SampleApplicationBase.h" 24 #include "SampleApplicationBase.h"
25 25
26 #include "../../Framework/Layers/OrthancFrameLayerSource.h" 26 #include "../../Framework/Layers/OrthancFrameLayerSource.h"
27 #include "../../Framework/Widgets/LayerWidget.h" 27 #include "../../Framework/Widgets/SliceViewerWidget.h"
28 28
29 #include <Core/Logging.h> 29 #include <Core/Logging.h>
30 30
31 #include <boost/math/constants/constants.hpp> 31 #include <boost/math/constants/constants.hpp>
32 32
71 double y, 71 double y,
72 IStatusBar* statusBar) 72 IStatusBar* statusBar)
73 { 73 {
74 if (statusBar != NULL) 74 if (statusBar != NULL)
75 { 75 {
76 Vector p = dynamic_cast<LayerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y); 76 Vector p = dynamic_cast<SliceViewerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y);
77 77
78 char buf[64]; 78 char buf[64];
79 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)", 79 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)",
80 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0); 80 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0);
81 statusBar->SetMessage(buf); 81 statusBar->SetMessage(buf);
145 } 145 }
146 } 146 }
147 } 147 }
148 148
149 149
150 LayerWidget& GetMainWidget() 150 SliceViewerWidget& GetMainWidget()
151 { 151 {
152 return *dynamic_cast<LayerWidget*>(mainWidget_); 152 return *dynamic_cast<SliceViewerWidget*>(mainWidget_);
153 } 153 }
154 154
155 155
156 void SetSlice(size_t index) 156 void SetSlice(size_t index)
157 { 157 {
241 241
242 std::string instance = parameters["instance"].as<std::string>(); 242 std::string instance = parameters["instance"].as<std::string>();
243 int frame = parameters["frame"].as<unsigned int>(); 243 int frame = parameters["frame"].as<unsigned int>();
244 244
245 orthancApiClient_.reset(new OrthancApiClient(IObserver::broker_, context_->GetWebService())); 245 orthancApiClient_.reset(new OrthancApiClient(IObserver::broker_, context_->GetWebService()));
246 mainWidget_ = new LayerWidget(broker_, "main-widget"); 246 mainWidget_ = new SliceViewerWidget(broker_, "main-widget");
247 247
248 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(broker_, *orthancApiClient_)); 248 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(broker_, *orthancApiClient_));
249 source_ = layer.get(); 249 source_ = layer.get();
250 layer->LoadFrame(instance, frame); 250 layer->LoadFrame(instance, frame);
251 layer->RegisterObserverCallback(new Callable<SingleFrameApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady)); 251 layer->RegisterObserverCallback(new Callable<SingleFrameApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady));