class mrpt::viz::CText

Python API: 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

See also:

CText3D, opengl::Scene

#include <mrpt/viz/CText.h>

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

    typedef std::shared_ptr<mrpt::viz ::CText> Ptr;
    typedef std::shared_ptr<const mrpt::viz ::CText> ConstPtr;
    typedef std::unique_ptr<mrpt::viz ::CText> UniquePtr;
    typedef std::unique_ptr<const mrpt::viz ::CText> ConstUniquePtr;

    // fields

    static constexpr const char* className = "mrpt::viz" "::" "CText";

    // construction

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

    // methods

    static constexpr auto getClassName();
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    static std::shared_ptr<CObject> CreateObject();

    template <typename... Args>
    static Ptr Create(Args&&... args);

    template <typename Alloc, typename... Args>
    static Ptr CreateAlloc(
        const Alloc& alloc,
        Args&&... args
        );

    template <typename... Args>
    static UniquePtr CreateUnique(Args&&... args);

    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual mrpt::rtti::CObject* clone() const;
    void setString(const std::string& s);
    std::string getString() const;
    void setFont(const std::string& s, int height);
    std::string getFont() const;
    int getFontHeight() const;
    virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const;
    virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CSerializable> Ptr;
    typedef std::shared_ptr<const CSerializable> ConstPtr;

    // structs

    struct BuffersVersion;
    struct ChangeCounter;
    struct PoseAndScale;
    struct State;

    // methods

    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;

Typedefs

typedef std::shared_ptr<mrpt::viz ::CText> Ptr

A type for the associated smart pointer.

Construction

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

Constructor.

Methods

virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const

Returns information about the class of an object in runtime.

virtual mrpt::rtti::CObject* clone() const

Returns a deep copy (clone) of the object, indepently of its class.

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”.

int getFontHeight() const

Nominal font size, as given to setFont().

The label keeps this size on screen whatever the viewport projection is; the glyphs it actually draws are about half of it in cap height (the default 20 yields the ~6x10 px characters the app layouts are written against).

See also:

setFont()

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)