VTK  9.6.20260326
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
31VTK_ABI_NAMESPACE_BEGIN
32class vtkRenderer;
34
35class VTKINTERACTIONSTYLE_EXPORT vtkCameraManipulator : public vtkObject
36{
37public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
42
47 virtual void StartInteraction() = 0;
48 virtual void EndInteraction() = 0;
50
55 virtual void OnMouseMove(int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* iren) = 0;
56 virtual void OnButtonDown(int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* iren) = 0;
57 virtual void OnButtonUp(int x, int y, vtkRenderer* ren, vtkRenderWindowInteractor* iren) = 0;
58
60
65 virtual void OnKeyUp(vtkRenderWindowInteractor* iren) = 0;
66 virtual void OnKeyDown(vtkRenderWindowInteractor* iren) = 0;
68
69 enum class MouseButtonType
70 {
71 Left = 1,
72 Middle = 2,
74 };
75
77
87
89
93 vtkSetMacro(Alt, bool);
94 vtkGetMacro(Alt, bool);
95 vtkBooleanMacro(Alt, bool);
97
99
103 vtkSetMacro(Control, bool);
104 vtkGetMacro(Control, bool);
105 vtkBooleanMacro(Control, bool);
107
109
113 vtkSetMacro(Shift, bool);
114 vtkGetMacro(Shift, bool);
115 vtkBooleanMacro(Shift, bool);
117
119
124 vtkSetVector3Macro(CenterOfRotation, double);
125 vtkGetVector3Macro(CenterOfRotation, double);
127
129
132 vtkSetMacro(MouseMotionFactor, double);
133 vtkGetMacro(MouseMotionFactor, double);
135
137
140 vtkSetStringMacro(ManipulatorName);
141 vtkGetStringMacro(ManipulatorName);
143
144protected:
147
154
155 // protected so subclasses can use it in their mouse move events.
156 double CenterOfRotationInDisplayCoordinates[2] = { 0.0, 0.0 };
157
158private:
160 void operator=(const vtkCameraManipulator&) = delete;
161
162 char* ManipulatorName = nullptr;
163
164 MouseButtonType MouseButton = MouseButtonType::Left;
165
166 bool Alt = false;
167 bool Control = false;
168 bool Shift = false;
169
170 double CenterOfRotation[3] = { 0.0, 0.0, 0.0 };
171 double MouseMotionFactor = 1.0;
172};
173VTK_ABI_NAMESPACE_END
174#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