Main MRPT website > C++ reference
MRPT logo
CGridPlaneXY.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_CGridPlaneXY_H
00030 #define opengl_CGridPlaneXY_H
00031 
00032 #include <mrpt/opengl/CRenderizableDisplayList.h>
00033 
00034 namespace mrpt
00035 {
00036         namespace opengl
00037         {
00038                 class OPENGL_IMPEXP CGridPlaneXY;
00039 
00040                 // This must be added to any CSerializable derived class:
00041                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CGridPlaneXY , CRenderizableDisplayList, OPENGL_IMPEXP )
00042 
00043                 /** A grid of lines over the XY 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::CGridPlaneXY </td> <td> \image html preview_CGridPlaneXY.png </td> </tr>
00049                   *  </table>
00050                   *  </div>
00051                   *  
00052                   * \ingroup mrpt_opengl_grp
00053                   */
00054                 class OPENGL_IMPEXP CGridPlaneXY : public CRenderizableDisplayList
00055                 {
00056                         DEFINE_SERIALIZABLE( CGridPlaneXY )
00057 
00058                 protected:
00059                         float   m_xMin, m_xMax;
00060                         float   m_yMin, m_yMax;
00061                         float   m_plane_z;
00062                         float   m_frequency;
00063 
00064 
00065                 public:
00066                         void setPlaneLimits(float xmin,float xmax, float ymin, float ymax)
00067                         {
00068                                 m_xMin=xmin; m_xMax = xmax;
00069                                 m_yMin=ymin; m_yMax = ymax;
00070                                 CRenderizableDisplayList::notifyChange();
00071                         }
00072 
00073                         void getPlaneLimits(float &xmin,float &xmax, float &ymin, float &ymax) const
00074                         {
00075                                 xmin=m_xMin; xmax=m_xMax;
00076                                 ymin=m_yMin; ymax=m_yMax;
00077                         }
00078 
00079                         void setPlaneZcoord(float z) { CRenderizableDisplayList::notifyChange(); m_plane_z=z;  }
00080                         float getPlaneZcoord() const { return m_plane_z; }
00081 
00082                         void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
00083                         float getGridFrequency() const { return m_frequency; }
00084 
00085 
00086                         /** Render */
00087                         virtual void  render_dl() const;
00088 
00089                         /** Class factory  */
00090                         static CGridPlaneXYPtr Create(
00091                                 float                           xMin,
00092                                 float                           xMax,
00093                                 float                           yMin,
00094                                 float                           yMax,
00095                                 float                           z    = 0,
00096                                 float                           frequency = 1 )
00097                         {
00098                                 return CGridPlaneXYPtr( new CGridPlaneXY(
00099                                         xMin,
00100                                         xMax,
00101                                         yMin,
00102                                         yMax,
00103                                         z,
00104                                         frequency ) );
00105                         }
00106 
00107 
00108                 private:
00109                         /** Constructor
00110                           */
00111                         CGridPlaneXY(
00112                                 float                           xMin = -10,
00113                                 float                           xMax = 10 ,
00114                                 float                           yMin = -10,
00115                                 float                           yMax = 10,
00116                                 float                           z    = 0,
00117                                 float                           frequency = 1
00118                                 ) :
00119                                 m_xMin(xMin),
00120                                 m_xMax(xMax),
00121                                 m_yMin(yMin),
00122                                 m_yMax(yMax),
00123                                 m_plane_z(z),
00124                                 m_frequency(frequency)
00125                         {
00126                         }
00127                         /** Private, virtual destructor: only can be deleted from smart pointers */
00128                         virtual ~CGridPlaneXY() { }
00129                 };
00130 
00131         } // end namespace
00132 
00133 } // End of namespace
00134 
00135 
00136 #endif



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