VTK  9.7.20261008
vtkCameraManipulator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2// SPDX-License-Identifier: BSD-3-Clause
23
24#ifndef vtkCameraManipulator_h
25#define vtkCameraManipulator_h
26
27#include "vtkObject.h"
28
29#include "vtkInteractionStyleModule.h" // needed for export macro
30#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
31
32VTK_ABI_NAMESPACE_BEGIN
33class vtkRenderer;
35
36class VTKINTERACTIONSTYLE_EXPORT VTK_MARSHALAUTO vtkCameraManipulator : public vtkObject
37{
38public:
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
43
48 virtual void StartInteraction() = 0;
49 virtual void EndInteraction() = 0;
51
56 virtual void OnMouseMove(int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* iren) = 0;
57 virtual void OnButtonDown(int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* iren) = 0;
58 virtual void OnButtonUp(int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* iren) = 0;
59
61
66 virtual void OnKeyUp(vtkRenderWindowInteractor* iren) = 0;
67 virtual void OnKeyDown(vtkRenderWindowInteractor* iren) = 0;
69
70 enum class MouseButtonType
71 {
72 Left = 1,
73 Middle = 2,
74 Right = 3
75 };
76
78
88
90
94 vtkSetMacro(Alt, bool);
95 vtkGetMacro(Alt, bool);
96 vtkBooleanMacro(Alt, bool);
98
100
104 vtkSetMacro(Control, bool);
105 vtkGetMacro(Control, bool);
106 vtkBooleanMacro(Control, bool);
108
110
114 vtkSetMacro(Shift, bool);
115 vtkGetMacro(Shift, bool);
116 vtkBooleanMacro(Shift, bool);
118
120
125 vtkSetVector3Macro(CenterOfRotation, double);
126 vtkGetVector3Macro(CenterOfRotation, double);
128
130
133 vtkSetMacro(MouseMotionFactor, double);
134 vtkGetMacro(MouseMotionFactor, double);
136
138
141 vtkSetStringMacro(ManipulatorName);
142 vtkGetStringMacro(ManipulatorName);
144
145protected:
148
155
156 // protected so subclasses can use it in their mouse move events.
157 double CenterOfRotationInDisplayCoordinates[2] = { 0.0, 0.0 };
158
159private:
161 void operator=(const vtkCameraManipulator&) = delete;
162
163 char* ManipulatorName = nullptr;
164
165 MouseButtonType MouseButton = MouseButtonType::Left;
166
167 bool Alt = false;
168 bool Control = false;
169 bool Shift = false;
170
171 double CenterOfRotation[3] = { 0.0, 0.0, 0.0 };
172 double MouseMotionFactor = 1.0;
173};
174VTK_ABI_NAMESPACE_END
175#endif
Abstraction of style away from button.
virtual void OnMouseMove(int x, int y, vtkRenderer *ren, vtkRenderWindowInteractor *iren)=0
These methods are called on the active manipulator when the corresponding events occur.
vtkSetEnumMacro(MouseButton, MouseButtonType)
These settings determine which button the manipulator responds to.
virtual void OnKeyDown(vtkRenderWindowInteractor *iren)=0
These methods are called on all registered manipulators, not just the active one.
vtkGetEnumMacro(MouseButton, MouseButtonType)
These settings determine which button the manipulator responds to.
virtual void StartInteraction()=0
The vtkInterctorStyleManipulator will call these methods when the corresponding events occur.
virtual void OnButtonUp(int x, int y, vtkRenderer *ren, vtkRenderWindowInteractor *iren)=0
double CenterOfRotationInDisplayCoordinates[2]
virtual void OnKeyUp(vtkRenderWindowInteractor *iren)=0
These methods are called on all registered manipulators, not just the active one.
virtual void EndInteraction()=0
The vtkInterctorStyleManipulator will call these methods when the corresponding events occur.
void ComputeCenterOfRotationInDisplayCoordinates(vtkRenderer *ren)
Compute the center of rotation in display coordinates.
~vtkCameraManipulator() override
virtual void OnButtonDown(int x, int y, vtkRenderer *ren, vtkRenderWindowInteractor *iren)=0
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition vtkIndent.h:108
platform-independent render window interaction including picking and frame rate control.
abstract specification for renderers
#define VTK_MARSHALAUTO