Class CText

Inheritance Relationships

Base Type

Class Documentation

class CText : public mrpt::viz::CVisualObject

A 2D text that always “faces the observer” despite it having a real 3D position, used to compute its position on the screen, and depth (so it can be occluded).

Use setString() and setFont() to change the text and its appareance.

../../output_staging/generated/doxygen/xml/preview_CText.png

See also

CText3D, opengl::Scene

Public Functions

inline void setString(const std::string &s)

Sets the text to display

inline std::string getString() const

Return the current text associated to this label

inline void setFont(const std::string &s, int height)

Sets the font among “sans”, “serif”, “mono”.

inline std::string getFont() const
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const override

Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.

inline CText(const std::string &str = std::string(""))

Constructor

virtual ~CText() override
std::pair<double, double> computeTextExtension() const
virtual void toYAMLMap(mrpt::containers::yaml &propertiesMap) const override

Used from Scene::asYAML().

Note

(New in MRPT 2.4.2)

Protected Attributes

std::string m_str
std::string m_fontName = "sans"
int m_fontHeight = 20