ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
vtkCustomInteractorStyle.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <pcl/visualization/interactor_style.h>
11 #include <vtkInteractorStyleRubberBandPick.h>
12 
13 #include "qPCL.h"
14 
15 class vtkRendererCollection;
16 class vtkPointPicker;
17 
19 class vtkCollection;
20 
21 namespace VTKExtensions {
58  : public pcl::visualization::PCLVisualizerInteractorStyle {
59 public:
61  // this macro defines Superclass, the isA functionality and the safe
62  // downcast method
64  pcl::visualization::PCLVisualizerInteractorStyle);
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
69 
71  virtual ~vtkCustomInteractorStyle() override;
72 
73  void toggleAreaPicking();
74 
77  win_ = win;
78  }
79 
80 public:
84  void AddManipulator(vtkCameraManipulator* m);
85 
89  void RemoveAllManipulators();
90 
92 
95  vtkGetObjectMacro(CameraManipulators, vtkCollection);
97 
99 
108  vtkSetVector3Macro(CenterOfRotation, double);
109  vtkGetVector3Macro(CenterOfRotation, double);
111 
113 
122  vtkSetMacro(RotationFactor, double);
123  vtkGetMacro(RotationFactor, double);
125 
129  virtual vtkCameraManipulator* FindManipulator(int button,
130  int shift,
131  int control);
132 
136  static void DollyToPosition(double fact,
137  int* position,
138  vtkRenderer* renderer);
139 
143  static void TranslateCamera(
144  vtkRenderer* renderer, int toX, int toY, int fromX, int fromY);
145 
146  using vtkInteractorStyleTrackballCamera::Dolly;
147 
148 protected:
150  void zoomIn();
151 
153  void zoomOut();
154 
155  // Keyboard events
156  virtual void OnKeyDown() override;
157  virtual void OnKeyUp() override;
158 
161  virtual void OnChar() override;
162 
163  // mouse button events
164  virtual void OnMouseMove() override;
165  virtual void OnLeftButtonDown() override;
166  virtual void OnLeftButtonUp() override;
167  virtual void OnMiddleButtonDown() override;
168  virtual void OnMiddleButtonUp() override;
169  virtual void OnRightButtonDown() override;
170  virtual void OnRightButtonUp() override;
171  virtual void OnMouseWheelForward() override;
172  virtual void OnMouseWheelBackward() override;
173 
174  friend class PointPickingCallback;
175  friend class PCLVisualizer;
176 
177  void Dolly(double factor) override;
178 
182  std::string lut_actor_id_;
183 
189  void updateLookUpTableDisplay(bool add_lut = false);
190 
192  double CenterOfRotation[3];
194 
195  // The CameraInteractors also store there button and modifier.
196  vtkCollection* CameraManipulators;
197 
198  void OnButtonDown(int button, int shift, int control);
199  void OnButtonUp(int button);
200  void ResetLights();
201 
203  void operator=(const vtkCustomInteractorStyle&) = delete;
204 };
205 
206 } // namespace VTKExtensions
math::float3 position
vtkCustomInteractorStyle defines an unique, custom VTK based interactory style for PCL Visualizer app...
vtkGetObjectMacro(CameraManipulators, vtkCollection)
std::string lut_actor_id_
ID used to fetch/display the look up table on the visualizer It should be set by PCLVisualizer setLoo...
vtkTypeMacro(vtkCustomInteractorStyle, pcl::visualization::PCLVisualizerInteractorStyle)
vtkSetMacro(RotationFactor, double)
vtkGetVector3Macro(CenterOfRotation, double)
vtkGetMacro(RotationFactor, double)
void operator=(const vtkCustomInteractorStyle &)=delete
static vtkCustomInteractorStyle * New()
void setRenderWindow(const vtkSmartPointer< vtkRenderWindow > &win)
Set render window.
vtkSetVector3Macro(CenterOfRotation, double)
vtkCustomInteractorStyle(const vtkCustomInteractorStyle &)=delete
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15