class mrpt::viz::CText3D
Overview
A 3D text (rendered with OpenGL primitives), with selectable font face and drawing style.
Use setString and setFont to change the text displayed by this object (can be multi-lined).
Text is drawn along the (+X,+Y) axes.
Default size of characters is “1.0 units”. Change it with the standard method CVisualObject::setScale() as with any other 3D object. The color can be also changed with standard methods in the base class CRenderizable.
This class is based on code from libcvd (BSD, http://www.edwardrosten.com/cvd/)
See also:
opengl::Scene, CText
#include <mrpt/viz/CText3D.h> class CText3D: public mrpt::viz::CVisualObject { public: // typedefs typedef std::shared_ptr<mrpt::viz ::CText3D> Ptr; typedef std::shared_ptr<const mrpt::viz ::CText3D> ConstPtr; typedef std::unique_ptr<mrpt::viz ::CText3D> UniquePtr; typedef std::unique_ptr<const mrpt::viz ::CText3D> ConstUniquePtr; // fields static constexpr const char* className = "mrpt::viz" "::" "CText3D"; // construction CText3D( const std::string& str = std::string(""), const std::string& fontName = std::string("sans"), const float scale = 1.0, const mrpt::viz::TOpenGLFontStyle text_style = mrpt::viz::NICE, const double text_spacing = 1.5, const double text_kerning = 0.1 ); // 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); const std::string& getString() const; void setFont(const std::string& font); const std::string& getFont() const; void setTextStyle(const mrpt::viz::TOpenGLFontStyle text_style); mrpt::viz::TOpenGLFontStyle getTextStyle() const; void setTextSpacing(const double text_spacing); double setTextSpacing() const; void setTextKerning(const double text_kerning); double setTextKerning() const; virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const; virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const; };
Inherited Members
public: // typedefs typedef std::shared_ptr<CObject> Ptr; typedef std::shared_ptr<const CObject> ConstPtr; typedef std::shared_ptr<CSerializable> Ptr; typedef std::shared_ptr<const CSerializable> ConstPtr; // structs struct PoseAndScale; struct State; // methods static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic(); 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 ::CText3D> Ptr
A type for the associated smart pointer.
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 displayed string.
const std::string& getString() const
Returns the currently text associated to this object.
void setFont(const std::string& font)
Changes the font name, among accepted values: “sans”, “mono”, “serif”.
const std::string& getFont() const
Returns the text font
void setTextStyle(const mrpt::viz::TOpenGLFontStyle text_style)
Change drawing style: FILL, OUTLINE, NICE.
mrpt::viz::TOpenGLFontStyle getTextStyle() const
Gets the current drawing style.
virtual mrpt::math::TBoundingBoxf internalBoundingBoxLocal() const
Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates.
This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.
See also:
getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()
virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const
Used from Scene::asYAML().
(New in MRPT 2.4.2)