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 
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);
145 
147 
155  vtkGetObjectMacro(CurrentRenderer,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 
235 
238  virtual void PickersModified();
239 
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
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:326
vtkInteractorObserver::KeyPressActivationValue
char KeyPressActivationValue
Definition: vtkInteractorObserver.h:254
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkInteractorObserver::EventCallbackCommand
vtkCallbackCommand * EventCallbackCommand
Definition: vtkInteractorObserver.h:219
vtkInteractorObserver::ComputeDisplayToWorld
void ComputeDisplayToWorld(double x, double y, double z, double worldPt[4])
vtkInteractorObserver::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkInteractorObserver::DeleteObserverTag
unsigned long DeleteObserverTag
Definition: vtkInteractorObserver.h:264
vtkInteractorObserver::EnabledOn
void EnabledOn()
Definition: vtkInteractorObserver.h:76
vtkInteractorObserver::OnChar
virtual void OnChar()
vtkInteractorObserver::SetDefaultRenderer
virtual void SetDefaultRenderer(vtkRenderer *)
vtkInteractorObserver::ReleaseFocus
void ReleaseFocus()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkInteractorObserver::PickingManaged
bool PickingManaged
Definition: vtkInteractorObserver.h:227
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkInteractorObserver::CharObserverTag
unsigned long CharObserverTag
Definition: vtkInteractorObserver.h:263
vtkAssemblyPath
a list of nodes that form an assembly path
Definition: vtkAssemblyPath.h:41
vtkInteractorObserver
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
Definition: vtkInteractorObserver.h:62
vtkInteractorObserver::~vtkInteractorObserver
~vtkInteractorObserver()
vtkgl::event
struct _cl_event * event
Definition: vtkgl.h:14387
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkInteractorObserver::GrabFocus
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=NULL)
vtkInteractorObserver::ProcessEvents
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkInteractorObserver::KeyPressActivation
int KeyPressActivation
Definition: vtkInteractorObserver.h:253
vtkInteractorObserver::Off
void Off()
Definition: vtkInteractorObserver.h:79
vtkInteractorObserver::On
void On()
Definition: vtkInteractorObserver.h:78
vtkInteractorObserver::SetEnabled
virtual void SetEnabled(int)
Definition: vtkInteractorObserver.h:74
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkInteractorObserver::ComputeDisplayToWorld
static void ComputeDisplayToWorld(vtkRenderer *ren, double x, double y, double z, double worldPt[4])
vtkRenderingCoreModule.h
vtkInteractorObserver::UnRegisterPickers
void UnRegisterPickers()
vtkInteractorObserver::GetAssemblyPath
vtkAssemblyPath * GetAssemblyPath(double X, double Y, double Z, vtkAbstractPropPicker *picker)
vtkInteractorObserver::GetEnabled
int GetEnabled()
Definition: vtkInteractorObserver.h:75
vtkInteractorObserver::CurrentRenderer
vtkRenderer * CurrentRenderer
Definition: vtkInteractorObserver.h:260
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkInteractorObserver::GetPickingManager
vtkPickingManager * GetPickingManager()
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:80
vtkInteractorObserver::RequestCursorShape
int RequestCursorShape(int requestedShape)
vtkgl::f
GLclampf f
Definition: vtkgl.h:14181
vtkInteractorObserver::Priority
float Priority
Definition: vtkInteractorObserver.h:223
vtkAbstractPropPicker
abstract API for pickers that can pick an instance of vtkProp
Definition: vtkAbstractPropPicker.h:79
vtkObject.h
vtkInteractorObserver::DefaultRenderer
vtkRenderer * DefaultRenderer
Definition: vtkInteractorObserver.h:261
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkInteractorObserver::RegisterPickers
virtual void RegisterPickers()
vtkInteractorObserver::ComputeWorldToDisplay
void ComputeWorldToDisplay(double x, double y, double z, double displayPt[3])
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkInteractorObserver::SetInteractor
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
vtkInteractorObserver::PickersModified
virtual void PickersModified()
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkInteractorObserver::Interactor
vtkRenderWindowInteractor * Interactor
Definition: vtkInteractorObserver.h:257
vtkInteractorObserver::ComputeWorldToDisplay
static void ComputeWorldToDisplay(vtkRenderer *ren, double x, double y, double z, double displayPt[3])
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:50
VTKRENDERINGCORE_EXPORT
#define VTKRENDERINGCORE_EXPORT
Definition: vtkRenderingCoreModule.h:15
vtkInteractorObserver::KeyPressCallbackCommand
vtkCallbackCommand * KeyPressCallbackCommand
Definition: vtkInteractorObserver.h:220
vtkObserverMediator
manage contention for cursors and other resources
Definition: vtkObserverMediator.h:42
vtkInteractorObserver::ObserverMediator
vtkObserverMediator * ObserverMediator
Definition: vtkInteractorObserver.h:267
vtkInteractorObserver::StartInteraction
virtual void StartInteraction()
vtkInteractorObserver::vtkInteractorObserver
vtkInteractorObserver()
vtkInteractorObserver::Enabled
int Enabled
Definition: vtkInteractorObserver.h:216
vtkInteractorObserver::SetCurrentRenderer
virtual void SetCurrentRenderer(vtkRenderer *)
vtkPickingManager
Definition: vtkPickingManager.h:85
vtkInteractorObserver::EnabledOff
void EnabledOff()
Definition: vtkInteractorObserver.h:77
vtkInteractorObserver::EndInteraction
virtual void EndInteraction()