Main MRPT website > C++ reference for MRPT 1.5.6
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-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_CGridPlaneXY_H
11 #define opengl_CGridPlaneXY_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( CGridPlaneXY , CRenderizableDisplayList, OPENGL_IMPEXP )
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;
43  float m_frequency;
44  float m_lineWidth;
45  bool m_antiAliasing;
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
void enableAntiAliasing(bool enable=true)
Definition: CGridPlaneXY.h:51
float getPlaneZcoord() const
Definition: CGridPlaneXY.h:68
A grid of lines over the XY plane.
Definition: CGridPlaneXY.h:35
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
float getGridFrequency() const
Definition: CGridPlaneXY.h:71
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1797
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
A renderizable object suitable for rendering with OpenGL's display lists.
void setGridFrequency(float freq)
Definition: CGridPlaneXY.h:70
bool isAntiAliasingEnabled() const
Definition: CGridPlaneXY.h:52
#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 setPlaneLimits(float xmin, float xmax, float ymin, float ymax)
Definition: CGridPlaneXY.h:54
JHUFF_TBL long freq[]
Definition: jchuff.h:44
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
GLdouble GLdouble z
Definition: glew.h:1464
void setPlaneZcoord(float z)
Definition: CGridPlaneXY.h:67
#define ASSERT_(f)
float getLineWidth() const
Definition: CGridPlaneXY.h:49
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void getPlaneLimits(float &xmin, float &xmax, float &ymin, float &ymax) const
Definition: CGridPlaneXY.h:61
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f
Definition: glew.h:5092



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