comparison Applications/Samples/SingleFrameEditorApplication.h @ 329:b10dfdb96866 am-2

removing WorldSceneWidget::IWorldObserver
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Oct 2018 12:30:32 +0200
parents 8716176ff7f0
children 7a364e44fbb4
comparison
equal deleted inserted replaced
328:c80b5bddf86b 329:b10dfdb96866
70 double x, 70 double x,
71 double y, 71 double y,
72 IStatusBar* statusBar) 72 IStatusBar* statusBar)
73 { 73 {
74 switch (application_.currentTool_) { 74 switch (application_.currentTool_) {
75 case Tools_Crop: 75 case Tools_Zoom:
76 printf("ZOOM\n");
77
78 case Tools_Crop:
76 case Tools_Windowing: 79 case Tools_Windowing:
77 case Tools_Zoom:
78 case Tools_Pan: 80 case Tools_Pan:
79 // TODO return the right mouse tracker 81 // TODO return the right mouse tracker
80 return NULL; 82 return NULL;
81 } 83 }
82 84
95 Vector p = dynamic_cast<LayerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y); 97 Vector p = dynamic_cast<LayerWidget&>(widget).GetSlice().MapSliceToWorldCoordinates(x, y);
96 98
97 char buf[64]; 99 char buf[64];
98 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)", 100 sprintf(buf, "X = %.02f Y = %.02f Z = %.02f (in cm)",
99 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0); 101 p[0] / 10.0, p[1] / 10.0, p[2] / 10.0);
100 statusBar->SetMessage(buf); 102 //statusBar->SetMessage(buf);
101 } 103 }
102 } 104 }
103 105
104 virtual void MouseWheel(WorldSceneWidget& widget, 106 virtual void MouseWheel(WorldSceneWidget& widget,
105 MouseWheelDirection direction, 107 MouseWheelDirection direction,
147 break; 149 break;
148 } 150 }
149 } 151 }
150 }; 152 };
151 153
152 void OnMainWidgetGeometryReady(const ILayerSource::GeometryReadyMessage& message) 154 void OnGeometryChanged(const LayerWidget::GeometryChangedMessage& message)
153 { 155 {
156 mainWidget_->SetSlice(source_->GetSlice(slice_).GetGeometry());
154 mainWidget_->SetDefaultView(); 157 mainWidget_->SetDefaultView();
155 } 158 }
156 159
157 std::unique_ptr<Interactor> mainWidgetInteractor_; 160 std::unique_ptr<Interactor> mainWidgetInteractor_;
158 std::unique_ptr<OrthancApiClient> orthancApiClient_; 161 std::unique_ptr<OrthancApiClient> orthancApiClient_;
206 mainWidget_ = new LayerWidget(broker_, "main-widget"); 209 mainWidget_ = new LayerWidget(broker_, "main-widget");
207 210
208 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(broker_, *orthancApiClient_)); 211 std::auto_ptr<OrthancFrameLayerSource> layer(new OrthancFrameLayerSource(broker_, *orthancApiClient_));
209 source_ = layer.get(); 212 source_ = layer.get();
210 layer->LoadFrame(instance, frame); 213 layer->LoadFrame(instance, frame);
211 layer->RegisterObserverCallback(new Callable<SingleFrameEditorApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameEditorApplication::OnMainWidgetGeometryReady)); 214 mainWidget_->RegisterObserverCallback(new Callable<SingleFrameEditorApplication, LayerWidget::GeometryChangedMessage>(*this, &SingleFrameEditorApplication::OnGeometryChanged));
212 mainWidget_->AddLayer(layer.release()); 215 mainWidget_->AddLayer(layer.release());
213 216
214 mainWidget_->SetTransmitMouseOver(true); 217 mainWidget_->SetTransmitMouseOver(true);
215 218
216 mainWidgetInteractor_.reset(new Interactor(*this)); 219 mainWidgetInteractor_.reset(new Interactor(*this));