Main MRPT website > C++ reference for MRPT 1.5.6
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-2017, 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 
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
A 2D text (bitmap rendering): it always "faces the observer" despite it's at some 3D location...
Definition: CText.h:39
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
The base class of 3D objects that can be directly rendered through OpenGL.
Definition: CRenderizable.h:44
GLdouble s
Definition: glew.h:1295
#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...
void setFont(const std::string &s, int height)
Sets the font (It has no effect yet!)
Definition: CText.h:51
GLint GLint GLint GLint GLint GLint GLsizei GLsizei height
Definition: glew.h:1166
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
GLsizei const GLcharARB ** string
Definition: glew.h:3293
std::string getString() const
Return the current text associated to this label.
Definition: CText.h:49
std::string getFont() const
Definition: CText.h:52
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018