Roomba App  1.0
GLWidget Class Reference

A wrapper class for drawing 3D shapes in OpenGL. More...

#include <glWidget.hh>

Inheritance diagram for GLWidget:
Collaboration diagram for GLWidget:

Classes

struct  Dimensions
 Dimensions used in drawing. More...
 

Public Slots

void obstacleDataReady (const std::map< float, int > &lidarData)
 A slot to get a lidar data when the parser sent a signal that this data is ready. More...
 
void rightWheelDirection (const int &direction)
 A slot to get a right wheel spining direction. More...
 
void leftWheelDirection (const int &direction)
 A slot to get the left wheel spining direction. More...
 

Public Member Functions

 GLWidget (QWidget *parent)
 Construct a new GLWidget object. More...
 

Protected Member Functions

virtual void init () override
 Initialize the openGL widget. More...
 
virtual void draw () override
 Draw a content in the openGL widget. More...
 
virtual QString helpString () const override
 Construct a help string for the openGL widget. More...
 

Private Member Functions

void loadTexture (GLuint *texture, const std::string &path)
 Load a texture object. More...
 
void drawRobot ()
 Draw the robot shape. More...
 
void drawOneObstacle (GLfloat x, GLfloat y, GLfloat z, GLfloat color)
 Draw the one obstacle on (x, y, z) coordinates. More...
 
void _drawCube (GLfloat size, GLubyte R, GLubyte G, GLubyte B)
 Draw a cube shape. More...
 
void _drawCylinder (GLfloat radius, GLfloat height, GLubyte R, GLubyte G, GLubyte B, GLuint texture)
 Draw the cylinder shape with the texture on the top. More...
 

Private Attributes

QString _wheelTexturePath
 The path to the wheel texture file. More...
 
QString _robotTexturePath
 The path to the robot texture file. More...
 
int _rightWheelDirection = 0
 The right robot wheel spining direction. More...
 
int _leftWheelDirection = 0
 The left robot wheel spining direction. More...
 
std::vector< std::vector< float > > _obstacleCoordinates
 All obstacles coordinates in 3D space. More...
 
std::vector< float > _obstacleColors
 All obstacles colors. More...
 
struct GLWidget::Dimensions _dimensions
 

Detailed Description

Definition at line 25 of file glWidget.hh.

Constructor & Destructor Documentation

◆ GLWidget()

GLWidget::GLWidget ( QWidget *  parent)
Parameters
[in,out]parentA pointer to the parent object.

Definition at line 27 of file glWidget.cpp.

Member Function Documentation

◆ _drawCube()

void GLWidget::_drawCube ( GLfloat  size,
GLubyte  R,
GLubyte  G,
GLubyte  B 
)
private
Parameters
[in]sizeA cube size.
[in]RA red color value [0-255].
[in]GA green color value [0-255].
[in]BA blue color value [0-255].

Definition at line 186 of file glWidget.cpp.

Here is the caller graph for this function:

◆ _drawCylinder()

void GLWidget::_drawCylinder ( GLfloat  radius,
GLfloat  height,
GLubyte  R,
GLubyte  G,
GLubyte  B,
GLuint  texture 
)
private
Parameters
[in]radiusThe cylinder radius value.
[in]heightThe cylinder height value.
[in]RA red color value [0-255].
[in]GA green color value [0-255].
[in]BA blue color value [0-255].
[in]textureThe texture to draw on the top on the cylinder.

Definition at line 233 of file glWidget.cpp.

Here is the caller graph for this function:

◆ draw()

void GLWidget::draw ( )
overrideprotectedvirtual

Definition at line 73 of file glWidget.cpp.

Here is the call graph for this function:

◆ drawOneObstacle()

void GLWidget::drawOneObstacle ( GLfloat  x,
GLfloat  y,
GLfloat  z,
GLfloat  color 
)
private
Parameters
[in]xCoordinate on the x axis.
[in]yCoordinate on the y axis.
[in]zCoordinate on the z axis.
[in]colorThe obstacle color.

Definition at line 177 of file glWidget.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ drawRobot()

void GLWidget::drawRobot ( )
private

Wrapper function for drawing whole the robot shape from a cylinder shapes.

Definition at line 152 of file glWidget.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ helpString()

QString GLWidget::helpString ( ) const
overrideprotectedvirtual
Returns
A string with help.

Definition at line 109 of file glWidget.cpp.

◆ init()

void GLWidget::init ( )
overrideprotectedvirtual

Definition at line 92 of file glWidget.cpp.

Here is the call graph for this function:

◆ leftWheelDirection

void GLWidget::leftWheelDirection ( const int &  direction)
slot
Parameters
[in]directionThe wheel spining direction.

Definition at line 68 of file glWidget.cpp.

Here is the caller graph for this function:

◆ loadTexture()

void GLWidget::loadTexture ( GLuint *  texture,
const std::string &  path 
)
private

Loads the texture from given path to passed texture handle.

Parameters
[in,out]textureA texture handle.
[in]pathA path to a texture file.

Definition at line 132 of file glWidget.cpp.

Here is the caller graph for this function:

◆ obstacleDataReady

void GLWidget::obstacleDataReady ( const std::map< float, int > &  lidarData)
slot
Parameters
[in]lidarDataA lidar data from the frame parser.

Definition at line 33 of file glWidget.cpp.

Here is the caller graph for this function:

◆ rightWheelDirection

void GLWidget::rightWheelDirection ( const int &  direction)
slot
Parameters
[in]directionThe wheel spining direction.

Definition at line 63 of file glWidget.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ _dimensions

struct GLWidget::Dimensions GLWidget::_dimensions
private

◆ _leftWheelDirection

int GLWidget::_leftWheelDirection = 0
private

Definition at line 120 of file glWidget.hh.

◆ _obstacleColors

std::vector<float> GLWidget::_obstacleColors
private

Definition at line 122 of file glWidget.hh.

◆ _obstacleCoordinates

std::vector<std::vector<float> > GLWidget::_obstacleCoordinates
private

Definition at line 121 of file glWidget.hh.

◆ _rightWheelDirection

int GLWidget::_rightWheelDirection = 0
private

Definition at line 119 of file glWidget.hh.

◆ _robotTexturePath

QString GLWidget::_robotTexturePath
private

Definition at line 118 of file glWidget.hh.

◆ _wheelTexturePath

QString GLWidget::_wheelTexturePath
private

Definition at line 117 of file glWidget.hh.


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