MRPT
2.0.1
|
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>
Classes | |
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 TListTextMessages & | getTextMessages () const |
Protected Attributes | |
TListTextMessages | m_2D_texts |
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().
x | The 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[. |
y | The 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[. |
text | The text string to display. |
color | The text color. For example: TColorf(1.0,1.0,1.0) |
unique_index | An "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().
Definition at line 64 of file CTextMessageCapable.cpp.
References mrpt::opengl::T2DTextData::text, mrpt::opengl::T2DTextData::x, and mrpt::opengl::T2DTextData::y.
void CTextMessageCapable::clearTextMessages | ( | ) |
Definition at line 42 of file CTextMessageCapable.cpp.
|
inline |
Definition at line 73 of file CTextMessageCapable.h.
References m_2D_texts.
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.
Definition at line 48 of file CTextMessageCapable.cpp.
|
protected |
Definition at line 76 of file CTextMessageCapable.h.
Referenced by getTextMessages(), and mrpt::opengl::COpenGLViewport::renderTextMessages().
Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020 |