Helios++
Helios software for LiDAR simulations
VHSimpleCanvas.h
1 #ifdef PCL_BINDING
2 
3 #include <memory>
4 #include <vector>
5 
6 #include <visualhelios/VHNormalsCanvas.h>
7 #include <visualhelios/adapters/VHDynObjectXYZRGBAdapter.h>
8 
9 namespace visualhelios{
10 
11 using std::shared_ptr;
12 using std::vector;
13 
21 protected:
22  // *** ATTRIBUTES *** //
23  // ******************** //
31  vector<shared_ptr<VHDynObjectXYZRGBAdapter>> dynObjs;
43  std::function<void(
44  vector<shared_ptr<VHDynObjectXYZRGBAdapter>>
46 
47 public:
48  // *** CONSTRUCTION / DESTRUCTION *** //
49  // ************************************ //
54  VHSimpleCanvas() : VHSimpleCanvas("Visual Helios simple canvas") {}
61  VHSimpleCanvas(string const title);
62  virtual ~VHSimpleCanvas() = default;
63 
64 protected:
65  // *** CANVAS METHODS *** //
66  // ************************ //
70  void configure() override;
74  void start() override;
78  void update() override;
79 
80  // *** NORMALS RENDERING METHODS *** //
81  // ************************************ //
86  void renderNormals(VHStaticObjectAdapter & staticObj) override;
91  void unrenderAllNormals() override;
92 
93 public:
94  // *** GETTERS and SETTERS *** //
95  // ***************************** //
101  inline void appendDynObj(shared_ptr<VHDynObjectXYZRGBAdapter> dynObj)
102  {dynObjs.push_back(dynObj);}
108  inline VHDynObjectAdapter const & getDynObj(size_t index) const
109  {return *dynObjs[index];}
115  inline void setDynObj(
116  size_t index,
117  shared_ptr<VHDynObjectXYZRGBAdapter> dynObj
118  )
119  {dynObjs[index] = dynObj;}
123  inline void clearDynObjs()
124  {dynObjs.clear();}
131  std::function<void(
132  vector<shared_ptr<VHDynObjectXYZRGBAdapter>>
133  )> const dynamicUpdateFunction
134  ){this->dynamicUpdateFunction = dynamicUpdateFunction;}
135 };
136 
137 }
138 
139 #endif
string const title
The title of the visual Helios canvas.
Definition: VHCanvas.h:36
Abstract class defining core mechanisms to adapt dynamic objects to the visual Helios context based o...
Definition: VHDynObjectAdapter.h:18
Abstract class providing some behaviors and defining the interface for all canvas which deal with nor...
Definition: VHNormalsCanvas.h:16
Visual Helios Simple Canvas is a class which supports rendering polygon meshes which are updated over...
Definition: VHSimpleCanvas.h:20
VHDynObjectAdapter const & getDynObj(size_t index) const
Obtain a dynamic object from simple canvas.
Definition: VHSimpleCanvas.h:108
void configure() override
Definition: VHSimpleCanvas.cpp:19
void renderNormals(VHStaticObjectAdapter &staticObj) override
Render normals for each primitive of given static object.
Definition: VHSimpleCanvas.cpp:78
void start() override
Definition: VHSimpleCanvas.cpp:27
void appendDynObj(shared_ptr< VHDynObjectXYZRGBAdapter > dynObj)
Append a dynamic object to the simple canvas.
Definition: VHSimpleCanvas.h:101
void setDynamicUpdateFunction(std::function< void(vector< shared_ptr< VHDynObjectXYZRGBAdapter >>)> const dynamicUpdateFunction)
Set the dynamic update function.
Definition: VHSimpleCanvas.h:130
void update() override
Definition: VHSimpleCanvas.cpp:54
vector< shared_ptr< VHDynObjectXYZRGBAdapter > > dynObjs
The dynamic objects that must be rendered by the simple canvas.
Definition: VHSimpleCanvas.h:31
void setDynObj(size_t index, shared_ptr< VHDynObjectXYZRGBAdapter > dynObj)
Replace a dynamic object in simple canvas.
Definition: VHSimpleCanvas.h:115
void clearDynObjs()
Remove all dynamic objects from simple canvas.
Definition: VHSimpleCanvas.h:123
VHSimpleCanvas()
Default constructor for the visual Helios simple canvas.
Definition: VHSimpleCanvas.h:54
std::function< void(vector< shared_ptr< VHDynObjectXYZRGBAdapter >>)> dynamicUpdateFunction
Function to define dynamic objects behavior before updating the canvas.
Definition: VHSimpleCanvas.h:45
void unrenderAllNormals() override
Remove all rendered normals.
Definition: VHSimpleCanvas.cpp:119
Abstract class defining core mechanisms to adapt static objects to the visual Helios context based on...
Definition: VHStaticObjectAdapter.h:25