class mrpt::viz::CText

Overview

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.

mrpt::viz::CText mrpt::viz::CText mrpt::viz::CText mrpt::viz::CText

See also:

CText3D, opengl::Scene

#include <mrpt/viz/CText.h>

class CText: public mrpt::viz::CVisualObject
{
public:
    // construction

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

    // methods

    void setString(const std::string& s);
    std::string getString() const;
    void setFont(const std::string& s, int height);
    std::string getFont() const;
    virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const;
    std::pair<double, double> computeTextExtension() const;
    virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const;
};

Inherited Members

public:
    // structs

    struct OutdatedState;
    struct State;

Construction

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

Constructor.

Methods

void setString(const std::string& s)

Sets the text to display.

std::string getString() const

Return the current text associated to this label.

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

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

virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const

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

virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const

Used from Scene::asYAML().

(New in MRPT 2.4.2)