VTK  9.7.1
vtkCameraManipulator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkCameraManipulator_h
25 #define vtkCameraManipulator_h
26 
27 #include "vtkObject.h"
28 
29 #include "vtkInteractionStyleModule.h" // needed for export macro
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkRenderer;
34 
35 class VTKINTERACTIONSTYLE_EXPORT vtkCameraManipulator : public vtkObject
36 {
37 public:
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,
73  Right = 3
74  };
75 
77 
84  vtkSetEnumMacro(MouseButton, MouseButtonType);
85  vtkGetEnumMacro(MouseButton, MouseButtonType);
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 
144 protected:
146  ~vtkCameraManipulator() override;
147 
153  void ComputeCenterOfRotationInDisplayCoordinates(vtkRenderer* ren);
154 
155  // protected so subclasses can use it in their mouse move events.
156  double CenterOfRotationInDisplayCoordinates[2] = { 0.0, 0.0 };
157 
158 private:
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 };
173 VTK_ABI_NAMESPACE_END
174 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract specification for renderers
Definition: vtkRenderer.h:63
Abstraction of style away from button.
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:28