#ifndef __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__ #define __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__ #include #include #include #include /* TODO #include #include #include // ------------------------------------------------------------------------- #define cpPlugins_ImageInteractorStyle_ObserverMacro( e ) \ inline unsigned long Add##e##Observer( vtkCommand* observer ) \ { return( this->AddObserver( Self::e##Event, observer ) ); } \ inline void Remove##e##Observer( unsigned long tag ) \ { this->RemoveObserver( tag ); } \ inline void Remove##e##Observer( vtkCommand* observer ) \ { this->RemoveObserver( observer ); } \ inline void Remove##e##Observers( ) \ { this->RemoveObservers( Self::e##Event ); } */ // Forward definitions class vtkImageActor; namespace cpExtensions { namespace Visualization { /** */ class cpExtensions_EXPORT ImageInteractorStyle : public BaseInteractorStyle { public: typedef ImageInteractorStyle Self; vtkTypeMacro( ImageInteractorStyle, BaseInteractorStyle ); public: typedef void ( *TMouseCommand )( void*, const ButtonID&, double*, bool, bool, bool ); typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool ); typedef void ( *TKeyCommand )( void*, const char& ); vtkGetMacro( MouseMoveCommand, TMouseCommand ); vtkGetMacro( MouseClickCommand, TMouseCommand ); vtkGetMacro( MouseDoubleClickCommand, TMouseCommand ); vtkGetMacro( MouseWheelCommand, TMouseWheelCommand ); vtkGetMacro( KeyCommand, TKeyCommand ); vtkSetMacro( MouseMoveCommand, TMouseCommand ); vtkSetMacro( MouseClickCommand, TMouseCommand ); vtkSetMacro( MouseDoubleClickCommand, TMouseCommand ); vtkSetMacro( MouseWheelCommand, TMouseWheelCommand ); vtkSetMacro( KeyCommand, TKeyCommand ); public: static Self* New( ); virtual void AssociateView( void* data ); virtual void AssociateImageActor( vtkImageActor* actor ); virtual void AssociateInteractor( vtkRenderWindowInteractor* rwi ); // Possible mouse motion events virtual void OnMouseMove( ); virtual void OnMouseWheelForward( ); virtual void OnMouseWheelBackward( ); // Possible mouse click-related events virtual void OnLeftClick( ); virtual void OnLeftDoubleClick( ); virtual void OnMiddleClick( ); virtual void OnMiddleDoubleClick( ); virtual void OnRightClick( ); virtual void OnRightDoubleClick( ); // Keyboard-related events virtual void OnChar( ); // Other events virtual void OnExpose( ); virtual void OnConfigure( ); virtual void OnEnter( ); virtual void OnLeave( ); protected: ImageInteractorStyle( ); virtual ~ImageInteractorStyle( ); bool _PickPosition( double pos[ 3 ] ); void _RenderAssociatedInteractors( ); private: // Purposely not implemented ImageInteractorStyle( const Self& ); Self& operator=( const Self& ); protected: vtkSmartPointer< vtkPropPicker > PropPicker; std::vector< vtkSmartPointer< vtkRenderWindowInteractor > > AssociatedInteractors; // Commands void* Data; TMouseCommand MouseMoveCommand; TMouseCommand MouseClickCommand; TMouseCommand MouseDoubleClickCommand; TMouseWheelCommand MouseWheelCommand; TKeyCommand KeyCommand; }; /* class ImageSliceActors; class MPRActors; */ /** */ /* class cpExtensions_EXPORT ImageInteractorStyle : public vtkInteractorStyleImage { public: typedef ImageInteractorStyle Self; enum InteractionMode { NavigationMode = 0, DeformationMode }; public: vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage ); cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick ); cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor ); cpPlugins_ImageInteractorStyle_ObserverMacro( Radius ); public: static Self* New( ); void Configure( ImageSliceActors* slice_actors, MPRActors* mpr_actors = NULL ); void AssociateInteractor( vtkRenderWindowInteractor* interactor ); void SetModeToNavigation( ); void SetModeToDeformation( ); virtual void SetInteractor( vtkRenderWindowInteractor* interactor, const int& axis ); // Description: // Event bindings controlling the effects of pressing mouse buttons // or moving the mouse. virtual void OnMouseMove( ); virtual void OnLeftButtonDown( ); virtual void OnLeftButtonUp( ); virtual void OnMiddleButtonDown( ); virtual void OnMiddleButtonUp( ); virtual void OnRightButtonDown( ); virtual void OnRightButtonUp( ); virtual void OnMouseWheelForward( ); virtual void OnMouseWheelBackward( ); // Description: // Override the "fly-to" (f keypress) for images. virtual void OnChar( ); // These methods for the different interactions in different modes // are overridden in subclasses to perform the correct motion. Since // they might be called from OnTimer, they do not have mouse coord // parameters (use interactor's GetEventPosition and // GetLastEventPosition) virtual void Rotate( ) { } virtual void Spin( ) { } virtual void Zoom( ) { } virtual void Pick( ) { } virtual void Slice( ) { } virtual void WindowLevel( ); // Interaction mode entry points used internally. virtual void StartPick( ) { } virtual void EndPick( ) { } virtual void StartSlice( ) { } virtual void EndSlice( ) { } virtual void StartWindowLevel( ); virtual void EndWindowLevel( ); // New events virtual void StartCursorMoving( ); virtual void EndCursorMoving( ); virtual void StartRadiusMoving( ); virtual void EndRadiusMoving( ); protected: ImageInteractorStyle( ); virtual ~ImageInteractorStyle( ); void _RenderAssociateInteractors( ); void _UpdateCursor( ); void _UpdateRadius( ); private: // Purposely not implemented ImageInteractorStyle( const Self& ); Self& operator=( const Self& ); protected: Self::InteractionMode Mode; ImageSliceActors* m_SliceActors; MPRActors* m_MPRActors; vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget; std::vector< vtkRenderWindowInteractor* > AssociatedInteractors; bool CursorMoving; double Cursor[ 3 ]; bool RadiusMoving; double Radius[ 3 ]; vtkSmartPointer< vtkPolyData > Circle; vtkSmartPointer< vtkPolyDataMapper > CircleMapper; vtkSmartPointer< vtkActor > CircleActor; public: static const int CursorEvent; static const int RadiusEvent; static const int DoubleClickEvent; }; */ } // ecapseman } // ecapseman #endif // __CPEXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__ // eof - $RCSfile$