VTK
dox/Rendering/vtkInteractorStyleImage.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkInteractorStyleImage.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00067 #ifndef __vtkInteractorStyleImage_h
00068 #define __vtkInteractorStyleImage_h
00069 
00070 #include "vtkInteractorStyleTrackballCamera.h"
00071 
00072 // Motion flags
00073 
00074 #define VTKIS_WINDOW_LEVEL 1024
00075 #define VTKIS_PICK         1025
00076 #define VTKIS_SLICE        1026
00077 
00078 // Style flags
00079 
00080 #define VTKIS_IMAGE2D 2
00081 #define VTKIS_IMAGE3D 3
00082 #define VTKIS_IMAGE_SLICING 4
00083 
00084 class vtkImageProperty;
00085 
00086 class VTK_RENDERING_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
00087 {
00088 public:
00089   static vtkInteractorStyleImage *New();
00090   vtkTypeMacro(vtkInteractorStyleImage, vtkInteractorStyleTrackballCamera);
00091   void PrintSelf(ostream& os, vtkIndent indent);
00092 
00094 
00095   vtkGetVector2Macro(WindowLevelStartPosition,int);
00096   vtkGetVector2Macro(WindowLevelCurrentPosition,int);
00098   
00100 
00102   virtual void OnMouseMove();
00103   virtual void OnLeftButtonDown();
00104   virtual void OnLeftButtonUp();
00105   virtual void OnMiddleButtonDown();
00106   virtual void OnMiddleButtonUp();
00107   virtual void OnRightButtonDown();
00108   virtual void OnRightButtonUp();
00110 
00112   virtual void OnChar();
00113 
00114   // These methods for the different interactions in different modes
00115   // are overridden in subclasses to perform the correct motion. Since
00116   // they might be called from OnTimer, they do not have mouse coord parameters
00117   // (use interactor's GetEventPosition and GetLastEventPosition)
00118   virtual void WindowLevel();
00119   virtual void Pick();
00120   virtual void Slice();
00121   
00122   // Interaction mode entry points used internally.  
00123   virtual void StartWindowLevel();
00124   virtual void EndWindowLevel();
00125   virtual void StartPick();
00126   virtual void EndPick();
00127   virtual void StartSlice();
00128   virtual void EndSlice();
00129 
00131 
00135   vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
00136   vtkGetMacro(InteractionMode, int);
00137   void SetInteractionModeToImage2D() {
00138     this->SetInteractionMode(VTKIS_IMAGE2D); }
00139   void SetInteractionModeToImage3D() {
00140     this->SetInteractionMode(VTKIS_IMAGE3D); }
00141   void SetInteractionModeToImageSlicing() {
00142     this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
00144 
00146 
00148   vtkSetVector3Macro(XViewRightVector, double);
00149   vtkGetVector3Macro(XViewRightVector, double);
00150   vtkSetVector3Macro(XViewUpVector, double);
00151   vtkGetVector3Macro(XViewUpVector, double);
00152   vtkSetVector3Macro(YViewRightVector, double);
00153   vtkGetVector3Macro(YViewRightVector, double);
00154   vtkSetVector3Macro(YViewUpVector, double);
00155   vtkGetVector3Macro(YViewUpVector, double);
00156   vtkSetVector3Macro(ZViewRightVector, double);
00157   vtkGetVector3Macro(ZViewRightVector, double);
00158   vtkSetVector3Macro(ZViewUpVector, double);
00159   vtkGetVector3Macro(ZViewUpVector, double);
00161 
00163 
00169   void SetImageOrientation(const double leftToRight[3],
00170                            const double bottomToTop[3]);
00172 
00173 protected:
00174   vtkInteractorStyleImage();
00175   ~vtkInteractorStyleImage();
00176 
00177   void SetCurrentImageToNthImage(int i);
00178 
00179   int WindowLevelStartPosition[2];
00180   int WindowLevelCurrentPosition[2];
00181   double WindowLevelInitial[2];
00182   vtkImageProperty *CurrentImageProperty;
00183  
00184   int InteractionMode;
00185   double XViewRightVector[3];
00186   double XViewUpVector[3];
00187   double YViewRightVector[3];
00188   double YViewUpVector[3];
00189   double ZViewRightVector[3];
00190   double ZViewUpVector[3];
00191 
00192 private:
00193   vtkInteractorStyleImage(const vtkInteractorStyleImage&);  // Not implemented.
00194   void operator=(const vtkInteractorStyleImage&);  // Not implemented.
00195 };
00196 
00197 #endif