VTK  9.7.20260821
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
90
91#ifndef vtkInteractorObserver_h
92#define vtkInteractorObserver_h
93
94#include "vtkObject.h"
95#include "vtkRenderingCoreModule.h" // For export macro
96#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
97
98VTK_ABI_NAMESPACE_BEGIN
100class vtkAssemblyPath;
102class vtkRenderer;
106
107class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkInteractorObserver : public vtkObject
108{
109public:
111 void PrintSelf(ostream& os, vtkIndent indent) override;
112
114
125
134 virtual void SetEnabled(int) {}
135 int GetEnabled() { return this->Enabled; }
136 void EnabledOn() { this->SetEnabled(1); }
137 void EnabledOff() { this->SetEnabled(0); }
138 void On() { this->SetEnabled(1); }
139 void Off() { this->SetEnabled(0); }
140
142
152 vtkSetClampMacro(Priority, float, 0.0f, 1.0f);
153 vtkGetMacro(Priority, float);
155
157
161 vtkBooleanMacro(PickingManaged, bool);
162 virtual void SetPickingManaged(bool managed);
163 vtkGetMacro(PickingManaged, bool);
165
167
177
179
186 vtkSetMacro(KeyPressActivationValue, char);
187 vtkGetMacro(KeyPressActivationValue, char);
189
191
199 vtkGetObjectMacro(DefaultRenderer, vtkRenderer);
202
204
215 vtkGetObjectMacro(CurrentRenderer, vtkRenderer);
218
222 virtual void OnChar();
223
225
230 vtkRenderer* ren, double x, double y, double z, double worldPt[4]);
232 vtkRenderer* ren, double x, double y, double z, double displayPt[3]);
234
236
246 void GrabFocus(vtkCommand* mouseEvents, vtkCommand* keypressEvents = nullptr);
249
250protected:
253
255
260 virtual void StartInteraction();
261 virtual void EndInteraction();
263
267 static void ProcessEvents(
268 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
269
271
274 void ComputeDisplayToWorld(double x, double y, double z, double worldPt[4]);
275 void ComputeWorldToDisplay(double x, double y, double z, double displayPt[3]);
277
278 // The state of the widget, whether on or off (observing events or not)
280
281 // Used to process events
283 vtkCallbackCommand* KeyPressCallbackCommand; // listens to key activation
284
285 // Priority at which events are processed
286 float Priority;
287
288 // This variable controls whether the picking is managed by the Picking
289 // Manager process or not. True by default.
291
297 virtual void RegisterPickers();
298
303
309
314 vtkAssemblyPath* GetAssemblyPath(double X, double Y, double Z, vtkAbstractPropPicker* picker);
315
316 // Keypress activation controls
319
320 // Used to associate observers with the interactor
322
323 // Internal ivars for processing events
326
327 unsigned long CharObserverTag;
328 unsigned long DeleteObserverTag;
329
330 // The mediator used to request resources from the interactor.
332 int RequestCursorShape(int requestedShape);
333
334private:
336 void operator=(const vtkInteractorObserver&) = delete;
337};
338
339VTK_ABI_NAMESPACE_END
340#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:386
a simple class to control print indentation
Definition vtkIndent.h:108
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...
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