]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Visualization/MPRActors.cxx
Widget integration (step 5/6): Just one step leftgit shortlog !
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.cxx
index 72bf719729b46078d34948f7aacf5477e859a71c..4498a2ba8120d5c18a23db065e75d488bc672028 100644 (file)
@@ -193,6 +193,20 @@ PushActorsInto(
   } // rof
   if( wren != NULL )
     wren->AddActor( this->ImageOutlineActor );
+
+  for( unsigned int j = 0; j < 3; ++j )
+  {
+    ImageInteractorStyle* st =
+      dynamic_cast< ImageInteractorStyle* >( this->Slices[ 0 ][ j ]->GetStyle( ) );
+    if( w != NULL )
+      st->AssociateInteractor( w->GetInteractor( ) );
+    for( unsigned int l = 0; l < 3; ++l )
+      if( j != l )
+        st->AssociateInteractor(
+          this->Slices[ 0 ][ l ]->GetStyle( )->GetInteractor( )
+          );
+
+  } // rof
 }
 
 // -------------------------------------------------------------------------
@@ -606,6 +620,14 @@ MPRActors( )
   for( unsigned int i = 0; i < 2; ++i )
     for( unsigned int j = 0; j < 3; ++j )
       this->Slices[ i ][ j ] = vtkSmartPointer< ImageSliceActors >::New( );
+
+  this->Slices[ 0 ][ 0 ]->AssociateSlice( this->Slices[ 1 ][ 0 ] );
+  this->Slices[ 0 ][ 1 ]->AssociateSlice( this->Slices[ 1 ][ 1 ] );
+  this->Slices[ 0 ][ 2 ]->AssociateSlice( this->Slices[ 1 ][ 2 ] );
+
+  this->Slices[ 0 ][ 0 ]->SetSlicesCommand( Self::_SetSlices, this );
+  this->Slices[ 0 ][ 1 ]->SetSlicesCommand( Self::_SetSlices, this );
+  this->Slices[ 0 ][ 2 ]->SetSlicesCommand( Self::_SetSlices, this );
 }
 
 // -------------------------------------------------------------------------
@@ -691,4 +713,17 @@ _Update( unsigned int i )
   */
 }
 
+// -------------------------------------------------------------------------
+void cpExtensions::Visualization::MPRActors::
+_SetSlices( double* pos, int axis, void* data )
+{
+  MPRActors* actors = reinterpret_cast< MPRActors* >( data );
+  if( actors == NULL )
+    return;
+  for( unsigned int j = 0; j < 3; ++j )
+    if( actors->Slices[ 0 ][ j ]->GetAxis( ) != axis )
+      actors->Slices[ 0 ][ j ]->SetSlice( pos );
+  actors->Modified( );
+}
+
 // eof - $RCSfile$