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

vtkInteractorObserver.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkInteractorObserver.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 =========================================================================*/
00043 #ifndef __vtkInteractorObserver_h
00044 #define __vtkInteractorObserver_h
00045 
00046 #include "vtkObject.h"
00047 
00048 class vtkRenderWindowInteractor;
00049 class vtkRenderer;
00050 class vtkCallbackCommand;
00051 
00052 class VTK_RENDERING_EXPORT vtkInteractorObserver : public vtkObject
00053 {
00054 public:
00055   vtkTypeRevisionMacro(vtkInteractorObserver,vtkObject);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059 
00065   virtual void SetEnabled(int) {};
00066   int GetEnabled() {return this->Enabled;}
00067   void EnabledOn() {this->SetEnabled(1);}
00068   void EnabledOff() {this->SetEnabled(0);}
00069   void On() {this->SetEnabled(1);}
00070   void Off() {this->SetEnabled(0);}
00072 
00074 
00079   virtual void SetInteractor(vtkRenderWindowInteractor* iren);
00080   vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
00082 
00084 
00092   vtkSetClampMacro(Priority,float,0.0f,1.0f);
00093   vtkGetMacro(Priority,float);
00095 
00097 
00101   vtkSetMacro(KeyPressActivation,int);
00102   vtkGetMacro(KeyPressActivation,int);
00103   vtkBooleanMacro(KeyPressActivation,int);
00105   
00107 
00113   vtkSetMacro(KeyPressActivationValue,char);
00114   vtkGetMacro(KeyPressActivationValue,char);
00116 
00118 
00124   vtkGetObjectMacro(DefaultRenderer,vtkRenderer);
00125   virtual void SetDefaultRenderer(vtkRenderer*);
00127 
00129 
00137   vtkGetObjectMacro(CurrentRenderer,vtkRenderer);
00138   virtual void SetCurrentRenderer(vtkRenderer*);
00140 
00141   // Sets up the keypress-i event. 
00142   virtual void OnChar();
00143   
00144   // Convenience methods for outside classes. Make sure that the
00145   // parameter "ren" is not-null.
00146   static void ComputeDisplayToWorld(vtkRenderer *ren, double x, double y, 
00147                                     double z, double worldPt[4]);
00148   static void ComputeWorldToDisplay(vtkRenderer *ren, double x, double y, 
00149                                     double z, double displayPt[3]);
00150 
00151 protected:
00152   vtkInteractorObserver();
00153   ~vtkInteractorObserver();
00154 
00156 
00159   virtual void StartInteraction();
00160   virtual void EndInteraction();
00162 
00164 
00166   static void ProcessEvents(vtkObject* object, 
00167                             unsigned long event,
00168                             void* clientdata, 
00169                             void* calldata);
00171 
00173 
00174   void ComputeDisplayToWorld(double x, double y, double z, 
00175                              double worldPt[4]);
00176   void ComputeWorldToDisplay(double x, double y, double z, 
00177                              double displayPt[3]);
00179     
00180   // The state of the widget, whether on or off (observing events or not)
00181   int Enabled;
00182   
00183   // Used to process events
00184   vtkCallbackCommand* EventCallbackCommand; //subclasses use one
00185   vtkCallbackCommand* KeyPressCallbackCommand; //listens to key activation
00186 
00187   // Priority at which events are processed
00188   float Priority;
00189 
00190   // Keypress activation controls
00191   int KeyPressActivation;
00192   char KeyPressActivationValue;
00193 
00194   // Used to associate observers with the interactor
00195   vtkRenderWindowInteractor *Interactor;
00196   
00197   // Internal ivars for processing events
00198   vtkRenderer *CurrentRenderer;
00199   vtkRenderer *DefaultRenderer;
00200 
00201   unsigned long CharObserverTag;
00202   unsigned long DeleteObserverTag;
00203 
00204 private:
00205   vtkInteractorObserver(const vtkInteractorObserver&);  // Not implemented.
00206   void operator=(const vtkInteractorObserver&);  // Not implemented.
00207   
00208 };
00209 
00210 #endif

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