Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | 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 =========================================================================*/
00104 #ifndef __vtkInteractorStyle_h
00105 #define __vtkInteractorStyle_h
00106 
00107 #include "vtkInteractorObserver.h"
00108 
00109 // Motion flags
00110 
00111 #define VTKIS_START        0
00112 #define VTKIS_NONE         0
00113 
00114 #define VTKIS_ROTATE       1
00115 #define VTKIS_PAN          2
00116 #define VTKIS_SPIN         3
00117 #define VTKIS_DOLLY        4
00118 #define VTKIS_ZOOM         5
00119 #define VTKIS_USCALE       6
00120 #define VTKIS_TIMER        7
00121 #define VTKIS_FORWARDFLY   8
00122 #define VTKIS_REVERSEFLY   9
00123 
00124 #define VTKIS_ANIM_OFF 0
00125 #define VTKIS_ANIM_ON  1
00126 
00127 class vtkActor2D;
00128 class vtkActor;
00129 class vtkCallbackCommand;
00130 class vtkOutlineSource;
00131 class vtkPolyDataMapper;
00132 class vtkProp3D;
00133 class vtkProp;
00134 
00135 class VTK_RENDERING_EXPORT vtkInteractorStyle : public vtkInteractorObserver
00136 {
00137 public:
00141   static vtkInteractorStyle *New();
00142 
00143   vtkTypeRevisionMacro(vtkInteractorStyle,vtkInteractorObserver);
00144   void PrintSelf(ostream& os, vtkIndent indent);
00145 
00148   virtual void SetInteractor(vtkRenderWindowInteractor *interactor);
00149 
00155   virtual void SetEnabled(int);
00156 
00158 
00164   vtkSetClampMacro(AutoAdjustCameraClippingRange, int, 0, 1 );
00165   vtkGetMacro(AutoAdjustCameraClippingRange, int );
00166   vtkBooleanMacro(AutoAdjustCameraClippingRange, int );
00168   
00172   void FindPokedRenderer(int,int);
00173 
00175 
00176   vtkGetMacro(State,int);
00178 
00180 
00181   vtkGetMacro(UseTimers,int);
00182   vtkSetMacro(UseTimers,int);
00183   vtkBooleanMacro(UseTimers,int);
00185 
00187 
00188   vtkSetMacro(HandleObservers,int);
00189   vtkGetMacro(HandleObservers,int);
00190   vtkBooleanMacro(HandleObservers,int);
00192 
00194 
00195   virtual void OnMouseMove() {};
00196   virtual void OnLeftButtonDown() {};
00197   virtual void OnLeftButtonUp() {};
00198   virtual void OnMiddleButtonDown() {};
00199   virtual void OnMiddleButtonUp() {};
00200   virtual void OnRightButtonDown() {};
00201   virtual void OnRightButtonUp() {};
00202   virtual void OnMouseWheelForward() {};
00203   virtual void OnMouseWheelBackward() {};
00205 
00207 
00209   virtual void OnChar();
00210   virtual void OnKeyDown() {};
00211   virtual void OnKeyUp() {};
00212   virtual void OnKeyPress() {};
00213   virtual void OnKeyRelease() {};
00215 
00217 
00218   virtual void OnExpose() {};
00219   virtual void OnConfigure() {};
00220   virtual void OnEnter() {};
00221   virtual void OnLeave() {};
00223 
00226   virtual void OnTimer();
00227 
00229 
00233   virtual void Rotate() {};
00234   virtual void Spin() {};
00235   virtual void Pan() {};
00236   virtual void Dolly() {};
00237   virtual void Zoom() {};
00238   virtual void UniformScale() {};
00240 
00242 
00243   virtual void StartState(int newstate);
00244   virtual void StopState();
00246 
00248 
00249   virtual void StartAnimate();  
00250   virtual void StopAnimate();  
00251   virtual void StartRotate();
00252   virtual void EndRotate();
00253   virtual void StartZoom();
00254   virtual void EndZoom();
00255   virtual void StartPan();
00256   virtual void EndPan();
00257   virtual void StartSpin();
00258   virtual void EndSpin();
00259   virtual void StartDolly();
00260   virtual void EndDolly();
00261   virtual void StartUniformScale();
00262   virtual void EndUniformScale();
00263   virtual void StartTimer();
00264   virtual void EndTimer();
00266 
00268 
00272   virtual void HighlightProp(vtkProp *prop);
00273   virtual void HighlightActor2D(vtkActor2D *actor2D);
00274   virtual void HighlightProp3D(vtkProp3D *prop3D);
00276 
00278 
00280   vtkSetVector3Macro(PickColor,double);
00281   vtkGetVectorMacro(PickColor, double, 3);
00283 
00285 
00288   vtkSetMacro(MouseWheelMotionFactor, double);
00289   vtkGetMacro(MouseWheelMotionFactor, double);
00291 
00292 protected:
00293   vtkInteractorStyle();
00294   ~vtkInteractorStyle();
00295   
00297 
00298   static void ProcessEvents(vtkObject* object, 
00299                             unsigned long event,
00300                             void* clientdata, 
00301                             void* calldata);
00303   
00304   // Keep track of current state
00305 
00306   int State;  
00307   int AnimState;  
00308 
00309   // Should observers be handled here, should we fire timers
00310 
00311   int HandleObservers; 
00312   int UseTimers;       
00313 
00314   int AutoAdjustCameraClippingRange;
00315 
00316   // For picking and highlighting props
00317 
00318   vtkOutlineSource   *Outline;
00319   vtkPolyDataMapper  *OutlineMapper;
00320   vtkActor           *OutlineActor;
00321   vtkRenderer        *PickedRenderer;
00322   vtkProp            *CurrentProp;
00323   vtkActor2D         *PickedActor2D;
00324   int                PropPicked;      // bool: prop picked?
00325   double             PickColor[3];    // support 2D picking
00326   double             MouseWheelMotionFactor;
00327 
00328 private:
00329   vtkInteractorStyle(const vtkInteractorStyle&);  // Not implemented.
00330   void operator=(const vtkInteractorStyle&);  // Not implemented.
00331 };
00332 
00333 #endif