VTK  9.4.20241010
vtkInteractorObserver.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
88#ifndef vtkInteractorObserver_h
89#define vtkInteractorObserver_h
90
91#include "vtkObject.h"
92#include "vtkRenderingCoreModule.h" // For export macro
93#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
94
95VTK_ABI_NAMESPACE_BEGIN
97class vtkAssemblyPath;
99class vtkRenderer;
103
104class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkInteractorObserver : public vtkObject
105{
106public:
108 void PrintSelf(ostream& os, vtkIndent indent) override;
109
111
120 vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
122
131 virtual void SetEnabled(int) {}
132 int GetEnabled() { return this->Enabled; }
133 void EnabledOn() { this->SetEnabled(1); }
134 void EnabledOff() { this->SetEnabled(0); }
135 void On() { this->SetEnabled(1); }
136 void Off() { this->SetEnabled(0); }
137
139
149 vtkSetClampMacro(Priority, float, 0.0f, 1.0f);
150 vtkGetMacro(Priority, float);
152
154
158 vtkBooleanMacro(PickingManaged, bool);
159 virtual void SetPickingManaged(bool managed);
160 vtkGetMacro(PickingManaged, bool);
162
164
170 vtkSetMacro(KeyPressActivation, vtkTypeBool);
171 vtkGetMacro(KeyPressActivation, vtkTypeBool);
172 vtkBooleanMacro(KeyPressActivation, vtkTypeBool);
174
176
183 vtkSetMacro(KeyPressActivationValue, char);
184 vtkGetMacro(KeyPressActivationValue, char);
186
188
196 vtkGetObjectMacro(DefaultRenderer, vtkRenderer);
199
201
212 vtkGetObjectMacro(CurrentRenderer, vtkRenderer);
215
219 virtual void OnChar();
220
222
227 vtkRenderer* ren, double x, double y, double z, double worldPt[4]);
229 vtkRenderer* ren, double x, double y, double z, double displayPt[3]);
231
233
243 void GrabFocus(vtkCommand* mouseEvents, vtkCommand* keypressEvents = nullptr);
246
247protected:
250
252
257 virtual void StartInteraction();
258 virtual void EndInteraction();
260
264 static void ProcessEvents(
265 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
266
268
271 void ComputeDisplayToWorld(double x, double y, double z, double worldPt[4]);
272 void ComputeWorldToDisplay(double x, double y, double z, double displayPt[3]);
274
275 // The state of the widget, whether on or off (observing events or not)
277
278 // Used to process events
280 vtkCallbackCommand* KeyPressCallbackCommand; // listens to key activation
281
282 // Priority at which events are processed
283 float Priority;
284
285 // This variable controls whether the picking is managed by the Picking
286 // Manager process or not. True by default.
288
294 virtual void RegisterPickers();
295
300
306
311 vtkAssemblyPath* GetAssemblyPath(double X, double Y, double Z, vtkAbstractPropPicker* picker);
312
313 // Keypress activation controls
316
317 // Used to associate observers with the interactor
319
320 // Internal ivars for processing events
323
324 unsigned long CharObserverTag;
325 unsigned long DeleteObserverTag;
326
327 // The mediator used to request resources from the interactor.
329 int RequestCursorShape(int requestedShape);
330
331private:
333 void operator=(const vtkInteractorObserver&) = delete;
334};
335
336VTK_ABI_NAMESPACE_END
337#endif
abstract API for pickers that can pick an instance of vtkProp
a list of nodes that form an assembly path
supports function callbacks
superclass for callback/observer methods
Definition vtkCommand.h:384
a simple class to control print indentation
Definition vtkIndent.h:108
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
virtual void EndInteraction()
Utility routines used to start and end interaction.
void UnRegisterPickers()
Unregister internal pickers from the Picking Manager.
virtual void StartInteraction()
Utility routines used to start and end interaction.
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Handles the char widget activation event.
~vtkInteractorObserver() override
vtkCallbackCommand * EventCallbackCommand
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPickingManager * GetPickingManager()
Return the picking manager associated on the context on which the observer currently belong.
void ComputeWorldToDisplay(double x, double y, double z, double displayPt[3])
Helper method for subclasses.
static void ComputeDisplayToWorld(vtkRenderer *ren, double x, double y, double z, double worldPt[4])
Convenience methods for outside classes.
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
vtkCallbackCommand * KeyPressCallbackCommand
void GrabFocus(vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
These methods enable an interactor observer to exclusively grab all events invoked by its associated ...
virtual void OnChar()
Sets up the keypress-i event.
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
This method is used to associate the widget with the render window interactor.
void ComputeDisplayToWorld(double x, double y, double z, double worldPt[4])
Helper method for subclasses.
void ReleaseFocus()
These methods enable an interactor observer to exclusively grab all events invoked by its associated ...
virtual void SetCurrentRenderer(vtkRenderer *)
Set/Get the current renderer.
vtkObserverMediator * ObserverMediator
int RequestCursorShape(int requestedShape)
virtual void SetDefaultRenderer(vtkRenderer *)
Set/Get the default renderer to use when activating the interactor observer.
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
static void ComputeWorldToDisplay(vtkRenderer *ren, double x, double y, double z, double displayPt[3])
Convenience methods for outside classes.
virtual void SetPickingManaged(bool managed)
Enable/Disable the use of a manager to process the picking.
vtkRenderWindowInteractor * Interactor
vtkAssemblyPath * GetAssemblyPath(double X, double Y, double Z, vtkAbstractPropPicker *picker)
Proceed to a pick, whether through the PickingManager if the picking is managed or directly using the...
abstract base class for most VTK objects
Definition vtkObject.h:162
manage contention for cursors and other resources
Class defines API to manage the picking process.
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHALAUTO