1 #include <cpExtensions/Visualization/ImageInteractorStyle.h>
3 #include <vtkImageActor.h>
4 #include <vtkRenderWindowInteractor.h>
6 // -------------------------------------------------------------------------
7 cpExtensions::Visualization::ImageInteractorStyle::
8 Self* cpExtensions::Visualization::ImageInteractorStyle::
14 // -------------------------------------------------------------------------
15 void cpExtensions::Visualization::ImageInteractorStyle::
16 AssociateImageActor( vtkImageActor* actor )
20 this->m_PropPicker->AddPickList( actor );
26 // -------------------------------------------------------------------------
27 cpExtensions::Visualization::ImageInteractorStyle::
28 ImageInteractorStyle( )
31 this->m_PropPicker = vtkSmartPointer< vtkPropPicker >::New( );
32 this->m_PropPicker->PickFromListOn( );
35 // -------------------------------------------------------------------------
36 cpExtensions::Visualization::ImageInteractorStyle::
37 ~ImageInteractorStyle( )
41 // -------------------------------------------------------------------------
42 bool cpExtensions::Visualization::ImageInteractorStyle::
43 _PickPosition( double pos[ 3 ] )
45 static const double _0 = double( 0 );
46 vtkRenderWindowInteractor* rwi = this->GetInteractor( );
50 // Find the renderer where the event has been raised
51 double x = double( rwi->GetEventPosition( )[ 0 ] );
52 double y = double( rwi->GetEventPosition( )[ 1 ] );
53 this->FindPokedRenderer( x, y );
56 int r = this->m_PropPicker->Pick( x, y, _0, this->CurrentRenderer );
59 this->m_PropPicker->GetPickPosition( pos );