Warning: include(php/utility.php): Failed to open stream: No such file or directory in /home/argos/argos3/doc/api/embedded/a03762.php on line 2

Warning: include(): Failed opening 'php/utility.php' for inclusion (include_path='.:/usr/lib64/php') in /home/argos/argos3/doc/api/embedded/a03762.php on line 2
The ARGoS Website

#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

◆ CQTOpenGLWidget()

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.

◆ ~CQTOpenGLWidget()

argos::CQTOpenGLWidget::~CQTOpenGLWidget ( )
virtual

Class destructor.

Definition at line 76 of file qtopengl_widget.cpp.

Member Function Documentation

◆ DeselectEntity()

void argos::CQTOpenGLWidget::DeselectEntity ( )

Deselects the currently selected entity.

If no entity is selected, nothing is done.

Definition at line 329 of file qtopengl_widget.cpp.

◆ DrawArena()

void argos::CQTOpenGLWidget::DrawArena ( )
protected

Definition at line 671 of file qtopengl_widget.cpp.

◆ DrawAxes()

void argos::CQTOpenGLWidget::DrawAxes ( )
protected

Definition at line 773 of file qtopengl_widget.cpp.

◆ DrawBoundingBox()

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

Draws the bounding box of an embodied entity.

Definition at line 426 of file qtopengl_widget.cpp.

◆ DrawEntity() [1/2]

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

Draws a positional entity.

Definition at line 356 of file qtopengl_widget.cpp.

◆ DrawEntity() [2/2]

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

Draws an embodied entity.

Definition at line 374 of file qtopengl_widget.cpp.

◆ DrawRays()

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

Draws a ray.

Definition at line 392 of file qtopengl_widget.cpp.

◆ DrawScene()

void argos::CQTOpenGLWidget::DrawScene ( )
protected

◆ EntityDeselected

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

Emitted when an entity is deselected.

Parameters
Thedeselected entity

◆ EntitySelected

void argos::CQTOpenGLWidget::EntitySelected ( CEntity pc_entity)
signal

Emitted when an entity is selected.

Parameters
Theselected entity

◆ ExperimentDone

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.

◆ FastForwardExperiment

void argos::CQTOpenGLWidget::FastForwardExperiment ( )
slot

Fast forwards the experiment.

Internally sets a timer whose period is 1ms.

Definition at line 491 of file qtopengl_widget.cpp.

◆ GetCamera()

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

Returns a reference to the camera.

Definition at line 212 of file qtopengl_widget.h.

◆ GetFrameGrabData()

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

Returns the current frame grabbing data.

Definition at line 219 of file qtopengl_widget.h.

◆ GetSelectedEntity()

CEntity * argos::CQTOpenGLWidget::GetSelectedEntity ( )

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

Returns
The currently selected entity.

Definition at line 295 of file qtopengl_widget.cpp.

◆ GetUserFunctions()

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

Returns a reference to the user functions.

Definition at line 205 of file qtopengl_widget.h.

◆ GetWindowCoordInWorld()

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 253 of file qtopengl_widget.cpp.

◆ heightForWidth()

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.

◆ initializeGL()

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 88 of file qtopengl_widget.cpp.

◆ KeyPressed

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

Handles key press events.

Definition at line 579 of file qtopengl_widget.cpp.

◆ keyPressEvent()

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

Definition at line 903 of file qtopengl_widget.cpp.

◆ KeyReleased

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

Handles key release events.

Definition at line 625 of file qtopengl_widget.cpp.

◆ keyReleaseEvent()

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

Definition at line 910 of file qtopengl_widget.cpp.

◆ minimumSize()

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.

◆ mouseMoveEvent()

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

Definition at line 866 of file qtopengl_widget.cpp.

◆ mousePressEvent()

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

Definition at line 786 of file qtopengl_widget.cpp.

◆ mouseReleaseEvent()

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

Definition at line 813 of file qtopengl_widget.cpp.

◆ paintGL()

void argos::CQTOpenGLWidget::paintGL ( )
virtual

Logic for scene drawing.

Definition at line 128 of file qtopengl_widget.cpp.

◆ PauseExperiment

void argos::CQTOpenGLWidget::PauseExperiment ( )
slot

Pauses the experiment.

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

Definition at line 501 of file qtopengl_widget.cpp.

◆ PlayExperiment

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 482 of file qtopengl_widget.cpp.

◆ RayFromWindowCoord()

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 207 of file qtopengl_widget.cpp.

◆ reactToKeyEvent()

void argos::CQTOpenGLWidget::reactToKeyEvent ( )
protected

Definition at line 917 of file qtopengl_widget.cpp.

◆ ResetExperiment

void argos::CQTOpenGLWidget::ResetExperiment ( )
slot

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

Definition at line 534 of file qtopengl_widget.cpp.

◆ resizeEvent()

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

Definition at line 942 of file qtopengl_widget.cpp.

◆ SelectEntity()

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

Selects the passed entity.

Parameters
c_entityThe entity to select.

Definition at line 304 of file qtopengl_widget.cpp.

◆ SelectInScene()

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 343 of file qtopengl_widget.cpp.

◆ SetCamera

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 559 of file qtopengl_widget.cpp.

◆ SetCameraFocalLength

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 568 of file qtopengl_widget.cpp.

◆ SetDrawFrameEvery

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

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

Definition at line 545 of file qtopengl_widget.cpp.

◆ SetGrabFrame

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

Toggles frame grabbing.

Definition at line 552 of file qtopengl_widget.cpp.

◆ SetInvertMouse()

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.

◆ sizeHint()

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.

◆ StepDone

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

Emitted whenever a time step has been executed.

Parameters
n_stepThe time-step count

◆ StepExperiment

void argos::CQTOpenGLWidget::StepExperiment ( )
slot

Executes one experiment time step.

Definition at line 510 of file qtopengl_widget.cpp.

◆ timerEvent()

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

Definition at line 779 of file qtopengl_widget.cpp.