Point Cloud Library (PCL)  1.9.1-dev
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
pcl::visualization::PCLVisualizerInteractorStyle Class Reference

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

#include <pcl/visualization/interactor_style.h>

+ Inheritance diagram for pcl::visualization::PCLVisualizerInteractorStyle:

Public Types

typedef boost::shared_ptr< CloudActorMapCloudActorMapPtr
 

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 (boost::function< void(const pcl::visualization::MouseEvent &)> cb)
 Register a callback function for mouse events. More...
 
boost::signals2::connection registerKeyboardCallback (boost::function< void(const pcl::visualization::KeyboardEvent &)> cb)
 Register a callback boost::function for keyboard events. More...
 
boost::signals2::connection registerPointPickingCallback (boost::function< void(const pcl::visualization::PointPickingEvent &)> cb)
 Register a callback function for point picking events. More...
 
boost::signals2::connection registerAreaPickingCallback (boost::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 PCLVisualizerInteractorStyleNew ()
 

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< PointPickingCallbackmouse_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:

Author
Radu B. Rusu

Definition at line 108 of file interactor_style.h.

Member Typedef Documentation

Definition at line 111 of file interactor_style.h.

Constructor & Destructor Documentation

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

Empty constructor.

Definition at line 116 of file interactor_style.h.

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

Empty destructor.

Definition at line 125 of file interactor_style.h.

Member Function Documentation

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

Get camera file for camera parameter saving/restoring.

Definition at line 245 of file interactor_style.h.

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

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

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

Get camera parameters from a string vector.

Parameters
[in]cameraA 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 ','
CloudActorMapPtr pcl::visualization::PCLVisualizerInteractorStyle::getCloudActorMap ( )
inline

Get the cloud actor map pointer.

Definition at line 148 of file interactor_style.h.

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

Get the cloud actor map pointer.

Definition at line 152 of file interactor_style.h.

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

Initialization routine.

Must be called before anything else.

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

Load camera parameters from a camera parameter file.

Parameters
[in]filethe name of the camera parameter file
static PCLVisualizerInteractorStyle* pcl::visualization::PCLVisualizerInteractorStyle::New ( )
static
void pcl::visualization::PCLVisualizerInteractorStyle::OnChar ( )
overrideprotected

Interactor style internal method.

Gets called whenever a key is pressed.

void pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnKeyUp ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnLeftButtonDown ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnLeftButtonUp ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnMiddleButtonDown ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnMiddleButtonUp ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnMouseMove ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnMouseWheelBackward ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnMouseWheelForward ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnRightButtonDown ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnRightButtonUp ( )
overrideprotected
void pcl::visualization::PCLVisualizerInteractorStyle::OnTimer ( )
overrideprotected

Interactor style internal method.

Gets called periodically if a timer is set.

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

Register a callback function for area picking events.

Parameters
[in]cba boost function that will be registered as a callback for a area picking event
Returns
a connection object that allows to disconnect the callback function.
boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerKeyboardCallback ( boost::function< void(const pcl::visualization::KeyboardEvent &)>  cb)

Register a callback boost::function for keyboard events.

Parameters
[in]cba boost function that will be registered as a callback for a keyboard event
Returns
a connection object that allows to disconnect the callback function.
boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerMouseCallback ( boost::function< void(const pcl::visualization::MouseEvent &)>  cb)

Register a callback function for mouse events.

Parameters
[in]cba boost function that will be registered as a callback for a mouse event
Returns
a connection object that allows to disconnect the callback function.
boost::signals2::connection pcl::visualization::PCLVisualizerInteractorStyle::registerPointPickingCallback ( boost::function< void(const pcl::visualization::PointPickingEvent &)>  cb)

Register a callback function for point picking events.

Parameters
[in]cba boost function that will be registered as a callback for a point picking event
Returns
a connection object that allows to disconnect the callback function.
bool pcl::visualization::PCLVisualizerInteractorStyle::saveCameraParameters ( const std::string &  file)

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

Parameters
[in]filethe name of the .cam file
void pcl::visualization::PCLVisualizerInteractorStyle::saveScreenshot ( const std::string &  file)

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

Parameters
[in]filethe name of the PNG file
void pcl::visualization::PCLVisualizerInteractorStyle::setCameraFile ( const std::string  file)
inline

Set camera file for camera parameter saving/restoring.

Parameters
[in]filethe name of the camera parameter file

Definition at line 238 of file interactor_style.h.

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]intrinsicsthe intrinsics that will be used to compute the VTK camera parameters
[in]extrinsicsthe extrinsics that will be used to compute the VTK camera parameters
[in]viewportthe viewport to modify camera of (0 modifies all cameras)
void pcl::visualization::PCLVisualizerInteractorStyle::setCameraParameters ( const Camera camera,
int  viewport = 0 
)

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

Parameters
[in]cameracamera structure containing all the camera parameters.
[in]viewportthe viewport to modify camera of (0 modifies all cameras)
void pcl::visualization::PCLVisualizerInteractorStyle::setCloudActorMap ( const CloudActorMapPtr actors)
inline

Pass a pointer to the cloud actor map.

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

Definition at line 138 of file interactor_style.h.

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]modifierthe new keyboard modifier

Definition at line 258 of file interactor_style.h.

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

Pass a set of renderers to the interactor style.

Parameters
[in]rensthe vtkRendererCollection to use

Definition at line 158 of file interactor_style.h.

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

Set render window.

Definition at line 363 of file interactor_style.h.

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

Pass a pointer to the shape actor map.

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

Definition at line 144 of file interactor_style.h.

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_vbosset to true to use VBOs

Definition at line 166 of file interactor_style.h.

pcl::visualization::PCLVisualizerInteractorStyle::vtkTypeMacro ( PCLVisualizerInteractorStyle  ,
vtkInteractorStyleRubberBandPick   
)
void pcl::visualization::PCLVisualizerInteractorStyle::zoomIn ( )
protected

Interactor style internal method.

Zoom in.

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

Interactor style internal method.

Zoom out.

Friends And Related Function Documentation

friend class PCLVisualizer
friend

Definition at line 389 of file interactor_style.h.

friend class PointPickingCallback
friend

Definition at line 388 of file interactor_style.h.

Member Data Documentation

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

Definition at line 308 of file interactor_style.h.

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

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

Definition at line 380 of file interactor_style.h.

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

Camera file for camera parameter saving/restoring.

Definition at line 378 of file interactor_style.h.

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

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

Definition at line 382 of file interactor_style.h.

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

Cloud actor map stored internally.

Definition at line 271 of file interactor_style.h.

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

Actor for 2D grid on screen.

Definition at line 291 of file interactor_style.h.

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

Set to true if the grid actor is enabled.

Definition at line 289 of file interactor_style.h.

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

Set to true after initialization is complete.

Definition at line 265 of file interactor_style.h.

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

Definition at line 306 of file interactor_style.h.

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

Actor for 2D lookup table on screen.

Definition at line 296 of file interactor_style.h.

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

Set to true if the LUT actor is enabled.

Definition at line 294 of file interactor_style.h.

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

The maximum resizeable window width/height.

Definition at line 283 of file interactor_style.h.

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

Definition at line 283 of file interactor_style.h.

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

The keyboard modifier to use.

Default: Alt.

Definition at line 375 of file interactor_style.h.

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

A VTK Mouse Callback object, used for point picking.

Definition at line 372 of file interactor_style.h.

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

Definition at line 305 of file interactor_style.h.

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

Stores the point picker when switching to an area picker.

Definition at line 303 of file interactor_style.h.

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

Definition at line 307 of file interactor_style.h.

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

Collection of vtkRenderers stored internally.

Definition at line 268 of file interactor_style.h.

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

Shape map stored internally.

Definition at line 274 of file interactor_style.h.

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

A PNG writer for screenshot captures.

Definition at line 299 of file interactor_style.h.

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

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

Boolean that holds whether or not to use the vtkVertexBufferObjectMapper.

Definition at line 286 of file interactor_style.h.

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

Internal window to image filter.

Needed by snapshot_writer_.

Definition at line 301 of file interactor_style.h.

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

The render window.

Only used when interactor maybe not available

Definition at line 386 of file interactor_style.h.

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

The current window width/height.

Definition at line 277 of file interactor_style.h.

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

The current window position x/y.

Definition at line 280 of file interactor_style.h.

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

Definition at line 280 of file interactor_style.h.

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

Definition at line 277 of file interactor_style.h.


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