Main MRPT website > C++ reference
MRPT logo
CGridPlaneXY.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 
29 #ifndef opengl_CGridPlaneXY_H
30 #define opengl_CGridPlaneXY_H
31 
33 
34 namespace mrpt
35 {
36  namespace opengl
37  {
39 
40  // This must be added to any CSerializable derived class:
42 
43  /** A grid of lines over the XY plane.
44  * \sa opengl::COpenGLScene
45  *
46  * <div align="center">
47  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
48  * <tr> <td> mrpt::opengl::CGridPlaneXY </td> <td> \image html preview_CGridPlaneXY.png </td> </tr>
49  * </table>
50  * </div>
51  *
52  * \ingroup mrpt_opengl_grp
53  */
55  {
57 
58  protected:
59  float m_xMin, m_xMax;
60  float m_yMin, m_yMax;
61  float m_plane_z;
62  float m_frequency;
63 
64 
65  public:
66  void setPlaneLimits(float xmin,float xmax, float ymin, float ymax)
67  {
68  m_xMin=xmin; m_xMax = xmax;
69  m_yMin=ymin; m_yMax = ymax;
71  }
72 
73  void getPlaneLimits(float &xmin,float &xmax, float &ymin, float &ymax) const
74  {
75  xmin=m_xMin; xmax=m_xMax;
76  ymin=m_yMin; ymax=m_yMax;
77  }
78 
79  void setPlaneZcoord(float z) { CRenderizableDisplayList::notifyChange(); m_plane_z=z; }
80  float getPlaneZcoord() const { return m_plane_z; }
81 
82  void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
83  float getGridFrequency() const { return m_frequency; }
84 
85 
86  /** Render */
87  virtual void render_dl() const;
88 
89  /** Class factory */
90  static CGridPlaneXYPtr Create(
91  float xMin,
92  float xMax,
93  float yMin,
94  float yMax,
95  float z = 0,
96  float frequency = 1 )
97  {
98  return CGridPlaneXYPtr( new CGridPlaneXY(
99  xMin,
100  xMax,
101  yMin,
102  yMax,
103  z,
104  frequency ) );
105  }
106 
107 
108  private:
109  /** Constructor
110  */
112  float xMin = -10,
113  float xMax = 10 ,
114  float yMin = -10,
115  float yMax = 10,
116  float z = 0,
117  float frequency = 1
118  ) :
119  m_xMin(xMin),
120  m_xMax(xMax),
121  m_yMin(yMin),
122  m_yMax(yMax),
123  m_plane_z(z),
124  m_frequency(frequency)
125  {
126  }
127  /** Private, virtual destructor: only can be deleted from smart pointers */
128  virtual ~CGridPlaneXY() { }
129  };
130 
131  } // end namespace
132 
133 } // End of namespace
134 
135 
136 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013