]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/QT/SimpleMPRWidget.cxx
...
[cpPlugins.git] / lib / cpExtensions / QT / SimpleMPRWidget.cxx
index f3f1eb3c10cf7bafbe6dce11a366b67e33c42666..d335f538456d2439f6da9ff5e50cfe22963aec7d 100644 (file)
@@ -75,6 +75,23 @@ cpExtensions::QT::SimpleMPRWidget::
   delete this->m_UI;
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+Clear( )
+{
+  for( unsigned int i = 0; i < 4; ++i )
+    this->m_Renderers[ i ]->RemoveAllViewProps( );
+  for( unsigned int i = 0; i < 3; ++i )
+  {
+    if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
+      this->m_2DSlices[ i ]->Clear( );
+    if( this->m_3DSlices[ i ].GetPointer( ) != NULL )
+      this->m_3DSlices[ i ]->Clear( );
+
+  } // rof
+  this->m_PolyDatas.clear( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
 SetMainImage( vtkImageData* image )
@@ -122,6 +139,36 @@ SetMainImage( vtkImageData* image )
   this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::QT::SimpleMPRWidget::
+AddMesh( vtkPolyData* mesh )
+{
+  PolyDataActor a;
+  a.Configure( mesh );
+  this->m_PolyDatas[ mesh ] = a;
+  this->m_Renderers[ 3 ]->AddViewProp( a.Actor );
+
+  bool has_main_image = false;
+  for( unsigned int i = 0; i < 3; ++i )
+  {
+    if( this->m_2DSlices[ i ].GetPointer( ) != NULL )
+    {
+      if( this->m_2DSlices[ i ]->GetInputData( ) != NULL )
+      {
+        has_main_image = true;
+        this->m_2DSlices[ i ]->AddMesh( mesh );
+        this->m_2DSlices[ i ]->Render( );
+
+      } // fi
+
+    } // fi
+
+  } // rof
+  if( !has_main_image )
+    this->m_Renderers[ 3 ]->ResetCamera( );
+  this->m_VTK[ 3 ]->GetRenderWindow( )->Render( );
+}
+
 // -------------------------------------------------------------------------
 void cpExtensions::QT::SimpleMPRWidget::
 _SyncBottom( int a, int b )