1 #ifndef __IDMS__INTERACTORSTYLEIMAGE__H__
2 #define __IDMS__INTERACTORSTYLEIMAGE__H__
4 #include <vtkInteractorStyleImage.h>
5 #include <vtkLineWidget2.h>
6 #include <vtkLineRepresentation.h>
7 #include <vtkOrientationMarkerWidget.h>
9 #include <vtkPropPicker.h>
10 #include <vtkSmartPointer.h>
20 class InteractorStyleImage
21 : public vtkInteractorStyleImage
24 typedef InteractorStyleImage Self;
33 vtkTypeMacro( InteractorStyleImage, vtkInteractorStyleImage );
38 void Configure( VolumeActors* actors, const int& axis );
40 void SetModeToNavigation( );
41 void SetModeToDeformation( );
42 virtual void SetInteractor( vtkRenderWindowInteractor* interactor );
45 // Event bindings controlling the effects of pressing mouse buttons
46 // or moving the mouse.
47 virtual void OnMouseMove( );
48 virtual void OnLeftButtonDown( );
49 virtual void OnLeftButtonUp( );
51 virtual void OnMiddleButtonDown( );
52 virtual void OnMiddleButtonUp( );
53 virtual void OnRightButtonDown( );
54 virtual void OnRightButtonUp( );
56 virtual void OnMouseWheelForward( );
57 virtual void OnMouseWheelBackward( );
60 // Override the "fly-to" (f keypress) for images.
61 virtual void OnChar( );
63 // These methods for the different interactions in different modes
64 // are overridden in subclasses to perform the correct motion. Since
65 // they might be called from OnTimer, they do not have mouse coord
66 // parameters (use interactor's GetEventPosition and GetLastEventPosition)
67 virtual void Rotate( )
69 std::cout << "Rotate" << std::endl;
75 std::cout << "Zoom" << std::endl;
77 virtual void StartWindowLevel( );
78 virtual void WindowLevel( );
81 std::cout << "Pick" << std::endl;
85 std::cout << "Slice" << std::endl;
88 // Interaction mode entry points used internally.
90 virtual void StartWindowLevel();
91 virtual void EndWindowLevel();
92 virtual void StartPick();
93 virtual void EndPick();
94 virtual void StartSlice();
95 virtual void EndSlice();
99 // Set/Get current mode to 2D or 3D. The default is 2D. In 3D mode,
100 // it is possible to rotate the camera to view oblique slices. In Slicing
101 // mode, it is possible to slice through the data, but not to generate oblique
102 // views by rotating the camera.
104 vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
105 vtkGetMacro(InteractionMode, int);
106 void SetInteractionModeToImage2D() {
107 this->SetInteractionMode(VTKIS_IMAGE2D); }
108 void SetInteractionModeToImage3D() {
109 this->SetInteractionMode(VTKIS_IMAGE3D); }
110 void SetInteractionModeToImageSlicing() {
111 this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
115 // Set the orientations that will be used when the X, Y, or Z
116 // keys are pressed. See SetImageOrientation for more information.
118 vtkSetVector3Macro(XViewRightVector, double);
119 vtkGetVector3Macro(XViewRightVector, double);
120 vtkSetVector3Macro(XViewUpVector, double);
121 vtkGetVector3Macro(XViewUpVector, double);
122 vtkSetVector3Macro(YViewRightVector, double);
123 vtkGetVector3Macro(YViewRightVector, double);
124 vtkSetVector3Macro(YViewUpVector, double);
125 vtkGetVector3Macro(YViewUpVector, double);
126 vtkSetVector3Macro(ZViewRightVector, double);
127 vtkGetVector3Macro(ZViewRightVector, double);
128 vtkSetVector3Macro(ZViewUpVector, double);
129 vtkGetVector3Macro(ZViewUpVector, double);
133 // Set the view orientation, in terms of the horizontal and
134 // vertical directions of the computer screen. The first
135 // vector gives the direction that will correspond to moving
136 // horizontally left-to-right across the screen, and the
137 // second vector gives the direction that will correspond to
138 // moving bottom-to-top up the screen. This method changes
139 // the position of the camera to provide the desired view.
141 void SetImageOrientation(
142 const double leftToRight[3],
143 const double bottomToTop[3]);
147 // Get the current image property, which is set when StartWindowLevel
148 // is called immediately before StartWindowLevelEvent is generated.
149 // This is the image property of the topmost vtkImageSlice in the
150 // renderer or NULL if no image actors are present.
152 vtkImageProperty *GetCurrentImageProperty() {
153 return this->CurrentImageProperty; }
157 InteractorStyleImage( );
158 virtual ~InteractorStyleImage( );
160 bool _PickPosition( double pos[ 3 ] );
161 void _UpdateCursor( );
164 // Purposely not implemented
165 InteractorStyleImage( const Self& );
166 Self& operator=( const Self& );
169 Self::InteractionMode Mode;
171 vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
172 VolumeActors* Actors;
174 vtkSmartPointer< vtkPlane > Plane;
175 vtkSmartPointer< vtkPropPicker > PropPicker;
179 vtkSmartPointer< vtkLineRepresentation > LineRep;
180 vtkSmartPointer< vtkLineWidget2 > LineWdg;
183 static int SliceEvent;
188 #endif // __IDMS__INTERACTORSTYLEIMAGE__H__