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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020