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