#include <cpExtensions/cpExtensions_Export.h>
// -------------------------------------------------------------------------
-#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( ) \
+#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 ); }
namespace cpExtensions
+{
+ namespace Visualization
{
- namespace Visualization
+ class ImageSliceActors;
+ class MPRActors;
+
+ /**
+ */
+ class cpExtensions_EXPORT ImageInteractorStyle
+ : public vtkInteractorStyleImage
{
- class ImageSliceActors;
- class MPRActors;
+ public:
+ typedef ImageInteractorStyle Self;
- /**
- */
- class cpExtensions_EXPORT ImageInteractorStyle
- : public vtkInteractorStyleImage
+ enum InteractionMode
{
- 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( );
- bool _PickPosition( double pos[ 3 ] );
- 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;
- vtkSmartPointer< vtkPropPicker > PropPicker;
-
- 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;
+ NavigationMode = 0,
+ DeformationMode
};
- } // ecapseman
+ 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( );
+ bool _PickPosition( double pos[ 3 ] );
+ 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;
+ vtkSmartPointer< vtkPropPicker > PropPicker;
+
+ 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