point_cloud_library / 1.12.1 / classpcl_1_1visualization_1_1_p_c_l_visualizer_interactor_style.html /

PCLVisualizerInteractorStyle defines an unique, custom VTK based interactory style for PCL Visualizer applications. More...

#include <pcl/visualization/interactor_style.h>

Public Types

using CloudActorMapPtr = pcl::visualization::CloudActorMapPtr

Public Member Functions

PCLVisualizerInteractorStyle ()
Empty constructor. More...
~PCLVisualizerInteractorStyle ()
Empty destructor. More...
vtkTypeMacro (PCLVisualizerInteractorStyle, vtkInteractorStyleRubberBandPick)
virtual void Initialize ()
Initialization routine. More...
void setCloudActorMap (const CloudActorMapPtr &actors)
Pass a pointer to the cloud actor map. More...
void setShapeActorMap (const ShapeActorMapPtr &actors)
Pass a pointer to the shape actor map. More...
CloudActorMapPtr getCloudActorMap ()
Get the cloud actor map pointer. More...
ShapeActorMapPtr getShapeActorMap ()
Get the cloud actor map pointer. More...
void setRendererCollection (vtkSmartPointer< vtkRendererCollection > &rens)
Pass a set of renderers to the interactor style. More...
void setUseVbos (const bool use_vbos)
Use Vertex Buffer Objects renderers. More...
boost::signals2::connection registerMouseCallback (std::function< void(const pcl::visualization::MouseEvent &)> cb)
Register a callback function for mouse events. More...
boost::signals2::connection registerKeyboardCallback (std::function< void(const pcl::visualization::KeyboardEvent &)> cb)
Register a callback std::function for keyboard events. More...
boost::signals2::connection registerPointPickingCallback (std::function< void(const pcl::visualization::PointPickingEvent &)> cb)
Register a callback function for point picking events. More...
boost::signals2::connection registerAreaPickingCallback (std::function< void(const pcl::visualization::AreaPickingEvent &)> cb)
Register a callback function for area picking events. More...
void saveScreenshot (const std::string &file)
Save the current rendered image to disk, as a PNG screenshot. More...
bool saveCameraParameters (const std::string &file)
Save the camera parameters to disk, as a .cam file. More...
void getCameraParameters (Camera &camera, int viewport=0) const
Get camera parameters of a given viewport (0 means default viewport). More...
bool loadCameraParameters (const std::string &file)
Load camera parameters from a camera parameter file. More...
void setCameraParameters (const Eigen::Matrix3f &intrinsics, const Eigen::Matrix4f &extrinsics, int viewport=0)
Set the camera parameters via an intrinsics and and extrinsics matrix. More...
void setCameraParameters (const Camera &camera, int viewport=0)
Set the camera parameters by given a full camera data structure. More...
void setCameraFile (const std::string file)
Set camera file for camera parameter saving/restoring. More...
std::string getCameraFile () const
Get camera file for camera parameter saving/restoring. More...
void setKeyboardModifier (const InteractorKeyboardModifier &modifier)
Change the default keyboard modified from ALT to a different special key. More...

Static Public Member Functions

static PCLVisualizerInteractorStyle * New ()

Protected Member Functions

void OnChar () override
Interactor style internal method. More...
void OnKeyDown () override
void OnKeyUp () override
void OnMouseMove () override
void OnLeftButtonDown () override
void OnLeftButtonUp () override
void OnMiddleButtonDown () override
void OnMiddleButtonUp () override
void OnRightButtonDown () override
void OnRightButtonUp () override
void OnMouseWheelForward () override
void OnMouseWheelBackward () override
void OnTimer () override
Interactor style internal method. More...
void zoomIn ()
Interactor style internal method. More...
void zoomOut ()
Interactor style internal method. More...
bool getCameraParameters (const std::vector< std::string > &camera)
Get camera parameters from a string vector. More...
void setRenderWindow (const vtkSmartPointer< vtkRenderWindow > &win)
Set render window. More...

Protected Attributes

bool init_
Set to true after initialization is complete. More...
vtkSmartPointer< vtkRendererCollection > rens_
Collection of vtkRenderers stored internally. More...
CloudActorMapPtr cloud_actors_
Cloud actor map stored internally. More...
ShapeActorMapPtr shape_actors_
Shape map stored internally. More...
int win_height_
The current window width/height. More...
int win_width_
int win_pos_x_
The current window position x/y. More...
int win_pos_y_
int max_win_height_
The maximum resizeable window width/height. More...
int max_win_width_
bool use_vbos_
Boolean that holds whether or not to use the vtkVertexBufferObjectMapper. More...
bool grid_enabled_
Set to true if the grid actor is enabled. More...
vtkSmartPointer< vtkLegendScaleActor > grid_actor_
Actor for 2D grid on screen. More...
bool lut_enabled_
Set to true if the LUT actor is enabled. More...
vtkSmartPointer< vtkScalarBarActor > lut_actor_
Actor for 2D lookup table on screen. More...
vtkSmartPointer< vtkPNGWriter > snapshot_writer_
A PNG writer for screenshot captures. More...
vtkSmartPointer< vtkWindowToImageFilter > wif_
Internal window to image filter. More...
vtkSmartPointer< vtkPointPicker > point_picker_
Stores the point picker when switching to an area picker. More...
boost::signals2::signal< void(const pcl::visualization::MouseEvent &)> mouse_signal_
boost::signals2::signal< void(const pcl::visualization::KeyboardEvent &)> keyboard_signal_
boost::signals2::signal< void(const pcl::visualization::PointPickingEvent &)> point_picking_signal_
boost::signals2::signal< void(const pcl::visualization::AreaPickingEvent &)> area_picking_signal_
bool stereo_anaglyph_mask_default_
True if we're using red-blue colors for anaglyphic stereo, false if magenta-green. More...
vtkSmartPointer< PointPickingCallback > mouse_callback_
A VTK Mouse Callback object, used for point picking. More...
InteractorKeyboardModifier modifier_
The keyboard modifier to use. More...
std::string camera_file_
Camera file for camera parameter saving/restoring. More...
Camera camera_
A pcl::visualization::Camera for camera parameter saving/restoring. More...
bool camera_saved_
A pcl::visualization::Camera is saved or not. More...
vtkSmartPointer< vtkRenderWindow > win_
The render window. More...

Friends

class PointPickingCallback
class PCLVisualizer

Detailed Description

PCLVisualizerInteractorStyle 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 107 of file interactor_style.h.

Member Typedef Documentation

CloudActorMapPtr

Constructor & Destructor Documentation

PCLVisualizerInteractorStyle()

pcl::visualization::PCLVisualizerInteractorStyle::PCLVisualizerInteractorStyle ( )
inline

Empty constructor.

Definition at line 115 of file interactor_style.h.

~PCLVisualizerInteractorStyle()

pcl::visualization::PCLVisualizerInteractorStyle::~PCLVisualizerInteractorStyle ( )
inline

Empty destructor.

Definition at line 123 of file interactor_style.h.

Member Function Documentation

getCameraFile()

std::string pcl::visualization::PCLVisualizerInteractorStyle::getCameraFile ( ) const
inline

Get camera file for camera parameter saving/restoring.

Definition at line 243 of file interactor_style.h.

getCameraParameters() [1/2]

void pcl::visualization::PCLVisualizerInteractorStyle::getCameraParameters ( Camera & camera,
int viewport = 0
) const

Get camera parameters of a given viewport (0 means default viewport).

getCameraParameters() [2/2]

bool pcl::visualization::PCLVisualizerInteractorStyle::getCameraParameters ( const std::vector< std::string > & camera )
protected

Get camera parameters from a string vector.

Parameters
[in] camera A string vector: Clipping Range, Focal Point, Position, ViewUp, Distance, Field of View Y, Window Size, Window Pos. Values in each string are separated by a ','

getCloudActorMap()

CloudActorMapPtr pcl::visualization::PCLVisualizerInteractorStyle::getCloudActorMap ( )
inline

Get the cloud actor map pointer.

Definition at line 146 of file interactor_style.h.

getShapeActorMap()

ShapeActorMapPtr pcl::visualization::PCLVisualizerInteractorStyle::getShapeActorMap ( )
inline

Get the cloud actor map pointer.

Definition at line 150 of file interactor_style.h.

Initialize()

virtual void pcl::visualization::PCLVisualizerInteractorStyle::Initialize ( )
virtual

Initialization routine.

Must be called before anything else.

loadCameraParameters()

bool pcl::visualization::PCLVisualizerInteractorStyle::loadCameraParameters ( const std::string & file )

Load camera parameters from a camera parameter file.

Parameters
[in] file the name of the camera parameter file

New()

static PCLVisualizerInteractorStyle* pcl::visualization::PCLVisualizerInteractorStyle::New ( )
static

OnChar()

void pcl::visualization::PCLVisualizerInteractorStyle::OnChar ( )
overrideprotected

Interactor style internal method.

Gets called whenever a key is pressed.

OnKeyDown()

void pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown ( )
overrideprotected

OnKeyUp()

void pcl::visualization::PCLVisualizerInteractorStyle::OnKeyUp ( )
overrideprotected

OnLeftButtonDown()

void pcl::visualization::PCLVisualizerInteractorStyle::OnLeftButtonDown ( )
overrideprotected

OnLeftButtonUp()

void pcl::visualization::PCLVisualizerInteractorStyle::OnLeftButtonUp ( )
overrideprotected

OnMiddleButtonDown()

void pcl::visualization::PCLVisualizerInteractorStyle::OnMiddleButtonDown ( )
overrideprotected

OnMiddleButtonUp()

void pcl::visualization::PCLVisualizerInteractorStyle::OnMiddleButtonUp ( )
overrideprotected

OnMouseMove()

void pcl::visualization::PCLVisualizerInteractorStyle::OnMouseMove ( )
overrideprotected

OnMouseWheelBackward()

void pcl::visualization::PCLVisualizerInteractorStyle::OnMouseWheelBackward ( )
overrideprotected

OnMouseWheelForward()

void pcl::visualization::PCLVisualizerInteractorStyle::OnMouseWheelForward ( )
overrideprotected

OnRightButtonDown()

void pcl::visualization::PCLVisualizerInteractorStyle::OnRightButtonDown ( )
overrideprotected

OnRightButtonUp()

void pcl::visualization::PCLVisualizerInteractorStyle::OnRightButtonUp ( )
overrideprotected

OnTimer()

void pcl::visualization::PCLVisualizerInteractorStyle::OnTimer ( )
overrideprotected

Interactor style internal method.

Gets called periodically if a timer is set.

registerAreaPickingCallback()

boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerAreaPickingCallback ( std::function< void(const pcl::visualization::AreaPickingEvent &)> cb )

Register a callback function for area picking events.

Parameters
[in] cb a std function that will be registered as a callback for a area picking event
Returns
a connection object that allows to disconnect the callback function.

registerKeyboardCallback()

boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerKeyboardCallback ( std::function< void(const pcl::visualization::KeyboardEvent &)> cb )

Register a callback std::function for keyboard events.

Parameters
[in] cb a std function that will be registered as a callback for a keyboard event
Returns
a connection object that allows to disconnect the callback function.

registerMouseCallback()

boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerMouseCallback ( std::function< void(const pcl::visualization::MouseEvent &)> cb )

Register a callback function for mouse events.

Parameters
[in] cb a std function that will be registered as a callback for a mouse event
Returns
a connection object that allows to disconnect the callback function.

registerPointPickingCallback()

boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerPointPickingCallback ( std::function< void(const pcl::visualization::PointPickingEvent &)> cb )

Register a callback function for point picking events.

Parameters
[in] cb a std function that will be registered as a callback for a point picking event
Returns
a connection object that allows to disconnect the callback function.

saveCameraParameters()

bool pcl::visualization::PCLVisualizerInteractorStyle::saveCameraParameters ( const std::string & file )

Save the camera parameters to disk, as a .cam file.

Parameters
[in] file the name of the .cam file

saveScreenshot()

void pcl::visualization::PCLVisualizerInteractorStyle::saveScreenshot ( const std::string & file )

Save the current rendered image to disk, as a PNG screenshot.

Parameters
[in] file the name of the PNG file

setCameraFile()

void pcl::visualization::PCLVisualizerInteractorStyle::setCameraFile ( const std::string file )
inline

Set camera file for camera parameter saving/restoring.

Parameters
[in] file the name of the camera parameter file

Definition at line 236 of file interactor_style.h.

setCameraParameters() [1/2]

void pcl::visualization::PCLVisualizerInteractorStyle::setCameraParameters ( const Camera & camera,
int viewport = 0
)

Set the camera parameters by given a full camera data structure.

Parameters
[in] camera camera structure containing all the camera parameters.
[in] viewport the viewport to modify camera of (0 modifies all cameras)

setCameraParameters() [2/2]

void pcl::visualization::PCLVisualizerInteractorStyle::setCameraParameters ( const Eigen::Matrix3f & intrinsics,
const Eigen::Matrix4f & extrinsics,
int viewport = 0
)

Set the camera parameters via an intrinsics and and extrinsics matrix.

Note
This assumes that the pixels are square and that the center of the image is at the center of the sensor.
Parameters
[in] intrinsics the intrinsics that will be used to compute the VTK camera parameters
[in] extrinsics the extrinsics that will be used to compute the VTK camera parameters
[in] viewport the viewport to modify camera of (0 modifies all cameras)

setCloudActorMap()

void pcl::visualization::PCLVisualizerInteractorStyle::setCloudActorMap ( const CloudActorMapPtr & actors )
inline

Pass a pointer to the cloud actor map.

Parameters
[in] actors the actor map that will be used with this style

Definition at line 136 of file interactor_style.h.

setKeyboardModifier()

void pcl::visualization::PCLVisualizerInteractorStyle::setKeyboardModifier ( const InteractorKeyboardModifier & modifier )
inline

Change the default keyboard modified from ALT to a different special key.

Allowed values are:

  • INTERACTOR_KB_MOD_ALT
  • INTERACTOR_KB_MOD_CTRL
  • INTERACTOR_KB_MOD_SHIFT
    Parameters
    [in] modifier the new keyboard modifier

Definition at line 256 of file interactor_style.h.

setRendererCollection()

void pcl::visualization::PCLVisualizerInteractorStyle::setRendererCollection ( vtkSmartPointer< vtkRendererCollection > & rens )
inline

Pass a set of renderers to the interactor style.

Parameters
[in] rens the vtkRendererCollection to use

Definition at line 156 of file interactor_style.h.

setRenderWindow()

void pcl::visualization::PCLVisualizerInteractorStyle::setRenderWindow ( const vtkSmartPointer< vtkRenderWindow > & win )
inlineprotected

Set render window.

Definition at line 361 of file interactor_style.h.

setShapeActorMap()

void pcl::visualization::PCLVisualizerInteractorStyle::setShapeActorMap ( const ShapeActorMapPtr & actors )
inline

Pass a pointer to the shape actor map.

Parameters
[in] actors the actor map that will be used with this style

Definition at line 142 of file interactor_style.h.

setUseVbos()

void pcl::visualization::PCLVisualizerInteractorStyle::setUseVbos ( const bool use_vbos )
inline

Use Vertex Buffer Objects renderers.

This is an optimization for the obsolete OpenGL backend. Modern OpenGL2 backend (VTK ≥ 6.3) uses vertex buffer objects by default, transparently for the user.

Parameters
[in] use_vbos set to true to use VBOs

Definition at line 164 of file interactor_style.h.

vtkTypeMacro()

pcl::visualization::PCLVisualizerInteractorStyle::vtkTypeMacro ( PCLVisualizerInteractorStyle ,
vtkInteractorStyleRubberBandPick
)

zoomIn()

void pcl::visualization::PCLVisualizerInteractorStyle::zoomIn ( )
protected

Interactor style internal method.

Zoom in.

zoomOut()

void pcl::visualization::PCLVisualizerInteractorStyle::zoomOut ( )
protected

Interactor style internal method.

Zoom out.

Friends And Related Function Documentation

PCLVisualizer

friend class PCLVisualizer
friend

Definition at line 387 of file interactor_style.h.

PointPickingCallback

friend class PointPickingCallback
friend

Definition at line 386 of file interactor_style.h.

Member Data Documentation

area_picking_signal_

boost::signals2::signal<void (const pcl::visualization::AreaPickingEvent&)> pcl::visualization::PCLVisualizerInteractorStyle::area_picking_signal_
protected

Definition at line 306 of file interactor_style.h.

camera_

Camera pcl::visualization::PCLVisualizerInteractorStyle::camera_
protected

A pcl::visualization::Camera for camera parameter saving/restoring.

Definition at line 378 of file interactor_style.h.

camera_file_

std::string pcl::visualization::PCLVisualizerInteractorStyle::camera_file_
protected

Camera file for camera parameter saving/restoring.

Definition at line 376 of file interactor_style.h.

camera_saved_

bool pcl::visualization::PCLVisualizerInteractorStyle::camera_saved_
protected

A pcl::visualization::Camera is saved or not.

Definition at line 380 of file interactor_style.h.

cloud_actors_

CloudActorMapPtr pcl::visualization::PCLVisualizerInteractorStyle::cloud_actors_
protected

Cloud actor map stored internally.

Definition at line 269 of file interactor_style.h.

grid_actor_

vtkSmartPointer<vtkLegendScaleActor> pcl::visualization::PCLVisualizerInteractorStyle::grid_actor_
protected

Actor for 2D grid on screen.

Definition at line 289 of file interactor_style.h.

grid_enabled_

bool pcl::visualization::PCLVisualizerInteractorStyle::grid_enabled_
protected

Set to true if the grid actor is enabled.

Definition at line 287 of file interactor_style.h.

init_

bool pcl::visualization::PCLVisualizerInteractorStyle::init_
protected

Set to true after initialization is complete.

Definition at line 263 of file interactor_style.h.

keyboard_signal_

boost::signals2::signal<void (const pcl::visualization::KeyboardEvent&)> pcl::visualization::PCLVisualizerInteractorStyle::keyboard_signal_
protected

Definition at line 304 of file interactor_style.h.

lut_actor_

vtkSmartPointer<vtkScalarBarActor> pcl::visualization::PCLVisualizerInteractorStyle::lut_actor_
protected

Actor for 2D lookup table on screen.

Definition at line 294 of file interactor_style.h.

lut_enabled_

bool pcl::visualization::PCLVisualizerInteractorStyle::lut_enabled_
protected

Set to true if the LUT actor is enabled.

Definition at line 292 of file interactor_style.h.

max_win_height_

int pcl::visualization::PCLVisualizerInteractorStyle::max_win_height_
protected

The maximum resizeable window width/height.

Definition at line 281 of file interactor_style.h.

max_win_width_

int pcl::visualization::PCLVisualizerInteractorStyle::max_win_width_
protected

Definition at line 281 of file interactor_style.h.

modifier_

InteractorKeyboardModifier pcl::visualization::PCLVisualizerInteractorStyle::modifier_
protected

The keyboard modifier to use.

Default: Alt.

Definition at line 373 of file interactor_style.h.

mouse_callback_

vtkSmartPointer<PointPickingCallback> pcl::visualization::PCLVisualizerInteractorStyle::mouse_callback_
protected

A VTK Mouse Callback object, used for point picking.

Definition at line 370 of file interactor_style.h.

mouse_signal_

boost::signals2::signal<void (const pcl::visualization::MouseEvent&)> pcl::visualization::PCLVisualizerInteractorStyle::mouse_signal_
protected

Definition at line 303 of file interactor_style.h.

point_picker_

vtkSmartPointer<vtkPointPicker> pcl::visualization::PCLVisualizerInteractorStyle::point_picker_
protected

Stores the point picker when switching to an area picker.

Definition at line 301 of file interactor_style.h.

point_picking_signal_

boost::signals2::signal<void (const pcl::visualization::PointPickingEvent&)> pcl::visualization::PCLVisualizerInteractorStyle::point_picking_signal_
protected

Definition at line 305 of file interactor_style.h.

rens_

vtkSmartPointer<vtkRendererCollection> pcl::visualization::PCLVisualizerInteractorStyle::rens_
protected

Collection of vtkRenderers stored internally.

Definition at line 266 of file interactor_style.h.

shape_actors_

ShapeActorMapPtr pcl::visualization::PCLVisualizerInteractorStyle::shape_actors_
protected

Shape map stored internally.

Definition at line 272 of file interactor_style.h.

snapshot_writer_

vtkSmartPointer<vtkPNGWriter> pcl::visualization::PCLVisualizerInteractorStyle::snapshot_writer_
protected

A PNG writer for screenshot captures.

Definition at line 297 of file interactor_style.h.

stereo_anaglyph_mask_default_

bool pcl::visualization::PCLVisualizerInteractorStyle::stereo_anaglyph_mask_default_
protected

True if we're using red-blue colors for anaglyphic stereo, false if magenta-green.

Definition at line 367 of file interactor_style.h.

use_vbos_

bool pcl::visualization::PCLVisualizerInteractorStyle::use_vbos_
protected

Boolean that holds whether or not to use the vtkVertexBufferObjectMapper.

Definition at line 284 of file interactor_style.h.

wif_

vtkSmartPointer<vtkWindowToImageFilter> pcl::visualization::PCLVisualizerInteractorStyle::wif_
protected

Internal window to image filter.

Needed by snapshot_writer_.

Definition at line 299 of file interactor_style.h.

win_

vtkSmartPointer<vtkRenderWindow> pcl::visualization::PCLVisualizerInteractorStyle::win_
protected

The render window.

Only used when interactor maybe not available

Definition at line 384 of file interactor_style.h.

win_height_

int pcl::visualization::PCLVisualizerInteractorStyle::win_height_
protected

The current window width/height.

Definition at line 275 of file interactor_style.h.

win_pos_x_

int pcl::visualization::PCLVisualizerInteractorStyle::win_pos_x_
protected

The current window position x/y.

Definition at line 278 of file interactor_style.h.

win_pos_y_

int pcl::visualization::PCLVisualizerInteractorStyle::win_pos_y_
protected

Definition at line 278 of file interactor_style.h.

win_width_

int pcl::visualization::PCLVisualizerInteractorStyle::win_width_
protected

Definition at line 275 of file interactor_style.h.


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

© 2009–2012, Willow Garage, Inc.
© 2012–, Open Perception, Inc.
Licensed under the BSD License.
https://pointclouds.org/documentation/classpcl_1_1visualization_1_1_p_c_l_visualizer_interactor_style.html