Main MRPT website > C++ reference for MRPT 1.4.0
CGridPlaneXZ.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_CGridPlaneXZ_H
11 #define opengl_CGridPlaneXZ_H
12 
14 
15 namespace mrpt
16 {
17  namespace opengl
18  {
19 
20 
21  // This must be added to any CSerializable derived class:
22  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CGridPlaneXZ, CRenderizableDisplayList, OPENGL_IMPEXP )
23 
24  /** A grid of lines over the XZ 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::CGridPlaneXZ </td> <td> \image html preview_CGridPlaneXZ.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_zMin, m_zMax;
42  float m_plane_y;
43  float m_frequency;
44  float m_lineWidth;
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 zmin, float zmax)
55  {
56  m_xMin=xmin; m_xMax = xmax;
57  m_zMin=zmin; m_zMax = zmax;
59  }
60 
61  void getPlaneLimits(float &xmin,float &xmax, float &zmin, float &zmax) const
62  {
63  xmin=m_xMin; xmax=m_xMax;
64  zmin=m_zMin; zmax=m_zMax;
65  }
66 
67  void setPlaneYcoord(float y) { m_plane_y=y; CRenderizableDisplayList::notifyChange(); }
68  float getPlaneYcoord() const { return m_plane_y; }
69 
70  void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
71  float getGridFrequency() const { return m_frequency; }
72 
73 
74 
75  /** Class factory */
76  static CGridPlaneXZPtr Create(
77  float xMin = -10,
78  float xMax = 10,
79  float zMin = -10,
80  float zMax = 10,
81  float y = 0,
82  float frequency = 1,
83  float lineWidth = 1.3f,
84  bool antiAliasing = true
85  );
86 
87  /** Render
88  */
89  void render_dl() const MRPT_OVERRIDE;
90 
91  /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
92  void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
93  private:
94  /** Constructor */
96  float xMin = -10,
97  float xMax = 10,
98  float zMin = -10,
99  float zMax = 10,
100  float y = 0,
101  float frequency = 1,
102  float lineWidth = 1.3f,
103  bool antiAliasing = true
104  );
105  /** Private, virtual destructor: only can be deleted from smart pointers */
106  virtual ~CGridPlaneXZ() { }
107  };
108  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CGridPlaneXZ, CRenderizableDisplayList, OPENGL_IMPEXP )
109 
110  } // end namespace
111 
112 } // End of namespace
113 
114 
115 #endif
mrpt::opengl::CGridPlaneXZ::getPlaneYcoord
float getPlaneYcoord() const
Definition: CGridPlaneXZ.h:68
mrpt::opengl::CGridPlaneXZ::setGridFrequency
void setGridFrequency(float freq)
Definition: CGridPlaneXZ.h:70
mrpt::opengl::CGridPlaneXZ::m_lineWidth
float m_lineWidth
Definition: CGridPlaneXZ.h:44
mrpt::opengl::CGridPlaneXZ::m_frequency
float m_frequency
Definition: CGridPlaneXZ.h:43
CRenderizableDisplayList.h
mrpt::opengl::CGridPlaneXZ::getPlaneLimits
void getPlaneLimits(float &xmin, float &xmax, float &zmin, float &zmax) const
Definition: CGridPlaneXZ.h:61
mrpt::opengl::CRenderizableDisplayList
A renderizable object suitable for rendering with OpenGL's display lists.
Definition: CRenderizableDisplayList.h:36
mrpt::opengl::CGridPlaneXZ::setLineWidth
void setLineWidth(float w)
Definition: CGridPlaneXZ.h:48
mrpt::opengl::CRenderizableDisplayList::notifyChange
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
Definition: CRenderizableDisplayList.h:49
mrpt::opengl::CGridPlaneXZ::m_antiAliasing
bool m_antiAliasing
Definition: CGridPlaneXZ.h:45
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::opengl::CGridPlaneXZ::m_plane_y
float m_plane_y
Definition: CGridPlaneXZ.h:42
mrpt::opengl::CGridPlaneXZ::enableAntiAliasing
void enableAntiAliasing(bool enable=true)
Definition: CGridPlaneXZ.h:51
mrpt::opengl::CGridPlaneXZ::setPlaneLimits
void setPlaneLimits(float xmin, float xmax, float zmin, float zmax)
Definition: CGridPlaneXZ.h:54
DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
Definition: CSerializable.h:174
mrpt::opengl::CGridPlaneXZ::m_zMin
float m_zMin
Definition: CGridPlaneXZ.h:41
mrpt::opengl::CGridPlaneXZ::isAntiAliasingEnabled
bool isAntiAliasingEnabled() const
Definition: CGridPlaneXZ.h:52
mrpt::opengl::CGridPlaneXZ::getGridFrequency
float getGridFrequency() const
Definition: CGridPlaneXZ.h:71
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE
#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...
Definition: CSerializable.h:170
mrpt::opengl::CGridPlaneXZ
A grid of lines over the XZ plane.
Definition: CGridPlaneXZ.h:35
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:147
mrpt::opengl::CGridPlaneXZ::getLineWidth
float getLineWidth() const
Definition: CGridPlaneXZ.h:49
ASSERT_
#define ASSERT_(f)
Definition: mrpt_macros.h:261
MRPT_OVERRIDE
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
mrpt::opengl::CGridPlaneXZ::m_xMin
float m_xMin
Definition: CGridPlaneXZ.h:40
mrpt::opengl::CGridPlaneXZ::setPlaneYcoord
void setPlaneYcoord(float y)
Definition: CGridPlaneXZ.h:67



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:08:25 UTC 2019