VTK
vtkInteractorObserver.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractorObserver.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
47 #ifndef vtkInteractorObserver_h
48 #define vtkInteractorObserver_h
49 
50 #include "vtkRenderingCoreModule.h" // For export macro
51 #include "vtkObject.h"
52 
54 class vtkAssemblyPath;
56 class vtkRenderer;
57 class vtkCallbackCommand;
59 class vtkPickingManager;
60 
62 {
63 public:
65  void PrintSelf(ostream& os, vtkIndent indent);
66 
68 
74  virtual void SetEnabled(int) {}
75  int GetEnabled() {return this->Enabled;}
76  void EnabledOn() {this->SetEnabled(1);}
77  void EnabledOff() {this->SetEnabled(0);}
78  void On() {this->SetEnabled(1);}
79  void Off() {this->SetEnabled(0);}
81 
83 
89  virtual void SetInteractor(vtkRenderWindowInteractor* iren);
90  vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
92 
94 
102  vtkSetClampMacro(Priority,float,0.0f,1.0f);
103  vtkGetMacro(Priority,float);
105 
107 
109  vtkBooleanMacro(PickingManaged, bool);
110  vtkSetMacro(PickingManaged, bool);
111  vtkGetMacro(PickingManaged, bool);
113 
115 
119  vtkSetMacro(KeyPressActivation,int);
120  vtkGetMacro(KeyPressActivation,int);
121  vtkBooleanMacro(KeyPressActivation,int);
123 
125 
131  vtkSetMacro(KeyPressActivationValue,char);
132  vtkGetMacro(KeyPressActivationValue,char);
134 
136 
142  vtkGetObjectMacro(DefaultRenderer,vtkRenderer);
143  virtual void SetDefaultRenderer(vtkRenderer*);
145 
147 
155  vtkGetObjectMacro(CurrentRenderer,vtkRenderer);
156  virtual void SetCurrentRenderer(vtkRenderer*);
158 
160  virtual void OnChar();
161 
163 
165  static void ComputeDisplayToWorld(vtkRenderer *ren, double x, double y,
166  double z, double worldPt[4]);
167  static void ComputeWorldToDisplay(vtkRenderer *ren, double x, double y,
168  double z, double displayPt[3]);
170 
171  //BTX
173 
181  void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL);
182  void ReleaseFocus();
183  //ETX
185 
186 protected:
189 
191 
194  virtual void StartInteraction();
195  virtual void EndInteraction();
197 
199 
201  static void ProcessEvents(vtkObject* object,
202  unsigned long event,
203  void* clientdata,
204  void* calldata);
206 
208 
209  void ComputeDisplayToWorld(double x, double y, double z,
210  double worldPt[4]);
211  void ComputeWorldToDisplay(double x, double y, double z,
212  double displayPt[3]);
214 
215  // The state of the widget, whether on or off (observing events or not)
216  int Enabled;
217 
218  // Used to process events
220  vtkCallbackCommand* KeyPressCallbackCommand; //listens to key activation
221 
222  // Priority at which events are processed
223  float Priority;
224 
225  // This variable controls whether the picking is managed by the Picking
226  // Manager process or not. True by default.
228 
231  virtual void RegisterPickers();
232 
234  void UnRegisterPickers();
235 
238  virtual void PickersModified();
239 
242  vtkPickingManager* GetPickingManager();
243 
245 
248  vtkAssemblyPath* GetAssemblyPath(double X, double Y, double Z,
249  vtkAbstractPropPicker* picker);
251 
252  // Keypress activation controls
255 
256  // Used to associate observers with the interactor
258 
259  // Internal ivars for processing events
262 
263  unsigned long CharObserverTag;
264  unsigned long DeleteObserverTag;
265 
266  // The mediator used to request resources from the interactor.
268  int RequestCursorShape(int requestedShape);
269 
270 private:
271  vtkInteractorObserver(const vtkInteractorObserver&); // Not implemented.
272  void operator=(const vtkInteractorObserver&); // Not implemented.
273 
274 };
275 
276 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkObserverMediator * ObserverMediator
virtual void SetEnabled(int)
abstract specification for renderers
Definition: vtkRenderer.h:63
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
platform-independent render window interaction including picking and frame rate control.
superclass for callback/observer methods
Definition: vtkCommand.h:325
supports function callbacks
virtual void PrintSelf(ostream &os, vtkIndent indent)
a list of nodes that form an assembly path
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkCallbackCommand * KeyPressCallbackCommand
abstract API for pickers that can pick an instance of vtkProp
#define VTKRENDERINGCORE_EXPORT
vtkRenderWindowInteractor * Interactor
manage contention for cursors and other resources
vtkCallbackCommand * EventCallbackCommand