#include <qtopengl_widget.h>

Inheritance diagram for argos::CQTOpenGLWidget:
Collaboration diagram for argos::CQTOpenGLWidget:

Classes

struct  SFrameGrabData
 Data regarding frame grabbing. More...
 
struct  SSelectionInfo
 Data arelated to robot selection. More...
 

Public Slots

void PlayExperiment ()
 Plays the experiment. More...
 
void FastForwardExperiment ()
 Fast forwards the experiment. More...
 
void PauseExperiment ()
 Pauses the experiment. More...
 
void StepExperiment ()
 Executes one experiment time step. More...
 
void ResetExperiment ()
 Resets the state of the experiment to its state right after initialization. More...
 
void SetDrawFrameEvery (int n_every)
 When fast-forwarding, sets every how many steps a frame must be drawn. More...
 
void SetGrabFrame (bool b_grab_on)
 Toggles frame grabbing. More...
 
void SetCamera (int n_camera)
 Sets the current camera in use. More...
 
void SetCameraFocalLength (double f_length)
 Sets the focal length of the current camera. More...
 
void KeyPressed (QKeyEvent *pc_event)
 Handles key press events. More...
 
void KeyReleased (QKeyEvent *pc_event)
 Handles key release events. More...
 

Signals

void StepDone (int n_step)
 Emitted whenever a time step has been executed. More...
 
void ExperimentDone ()
 Emitted when the experiment is finished. More...
 
void EntitySelected (CEntity *pc_entity)
 Emitted when an entity is selected. More...
 
void EntityDeselected (CEntity *pc_entity)
 Emitted when an entity is deselected. More...
 

Public Member Functions

 CQTOpenGLWidget (QWidget *pc_parent, CQTOpenGLMainWindow &c_main_window, CQTOpenGLUserFunctions &c_user_functions)
 Class constructor. More...
 
virtual ~CQTOpenGLWidget ()
 Class destructor. More...
 
virtual void initializeGL ()
 Called when the GL context must be initialized. More...
 
virtual void paintGL ()
 Logic for scene drawing. More...
 
CRay3 RayFromWindowCoord (int n_x, int n_y)
 Casts a ray from the given window coordinate. More...
 
CVector3 GetWindowCoordInWorld (int n_x, int n_y)
 Returns the position in the world corresponding to the given window coordinate. More...
 
CEntityGetSelectedEntity ()
 Returns the currently selected entity, or NULL if none is selected. More...
 
void SelectEntity (CEntity &c_entity)
 Selects the passed entity. More...
 
void DeselectEntity ()
 Deselects the currently selected entity. More...
 
void SelectInScene (UInt32 un_x, UInt32 un_y)
 Selects the entity closest to the camera at the given screen coordinates. More...
 
void DrawEntity (CPositionalEntity &c_entity)
 Draws a positional entity. More...
 
void DrawEntity (CEmbodiedEntity &c_entity)
 Draws an embodied entity. More...
 
void DrawRays (CControllableEntity &c_entity)
 Draws a ray. More...
 
void DrawBoundingBox (CEmbodiedEntity &c_entity)
 Draws the bounding box of an embodied entity. More...
 
virtual int heightForWidth (int w) const
 Called internally by Qt to set the aspect ratio. More...
 
virtual QSize sizeHint () const
 Called internally by Qt to know the preferred widget size. More...
 
virtual QSize minimumSize () const
 Called internally by Qt to know the minimum widget size. More...
 
CQTOpenGLUserFunctionsGetUserFunctions ()
 Returns a reference to the user functions. More...
 
CQTOpenGLCameraGetCamera ()
 Returns a reference to the camera. More...
 
SFrameGrabDataGetFrameGrabData ()
 Returns the current frame grabbing data. More...
 
void SetInvertMouse (bool b_InvertMouse)
 Sets whether the mouse should be inverted when moving. More...
 

Protected Member Functions

void DrawScene ()
 
void DrawArena ()
 
void DrawAxes ()
 
virtual void timerEvent (QTimerEvent *pc_event)
 
virtual void mousePressEvent (QMouseEvent *pc_event)
 
virtual void mouseReleaseEvent (QMouseEvent *pc_event)
 
virtual void mouseMoveEvent (QMouseEvent *pc_event)
 
virtual void keyPressEvent (QKeyEvent *pc_event)
 
virtual void keyReleaseEvent (QKeyEvent *pc_event)
 
virtual void resizeEvent (QResizeEvent *pc_event)
 
void reactToKeyEvent ()
 

Detailed Description

Definition at line 56 of file qtopengl_widget.h.

Constructor & Destructor Documentation

argos::CQTOpenGLWidget::CQTOpenGLWidget ( QWidget *  pc_parent,
CQTOpenGLMainWindow c_main_window,
CQTOpenGLUserFunctions c_user_functions 
)

Class constructor.

Parameters
pc_parentThe containing widget.
pc_main_windowA pointer to the main window.
c_user_functionsA reference to the main window.

Definition at line 38 of file qtopengl_widget.cpp.

argos::CQTOpenGLWidget::~CQTOpenGLWidget ( )
virtual

Class destructor.

Definition at line 76 of file qtopengl_widget.cpp.

Member Function Documentation

void argos::CQTOpenGLWidget::DeselectEntity ( )

Deselects the currently selected entity.

If no entity is selected, nothing is done.

Definition at line 331 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawArena ( )
protected

Definition at line 673 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawAxes ( )
protected

Definition at line 775 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawBoundingBox ( CEmbodiedEntity c_entity)

Draws the bounding box of an embodied entity.

Definition at line 428 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawEntity ( CPositionalEntity c_entity)

Draws a positional entity.

Definition at line 358 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawEntity ( CEmbodiedEntity c_entity)

Draws an embodied entity.

Definition at line 376 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawRays ( CControllableEntity c_entity)

Draws a ray.

Definition at line 394 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::DrawScene ( )
protected
void argos::CQTOpenGLWidget::EntityDeselected ( CEntity pc_entity)
signal

Emitted when an entity is deselected.

Parameters
Thedeselected entity
void argos::CQTOpenGLWidget::EntitySelected ( CEntity pc_entity)
signal

Emitted when an entity is selected.

Parameters
Theselected entity
void argos::CQTOpenGLWidget::ExperimentDone ( )
signal

Emitted when the experiment is finished.

An experiment can finish "naturally", when CSimulator::IsExperimentFinished() returns true; or "forcedly", when the user pressed the terminate button.

void argos::CQTOpenGLWidget::FastForwardExperiment ( )
slot

Fast forwards the experiment.

Internally sets a timer whose period is 1ms.

Definition at line 493 of file qtopengl_widget.cpp.

CQTOpenGLCamera& argos::CQTOpenGLWidget::GetCamera ( )
inline

Returns a reference to the camera.

Definition at line 212 of file qtopengl_widget.h.

SFrameGrabData& argos::CQTOpenGLWidget::GetFrameGrabData ( )
inline

Returns the current frame grabbing data.

Definition at line 219 of file qtopengl_widget.h.

CEntity * argos::CQTOpenGLWidget::GetSelectedEntity ( )

Returns the currently selected entity, or NULL if none is selected.

Returns
The currently selected entity.

Definition at line 297 of file qtopengl_widget.cpp.

CQTOpenGLUserFunctions& argos::CQTOpenGLWidget::GetUserFunctions ( )
inline

Returns a reference to the user functions.

Definition at line 205 of file qtopengl_widget.h.

CVector3 argos::CQTOpenGLWidget::GetWindowCoordInWorld ( int  n_x,
int  n_y 
)

Returns the position in the world corresponding to the given window coordinate.

Definition at line 255 of file qtopengl_widget.cpp.

virtual int argos::CQTOpenGLWidget::heightForWidth ( int  w) const
inlinevirtual

Called internally by Qt to set the aspect ratio.

Definition at line 184 of file qtopengl_widget.h.

void argos::CQTOpenGLWidget::initializeGL ( )
virtual

Called when the GL context must be initialized.

This happens once per runtime, either before the first call to resizeGL() or to paintGL().

Definition at line 90 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::KeyPressed ( QKeyEvent *  pc_event)
slot

Handles key press events.

Definition at line 581 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::keyPressEvent ( QKeyEvent *  pc_event)
protectedvirtual

Definition at line 905 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::KeyReleased ( QKeyEvent *  pc_event)
slot

Handles key release events.

Definition at line 627 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::keyReleaseEvent ( QKeyEvent *  pc_event)
protectedvirtual

Definition at line 912 of file qtopengl_widget.cpp.

virtual QSize argos::CQTOpenGLWidget::minimumSize ( ) const
inlinevirtual

Called internally by Qt to know the minimum widget size.

Definition at line 198 of file qtopengl_widget.h.

void argos::CQTOpenGLWidget::mouseMoveEvent ( QMouseEvent *  pc_event)
protectedvirtual

Definition at line 868 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::mousePressEvent ( QMouseEvent *  pc_event)
protectedvirtual

Definition at line 788 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::mouseReleaseEvent ( QMouseEvent *  pc_event)
protectedvirtual

Definition at line 815 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::paintGL ( )
virtual

Logic for scene drawing.

Definition at line 130 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::PauseExperiment ( )
slot

Pauses the experiment.

The experiment can be resumed with PlayExperiment() or FastForwardExperiment().

Definition at line 503 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::PlayExperiment ( )
slot

Plays the experiment.

Internally sets a timer whose period corresponds to the XML attribute 'ticks_per_second' in the .argos file.

Definition at line 484 of file qtopengl_widget.cpp.

CRay3 argos::CQTOpenGLWidget::RayFromWindowCoord ( int  n_x,
int  n_y 
)

Casts a ray from the given window coordinate.

The ray goes from the near clipping plane to the far one.

Definition at line 209 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::reactToKeyEvent ( )
protected

Definition at line 919 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::ResetExperiment ( )
slot

Resets the state of the experiment to its state right after initialization.

Definition at line 536 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::resizeEvent ( QResizeEvent *  pc_event)
protectedvirtual

Definition at line 944 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SelectEntity ( CEntity c_entity)

Selects the passed entity.

Parameters
c_entityThe entity to select.

Definition at line 306 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SelectInScene ( UInt32  un_x,
UInt32  un_y 
)

Selects the entity closest to the camera at the given screen coordinates.

Parameters
un_xThe screen X coordinate.
un_yThe screen Y coordinate.

Definition at line 345 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SetCamera ( int  n_camera)
slot

Sets the current camera in use.

Parameters
n_cameraThe index of the wanted camera [0-11]

Definition at line 561 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SetCameraFocalLength ( double  f_length)
slot

Sets the focal length of the current camera.

Parameters
f_lengthThe desired focal length

Definition at line 570 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SetDrawFrameEvery ( int  n_every)
slot

When fast-forwarding, sets every how many steps a frame must be drawn.

Definition at line 547 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SetGrabFrame ( bool  b_grab_on)
slot

Toggles frame grabbing.

Definition at line 554 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::SetInvertMouse ( bool  b_InvertMouse)
inline

Sets whether the mouse should be inverted when moving.

Definition at line 226 of file qtopengl_widget.h.

virtual QSize argos::CQTOpenGLWidget::sizeHint ( ) const
inlinevirtual

Called internally by Qt to know the preferred widget size.

Definition at line 191 of file qtopengl_widget.h.

void argos::CQTOpenGLWidget::StepDone ( int  n_step)
signal

Emitted whenever a time step has been executed.

Parameters
n_stepThe time-step count
void argos::CQTOpenGLWidget::StepExperiment ( )
slot

Executes one experiment time step.

Definition at line 512 of file qtopengl_widget.cpp.

void argos::CQTOpenGLWidget::timerEvent ( QTimerEvent *  pc_event)
protectedvirtual

Definition at line 781 of file qtopengl_widget.cpp.