OpenGL widget to display sensor data and the 3D world model. More...
#include <SensorDataGLWidget.h>
Public Slots | |
void | followNode (const QString &nodeName) |
Process ingoing messages. | |
void | performCameraMove () |
Performs a 360 degree camera move around the robot. | |
void | setBgColor (float r, float g, float b, float a=0.0) |
Set clear color. | |
void | setCameraRotation (float rotationY, float rotationZ) |
set camera rotation relative to look-at node [deg] | |
void | setLookAt (BaseLib::Math::Vec3d lookAt) |
Public Member Functions | |
void | addPainter (PainterPlugin *painter) |
PainterPlugin * | getPainter (std::string p) |
SensorDataGLWidget (QWidget *parent=0) | |
~SensorDataGLWidget () | |
Protected Member Functions | |
void | initializeGL () |
This method enables the OpenGL features that are used by the widget and sets the initial perspective. It is called by Qt once while creating the widget. | |
virtual QSize | minimumSizeHint () const |
void | mouseMoveEvent (QMouseEvent *event) |
void | mousePressEvent (QMouseEvent *event) |
void | paintGL () |
void | resizeGL (int w, int h) |
virtual QSize | sizeHint () const |
void | wheelEvent (QWheelEvent *event) |
Private Member Functions | |
void | setProjectionMatrix () |
Private Attributes | |
float | m_CameraDistance |
bool | m_CameraImageMode |
float | m_CameraOpeningAngle |
float | m_CameraRotationY |
float | m_CameraRotationZ |
Camera Position relative to LookAt point (degrees / mm) | |
int | m_CameraTurning |
float | m_CameraTurnStartTime |
variables used for camera turn | |
bool | m_ForceRedraw |
BaseLib::Math::Vec3d | m_LookAt |
Look-At coordinates relative to LookAtNode. | |
std::string | m_LookAtNode |
Node in SceneGraph to follow. | |
QPoint | m_MousePosOld |
the position of the mouse when a button is pressed. | |
std::list< PainterPlugin * > | m_Painters |
std::map< std::string, PainterPlugin * > | m_PaintersMap |
QTimer * | m_RedrawTimer |
bool | m_SceneGraphInitialized |
int | m_ViewportHeight |
int | m_ViewportWidth |
Static Private Attributes | |
static int | WidgetCounter |
OpenGL widget to display sensor data and the 3D world model.
Definition at line 37 of file SensorDataGLWidget.h.
SensorDataGLWidget::SensorDataGLWidget | ( | QWidget * | parent = 0 | ) |
The constructor initializes all member variables with meaningful values and gives the given parent to the constructor of the base class.
parent | Pointer to the parent-widget. |
The destructor deletes all dynamically allocated memory.
void SensorDataGLWidget::addPainter | ( | PainterPlugin * | painter | ) |
void SensorDataGLWidget::followNode | ( | const QString & | nodeName | ) | [slot] |
Process ingoing messages.
attach the camera to this node
PainterPlugin* SensorDataGLWidget::getPainter | ( | std::string | p | ) | [inline] |
Definition at line 58 of file SensorDataGLWidget.h.
void SensorDataGLWidget::initializeGL | ( | ) | [protected] |
This method enables the OpenGL features that are used by the widget and sets the initial perspective. It is called by Qt once while creating the widget.
virtual QSize SensorDataGLWidget::minimumSizeHint | ( | ) | const [protected, virtual] |
void SensorDataGLWidget::mouseMoveEvent | ( | QMouseEvent * | event | ) | [protected] |
This event is caught by the widget to implement zooming and changing the view angle by dragging the mouse. The pressed button is checked and the zoom or the view angle are changed according to the distance the mouse was moved. It is only used if the left or the right mouse button is pressed.
event | The event that Qt gives to this widget when the mouse is moving across this widget. |
void SensorDataGLWidget::mousePressEvent | ( | QMouseEvent * | event | ) | [protected] |
When the widget receives this event, the mouse position is saved to enable zooming and tilting with moving the mouse.
event | The event that Qt gives to this widget when a mouse button was pressed above this widget. |
void SensorDataGLWidget::paintGL | ( | ) | [protected] |
This is the main painting method of the widget. It is automatically called by Qt when the window has to be drawn. It is also called when incoming messages (by the message receive slot) change the data that is displayed. The method calls the other painting methods (i.e. paintSonarData(), paintRobot(), ...) if the corresponding switches (m_PaintSonarData, m_PaintRobot) are set to true.
void SensorDataGLWidget::performCameraMove | ( | ) | [slot] |
Performs a 360 degree camera move around the robot.
deltaPhi | defines the angle wich the camera is turned by per step. |
void SensorDataGLWidget::resizeGL | ( | int | w, |
int | h | ||
) | [protected] |
This method is automatically called by Qt when the widget was resized. It re-sets the perspective, so that everything looks fine.
w | new width of the widget (given by Qt) |
h | new height of the widget (given by Qt) |
void SensorDataGLWidget::setBgColor | ( | float | r, |
float | g, | ||
float | b, | ||
float | a = 0.0 |
||
) | [slot] |
Set clear color.
void SensorDataGLWidget::setCameraRotation | ( | float | rotationY, |
float | rotationZ | ||
) | [slot] |
set camera rotation relative to look-at node [deg]
void SensorDataGLWidget::setLookAt | ( | BaseLib::Math::Vec3d | lookAt | ) | [slot] |
void SensorDataGLWidget::setProjectionMatrix | ( | ) | [private] |
virtual QSize SensorDataGLWidget::sizeHint | ( | ) | const [protected, virtual] |
void SensorDataGLWidget::wheelEvent | ( | QWheelEvent * | event | ) | [protected] |
This event is used to manipulate the z-position (zoom) of the camera.
event | The event that Qt gives to this widget when the scroll wheel of the mouse was turned above this widget. |
float SensorDataGLWidget::m_CameraDistance [private] |
Definition at line 152 of file SensorDataGLWidget.h.
bool SensorDataGLWidget::m_CameraImageMode [private] |
Definition at line 169 of file SensorDataGLWidget.h.
float SensorDataGLWidget::m_CameraOpeningAngle [private] |
Definition at line 154 of file SensorDataGLWidget.h.
float SensorDataGLWidget::m_CameraRotationY [private] |
Definition at line 151 of file SensorDataGLWidget.h.
float SensorDataGLWidget::m_CameraRotationZ [private] |
Camera Position relative to LookAt point (degrees / mm)
Definition at line 150 of file SensorDataGLWidget.h.
int SensorDataGLWidget::m_CameraTurning [private] |
Definition at line 158 of file SensorDataGLWidget.h.
float SensorDataGLWidget::m_CameraTurnStartTime [private] |
variables used for camera turn
Definition at line 157 of file SensorDataGLWidget.h.
bool SensorDataGLWidget::m_ForceRedraw [private] |
Definition at line 174 of file SensorDataGLWidget.h.
BaseLib::Math::Vec3d SensorDataGLWidget::m_LookAt [private] |
Look-At coordinates relative to LookAtNode.
Definition at line 147 of file SensorDataGLWidget.h.
std::string SensorDataGLWidget::m_LookAtNode [private] |
Node in SceneGraph to follow.
Definition at line 144 of file SensorDataGLWidget.h.
QPoint SensorDataGLWidget::m_MousePosOld [private] |
the position of the mouse when a button is pressed.
Definition at line 162 of file SensorDataGLWidget.h.
std::list<PainterPlugin*> SensorDataGLWidget::m_Painters [private] |
Definition at line 166 of file SensorDataGLWidget.h.
std::map<std::string, PainterPlugin*> SensorDataGLWidget::m_PaintersMap [private] |
Definition at line 167 of file SensorDataGLWidget.h.
QTimer* SensorDataGLWidget::m_RedrawTimer [private] |
Definition at line 159 of file SensorDataGLWidget.h.
bool SensorDataGLWidget::m_SceneGraphInitialized [private] |
Definition at line 141 of file SensorDataGLWidget.h.
int SensorDataGLWidget::m_ViewportHeight [private] |
Definition at line 172 of file SensorDataGLWidget.h.
int SensorDataGLWidget::m_ViewportWidth [private] |
Definition at line 171 of file SensorDataGLWidget.h.
int SensorDataGLWidget::WidgetCounter [static, private] |
Definition at line 176 of file SensorDataGLWidget.h.