Main MRPT website > C++ reference for MRPT 1.4.0
CGridPlaneXY.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_CGridPlaneXY_H
11#define opengl_CGridPlaneXY_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 grid of lines over the XY plane.
25 * \sa opengl::COpenGLScene
26 *
27 * <div align="center">
28 * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
29 * <tr> <td> mrpt::opengl::CGridPlaneXY </td> <td> \image html preview_CGridPlaneXY.png </td> </tr>
30 * </table>
31 * </div>
32 *
33 * \ingroup mrpt_opengl_grp
34 */
36 {
38
39 protected:
40 float m_xMin, m_xMax;
41 float m_yMin, m_yMax;
42 float m_plane_z;
46
47 public:
48 void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
49 float getLineWidth() const { return m_lineWidth;}
50
51 void enableAntiAliasing(bool enable=true) { m_antiAliasing =enable; CRenderizableDisplayList::notifyChange(); }
52 bool isAntiAliasingEnabled() const { return m_antiAliasing; }
53
54 void setPlaneLimits(float xmin,float xmax, float ymin, float ymax)
55 {
56 m_xMin=xmin; m_xMax = xmax;
57 m_yMin=ymin; m_yMax = ymax;
59 }
60
61 void getPlaneLimits(float &xmin,float &xmax, float &ymin, float &ymax) const
62 {
63 xmin=m_xMin; xmax=m_xMax;
64 ymin=m_yMin; ymax=m_yMax;
65 }
66
68 float getPlaneZcoord() const { return m_plane_z; }
69
70 void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
71 float getGridFrequency() const { return m_frequency; }
72
73
74 /** Render */
75 virtual void render_dl() const MRPT_OVERRIDE;
76
77 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
78 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
79
80 /** Class factory */
81 static CGridPlaneXYPtr Create(
82 float xMin,
83 float xMax,
84 float yMin,
85 float yMax,
86 float z = 0,
87 float frequency = 1,
88 float lineWidth = 1.3f,
89 bool antiAliasing = true);
90
91
92 private:
93 /** Constructor */
95 float xMin = -10,
96 float xMax = 10 ,
97 float yMin = -10,
98 float yMax = 10,
99 float z = 0,
100 float frequency = 1,
101 float lineWidth = 1.3f,
102 bool antiAliasing = true);
103
104 /** Private, virtual destructor: only can be deleted from smart pointers */
105 virtual ~CGridPlaneXY() { }
106 };
107 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CGridPlaneXY , CRenderizableDisplayList, OPENGL_IMPEXP )
108
109 } // end namespace
110
111} // End of namespace
112
113
114#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...
A grid of lines over the XY plane.
Definition: CGridPlaneXY.h:36
void setGridFrequency(float freq)
Definition: CGridPlaneXY.h:70
void getPlaneLimits(float &xmin, float &xmax, float &ymin, float &ymax) const
Definition: CGridPlaneXY.h:61
void setLineWidth(float w)
Definition: CGridPlaneXY.h:48
float getGridFrequency() const
Definition: CGridPlaneXY.h:71
void enableAntiAliasing(bool enable=true)
Definition: CGridPlaneXY.h:51
float getLineWidth() const
Definition: CGridPlaneXY.h:49
void setPlaneLimits(float xmin, float xmax, float ymin, float ymax)
Definition: CGridPlaneXY.h:54
bool isAntiAliasingEnabled() const
Definition: CGridPlaneXY.h:52
float getPlaneZcoord() const
Definition: CGridPlaneXY.h:68
void setPlaneZcoord(float z)
Definition: CGridPlaneXY.h:67
virtual void render_dl() const MRPT_OVERRIDE
Render.
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
#define ASSERT_(f)
Definition: mrpt_macros.h:261
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
struct OPENGL_IMPEXP CGridPlaneXYPtr
Definition: CGridPlaneXY.h:22
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Sun Nov 27 02:56:59 UTC 2022