MRPT  2.0.5
List of all members | Classes | Public Member Functions | Protected Attributes
mrpt::opengl::CTextMessageCapable Class Reference

Detailed Description

Keeps a list of text messages which can be rendered to OpenGL contexts by graphic classes.

Definition at line 22 of file CTextMessageCapable.h.

#include <mrpt/opengl/CTextMessageCapable.h>

Inheritance diagram for mrpt::opengl::CTextMessageCapable:


struct  DataPerText
struct  TListTextMessages

Public Member Functions

void clearTextMessages ()
void addTextMessage (const double x_frac, const double y_frac, const std::string &text, const size_t unique_index=0, const TFontParams &fontParams=TFontParams())
 Add 2D text messages overlapped to the 3D rendered scene. More...
bool updateTextMessage (const size_t unique_index, const std::string &text)
 Just updates the text of a given text message, without touching the other parameters. More...
const TListTextMessagesgetTextMessages () const

Protected Attributes

TListTextMessages m_2D_texts

Member Function Documentation

◆ addTextMessage()

void CTextMessageCapable::addTextMessage ( const double  x_frac,
const double  y_frac,
const std::string &  text,
const size_t  unique_index = 0,
const TFontParams fontParams = TFontParams() 

Add 2D text messages overlapped to the 3D rendered scene.

overload with more font parameters - refer to mrpt::opengl::gl_utils::glDrawText()

The string will remain displayed in the 3D window until it's changed with subsequent calls to this same method, or all the texts are cleared with clearTextMessages().

xThe X position, interpreted as absolute pixels from the left if X>=1, absolute pixels from the left if X<0 or as a width factor if in the range [0,1[.
yThe Y position, interpreted as absolute pixels from the bottom if Y>=1, absolute pixels from the top if Y<0 or as a height factor if in the range [0,1[.
textThe text string to display.
colorThe text color. For example: TColorf(1.0,1.0,1.0)
unique_indexAn "index" for this text message, so that subsequent calls with the same index will overwrite this text message instead of creating new ones.

You'll need to refresh the display manually with forceRepaint().

See also
clearTextMessages, updateTextMessage

Definition at line 64 of file CTextMessageCapable.cpp.

References mrpt::opengl::T2DTextData::text, mrpt::opengl::T2DTextData::x, and mrpt::opengl::T2DTextData::y.

Referenced by mrpt::opengl::COpenGLViewport::serializeFrom().

Here is the caller graph for this function:

◆ clearTextMessages()

void CTextMessageCapable::clearTextMessages ( )

Definition at line 42 of file CTextMessageCapable.cpp.

◆ getTextMessages()

const TListTextMessages& mrpt::opengl::CTextMessageCapable::getTextMessages ( ) const

Definition at line 73 of file CTextMessageCapable.h.

References m_2D_texts.

◆ updateTextMessage()

bool CTextMessageCapable::updateTextMessage ( const size_t  unique_index,
const std::string &  text 

Just updates the text of a given text message, without touching the other parameters.

false if given ID doesn't exist.

Definition at line 48 of file CTextMessageCapable.cpp.

Member Data Documentation

◆ m_2D_texts

TListTextMessages mrpt::opengl::CTextMessageCapable::m_2D_texts

Page generated by Doxygen 1.8.14 for MRPT 2.0.5 Git: b26ce1112 Mon Jul 6 09:39:08 2020 +0200 at lun jul 6 09:45:13 CEST 2020