Main MRPT website > C++ reference
MRPT logo
CSimpleLine.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef opengl_CSimpleLine_H
29 #define opengl_CSimpleLine_H
30 
32 
33 namespace mrpt
34 {
35  namespace opengl
36  {
38 
39  // This must be added to any CSerializable derived class:
41 
42  /** A line segment
43  * \sa opengl::COpenGLScene
44  * \ingroup mrpt_opengl_grp
45  */
47  {
49 
50  protected:
51  float m_x0,m_y0,m_z0;
52  float m_x1,m_y1,m_z1;
53  float m_lineWidth;
54  public:
55  void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
56  float getLineWidth() const { return m_lineWidth;}
57 
58  void setLineCoords(float x0,float y0,float z0, float x1, float y1, float z1)
59  {
60  m_x0=x0; m_y0=y0; m_z0=z0;
61  m_x1=x1; m_y1=y1; m_z1=z1;
63  }
64 
65  void getLineCoords(float &x0,float &y0,float &z0, float &x1, float &y1, float &z1) const
66  {
67  x0=m_x0; y0=m_y0; z0=m_z0;
68  x1=m_x1; y1=m_y1; z1=m_z1;
69  }
70 
71  /** Render
72  */
73  void render_dl() const;
74 
75  /** Class factory */
76  static CSimpleLinePtr Create(
77  float x0,float y0, float z0,
78  float x1,float y1, float z1, float lineWidth = 1 )
79  {
80  return CSimpleLinePtr(new CSimpleLine(x0,y0,z0,x1,y1,z1,lineWidth));
81  }
82 
83  private:
84  /** Constructor
85  */
87  float x0=0,float y0=0, float z0=0,
88  float x1=0,float y1=0, float z1=0, float lineWidth = 1 ) :
89  m_x0(x0),m_y0(y0),m_z0(z0),
90  m_x1(x1),m_y1(y1),m_z1(z1),
91  m_lineWidth(lineWidth)
92  {
93  }
94 
95  /** Private, virtual destructor: only can be deleted from smart pointers */
96  virtual ~CSimpleLine() { }
97  };
98 
99  } // end namespace
100 
101 } // End of namespace
102 
103 
104 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013