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://mrpt.sourceforge.net/                            |
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                   */
00053                 class OPENGL_IMPEXP CGridPlaneXZ : public CRenderizableDisplayList
00054                 {
00055                         DEFINE_SERIALIZABLE( CGridPlaneXZ )
00056 
00057                 protected:
00058                         float   m_xMin, m_xMax;
00059                         float   m_zMin, m_zMax;
00060                         float   m_plane_y;
00061                         float   m_frequency;
00062 
00063                 public:
00064 
00065                         void setPlaneLimits(float xmin,float xmax, float zmin, float zmax)
00066                         {
00067                                 m_xMin=xmin; m_xMax = xmax;
00068                                 m_zMin=zmin; m_zMax = zmax;
00069                                 CRenderizableDisplayList::notifyChange();
00070                         }
00071 
00072                         void getPlaneLimits(float &xmin,float &xmax, float &zmin, float &zmax) const
00073                         {
00074                                 xmin=m_xMin; xmax=m_xMax;
00075                                 zmin=m_zMin; zmax=m_zMax;
00076                         }
00077 
00078                         void setPlaneYcoord(float y) { m_plane_y=y; CRenderizableDisplayList::notifyChange(); }
00079                         float getPlaneYcoord() const { return m_plane_y; }
00080 
00081                         void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
00082                         float getGridFrequency() const { return m_frequency; }
00083 
00084 
00085 
00086                         /** Class factory  */
00087                         static CGridPlaneXZPtr Create(
00088                                 float                           xMin = -10,
00089                                 float                           xMax = 10,
00090                                 float                           zMin = -10,
00091                                 float                           zMax = 10,
00092                                 float                           y = 0,
00093                                 float                           frequency = 1
00094                                 )
00095                         {
00096                                 return CGridPlaneXZPtr( new CGridPlaneXZ( xMin,xMax, zMin, zMax, y, frequency ) );
00097                         }
00098 
00099                         /** Render
00100                           */
00101                         void  render_dl() const;
00102 
00103                 private:
00104                         /** Constructor
00105                           */
00106                         CGridPlaneXZ(
00107                                 float                           xMin = -10,
00108                                 float                           xMax = 10,
00109                                 float                           zMin = -10,
00110                                 float                           zMax = 10,
00111                                 float                           y = 0,
00112                                 float                           frequency = 1
00113                                 ) :
00114                                 m_xMin(xMin),m_xMax(xMax),
00115                                 m_zMin(zMin),m_zMax(zMax),
00116                                 m_plane_y(y),
00117                                 m_frequency(frequency)
00118                         {
00119                         }
00120                         /** Private, virtual destructor: only can be deleted from smart pointers */
00121                         virtual ~CGridPlaneXZ() { }
00122                 };
00123 
00124         } // end namespace
00125 
00126 } // End of namespace
00127 
00128 
00129 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011