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



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