ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
7 #ifndef QTOPENGL_USER_FUNCTIONS_H
8 #define QTOPENGL_USER_FUNCTIONS_H
11 class CQTOpenGLUserFunctions;
17 #include <argos3/core/utility/configuration/base_configurable_resource.h>
18 #include <argos3/plugins/simulator/visualizations/qt-opengl/qtopengl_main_window.h>
19 #include <argos3/plugins/simulator/visualizations/qt-opengl/qtopengl_widget.h>
20 #include <argos3/core/utility/datatypes/color.h>
21 #include <argos3/core/utility/math/quaternion.h>
209 Real f_diameter = 5.0);
227 const bool b_fill =
true);
240 const std::vector<CVector2>& vec_points,
242 const bool b_fill =
true);
259 const bool b_fill =
true,
260 GLuint un_vertices = 20);
278 GLuint un_vertices = 20);
303 Real f_width = 1.0f);
314 const std::string& str_text,
316 const QFont& c_font = QFont());
335 template <
typename USER_IMPL,
typename ENTITY>
379 template <
typename USER_IMPL,
typename ENTITY>
400 template <
typename USER_IMPL,
typename ENTITY>
411 static USER_IMPL& cImpl =
static_cast<USER_IMPL&
>(*this);
413 ENTITY& cEntity =
static_cast<ENTITY&
>(c_entity);
417 (cImpl.*(cFunctionHolder.
Function))(cEntity);
420 template <
typename USER_IMPL,
typename ENTITY>
423 m_cThunks.Add<ENTITY>(&CQTOpenGLUserFunctions::Thunk<USER_IMPL,ENTITY>);
425 size_t unIdx = GetTag<ENTITY,CEntity>();
438 #define REGISTER_QTOPENGL_USER_FUNCTIONS(CLASSNAME, LABEL) \
439 REGISTER_SYMBOL(CQTOpenGLUserFunctions, \
virtual void Destroy()
Undoes whatever was done by Init().
This class is the base of all XML-configurable ARGoS interface.
void DrawRay(const CRay3 &c_ray, const CColor &c_color=CColor::RED, Real f_width=1.0f)
Draws a ray, with optional endpoint markers.
The namespace containing all the ARGoS related code.
void DrawCircle(const CVector3 &c_position, const CQuaternion &c_orientation, Real f_radius, const CColor &c_color=CColor::RED, const bool b_fill=true, GLuint un_vertices=20)
Draws a circle.
virtual void DrawInWorld()
Drawing hook executed after all objects have been drawn.
void(CQTOpenGLUserFunctions::* TThunk)(CEntity &)
Pointer-to-thunk type definition.
void RegisterUserFunction(void(USER_IMPL::*pt_function)(ENTITY &))
Registers a user method.
void(USER_IMPL::* TFunction)(ENTITY &)
void SetColor(const CColor &c_color)
Sets the current drawing color.
void DrawText(const CVector3 &c_position, const std::string &str_text, const CColor &c_color=CColor::BLACK, const QFont &c_font=QFont())
Draws a string of text.
virtual void EntitySelected(CEntity &c_entity)
Called every time an entity is selected.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
CQTOpenGLUserFunctions()
Class constructor.
virtual void DeselectEntity()
Deselects the currently selected entity.
The actual function holder.
void DrawTriangle(const CVector3 &c_position, const CQuaternion &c_orientation, Real f_base, Real f_height, const CColor &c_color=CColor::RED, const bool b_fill=true)
Draws an isosceles triangle.
void DrawPoint(const CVector3 &c_position, const CColor &c_color=CColor::RED, Real f_diameter=5.0)
Draws a point.
virtual void SelectEntity(CEntity &c_entity)
Selects the specified entity.
void SetMainWindow(CQTOpenGLMainWindow &c_main_win)
Sets the QTOpenGL main window for these user functions.
void Thunk(CEntity &c_entity)
A templetized thunk.
virtual void Draw(CFloorEntity &c_entity)
Drawing hook executed after the floor is drawn.
virtual void EntityDeselected(CEntity &c_entity)
Called every time an entity is deselected.
virtual void KeyPressed(QKeyEvent *pc_event)
Called when a key press event occurs.
The QTOpenGL user functions.
std::vector< CFunctionHolder * > m_vecFunctionHolders
A vector of function holders.
void DrawPolygon(const CVector3 &c_position, const CQuaternion &c_orientation, const std::vector< CVector2 > &vec_points, const CColor &c_color=CColor::RED, const bool b_fill=true)
Draws a 2D polygon.
CQTOpenGLMainWindow & GetMainWindow()
Returns the QTOpenGL main window.
virtual void Reset()
Resets the resource.
virtual ~CQTOpenGLUserFunctions()
Class destructor.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
void DrawBox(const CVector3 &c_position, const CQuaternion &c_orientation, const CVector3 &c_size, const CColor &c_color=CColor::RED)
Draws a box.
virtual void DrawOverlay(QPainter &c_painter)
Drawing hook to put graphics on top of the OpenGL window.
virtual void Call(CEntity &c_entity)
Calls a user method for the given entity.
virtual void KeyReleased(QKeyEvent *pc_event)
Called when a key release event occurs.
CVTable< CQTOpenGLUserFunctions, CEntity, TThunk > m_cThunks
The vtable storing the thunks.
void DrawCylinder(const CVector3 &c_position, const CQuaternion &c_orientation, Real f_radius, Real f_height, const CColor &c_color=CColor::RED, GLuint un_vertices=20)
Draws a cylinder, with the height perpendicular to the XY plane.
CEntity * GetSelectedEntity()
Returns the currently selected entity, or NULL.
float Real
Collects all ARGoS code.
The base function holder.
CQTOpenGLWidget & GetQTOpenGLWidget()
Returns the QTOpenGLWidget.
CFunctionHolderImpl(TFunction t_function)