Helios++
Helios software for LiDAR simulations
VHNormalsCanvas.h
1 #ifdef PCL_BINDING
2 
3 #pragma once
4 
5 #include <visualhelios/VHDynCanvas.h>
6 #include <visualhelios/adapters/VHStaticObjectAdapter.h>
7 
8 namespace visualhelios{
9 
17 protected:
18  // *** ATTRIBUTES *** //
19  // ******************** //
43  float normalDefColor[3];
44 
45 public:
46  // *** CONSTRUCTION / DESTRUCTION *** //
47  // ************************************ //
52  VHNormalsCanvas() : VHNormalsCanvas("Visual Helios normals canvas") {}
64  string const title,
65  bool const normalsKeyboardCallbackEnabled=true,
66  bool const normalsUsageTextEnabled=true,
67  bool const renderingNormals=true,
68  float const normalMagnitude=1.0
69  );
70  virtual ~VHNormalsCanvas () = default;
71 
72 protected:
73  // *** CANVAS METHODS *** //
74  // ************************ //
78  void configure() override;
82  void start() override;
83 
84  // *** NORMALS RENDERING METHODS *** //
85  // *********************************** //
92  virtual void renderNormals(VHStaticObjectAdapter & dynObj) = 0;
98  virtual void unrenderAllNormals() = 0;
105  virtual void registerNormalsKeyboardCallback();
111  virtual void addKeyboardCallbackUsageText();
112 
113 public:
114  // *** GETTERs and SETTERs *** //
115  // ***************************** //
121  virtual inline bool isRenderingNormals() const {return renderingNormals;}
128  virtual inline void setRenderingNormals(bool const renderingNormals)
129  {this->renderingNormals = renderingNormals;}
135  virtual inline float getNormalMagnitude() const {return normalMagnitude;}
141  virtual inline void setNormalMagnitude(float const normalMagnitude)
142  {this->normalMagnitude = normalMagnitude;}
148  virtual inline bool isNormalsKeyboardCallbackEnabled() const
154  virtual inline bool isNormalsUsageTextEnabled() const
155  {return normalsUsageTextEnabled;}
161  virtual inline float const * getNormalDefColor() const
162  {return normalDefColor;}
168  virtual inline void setNormalDefColor(float const color[3])
169  {for(size_t i = 0 ; i < 3 ; ++i) normalDefColor[i] = color[i];}
176  virtual inline void setNormalDefColor(
177  float const r, float const g, float const b
178  ){
179  normalDefColor[0] = r;
180  normalDefColor[1] = g;
181  normalDefColor[2] = b;
182  }
183 
184 };
185 
186 }
187 
188 #endif
string const title
The title of the visual Helios canvas.
Definition: VHCanvas.h:36
Visual Helios Dynamic Canvas is a class which provides the basis layer to deal with dynamic objects r...
Definition: VHDynCanvas.h:15
Abstract class providing some behaviors and defining the interface for all canvas which deal with nor...
Definition: VHNormalsCanvas.h:16
virtual void unrenderAllNormals()=0
Remove all rendered normals. This method implementation must be provided by concrete derived classes ...
virtual bool isNormalsUsageTextEnabled() const
Check whether normals usage text is enabled (true) or not (false)
Definition: VHNormalsCanvas.h:154
virtual void setRenderingNormals(bool const renderingNormals)
Enable or disable normals rendering.
Definition: VHNormalsCanvas.h:128
virtual void setNormalMagnitude(float const normalMagnitude)
Set the magnitude for normal vectors visualization.
Definition: VHNormalsCanvas.h:141
virtual float getNormalMagnitude() const
Obtain the magnitude for normal vectors visualization.
Definition: VHNormalsCanvas.h:135
virtual bool isRenderingNormals() const
Check whether the normals canvas is rendering normals or not.
Definition: VHNormalsCanvas.h:121
bool normalsKeyboardCallbackEnabled
Specify if the keyboard callback to toggle normals visualization is enabled (true) or not (false)
Definition: VHNormalsCanvas.h:24
virtual bool isNormalsKeyboardCallbackEnabled() const
Check whether normals keyboard callback is enabled (true) or not (false)
Definition: VHNormalsCanvas.h:148
virtual void setNormalDefColor(float const r, float const g, float const b)
Set the default color for normals visualization.
Definition: VHNormalsCanvas.h:176
virtual void addKeyboardCallbackUsageText()
Render text explaining how to use the normals keyboard callback.
Definition: VHNormalsCanvas.cpp:67
bool renderingNormals
Specify if the normals canvas must render normals (true) or not (false)
Definition: VHNormalsCanvas.h:34
virtual void setNormalDefColor(float const color[3])
Set the default color for normals visualization.
Definition: VHNormalsCanvas.h:168
virtual void registerNormalsKeyboardCallback()
Register the keyboard callback to toggle normals rendering on/off.
Definition: VHNormalsCanvas.cpp:46
float normalDefColor[3]
Default color for normals in RGB format with components in .
Definition: VHNormalsCanvas.h:43
void start() override
Definition: VHNormalsCanvas.cpp:35
virtual float const * getNormalDefColor() const
Return the default color for normals visualization.
Definition: VHNormalsCanvas.h:161
VHNormalsCanvas()
Default constructor for the visual Helios normals canvas.
Definition: VHNormalsCanvas.h:52
float normalMagnitude
Specify the magnitude of normal vector for visualization.
Definition: VHNormalsCanvas.h:38
bool normalsUsageTextEnabled
Specify if the normals keyboard callback usage text is enabled (true) or not (false)
Definition: VHNormalsCanvas.h:29
virtual void renderNormals(VHStaticObjectAdapter &dynObj)=0
Render normals for each primitive of given dynamic object. This method implementation must be provide...
void configure() override
Definition: VHNormalsCanvas.cpp:27
Abstract class defining core mechanisms to adapt static objects to the visual Helios context based on...
Definition: VHStaticObjectAdapter.h:25