diff Applications/Samples/SingleFrameApplication.h @ 336:c7fdc8bac581 am-2

creating GrayscaleBitmapStack
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Oct 2018 19:29:14 +0200
parents c34784e5f299
children 885f0a5eaa49
line wrap: on
line diff
--- a/Applications/Samples/SingleFrameApplication.h	Thu Oct 18 10:54:46 2018 +0200
+++ b/Applications/Samples/SingleFrameApplication.h	Thu Oct 18 19:29:14 2018 +0200
@@ -140,6 +140,12 @@
           }   
         }
       }
+
+
+      LayerWidget& GetMainWidget()
+      {
+        return *dynamic_cast<LayerWidget*>(mainWidget_);
+      }
       
 
       void SetSlice(size_t index)
@@ -150,7 +156,7 @@
           slice_ = index;
           
 #if 1
-          mainWidget_->SetSlice(source_->GetSlice(slice_).GetGeometry());
+          GetMainWidget().SetSlice(source_->GetSlice(slice_).GetGeometry());
 #else
           // TEST for scene extents - Rotate the axes
           double a = 15.0 / 180.0 * M_PI;
@@ -181,7 +187,7 @@
           SetSlice(source_->GetSliceCount() / 2);
         }
 
-        mainWidget_->FitContent();
+        GetMainWidget().FitContent();
       }
       
       std::auto_ptr<Interactor>         mainWidgetInteractor_;
@@ -238,7 +244,7 @@
         source_ = layer.get();
         layer->LoadFrame(instance, frame);
         layer->RegisterObserverCallback(new Callable<SingleFrameApplication, ILayerSource::GeometryReadyMessage>(*this, &SingleFrameApplication::OnMainWidgetGeometryReady));
-        mainWidget_->AddLayer(layer.release());
+        GetMainWidget().AddLayer(layer.release());
 
         RenderStyle s;
 
@@ -247,11 +253,11 @@
           s.interpolation_ = ImageInterpolation_Bilinear;
         }
 
-        mainWidget_->SetLayerStyle(0, s);
-        mainWidget_->SetTransmitMouseOver(true);
+        GetMainWidget().SetLayerStyle(0, s);
+        GetMainWidget().SetTransmitMouseOver(true);
 
         mainWidgetInteractor_.reset(new Interactor(*this));
-        mainWidget_->SetInteractor(*mainWidgetInteractor_);
+        GetMainWidget().SetInteractor(*mainWidgetInteractor_);
       }
     };