Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
15namespace mrpt
16{
17 namespace opengl
18 {
19
20
21 // This must be added to any CSerializable derived class:
23
24 /** A 2D text (bitmap rendering): it always "faces the observer" despite it's at some 3D location.
25 * Use setString and setFont to change the text displayed by this object.
26 *
27 * \note All texts appear with the font GLUT_BITMAP_TIMES_ROMAN_10 for now (i.e. setFont is ignored)
28 * \sa opengl::COpenGLScene
29 *
30 * <div align="center">
31 * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
32 * <tr> <td> mrpt::opengl::CText </td> <td> \image html preview_CText.png </td> </tr>
33 * </table>
34 * </div>
35 *
36 * \sa CText3D
37 * \ingroup mrpt_opengl_grp
38 */
40 {
42 protected:
43 std::string m_str;
44 std::string m_fontName;
45 int m_fontHeight, m_fontWidth;
46
47 public:
48 void setString( const std::string &s ) { m_str=s; } //!< Sets the text to display
49 std::string getString() const { return m_str; } //!< Return the current text associated to this label
50
51 void setFont(const std::string &s, int height ) { m_fontName=s; m_fontHeight=height; } //!< Sets the font (It has no effect yet!)
52 std::string getFont() const { return m_fontName; }
53
54 /** Render */
55 void render() const MRPT_OVERRIDE;
56
57 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
58 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
59
60 /** Class factory */
61 static CTextPtr Create(const std::string &str);
62
63 private:
64 /** Constructor */
65 CText( const std::string &str = std::string("") );
66
67 /** Private, virtual destructor: only can be deleted from smart pointers */
68 virtual ~CText();
69 };
71
72 } // end namespace
73
74} // End of namespace
75
76
77#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
The base class of 3D objects that can be directly rendered through OpenGL.
A 2D text (bitmap rendering): it always "faces the observer" despite it's at some 3D location.
Definition CText.h:40
std::string m_str
Definition CText.h:43
void setString(const std::string &s)
Sets the text to display.
Definition CText.h:48
std::string m_fontName
Definition CText.h:44
void render() const MRPT_OVERRIDE
Render.
std::string getString() const
Return the current text associated to this label.
Definition CText.h:49
void setFont(const std::string &s, int height)
Sets the font (It has no effect yet!)
Definition CText.h:51
std::string getFont() const
Definition CText.h:52
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition mrpt_macros.h:28
struct OPENGL_IMPEXP CTextPtr
Definition CText.h:22
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.



Page generated by Doxygen 1.9.7 for MRPT 1.4.0 SVN: at Tue Jun 13 14:10:35 UTC 2023