VTK  9.1.0
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=========================================================================*/
70#ifndef vtkInteractorObserver_h
71#define vtkInteractorObserver_h
72
73#include "vtkObject.h"
74#include "vtkRenderingCoreModule.h" // For export macro
75
77class vtkAssemblyPath;
79class vtkRenderer;
83
84class VTKRENDERINGCORE_EXPORT vtkInteractorObserver : public vtkObject
85{
86public:
88 void PrintSelf(ostream& os, vtkIndent indent) override;
89
98 virtual void SetEnabled(int) {}
99 int GetEnabled() { return this->Enabled; }
100 void EnabledOn() { this->SetEnabled(1); }
101 void EnabledOff() { this->SetEnabled(0); }
102 void On() { this->SetEnabled(1); }
103 void Off() { this->SetEnabled(0); }
104
106
115 vtkGetObjectMacro(Interactor, vtkRenderWindowInteractor);
117
119
129 vtkSetClampMacro(Priority, float, 0.0f, 1.0f);
130 vtkGetMacro(Priority, float);
132
134
138 vtkBooleanMacro(PickingManaged, bool);
139 virtual void SetPickingManaged(bool managed);
140 vtkGetMacro(PickingManaged, bool);
142
144
150 vtkSetMacro(KeyPressActivation, vtkTypeBool);
151 vtkGetMacro(KeyPressActivation, vtkTypeBool);
152 vtkBooleanMacro(KeyPressActivation, vtkTypeBool);
154
156
163 vtkSetMacro(KeyPressActivationValue, char);
164 vtkGetMacro(KeyPressActivationValue, char);
166
168
176 vtkGetObjectMacro(DefaultRenderer, vtkRenderer);
179
181
192 vtkGetObjectMacro(CurrentRenderer, vtkRenderer);
195
199 virtual void OnChar();
200
202
207 vtkRenderer* ren, double x, double y, double z, double worldPt[4]);
209 vtkRenderer* ren, double x, double y, double z, double displayPt[3]);
211
213
223 void GrabFocus(vtkCommand* mouseEvents, vtkCommand* keypressEvents = nullptr);
226
227protected:
230
232
237 virtual void StartInteraction();
238 virtual void EndInteraction();
240
244 static void ProcessEvents(
245 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
246
248
251 void ComputeDisplayToWorld(double x, double y, double z, double worldPt[4]);
252 void ComputeWorldToDisplay(double x, double y, double z, double displayPt[3]);
254
255 // The state of the widget, whether on or off (observing events or not)
257
258 // Used to process events
260 vtkCallbackCommand* KeyPressCallbackCommand; // listens to key activation
261
262 // Priority at which events are processed
263 float Priority;
264
265 // This variable controls whether the picking is managed by the Picking
266 // Manager process or not. True by default.
268
274 virtual void RegisterPickers();
275
280
286
291 vtkAssemblyPath* GetAssemblyPath(double X, double Y, double Z, vtkAbstractPropPicker* picker);
292
293 // Keypress activation controls
296
297 // Used to associate observers with the interactor
299
300 // Internal ivars for processing events
303
304 unsigned long CharObserverTag;
305 unsigned long DeleteObserverTag;
306
307 // The mediator used to request resources from the interactor.
309 int RequestCursorShape(int requestedShape);
310
311private:
313 void operator=(const vtkInteractorObserver&) = delete;
314};
315
316#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:394
a simple class to control print indentation
Definition: vtkIndent.h:113
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:82
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
Definition: vtkRenderer.h:182
int vtkTypeBool
Definition: vtkABI.h:69