00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00047 #ifndef __vtkInteractorObserver_h
00048 #define __vtkInteractorObserver_h
00049
00050 #include "vtkObject.h"
00051
00052 class vtkRenderWindowInteractor;
00053 class vtkRenderer;
00054 class vtkCallbackCommand;
00055 class vtkObserverMediator;
00056
00057
00058 class VTK_RENDERING_EXPORT vtkInteractorObserver : public vtkObject
00059 {
00060 public:
00061 vtkTypeMacro(vtkInteractorObserver,vtkObject);
00062 void PrintSelf(ostream& os, vtkIndent indent);
00063
00065
00071 virtual void SetEnabled(int) {};
00072 int GetEnabled() {return this->Enabled;}
00073 void EnabledOn() {this->SetEnabled(1);}
00074 void EnabledOff() {this->SetEnabled(0);}
00075 void On() {this->SetEnabled(1);}
00076 void Off() {this->SetEnabled(0);}
00078
00080
00085 virtual void SetInteractor(vtkRenderWindowInteractor* iren);
00086 vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
00088
00090
00098 vtkSetClampMacro(Priority,float,0.0f,1.0f);
00099 vtkGetMacro(Priority,float);
00101
00103
00107 vtkSetMacro(KeyPressActivation,int);
00108 vtkGetMacro(KeyPressActivation,int);
00109 vtkBooleanMacro(KeyPressActivation,int);
00111
00113
00119 vtkSetMacro(KeyPressActivationValue,char);
00120 vtkGetMacro(KeyPressActivationValue,char);
00122
00124
00130 vtkGetObjectMacro(DefaultRenderer,vtkRenderer);
00131 virtual void SetDefaultRenderer(vtkRenderer*);
00133
00135
00143 vtkGetObjectMacro(CurrentRenderer,vtkRenderer);
00144 virtual void SetCurrentRenderer(vtkRenderer*);
00146
00148 virtual void OnChar();
00149
00151
00153 static void ComputeDisplayToWorld(vtkRenderer *ren, double x, double y,
00154 double z, double worldPt[4]);
00155 static void ComputeWorldToDisplay(vtkRenderer *ren, double x, double y,
00156 double z, double displayPt[3]);
00158
00159
00161
00169 void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL);
00170 void ReleaseFocus();
00171
00173
00174 protected:
00175 vtkInteractorObserver();
00176 ~vtkInteractorObserver();
00177
00179
00182 virtual void StartInteraction();
00183 virtual void EndInteraction();
00185
00187
00189 static void ProcessEvents(vtkObject* object,
00190 unsigned long event,
00191 void* clientdata,
00192 void* calldata);
00194
00196
00197 void ComputeDisplayToWorld(double x, double y, double z,
00198 double worldPt[4]);
00199 void ComputeWorldToDisplay(double x, double y, double z,
00200 double displayPt[3]);
00202
00203
00204 int Enabled;
00205
00206
00207 vtkCallbackCommand* EventCallbackCommand;
00208 vtkCallbackCommand* KeyPressCallbackCommand;
00209
00210
00211 float Priority;
00212
00213
00214 int KeyPressActivation;
00215 char KeyPressActivationValue;
00216
00217
00218 vtkRenderWindowInteractor *Interactor;
00219
00220
00221 vtkRenderer *CurrentRenderer;
00222 vtkRenderer *DefaultRenderer;
00223
00224 unsigned long CharObserverTag;
00225 unsigned long DeleteObserverTag;
00226
00227
00228 vtkObserverMediator *ObserverMediator;
00229 int RequestCursorShape(int requestedShape);
00230
00231 private:
00232 vtkInteractorObserver(const vtkInteractorObserver&);
00233 void operator=(const vtkInteractorObserver&);
00234
00235 };
00236
00237 #endif