#include #include #include // ------------------------------------------------------------------------- cpExtensions::Interaction::ImageInteractorStyle:: Self* cpExtensions::Interaction::ImageInteractorStyle:: New( ) { return( new Self ); } // ------------------------------------------------------------------------- void cpExtensions::Interaction::ImageInteractorStyle:: AssociateImageActor( vtkImageActor* actor ) { if( actor != NULL ) { this->m_PropPicker->AddPickList( actor ); this->Modified( ); } // fi } // ------------------------------------------------------------------------- cpExtensions::Interaction::ImageInteractorStyle:: ImageInteractorStyle( ) : Superclass( ) { this->m_PropPicker = vtkSmartPointer< vtkPropPicker >::New( ); this->m_PropPicker->PickFromListOn( ); } // ------------------------------------------------------------------------- cpExtensions::Interaction::ImageInteractorStyle:: ~ImageInteractorStyle( ) { } // ------------------------------------------------------------------------- bool cpExtensions::Interaction::ImageInteractorStyle:: _PickPosition( int idx[ 2 ], double pos[ 3 ] ) { vtkRenderWindowInteractor* rwi = this->GetInteractor( ); if( rwi == NULL ) return( false ); // Find the renderer where the event has been raised idx[ 0 ] = rwi->GetEventPosition( )[ 0 ]; idx[ 1 ] = rwi->GetEventPosition( )[ 1 ]; this->FindPokedRenderer( double( idx[ 0 ] ), double( idx[ 1 ] ) ); // Pick a 3D position int r = this->m_PropPicker->Pick( double( idx[ 0 ] ), double( idx[ 1 ] ), double( 0 ), this->CurrentRenderer ); if( r == 0 ) return( false ); this->m_PropPicker->GetPickPosition( pos ); return( true ); } // eof - $RCSfile$