ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
VTKExtensions::vtkCustomInteractorStyle Class Reference

vtkCustomInteractorStyle defines an unique, custom VTK based interactory style for PCL Visualizer applications. Besides defining the rendering style, we also create a list of custom actions that are triggered on different keys being pressed: More...

#include <vtkCustomInteractorStyle.h>

Inheritance diagram for VTKExtensions::vtkCustomInteractorStyle:
Collaboration diagram for VTKExtensions::vtkCustomInteractorStyle:

Public Member Functions

 vtkTypeMacro (vtkCustomInteractorStyle, pcl::visualization::PCLVisualizerInteractorStyle)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 
 vtkCustomInteractorStyle ()
 Empty constructor. More...
 
virtual ~vtkCustomInteractorStyle () override
 Empty destructor. More...
 
void toggleAreaPicking ()
 
void setRenderWindow (const vtkSmartPointer< vtkRenderWindow > &win)
 Set render window. More...
 
void AddManipulator (vtkCameraManipulator *m)
 
void RemoveAllManipulators ()
 
 vtkGetObjectMacro (CameraManipulators, vtkCollection)
 
 vtkSetVector3Macro (CenterOfRotation, double)
 
 vtkGetVector3Macro (CenterOfRotation, double)
 
 vtkSetMacro (RotationFactor, double)
 
 vtkGetMacro (RotationFactor, double)
 
virtual vtkCameraManipulatorFindManipulator (int button, int shift, int control)
 

Static Public Member Functions

static vtkCustomInteractorStyleNew ()
 
static void DollyToPosition (double fact, int *position, vtkRenderer *renderer)
 
static void TranslateCamera (vtkRenderer *renderer, int toX, int toY, int fromX, int fromY)
 

Protected Member Functions

void zoomIn ()
 Interactor style internal method. Zoom in. More...
 
void zoomOut ()
 Interactor style internal method. Zoom out. More...
 
virtual void OnKeyDown () override
 
virtual void OnKeyUp () override
 
virtual void OnChar () override
 Interactor style internal method. Gets called whenever a key is pressed. More...
 
virtual void OnMouseMove () override
 
virtual void OnLeftButtonDown () override
 
virtual void OnLeftButtonUp () override
 
virtual void OnMiddleButtonDown () override
 
virtual void OnMiddleButtonUp () override
 
virtual void OnRightButtonDown () override
 
virtual void OnRightButtonUp () override
 
virtual void OnMouseWheelForward () override
 
virtual void OnMouseWheelBackward () override
 
void Dolly (double factor) override
 
void updateLookUpTableDisplay (bool add_lut=false)
 Add/remove the look up table displayed when 'u' is pressed, can also be used to update the current LUT displayed lut_actor_id_ is used (if not empty) to chose which cloud/shape actor LUT will be updated (depending on what is available) If lut_actor_id_ is empty the first actor with LUT support found will be used. More...
 
void OnButtonDown (int button, int shift, int control)
 
void OnButtonUp (int button)
 
void ResetLights ()
 
 vtkCustomInteractorStyle (const vtkCustomInteractorStyle &)=delete
 
void operator= (const vtkCustomInteractorStyle &)=delete
 

Protected Attributes

std::string lut_actor_id_
 ID used to fetch/display the look up table on the visualizer It should be set by PCLVisualizer setLookUpTableID. More...
 
vtkCameraManipulatorCurrentManipulator
 
double CenterOfRotation [3]
 
double RotationFactor
 
vtkCollection * CameraManipulators
 

Detailed Description

vtkCustomInteractorStyle defines an unique, custom VTK based interactory style for PCL Visualizer applications. Besides defining the rendering style, we also create a list of custom actions that are triggered on different keys being pressed:

  • p, P : switch to a point-based representation
  • w, W : switch to a wireframe-based representation (where available)
  • s, S : switch to a surface-based representation (where available)
  • j, J : take a .PNG snapshot of the current window view
  • c, C : display current camera/window parameters
  • f, F : fly to point mode
  • e, E : exit the interactor\
  • q, Q : stop and call VTK's TerminateApp
  • + / - : increment/decrement overall point size
  • g, G : display scale grid (on/off)
  • u, U : display lookup table (on/off)
  • r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]
  • CTRL + s, S : save camera parameters
  • CTRL + r, R : restore camera parameters
  • ALT + s, S : turn stereo mode on/off
  • ALT + f, F : switch between maximized window mode and original size
  • l, L : list all available geometric and color handlers for the current actor map
  • ALT + 0..9 [+ CTRL] : switch between different geometric handlers (where available)
  • 0..9 [+ CTRL] : switch between different color handlers (where available)
  • SHIFT + left click : select a point
  • x, X : toggle rubber band selection mode for left mouse button
Author
Radu B. Rusu

Definition at line 57 of file vtkCustomInteractorStyle.h.

Constructor & Destructor Documentation

◆ vtkCustomInteractorStyle() [1/2]

VTKExtensions::vtkCustomInteractorStyle::vtkCustomInteractorStyle ( )

Empty constructor.

Definition at line 64 of file vtkCustomInteractorStyle.cpp.

References CenterOfRotation.

◆ ~vtkCustomInteractorStyle()

VTKExtensions::vtkCustomInteractorStyle::~vtkCustomInteractorStyle ( )
overridevirtual

Empty destructor.

Definition at line 75 of file vtkCustomInteractorStyle.cpp.

References CameraManipulators.

◆ vtkCustomInteractorStyle() [2/2]

VTKExtensions::vtkCustomInteractorStyle::vtkCustomInteractorStyle ( const vtkCustomInteractorStyle )
protecteddelete

Member Function Documentation

◆ AddManipulator()

void VTKExtensions::vtkCustomInteractorStyle::AddManipulator ( vtkCameraManipulator m)

Access to adding or removing manipulators.

Definition at line 86 of file vtkCustomInteractorStyle.cpp.

References CameraManipulators.

Referenced by PclUtils::PCLVis::setCameraManipulators().

◆ Dolly()

void VTKExtensions::vtkCustomInteractorStyle::Dolly ( double  factor)
overrideprotected

Definition at line 1291 of file vtkCustomInteractorStyle.cpp.

References DollyToPosition().

Referenced by zoomIn(), and zoomOut().

◆ DollyToPosition()

void VTKExtensions::vtkCustomInteractorStyle::DollyToPosition ( double  fact,
int *  position,
vtkRenderer *  renderer 
)
static

Dolly the renderer's camera to a specific point

Definition at line 1302 of file vtkCustomInteractorStyle.cpp.

References position, and TranslateCamera().

Referenced by Dolly().

◆ FindManipulator()

vtkCameraManipulator * VTKExtensions::vtkCustomInteractorStyle::FindManipulator ( int  button,
int  shift,
int  control 
)
virtual

Returns the chosen manipulator based on the modifiers.

Definition at line 1274 of file vtkCustomInteractorStyle.cpp.

References CameraManipulators, and NULL.

Referenced by OnButtonDown().

◆ New()

static vtkCustomInteractorStyle* VTKExtensions::vtkCustomInteractorStyle::New ( )
static

◆ OnButtonDown()

void VTKExtensions::vtkCustomInteractorStyle::OnButtonDown ( int  button,
int  shift,
int  control 
)
protected

◆ OnButtonUp()

void VTKExtensions::vtkCustomInteractorStyle::OnButtonUp ( int  button)
protected

◆ OnChar()

void VTKExtensions::vtkCustomInteractorStyle::OnChar ( )
overrideprotectedvirtual

Interactor style internal method. Gets called whenever a key is pressed.

Definition at line 128 of file vtkCustomInteractorStyle.cpp.

References zoomIn(), and zoomOut().

◆ OnKeyDown()

◆ OnKeyUp()

void VTKExtensions::vtkCustomInteractorStyle::OnKeyUp ( )
overrideprotectedvirtual

◆ OnLeftButtonDown()

void VTKExtensions::vtkCustomInteractorStyle::OnLeftButtonDown ( )
overrideprotectedvirtual

Definition at line 1019 of file vtkCustomInteractorStyle.cpp.

References event, OnButtonDown(), x, and y.

◆ OnLeftButtonUp()

void VTKExtensions::vtkCustomInteractorStyle::OnLeftButtonUp ( )
overrideprotectedvirtual

Definition at line 1046 of file vtkCustomInteractorStyle.cpp.

References event, OnButtonUp(), x, and y.

◆ OnMiddleButtonDown()

void VTKExtensions::vtkCustomInteractorStyle::OnMiddleButtonDown ( )
overrideprotectedvirtual

Definition at line 1061 of file vtkCustomInteractorStyle.cpp.

References event, OnButtonDown(), x, and y.

◆ OnMiddleButtonUp()

void VTKExtensions::vtkCustomInteractorStyle::OnMiddleButtonUp ( )
overrideprotectedvirtual

Definition at line 1087 of file vtkCustomInteractorStyle.cpp.

References event, OnButtonUp(), x, and y.

◆ OnMouseMove()

void VTKExtensions::vtkCustomInteractorStyle::OnMouseMove ( )
overrideprotectedvirtual

◆ OnMouseWheelBackward()

void VTKExtensions::vtkCustomInteractorStyle::OnMouseWheelBackward ( )
overrideprotectedvirtual

Definition at line 1175 of file vtkCustomInteractorStyle.cpp.

References event, x, and y.

◆ OnMouseWheelForward()

void VTKExtensions::vtkCustomInteractorStyle::OnMouseWheelForward ( )
overrideprotectedvirtual

Definition at line 1144 of file vtkCustomInteractorStyle.cpp.

References event, x, and y.

◆ OnRightButtonDown()

void VTKExtensions::vtkCustomInteractorStyle::OnRightButtonDown ( )
overrideprotectedvirtual

Definition at line 1102 of file vtkCustomInteractorStyle.cpp.

References event, OnButtonDown(), x, and y.

◆ OnRightButtonUp()

void VTKExtensions::vtkCustomInteractorStyle::OnRightButtonUp ( )
overrideprotectedvirtual

Definition at line 1129 of file vtkCustomInteractorStyle.cpp.

References event, OnButtonUp(), x, and y.

◆ operator=()

void VTKExtensions::vtkCustomInteractorStyle::operator= ( const vtkCustomInteractorStyle )
protecteddelete

◆ PrintSelf()

void VTKExtensions::vtkCustomInteractorStyle::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
override

◆ RemoveAllManipulators()

void VTKExtensions::vtkCustomInteractorStyle::RemoveAllManipulators ( )

Removes all manipulators.

Definition at line 81 of file vtkCustomInteractorStyle.cpp.

References CameraManipulators.

Referenced by PclUtils::PCLVis::setCameraManipulators().

◆ ResetLights()

void VTKExtensions::vtkCustomInteractorStyle::ResetLights ( )
protected

Definition at line 1206 of file vtkCustomInteractorStyle.cpp.

References ecvColor::light().

◆ setRenderWindow()

void VTKExtensions::vtkCustomInteractorStyle::setRenderWindow ( const vtkSmartPointer< vtkRenderWindow > &  win)
inline

Set render window.

Definition at line 76 of file vtkCustomInteractorStyle.h.

◆ toggleAreaPicking()

void VTKExtensions::vtkCustomInteractorStyle::toggleAreaPicking ( )

Definition at line 112 of file vtkCustomInteractorStyle.cpp.

References ORIENT_MODE, and SELECT_MODE.

◆ TranslateCamera()

void VTKExtensions::vtkCustomInteractorStyle::TranslateCamera ( vtkRenderer *  renderer,
int  toX,
int  toY,
int  fromX,
int  fromY 
)
static

Translate the renderer's camera

Definition at line 1356 of file vtkCustomInteractorStyle.cpp.

Referenced by DollyToPosition().

◆ updateLookUpTableDisplay()

void VTKExtensions::vtkCustomInteractorStyle::updateLookUpTableDisplay ( bool  add_lut = false)
protected

Add/remove the look up table displayed when 'u' is pressed, can also be used to update the current LUT displayed lut_actor_id_ is used (if not empty) to chose which cloud/shape actor LUT will be updated (depending on what is available) If lut_actor_id_ is empty the first actor with LUT support found will be used.

Definition at line 1390 of file vtkCustomInteractorStyle.cpp.

References lut_actor_id_.

Referenced by OnKeyDown().

◆ vtkGetMacro()

VTKExtensions::vtkCustomInteractorStyle::vtkGetMacro ( RotationFactor  ,
double   
)

◆ vtkGetObjectMacro()

VTKExtensions::vtkCustomInteractorStyle::vtkGetObjectMacro ( CameraManipulators  ,
vtkCollection   
)

Accessor for the collection of camera manipulators.

◆ vtkGetVector3Macro()

VTKExtensions::vtkCustomInteractorStyle::vtkGetVector3Macro ( CenterOfRotation  ,
double   
)

◆ vtkSetMacro()

VTKExtensions::vtkCustomInteractorStyle::vtkSetMacro ( RotationFactor  ,
double   
)

Propagates the rotation factor to the manipulators. This simply sets an internal ivar. It is propagated to a manipulator before the event is sent to it. Also changing the RotationFactor during interaction i.e. after a button press but before a button up has no effect until the next button press.

◆ vtkSetVector3Macro()

VTKExtensions::vtkCustomInteractorStyle::vtkSetVector3Macro ( CenterOfRotation  ,
double   
)

Propagates the center to the manipulators. This simply sets an internal ivar. It is propagated to a manipulator before the event is sent to it. Also changing the CenterOfRotation during interaction i.e. after a button press but before a button up has no effect until the next button press.

◆ vtkTypeMacro()

VTKExtensions::vtkCustomInteractorStyle::vtkTypeMacro ( vtkCustomInteractorStyle  ,
pcl::visualization::PCLVisualizerInteractorStyle   
)

◆ zoomIn()

void VTKExtensions::vtkCustomInteractorStyle::zoomIn ( )
protected

Interactor style internal method. Zoom in.

Definition at line 91 of file vtkCustomInteractorStyle.cpp.

References Dolly().

Referenced by OnChar(), and OnKeyDown().

◆ zoomOut()

void VTKExtensions::vtkCustomInteractorStyle::zoomOut ( )
protected

Interactor style internal method. Zoom out.

Definition at line 102 of file vtkCustomInteractorStyle.cpp.

References Dolly().

Referenced by OnChar(), and OnKeyDown().

Member Data Documentation

◆ CameraManipulators

vtkCollection* VTKExtensions::vtkCustomInteractorStyle::CameraManipulators
protected

◆ CenterOfRotation

double VTKExtensions::vtkCustomInteractorStyle::CenterOfRotation[3]
protected

Definition at line 192 of file vtkCustomInteractorStyle.h.

Referenced by OnButtonDown(), PrintSelf(), and vtkCustomInteractorStyle().

◆ CurrentManipulator

vtkCameraManipulator* VTKExtensions::vtkCustomInteractorStyle::CurrentManipulator
protected

Definition at line 191 of file vtkCustomInteractorStyle.h.

Referenced by OnButtonDown(), OnButtonUp(), and OnMouseMove().

◆ lut_actor_id_

std::string VTKExtensions::vtkCustomInteractorStyle::lut_actor_id_
protected

ID used to fetch/display the look up table on the visualizer It should be set by PCLVisualizer setLookUpTableID.

Note
If empty, a random actor added to the interactor will be used

Definition at line 182 of file vtkCustomInteractorStyle.h.

Referenced by updateLookUpTableDisplay().

◆ RotationFactor

double VTKExtensions::vtkCustomInteractorStyle::RotationFactor
protected

Definition at line 193 of file vtkCustomInteractorStyle.h.

Referenced by OnButtonDown(), and PrintSelf().


The documentation for this class was generated from the following files: