Helios++
Helios software for LiDAR simulations
visualhelios::VHSimpleCanvas Class Reference

Visual Helios Simple Canvas is a class which supports rendering polygon meshes which are updated over time. More...

#include <VHSimpleCanvas.h>

Inheritance diagram for visualhelios::VHSimpleCanvas:
Collaboration diagram for visualhelios::VHSimpleCanvas:

Public Member Functions

 VHSimpleCanvas ()
 Default constructor for the visual Helios simple canvas. More...
 
 VHSimpleCanvas (string const title)
 Constructor for the visual Helios simple canvas which allows for title specification. More...
 
void appendDynObj (shared_ptr< VHDynObjectXYZRGBAdapter > dynObj)
 Append a dynamic object to the simple canvas. More...
 
VHDynObjectAdapter const & getDynObj (size_t index) const
 Obtain a dynamic object from simple canvas. More...
 
void setDynObj (size_t index, shared_ptr< VHDynObjectXYZRGBAdapter > dynObj)
 Replace a dynamic object in simple canvas. More...
 
void clearDynObjs ()
 Remove all dynamic objects from simple canvas.
 
void setDynamicUpdateFunction (std::function< void(vector< shared_ptr< VHDynObjectXYZRGBAdapter >>)> const dynamicUpdateFunction)
 Set the dynamic update function. More...
 
- Public Member Functions inherited from visualhelios::VHNormalsCanvas
 VHNormalsCanvas ()
 Default constructor for the visual Helios normals canvas. More...
 
 VHNormalsCanvas (string const title, bool const normalsKeyboardCallbackEnabled=true, bool const normalsUsageTextEnabled=true, bool const renderingNormals=true, float const normalMagnitude=1.0)
 Main constructor for the visual helios normals canvas which allows for title specification, flags specification and normal magnitude specification too. More...
 
virtual bool isRenderingNormals () const
 Check whether the normals canvas is rendering normals or not. More...
 
virtual void setRenderingNormals (bool const renderingNormals)
 Enable or disable normals rendering. More...
 
virtual float getNormalMagnitude () const
 Obtain the magnitude for normal vectors visualization. More...
 
virtual void setNormalMagnitude (float const normalMagnitude)
 Set the magnitude for normal vectors visualization. More...
 
virtual bool isNormalsKeyboardCallbackEnabled () const
 Check whether normals keyboard callback is enabled (true) or not (false) More...
 
virtual bool isNormalsUsageTextEnabled () const
 Check whether normals usage text is enabled (true) or not (false) More...
 
virtual float const * getNormalDefColor () const
 Return the default color for normals visualization. More...
 
virtual void setNormalDefColor (float const color[3])
 Set the default color for normals visualization. More...
 
virtual void setNormalDefColor (float const r, float const g, float const b)
 Set the default color for normals visualization. More...
 
- Public Member Functions inherited from visualhelios::VHDynCanvas
 VHDynCanvas ()
 Default constructor for the visual Helios dynamic canvas. More...
 
 VHDynCanvas (string const title)
 Constructor for the visual Helios dynamic canvas which allows for title specification. More...
 
virtual bool isNeedingUpdate () const
 Check whether the dynamic canvas needs an update no matter what (true) or not (false) More...
 
virtual void setNeedsUpdate (bool const needsUpdate)
 Specify if the dynamic canvas needs an update no matter what (true) or not (false) More...
 
- Public Member Functions inherited from visualhelios::VHCanvas
 VHCanvas ()
 Default constructor for the visual helios canvas.
 
 VHCanvas (string const title)
 Constructor for the visual helios canvas which allows for title specification. More...
 
virtual void show ()
 Make the visualization effective.
 
int getTimeBetweenUpdates () const
 Obtain milliseconds between canvas updates. More...
 
void setTimeBetweenUpdates (int const timeBetweenUpdates)
 Set the milliseconds between canvas updates. More...
 
bool isForceRedraw () const
 Check if force redraw is enabled or not. More...
 
void setForceRedraw (bool const forceRedraw)
 Enable or disable force redraw. More...
 
string const & getTitle () const
 Obtain the visual helios canvas title. More...
 

Protected Member Functions

void configure () override
 
void start () override
 
void update () override
 
void renderNormals (VHStaticObjectAdapter &staticObj) override
 Render normals for each primitive of given static object. More...
 
void unrenderAllNormals () override
 Remove all rendered normals. More...
 
- Protected Member Functions inherited from visualhelios::VHNormalsCanvas
virtual void registerNormalsKeyboardCallback ()
 Register the keyboard callback to toggle normals rendering on/off. More...
 
virtual void addKeyboardCallbackUsageText ()
 Render text explaining how to use the normals keyboard callback. More...
 
- Protected Member Functions inherited from visualhelios::VHDynCanvas
void postUpdate () override
 Defines the default post update behavior for dynamic canvas and derived classes. More...
 
- Protected Member Functions inherited from visualhelios::VHCanvas
virtual void onStop ()
 Method to handle the behavior of the canvas after visualization has finished.
 

Protected Attributes

vector< shared_ptr< VHDynObjectXYZRGBAdapter > > dynObjs
 The dynamic objects that must be rendered by the simple canvas. More...
 
std::function< void(vector< shared_ptr< VHDynObjectXYZRGBAdapter >>)> dynamicUpdateFunction
 Function to define dynamic objects behavior before updating the canvas. More...
 
- Protected Attributes inherited from visualhelios::VHNormalsCanvas
bool normalsKeyboardCallbackEnabled
 Specify if the keyboard callback to toggle normals visualization is enabled (true) or not (false)
 
bool normalsUsageTextEnabled
 Specify if the normals keyboard callback usage text is enabled (true) or not (false)
 
bool renderingNormals
 Specify if the normals canvas must render normals (true) or not (false)
 
float normalMagnitude
 Specify the magnitude of normal vector for visualization.
 
float normalDefColor [3]
 Default color for normals in RGB format with components in \([0, 1]\).
 
- Protected Attributes inherited from visualhelios::VHDynCanvas
bool needsUpdate = false
 Control whether an update is needed even when dynamic objects themselves have not been updated (true) or not (false)
 
- Protected Attributes inherited from visualhelios::VHCanvas
string const title
 The title of the visual Helios canvas.
 
PCLVisualizer::Ptr viewer
 The PCL visualizer which is used to render graphics.
 
int timeBetweenUpdates
 How many milliseconds must elapsed between canvas updates.
 
bool forceRedraw
 Force redraw even when it is not required if true. Try to avoid unnecessary redraws if false.
 

Detailed Description

Visual Helios Simple Canvas is a class which supports rendering polygon meshes which are updated over time.

Author
Alberto M. Esmoris Pena
Version
1.0

Constructor & Destructor Documentation

◆ VHSimpleCanvas() [1/2]

visualhelios::VHSimpleCanvas::VHSimpleCanvas ( )
inline

Default constructor for the visual Helios simple canvas.

See also
visualhelios::VHNormalsCanvas::VHNormalsCanvas

◆ VHSimpleCanvas() [2/2]

VHSimpleCanvas::VHSimpleCanvas ( string const  title)

Constructor for the visual Helios simple canvas which allows for title specification.

Parameters
titleTitle for the visualizer
See also
visualhelios::VHNormalCanvas::VHNormalCanvas(string const)

Member Function Documentation

◆ appendDynObj()

void visualhelios::VHSimpleCanvas::appendDynObj ( shared_ptr< VHDynObjectXYZRGBAdapter dynObj)
inline

Append a dynamic object to the simple canvas.

Parameters
dynObjDynamic object to be appended
See also
VHSimpleCanvas::dynObjs

◆ configure()

void VHSimpleCanvas::configure ( )
overrideprotectedvirtual

◆ getDynObj()

VHDynObjectAdapter const& visualhelios::VHSimpleCanvas::getDynObj ( size_t  index) const
inline

Obtain a dynamic object from simple canvas.

Parameters
indexIndex of dynamic object to be obtained
Returns
Dynamic object from simple canvas

◆ renderNormals()

void VHSimpleCanvas::renderNormals ( VHStaticObjectAdapter staticObj)
overrideprotectedvirtual

Render normals for each primitive of given static object.

See also
visualhelios::VHNormalsCanvas::renderNormals

Implements visualhelios::VHNormalsCanvas.

◆ setDynamicUpdateFunction()

void visualhelios::VHSimpleCanvas::setDynamicUpdateFunction ( std::function< void(vector< shared_ptr< VHDynObjectXYZRGBAdapter >>)> const  dynamicUpdateFunction)
inline

Set the dynamic update function.

Parameters
dynamicUpdateFunctionThe dynamic update function
See also
visualhelios::VHSimpleCanvas::dynamicUpdateFunction

◆ setDynObj()

void visualhelios::VHSimpleCanvas::setDynObj ( size_t  index,
shared_ptr< VHDynObjectXYZRGBAdapter dynObj 
)
inline

Replace a dynamic object in simple canvas.

Parameters
indexIndex of dynamic object to be replaced
dynObjDynamic object to replace with

◆ start()

void VHSimpleCanvas::start ( )
overrideprotectedvirtual

◆ unrenderAllNormals()

void VHSimpleCanvas::unrenderAllNormals ( )
overrideprotectedvirtual

Remove all rendered normals.

See also
visualhelios::VHNormalsCanvas::unrenderAllNormals

Implements visualhelios::VHNormalsCanvas.

◆ update()

void VHSimpleCanvas::update ( )
overrideprotectedvirtual
See also
VHNormalsCanvas::update

Reimplemented from visualhelios::VHCanvas.

Member Data Documentation

◆ dynamicUpdateFunction

std::function<void( vector<shared_ptr<VHDynObjectXYZRGBAdapter>> )> visualhelios::VHSimpleCanvas::dynamicUpdateFunction
protected

Function to define dynamic objects behavior before updating the canvas.

It can be used to populate the motion queues or any other required manipulation over dynamic objects.

Simple canvas does not rely on components which update the dynamic object outside the canvas scope, so any implementation to define the behavior of dynamic objects must be done through this ad-hoc function

◆ dynObjs

vector<shared_ptr<VHDynObjectXYZRGBAdapter> > visualhelios::VHSimpleCanvas::dynObjs
protected

The dynamic objects that must be rendered by the simple canvas.

See also
VHSimpleCanvas::appendDynObj
VHSimpleCanvas::getDynObj
VHSimpleCanvas::setDynObj
VHSimpleCanvas::clearDynObjs

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