Main MRPT website > C++ reference for MRPT 1.9.9
CText.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef opengl_CText_H
11 #define opengl_CText_H
12 
14 
15 namespace mrpt
16 {
17 namespace opengl
18 {
19 /** A 2D text (bitmap rendering): it always "faces the observer" despite it's at
20  * some 3D location.
21  * Use setString and setFont to change the text displayed by this object.
22  *
23  * \note All texts appear with the font GLUT_BITMAP_TIMES_ROMAN_10 for now
24  * (i.e. setFont is ignored)
25  * \sa opengl::COpenGLScene
26  *
27  * <div align="center">
28  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
29  * border-style: solid;">
30  * <tr> <td> mrpt::opengl::CText </td> <td> \image html preview_CText.png
31  * </td> </tr>
32  * </table>
33  * </div>
34  *
35  * \sa CText3D
36  * \ingroup mrpt_opengl_grp
37  */
38 class CText : public CRenderizable
39 {
41  protected:
45 
46  public:
47  /** Sets the text to display */
48  void setString(const std::string& s) { m_str = s; }
49  /** Return the current text associated to this label */
50  std::string getString() const { return m_str; }
51  /** Sets the font (It has no effect yet!) */
52  void setFont(const std::string& s, int height)
53  {
54  m_fontName = s;
56  }
57  std::string getFont() const { return m_fontName; }
58  /** Render */
59  void render() const override;
60 
61  /** Evaluates the bounding box of this object (including possible children)
62  * in the coordinate frame of the object parent. */
63  void getBoundingBox(
64  mrpt::math::TPoint3D& bb_min,
65  mrpt::math::TPoint3D& bb_max) const override;
66 
67  /** Class factory */
68  static CText::Ptr Create(const std::string& str);
69 
70  /** Constructor */
71  CText(const std::string& str = std::string(""));
72 
73  /** Private, virtual destructor: only can be deleted from smart pointers */
74  virtual ~CText();
75 };
76 
77 } // end namespace
78 
79 } // End of namespace
80 
81 #endif
mrpt::opengl::CText::getFont
std::string getFont() const
Definition: CText.h:57
s
GLdouble s
Definition: glext.h:3676
mrpt::opengl::CText::m_fontHeight
int m_fontHeight
Definition: CText.h:44
mrpt::opengl::CText::m_str
std::string m_str
Definition: CText.h:42
mrpt::opengl::CRenderizable
The base class of 3D objects that can be directly rendered through OpenGL.
Definition: CRenderizable.h:43
mrpt::opengl::CText::~CText
virtual ~CText()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CText.cpp:39
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::opengl::CText::CText
CText(const std::string &str=std::string(""))
Constructor.
Definition: CText.cpp:27
mrpt::opengl::CText::setString
void setString(const std::string &s)
Sets the text to display.
Definition: CText.h:48
mrpt::opengl::CText::m_fontWidth
int m_fontWidth
Definition: CText.h:44
mrpt::opengl::CText::m_fontName
std::string m_fontName
Definition: CText.h:43
CRenderizable.h
mrpt::opengl::CText::setFont
void setFont(const std::string &s, int height)
Sets the font (It has no effect yet!)
Definition: CText.h:52
height
GLenum GLsizei GLsizei height
Definition: glext.h:3554
mrpt::opengl::CText::render
void render() const override
Render.
Definition: CText.cpp:43
mrpt::opengl::CText::Create
static Ptr Create(Args &&... args)
Definition: CText.h:40
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
mrpt::opengl::CText::getString
std::string getString() const
Return the current text associated to this label.
Definition: CText.h:50
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::opengl::CText::getBoundingBox
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
Definition: CText.cpp:95
mrpt::opengl::CText
A 2D text (bitmap rendering): it always "faces the observer" despite it's at some 3D location.
Definition: CText.h:38
mrpt::opengl::CText::Ptr
std::shared_ptr< CText > Ptr
Definition: CText.h:40



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST