Main MRPT website > C++ reference
MRPT logo
CGridPlaneXZ.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                       http://www.mrpt.org/                                |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2011  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 
00029 #ifndef opengl_CGridPlaneXZ_H
00030 #define opengl_CGridPlaneXZ_H
00031 
00032 #include <mrpt/opengl/CRenderizableDisplayList.h>
00033 
00034 namespace mrpt
00035 {
00036         namespace opengl
00037         {
00038                 class OPENGL_IMPEXP CGridPlaneXZ;
00039 
00040                 // This must be added to any CSerializable derived class:
00041                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CGridPlaneXZ, CRenderizableDisplayList, OPENGL_IMPEXP )
00042 
00043                 /** A grid of lines over the XZ plane.
00044                   *  \sa opengl::COpenGLScene
00045                   *  
00046                   *  <div align="center">
00047                   *  <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
00048                   *   <tr> <td> mrpt::opengl::CGridPlaneXZ </td> <td> \image html preview_CGridPlaneXZ.png </td> </tr>
00049                   *  </table>
00050                   *  </div>
00051                   *  
00052                   * \ingroup mrpt_opengl_grp
00053                   */
00054                 class OPENGL_IMPEXP CGridPlaneXZ : public CRenderizableDisplayList
00055                 {
00056                         DEFINE_SERIALIZABLE( CGridPlaneXZ )
00057 
00058                 protected:
00059                         float   m_xMin, m_xMax;
00060                         float   m_zMin, m_zMax;
00061                         float   m_plane_y;
00062                         float   m_frequency;
00063 
00064                 public:
00065 
00066                         void setPlaneLimits(float xmin,float xmax, float zmin, float zmax)
00067                         {
00068                                 m_xMin=xmin; m_xMax = xmax;
00069                                 m_zMin=zmin; m_zMax = zmax;
00070                                 CRenderizableDisplayList::notifyChange();
00071                         }
00072 
00073                         void getPlaneLimits(float &xmin,float &xmax, float &zmin, float &zmax) const
00074                         {
00075                                 xmin=m_xMin; xmax=m_xMax;
00076                                 zmin=m_zMin; zmax=m_zMax;
00077                         }
00078 
00079                         void setPlaneYcoord(float y) { m_plane_y=y; CRenderizableDisplayList::notifyChange(); }
00080                         float getPlaneYcoord() const { return m_plane_y; }
00081 
00082                         void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
00083                         float getGridFrequency() const { return m_frequency; }
00084 
00085 
00086 
00087                         /** Class factory  */
00088                         static CGridPlaneXZPtr Create(
00089                                 float                           xMin = -10,
00090                                 float                           xMax = 10,
00091                                 float                           zMin = -10,
00092                                 float                           zMax = 10,
00093                                 float                           y = 0,
00094                                 float                           frequency = 1
00095                                 )
00096                         {
00097                                 return CGridPlaneXZPtr( new CGridPlaneXZ( xMin,xMax, zMin, zMax, y, frequency ) );
00098                         }
00099 
00100                         /** Render
00101                           */
00102                         void  render_dl() const;
00103 
00104                 private:
00105                         /** Constructor
00106                           */
00107                         CGridPlaneXZ(
00108                                 float                           xMin = -10,
00109                                 float                           xMax = 10,
00110                                 float                           zMin = -10,
00111                                 float                           zMax = 10,
00112                                 float                           y = 0,
00113                                 float                           frequency = 1
00114                                 ) :
00115                                 m_xMin(xMin),m_xMax(xMax),
00116                                 m_zMin(zMin),m_zMax(zMax),
00117                                 m_plane_y(y),
00118                                 m_frequency(frequency)
00119                         {
00120                         }
00121                         /** Private, virtual destructor: only can be deleted from smart pointers */
00122                         virtual ~CGridPlaneXZ() { }
00123                 };
00124 
00125         } // end namespace
00126 
00127 } // End of namespace
00128 
00129 
00130 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011