Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkInteractorStyle.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkInteractorStyle.h,v $
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 =========================================================================*/
00090 #ifndef __vtkInteractorStyle_h
00091 #define __vtkInteractorStyle_h
00092 
00093 #include "vtkInteractorObserver.h"
00094 
00095 // Motion flags
00096 
00097 #define VTKIS_START        0
00098 #define VTKIS_NONE         0
00099 
00100 #define VTKIS_ROTATE       1
00101 #define VTKIS_PAN          2
00102 #define VTKIS_SPIN         3
00103 #define VTKIS_DOLLY        4
00104 #define VTKIS_ZOOM         5
00105 #define VTKIS_USCALE       6
00106 #define VTKIS_TIMER        7
00107 #define VTKIS_FORWARDFLY   8
00108 #define VTKIS_REVERSEFLY   9
00109 
00110 #define VTKIS_ANIM_OFF 0
00111 #define VTKIS_ANIM_ON  1
00112 
00113 class vtkActor2D;
00114 class vtkActor;
00115 class vtkCallbackCommand;
00116 class vtkOutlineSource;
00117 class vtkPolyDataMapper;
00118 class vtkProp3D;
00119 class vtkProp;
00120 
00121 class VTK_RENDERING_EXPORT vtkInteractorStyle : public vtkInteractorObserver
00122 {
00123 public:
00127   static vtkInteractorStyle *New();
00128 
00129   vtkTypeRevisionMacro(vtkInteractorStyle,vtkInteractorObserver);
00130   void PrintSelf(ostream& os, vtkIndent indent);
00131 
00134   virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00135 
00141   virtual void SetEnabled(int);
00142 
00144 
00150   vtkSetClampMacro(AutoAdjustCameraClippingRange, int, 0, 1 );
00151   vtkGetMacro(AutoAdjustCameraClippingRange, int );
00152   vtkBooleanMacro(AutoAdjustCameraClippingRange, int );
00154   
00158   void FindPokedRenderer(int,int);
00159 
00161 
00162   vtkGetMacro(State,int);
00164 
00166 
00167   vtkGetMacro(UseTimers,int);
00168   vtkSetMacro(UseTimers,int);
00169   vtkBooleanMacro(UseTimers,int);
00171 
00173 
00174   vtkSetMacro(HandleObservers,int);
00175   vtkGetMacro(HandleObservers,int);
00176   vtkBooleanMacro(HandleObservers,int);
00178 
00180 
00181   virtual void OnMouseMove() {};
00182   virtual void OnLeftButtonDown() {};
00183   virtual void OnLeftButtonUp() {};
00184   virtual void OnMiddleButtonDown() {};
00185   virtual void OnMiddleButtonUp() {};
00186   virtual void OnRightButtonDown() {};
00187   virtual void OnRightButtonUp() {};
00188   virtual void OnMouseWheelForward() {};
00189   virtual void OnMouseWheelBackward() {};
00191 
00193 
00195   virtual void OnChar();
00196   virtual void OnKeyDown() {};
00197   virtual void OnKeyUp() {};
00198   virtual void OnKeyPress() {};
00199   virtual void OnKeyRelease() {};
00201 
00203 
00204   virtual void OnExpose() {};
00205   virtual void OnConfigure() {};
00206   virtual void OnEnter() {};
00207   virtual void OnLeave() {};
00209 
00212   virtual void OnTimer();
00213 
00215 
00219   virtual void Rotate() {};
00220   virtual void Spin() {};
00221   virtual void Pan() {};
00222   virtual void Dolly() {};
00223   virtual void Zoom() {};
00224   virtual void UniformScale() {};
00226 
00228 
00229   virtual void StartState(int newstate);
00230   virtual void StopState();
00232 
00234 
00235   virtual void StartAnimate();  
00236   virtual void StopAnimate();  
00237   virtual void StartRotate();
00238   virtual void EndRotate();
00239   virtual void StartZoom();
00240   virtual void EndZoom();
00241   virtual void StartPan();
00242   virtual void EndPan();
00243   virtual void StartSpin();
00244   virtual void EndSpin();
00245   virtual void StartDolly();
00246   virtual void EndDolly();
00247   virtual void StartUniformScale();
00248   virtual void EndUniformScale();
00249   virtual void StartTimer();
00250   virtual void EndTimer();
00252 
00254 
00258   virtual void HighlightProp(vtkProp *prop);
00259   virtual void HighlightActor2D(vtkActor2D *actor2D);
00260   virtual void HighlightProp3D(vtkProp3D *prop3D);
00262 
00264 
00266   vtkSetVector3Macro(PickColor,double);
00267   vtkGetVectorMacro(PickColor, double, 3);
00269 
00271 
00274   vtkSetMacro(MouseWheelMotionFactor, double);
00275   vtkGetMacro(MouseWheelMotionFactor, double);
00277 
00278 protected:
00279   vtkInteractorStyle();
00280   ~vtkInteractorStyle();
00281   
00283 
00284   static void ProcessEvents(vtkObject* object, 
00285                             unsigned long event,
00286                             void* clientdata, 
00287                             void* calldata);
00289   
00290   // Keep track of current state
00291 
00292   int State;  
00293   int AnimState;  
00294 
00295   // Should observers be handled here, should we fire timers
00296 
00297   int HandleObservers; 
00298   int UseTimers;       
00299 
00300   int AutoAdjustCameraClippingRange;
00301 
00302   // For picking and highlighting props
00303 
00304   vtkOutlineSource   *Outline;
00305   vtkPolyDataMapper  *OutlineMapper;
00306   vtkActor           *OutlineActor;
00307   vtkRenderer        *PickedRenderer;
00308   vtkProp            *CurrentProp;
00309   vtkActor2D         *PickedActor2D;
00310   int                PropPicked;      // bool: prop picked?
00311   double             PickColor[3];    // support 2D picking
00312   double             MouseWheelMotionFactor;
00313 
00314 private:
00315   vtkInteractorStyle(const vtkInteractorStyle&);  // Not implemented.
00316   void operator=(const vtkInteractorStyle&);  // Not implemented.
00317 };
00318 
00319 #endif

Generated on Mon Jan 21 23:07:34 2008 for VTK by  doxygen 1.4.3-20050530