1 #ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
2 #define __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
6 #include <vtkInteractorStyleImage.h>
7 #include <vtkOrientationMarkerWidget.h>
8 #include <vtkPropPicker.h>
9 #include <vtkSmartPointer.h>
12 #include <vtkInteractorStyleImage.h>
13 #include <vtkLineWidget2.h>
14 #include <vtkLineRepresentation.h>
19 // -------------------------------------------------------------------------
20 #define cpPlugins_ImageInteractorStyle_ObserverMacro( e ) \
21 inline unsigned long Add##e##Observer( vtkCommand* observer ) \
22 { return( this->AddObserver( Self::e##Event, observer ) ); } \
23 inline void Remove##e##Observer( unsigned long tag ) \
24 { this->RemoveObserver( tag ); } \
25 inline void Remove##e##Observer( vtkCommand* observer ) \
26 { this->RemoveObserver( observer ); } \
27 inline void Remove##e##Observers( ) \
28 { this->RemoveObservers( Self::e##Event ); }
34 namespace Visualization
36 class ImageSliceActors;
41 class ImageInteractorStyle
42 : public vtkInteractorStyleImage
45 typedef ImageInteractorStyle Self;
54 vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage );
56 cpPlugins_ImageInteractorStyle_ObserverMacro( DoubleClick );
57 cpPlugins_ImageInteractorStyle_ObserverMacro( Cursor );
58 cpPlugins_ImageInteractorStyle_ObserverMacro( Radius );
64 ImageSliceActors* slice_actors,
65 MPRActors* mpr_actors = NULL
67 void AssociateInteractor( vtkRenderWindowInteractor* interactor );
69 void SetModeToNavigation( );
70 void SetModeToDeformation( );
71 virtual void SetInteractor(
72 vtkRenderWindowInteractor* interactor, const int& axis
76 // Event bindings controlling the effects of pressing mouse buttons
77 // or moving the mouse.
78 virtual void OnMouseMove( );
79 virtual void OnLeftButtonDown( );
80 virtual void OnLeftButtonUp( );
81 virtual void OnMiddleButtonDown( );
82 virtual void OnMiddleButtonUp( );
83 virtual void OnRightButtonDown( );
84 virtual void OnRightButtonUp( );
85 virtual void OnMouseWheelForward( );
86 virtual void OnMouseWheelBackward( );
89 // Override the "fly-to" (f keypress) for images.
90 virtual void OnChar( );
92 // These methods for the different interactions in different modes
93 // are overridden in subclasses to perform the correct motion. Since
94 // they might be called from OnTimer, they do not have mouse coord
95 // parameters (use interactor's GetEventPosition and
96 // GetLastEventPosition)
98 virtual void Rotate( ) { }
99 virtual void Spin( ) { }
100 virtual void Zoom( ) { }
101 virtual void Pick( ) { }
102 virtual void Slice( ) { }
103 virtual void WindowLevel( );
105 // Interaction mode entry points used internally.
106 virtual void StartPick( ) { }
107 virtual void EndPick( ) { }
108 virtual void StartSlice( ) { }
109 virtual void EndSlice( ) { }
110 virtual void StartWindowLevel( );
111 virtual void EndWindowLevel( );
114 virtual void StartCursorMoving( );
115 virtual void EndCursorMoving( );
116 virtual void StartRadiusMoving( );
117 virtual void EndRadiusMoving( );
120 ImageInteractorStyle( );
121 virtual ~ImageInteractorStyle( );
123 void _RenderAssociateInteractors( );
124 bool _PickPosition( double pos[ 3 ] );
125 void _UpdateCursor( );
126 void _UpdateRadius( );
129 // Purposely not implemented
130 ImageInteractorStyle( const Self& );
131 Self& operator=( const Self& );
134 Self::InteractionMode Mode;
136 ImageSliceActors* m_SliceActors;
137 MPRActors* m_MPRActors;
139 vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
140 vtkSmartPointer< vtkPropPicker > PropPicker;
142 std::vector< vtkRenderWindowInteractor* > AssociatedInteractors;
149 vtkSmartPointer< vtkPolyData > Circle;
150 vtkSmartPointer< vtkPolyDataMapper > CircleMapper;
151 vtkSmartPointer< vtkActor > CircleActor;
154 static const int CursorEvent;
155 static const int RadiusEvent;
156 static const int DoubleClickEvent;
165 #endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__