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

Rendering/vtkInteractorObserver.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkInteractorObserver.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00058 #ifndef __vtkInteractorObserver_h
00059 #define __vtkInteractorObserver_h
00060 
00061 #include "vtkObject.h"
00062 
00063 class vtkRenderWindowInteractor;
00064 class vtkRenderer;
00065 class vtkCallbackCommand;
00066 
00067 class VTK_RENDERING_EXPORT vtkInteractorObserver : public vtkObject
00068 {
00069 public:
00070   vtkTypeRevisionMacro(vtkInteractorObserver,vtkObject);
00071   void PrintSelf(ostream& os, vtkIndent indent);
00072 
00074 
00080   virtual void SetEnabled(int) = 0;
00081   int GetEnabled() {return this->Enabled;}
00082   void EnabledOn() {this->SetEnabled(1);}
00083   void EnabledOff() {this->SetEnabled(0);}
00084   void On() {this->SetEnabled(1);}
00085   void Off() {this->SetEnabled(0);}
00087 
00089 
00094   virtual void SetInteractor(vtkRenderWindowInteractor* iren);
00095   vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
00097 
00099 
00107   vtkSetClampMacro(Priority,float,0.0f,1.0f);
00108   vtkGetMacro(Priority,float);
00110 
00112 
00116   vtkSetMacro(KeyPressActivation,int);
00117   vtkGetMacro(KeyPressActivation,int);
00118   vtkBooleanMacro(KeyPressActivation,int);
00120   
00122 
00128   vtkSetMacro(KeyPressActivationValue,char);
00129   vtkGetMacro(KeyPressActivationValue,char);
00131 
00133 
00138   virtual void SetCurrentRenderer(vtkRenderer*);
00139   vtkGetObjectMacro(CurrentRenderer,vtkRenderer);
00141 
00142   // Sets up the keypress-i event. 
00143   virtual void OnChar();
00144   
00145 protected:
00146   vtkInteractorObserver();
00147   ~vtkInteractorObserver();
00148 
00150 
00153   virtual void StartInteraction();
00154   virtual void EndInteraction();
00156 
00158 
00160   static void ProcessEvents(vtkObject* object, 
00161                             unsigned long event,
00162                             void* clientdata, 
00163                             void* calldata);
00165 
00167 
00168   void ComputeDisplayToWorld(double x, double y, double z, 
00169                              double worldPt[4]);
00170   void ComputeDisplayToWorld(double x, double y, double z, 
00171                              float worldPt[4]);
00172   void ComputeWorldToDisplay(double x, double y, double z, 
00173                              double displayPt[3]);
00174   void ComputeWorldToDisplay(double x, double y, double z, 
00175                              float displayPt[3]);
00177     
00178   // The state of the widget, whether on or off (observing events or not)
00179   int Enabled;
00180   
00181   // Used to process events
00182   vtkCallbackCommand* EventCallbackCommand; //subclasses use one
00183   vtkCallbackCommand* KeyPressCallbackCommand; //listens to key activation
00184 
00185   // Priority at which events are processed
00186   float Priority;
00187 
00188   // Keypress activation controls
00189   int KeyPressActivation;
00190   char KeyPressActivationValue;
00191 
00192   // Used to associate observers with the interactor
00193   vtkRenderWindowInteractor *Interactor;
00194   
00195   // Internal ivars for processing events
00196   vtkRenderer *CurrentRenderer;
00197 
00198 private:
00199   vtkInteractorObserver(const vtkInteractorObserver&);  // Not implemented.
00200   void operator=(const vtkInteractorObserver&);  // Not implemented.
00201   
00202 };
00203 
00204 #endif