GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_polylines.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
23 
24 #include "glc_polylines.h"
25 
27 : GLC_Geometry("Polyline", true)
28 {
29 
30 }
31 
33 : GLC_Geometry(polyline)
34 {
35 
36 }
37 
39 {
40 
41 }
42 
44 // Get Functions
47 {
48  if (NULL == GLC_Geometry::m_pBoundingBox)
49  {
51  if (! m_WireData.isEmpty())
52  {
54  }
55  }
57 }
58 
60 {
61  return new GLC_Polylines(*this);
62 }
63 
65 // Set Functions
67 
68 
69 GLC_uint GLC_Polylines::addPolyline(const QList<GLC_Point3d>& pointsList)
70 {
71  const int pointCount= pointsList.size();
72  const int size= pointCount * 3;
73  GLfloatVector data(size);
74  for (int i= 0; i < pointCount; ++i)
75  {
76  const GLC_Point3d currentPoint(pointsList.at(i));
77  data[i * 3]= static_cast<float>(currentPoint.x());
78  data[i * 3 + 1]= static_cast<float>(currentPoint.y());
79  data[i * 3 + 2]= static_cast<float>(currentPoint.z());
80  }
82 }
83 
84 GLC_uint GLC_Polylines::addPolyline(const QList<GLC_Point3df>& pointsList)
85 {
86  const int pointCount= pointsList.size();
87  const int size= pointCount * 3;
88  GLfloatVector data(size);
89  for (int i= 0; i < pointCount; ++i)
90  {
91  const GLC_Point3df currentPoint(pointsList.at(i));
92  data[i * 3]= currentPoint.x();
93  data[i * 3 + 1]= currentPoint.y();
94  data[i * 3 + 2]= currentPoint.z();
95  }
97 }
98 
100 {
101  if (this != &polyline)
102  {
103  GLC_Geometry::operator=(polyline);
104  }
105  return *this;
106 }
107 
109 // OpenGL Functions
111 void GLC_Polylines::glDraw(const GLC_RenderProperties& renderProperties)
112 {
114  {
115  GLC_Geometry::m_WireData.glDraw(renderProperties, GL_LINE_STRIP);
116  }
117 }
118 

©2005-2013 Laurent Ribon