Main MRPT website > C++ reference
MRPT logo
CAxis.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 #ifndef opengl_CAxis_H
00029 #define opengl_CAxis_H
00030 
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032 
00033 namespace mrpt
00034 {
00035         namespace opengl
00036         {
00037                 class OPENGL_IMPEXP CAxis;
00038 
00039                 // This must be added to any CSerializable derived class:
00040                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CAxis, CRenderizableDisplayList, OPENGL_IMPEXP )
00041 
00042                 /** Draw a 3D world axis, with coordinate marks at some regular interval
00043                   *  \sa opengl::COpenGLScene
00044                   *  
00045                   *  <div align="center">
00046                   *  <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
00047                   *  <tr> <td> mrpt::opengl::CAxis </td> <td> \image html preview_CAxis.png </td> </tr>
00048                   *  </table>
00049                   *  </div>
00050                   *  
00051                   * \ingroup mrpt_opengl_grp
00052                   */
00053                 class OPENGL_IMPEXP CAxis : public CRenderizableDisplayList
00054                 {
00055                         DEFINE_SERIALIZABLE( CAxis )
00056                 protected:
00057                         float   m_xmin,m_ymin,m_zmin;
00058                         float   m_xmax,m_ymax,m_zmax;
00059                         float   m_frecuency;
00060             float       m_lineWidth;
00061                         bool    m_marks;
00062 
00063                 public:
00064                         void setAxisLimits(float xmin,float ymin, float zmin, float xmax,float ymax, float zmax)
00065                         {
00066                                 m_xmin=xmin; m_ymin=ymin; m_zmin=zmin;
00067                                 m_xmax=xmax; m_ymax=ymax; m_zmax=zmax;
00068                                 CRenderizableDisplayList::notifyChange();
00069                         }
00070 
00071                         void setFrequency(float f) { ASSERT_(f>0); m_frecuency=f; CRenderizableDisplayList::notifyChange(); } //!< Changes the frequency of the "ticks"
00072 
00073                         void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
00074                         float getLineWidth() const { return  m_lineWidth;}
00075 
00076                         void enableTickMarks(bool v=true) { m_marks=v; CRenderizableDisplayList::notifyChange(); }
00077 
00078 
00079                         /** Class factory  */
00080                         static CAxisPtr Create(
00081                                 float xmin,float ymin, float zmin,
00082                                 float xmax, float ymax,  float zmax,
00083                                 float frecuency = 1, float lineWidth = 3, bool marks=false)
00084                         {
00085                                 return CAxisPtr( new CAxis( xmin,ymin, zmin, xmax,ymax,zmax,frecuency,lineWidth,marks  ) );
00086                         }
00087 
00088                         /** Render
00089                           */
00090                         void  render_dl() const;
00091 
00092         private:
00093                         /** Constructor
00094                           */
00095                         CAxis(
00096                                 float xmin=-1.0f,float ymin=-1.0f, float zmin=-1.0f,
00097                                 float xmax=1.0f, float ymax=1.0f,  float zmax=1.0f,
00098                                 float frecuency = 0.25f, float lineWidth = 3.0f, bool marks=false) :
00099                                 m_xmin(xmin),m_ymin(ymin),m_zmin(zmin),
00100                                 m_xmax(xmax),m_ymax(ymax),m_zmax(zmax),
00101                                 m_frecuency(frecuency),
00102                 m_lineWidth(lineWidth),
00103                                 m_marks(marks)
00104                         {
00105                         }
00106 
00107                         /** Private, virtual destructor: only can be deleted from smart pointers */
00108                         virtual ~CAxis() { }
00109                 };
00110 
00111         } // end namespace
00112 } // End of namespace
00113 
00114 #endif



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