Main MRPT website > C++ reference for MRPT 1.5.6
CSimpleLine.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef opengl_CSimpleLine_H
10 #define opengl_CSimpleLine_H
11 
13 
14 namespace mrpt
15 {
16  namespace opengl
17  {
18 
19 
20  // This must be added to any CSerializable derived class:
21  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CSimpleLine, CRenderizableDisplayList, OPENGL_IMPEXP )
22 
23  /** A line segment
24  * \sa opengl::COpenGLScene
25  * \ingroup mrpt_opengl_grp
26  */
28  {
30 
31  protected:
32  float m_x0,m_y0,m_z0;
33  float m_x1,m_y1,m_z1;
34  float m_lineWidth;
35  bool m_antiAliasing;
36  public:
37  void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
38  float getLineWidth() const { return m_lineWidth;}
39 
40  void enableAntiAliasing(bool enable=true) { m_antiAliasing =enable; CRenderizableDisplayList::notifyChange(); }
41  bool isAntiAliasingEnabled() const { return m_antiAliasing; }
42 
43  void setLineCoords(float x0,float y0,float z0, float x1, float y1, float z1)
44  {
45  m_x0=x0; m_y0=y0; m_z0=z0;
46  m_x1=x1; m_y1=y1; m_z1=z1;
48  }
49 
50  void getLineCoords(float &x0,float &y0,float &z0, float &x1, float &y1, float &z1) const
51  {
52  x0=m_x0; y0=m_y0; z0=m_z0;
53  x1=m_x1; y1=m_y1; z1=m_z1;
54  }
55 
56  /** Render
57  */
58  void render_dl() const MRPT_OVERRIDE;
59 
60  /** Class factory */
61  static CSimpleLinePtr Create(
62  float x0,float y0, float z0,
63  float x1,float y1, float z1, float lineWidth = 1 );
64 
65  /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
66  void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
67 
68  private:
69  /** Constructor
70  */
72  float x0=0,float y0=0, float z0=0,
73  float x1=0,float y1=0, float z1=0, float lineWidth = 1,
74  bool antiAliasing = true);
75 
76  /** Private, virtual destructor: only can be deleted from smart pointers */
77  virtual ~CSimpleLine() { }
78  };
79  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CSimpleLine, CRenderizableDisplayList, OPENGL_IMPEXP )
80 
81  } // end namespace
82 
83 } // End of namespace
84 
85 
86 #endif
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
bool isAntiAliasingEnabled() const
Definition: CSimpleLine.h:41
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1797
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
A renderizable object suitable for rendering with OpenGL's display lists.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
void getLineCoords(float &x0, float &y0, float &z0, float &x1, float &y1, float &z1) const
Definition: CSimpleLine.h:50
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
float getLineWidth() const
Definition: CSimpleLine.h:38
A line segment.
Definition: CSimpleLine.h:27
void enableAntiAliasing(bool enable=true)
Definition: CSimpleLine.h:40
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void setLineCoords(float x0, float y0, float z0, float x1, float y1, float z1)
Definition: CSimpleLine.h:43



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018