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 
156  vtkGetObjectMacro(CurrentRenderer,vtkRenderer);
157  virtual void SetCurrentRenderer(vtkRenderer*);
159 
161  virtual void OnChar();
162 
164 
166  static void ComputeDisplayToWorld(vtkRenderer *ren, double x, double y,
167  double z, double worldPt[4]);
168  static void ComputeWorldToDisplay(vtkRenderer *ren, double x, double y,
169  double z, double displayPt[3]);
171 
172  //BTX
174 
182  void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL);
183  void ReleaseFocus();
184  //ETX
186 
187 protected:
190 
192 
195  virtual void StartInteraction();
196  virtual void EndInteraction();
198 
200 
202  static void ProcessEvents(vtkObject* object,
203  unsigned long event,
204  void* clientdata,
205  void* calldata);
207 
209 
210  void ComputeDisplayToWorld(double x, double y, double z,
211  double worldPt[4]);
212  void ComputeWorldToDisplay(double x, double y, double z,
213  double displayPt[3]);
215 
216  // The state of the widget, whether on or off (observing events or not)
217  int Enabled;
218 
219  // Used to process events
221  vtkCallbackCommand* KeyPressCallbackCommand; //listens to key activation
222 
223  // Priority at which events are processed
224  float Priority;
225 
226  // This variable controls whether the picking is managed by the Picking
227  // Manager process or not. True by default.
229 
232  virtual void RegisterPickers();
233 
235  void UnRegisterPickers();
236 
239  virtual void PickersModified();
240 
243  vtkPickingManager* GetPickingManager();
244 
246 
249  vtkAssemblyPath* GetAssemblyPath(double X, double Y, double Z,
250  vtkAbstractPropPicker* picker);
252 
253  // Keypress activation controls
256 
257  // Used to associate observers with the interactor
259 
260  // Internal ivars for processing events
263 
264  unsigned long CharObserverTag;
265  unsigned long DeleteObserverTag;
266 
267  // The mediator used to request resources from the interactor.
269  int RequestCursorShape(int requestedShape);
270 
271 private:
272  vtkInteractorObserver(const vtkInteractorObserver&); // Not implemented.
273  void operator=(const vtkInteractorObserver&); // Not implemented.
274 
275 };
276 
277 #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:62
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:328
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