glc_line.cpp

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 3 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021  *****************************************************************************/
00022 
00023 #include "glc_line.h"
00024 #include "../glc_openglexception.h"
00025 
00027 // Constructor Destructor
00029 
00030 GLC_Line::GLC_Line(const GLC_Point3d & point1, const GLC_Point3d & point2)
00031 : GLC_Polylines()
00032 , m_Point1(point1)
00033 , m_Point2(point2)
00034 {
00035         createWire();
00036 }
00037 
00038 GLC_Line::GLC_Line(const GLC_Line& line)
00039 : GLC_Polylines(line)
00040 , m_Point1(line.m_Point1)
00041 , m_Point2(line.m_Point2)
00042 {
00043         createWire();
00044 }
00045 
00046 GLC_Line::~GLC_Line()
00047 {
00048 
00049 }
00050 
00052 // Get Functions
00054 
00055 const GLC_BoundingBox& GLC_Line::boundingBox(void)
00056 {
00057         return GLC_Polylines::boundingBox();
00058 }
00059 
00060 GLC_Geometry* GLC_Line::clone() const
00061 {
00062         return new GLC_Line(*this);
00063 }
00064 
00065 
00067 // Set Functions
00069 void GLC_Line::setCoordinate(const GLC_Point3d &point1, const GLC_Point3d &point2)
00070 {
00071         m_Point1= point1;
00072         m_Point2= point2;
00073         clear();
00074         createWire();
00075 }
00076 
00077 GLC_Line& GLC_Line::operator=(const GLC_Line& line)
00078 {
00079         if (this != &line)
00080         {
00081                 m_Point1= line.m_Point1;
00082                 m_Point2= line.m_Point2;
00083                 GLC_Polylines::operator=(line);
00084         }
00085         return *this;
00086 }
00087 
00089 // OpenGL Functions
00091 
00092 void GLC_Line::glDraw(const GLC_RenderProperties& renderProperties)
00093 {
00094         GLC_Polylines::glDraw(renderProperties);
00095 }
00096 
00097 
00099 // Private services Functions
00101 void  GLC_Line::createWire()
00102 {
00103         QList<GLC_Point3d> points;
00104         points.append(m_Point1);
00105         points.append(m_Point2);
00106         GLC_Polylines::addPolyline(points);
00107 }
00108 
00109 

SourceForge.net Logo

©2005-2011 Laurent Ribon