LineCloud.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools version 1.1
00003 //
00004 // GoTools module: CORE
00005 //
00006 // Copyright (C) 2000-2007 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program 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 General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef _GOLINECLOUD_H
00034 #define _GOLINECLOUD_H
00035 
00036 
00037 #include "GeomObject.h"
00038 #include "Array.h"
00039 #include <vector>
00040 
00041 
00042 namespace Go
00043 {
00046 
00047 
00052 class LineCloud : public GeomObject
00053 {
00054 public:
00055 
00057     LineCloud()
00058     {};
00059 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071     template <typename ForwardIterator>
00072     LineCloud(ForwardIterator start, int numlines)
00073         : points_(numlines*2)
00074     {
00075         std::copy(start, start + 6*numlines, points_[0].begin());
00076     }
00077 
00079     virtual ~LineCloud();
00080 
00083     virtual void read (std::istream& is);
00084 
00087     virtual void write (std::ostream& os) const;
00088 
00091     virtual BoundingBox boundingBox() const;
00092 
00096     virtual int dimension() const
00097     { return 3; }
00098 
00102     virtual ClassType instanceType() const
00103     { return LineCloud::classType(); }
00104 
00107     static ClassType classType()
00108     { return Class_LineCloud; }
00109 
00112 // #ifdef _MSC_VER
00113 // #if _MSC_VER < 1300
00114 //     virtual GeomObject* clone() const
00115 //     { return new LineCloud(*this); }
00116 // #else
00117 //     virtual LineCloud* clone() const
00118 //     { return new LineCloud(*this); }
00119 // #endif // _MSC_VER < 1300
00120 // #else
00121     virtual LineCloud* clone() const
00122     { return new LineCloud(*this); }
00123 // #endif
00124 
00131     void setCloud(const double* points, int numlines);
00132 
00135     int numLines() const { return points_.size()/2; }
00136 
00141     Vector3D& point(int i) { return points_[i]; }
00142 
00147     const Vector3D& point(int i) const { return points_[i]; }
00148 
00152     double* rawData() { return points_[0].begin(); }
00153 
00154 private:
00155     std::vector<Vector3D> points_;
00156 };
00157 
00158 
00160 } // namespace Go
00161 
00162 
00163 
00164 #endif // _GOLINECLOUD_H
00165 
00166 

Generated on Mon Jun 11 14:48:18 2007 for GoTools Core Library by  doxygen 1.5.1