Преглед изворни кода

Pipeline based rendering expects the pipeline out of date

before the rendering occurs, we then need to update the pipeline.
Actually, it should automatically done by the rendering mechanism...
Julien Finet пре 14 година
родитељ
комит
db0526ef70

+ 6 - 0
Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp

@@ -423,6 +423,12 @@ void vtkLightBoxRendererManager::SetImageData(vtkImageData* newImageData)
 }
 
 //----------------------------------------------------------------------------
+vtkImageData* vtkLightBoxRendererManager::GetImageData()const
+{
+  return this->Internal->ImageData;
+}
+
+//----------------------------------------------------------------------------
 vtkCamera* vtkLightBoxRendererManager::GetActiveCamera()
 {
   if (this->Internal->RenderWindowItemList.size() == 0)

+ 1 - 0
Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.h

@@ -31,6 +31,7 @@ class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkLightBoxRendererManager : public vtkO
 
   /// Set image data
   void SetImageData(vtkImageData* newImageData);
+  vtkImageData* GetImageData()const;
 
   /// Get active camera
   /// Note that the same camera is used with all the renderWindowItem

+ 1 - 0
Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.cpp

@@ -147,6 +147,7 @@ void ctkVTKAbstractView::forceRender()
     {
     return;
     }
+  this->preRender();
   d->RenderWindow->Render();
 }
 

+ 2 - 2
Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h

@@ -54,7 +54,7 @@ public slots:
   void scheduleRender();
 
   /// Force a render even if a render is already ocurring
-  void forceRender();
+  virtual void forceRender();
 
   /// Set background color
   virtual void setBackgroundColor(const QColor& newBackgroundColor) = 0;
@@ -97,7 +97,7 @@ public:
 protected:
   QScopedPointer<ctkVTKAbstractViewPrivate> d_ptr;
   ctkVTKAbstractView(ctkVTKAbstractViewPrivate* pimpl, QWidget* parent);
-
+  virtual void preRender(){};
 private:
   Q_DECLARE_PRIVATE(ctkVTKAbstractView);
   Q_DISABLE_COPY(ctkVTKAbstractView);

+ 13 - 0
Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp

@@ -134,6 +134,19 @@ void ctkVTKSliceView::resetCamera()
 }
 
 //----------------------------------------------------------------------------
+void ctkVTKSliceView::preRender()
+{
+  Q_D(ctkVTKSliceView);
+  vtkImageData* imageData = d->LightBoxRendererManager->GetImageData();
+  if (imageData)
+    {
+    /// FIXME: Shouldn't be needed to update the pipeline here. During the
+    /// rendering, the actors should update the pipeline via the mappers.
+    imageData->Update();
+    }
+}
+
+//----------------------------------------------------------------------------
 void ctkVTKSliceView::setImageData(vtkImageData* newImageData)
 {
   Q_D(ctkVTKSliceView);

+ 1 - 1
Libs/Visualization/VTK/Widgets/ctkVTKSliceView.h

@@ -129,7 +129,7 @@ signals:
 
 protected:
   virtual void resizeEvent(QResizeEvent * event);
-
+  virtual void preRender();
 private:
   Q_DECLARE_PRIVATE(ctkVTKSliceView);
   Q_DISABLE_COPY(ctkVTKSliceView);