Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxPolyline2d.h

00001 /*
00002  *  Copyright (c) 2000, University of Amsterdam, The Netherlands.
00003  *  All rights reserved.
00004  *
00005  *
00006  *  Author(s):
00007  *  Dennis Koelma (koelma@wins.uva.nl)
00008  */
00009 
00010 #ifndef HxPolyline2d_h
00011 #define HxPolyline2d_h
00012 
00013 #include "HxPointSetR2.h"
00014 
00020 class HxPolyline2d
00021 {
00022 public:
00024                         HxPolyline2d();
00025 
00029                         HxPolyline2d(const HxPointSetR2& v, int close);
00030 
00034                         HxPolyline2d(double* px, double* py, int np, int close);
00035 
00037                         ~HxPolyline2d();
00038 
00039 
00041     int                 ident() const;
00042 
00044     HxPointSetR2        getPoints() const;
00045 
00047     int                 getClosed() const;
00048 
00050     int                 getNrPoints() const;
00051 
00053     HxPointR2           getPoint(int index) const;
00054 
00059     void                getPoints(double* px, double* py) const;
00060 
00062     STD_OSTREAM&        put(STD_OSTREAM&) const;
00063 
00064 private:
00065     int                 _ident;
00066     HxPointSetR2        _points;
00067     int                 _closed;
00068 
00069     static int          _nr;
00070 };
00071 
00072 inline STD_OSTREAM&
00073 operator<<(STD_OSTREAM& os, const HxPolyline2d p)
00074 {
00075     return p.put(os);
00076 }
00077 
00078 inline
00079 HxPolyline2d::HxPolyline2d()
00080 {
00081     _ident = _nr++;
00082 }
00083 
00084 inline
00085 HxPolyline2d::HxPolyline2d(const HxPointSetR2& v, int close) :
00086     _points(v), _closed(close)
00087 {
00088     _ident = _nr++;
00089 }
00090 
00091 inline
00092 HxPolyline2d::HxPolyline2d(double* px, double* py, int np, int close)
00093 {
00094     for (int i=0 ; i<np ; i++)
00095         _points.push_back(HxPointR2(*px++, *py++));
00096     _closed = close;
00097     _ident = _nr++;
00098 }
00099 
00100 inline
00101 HxPolyline2d::~HxPolyline2d()
00102 {
00103 }
00104 
00105 inline int
00106 HxPolyline2d::ident() const
00107 {
00108     return _ident;
00109 }
00110 
00111 inline HxPointSetR2
00112 HxPolyline2d::getPoints() const
00113 {
00114     return _points;
00115 }
00116 
00117 inline int
00118 HxPolyline2d::getClosed() const
00119 {
00120     return _closed;
00121 }
00122 
00123 inline int
00124 HxPolyline2d::getNrPoints() const
00125 {
00126     return _points.size();
00127 }
00128 
00129 inline HxPointR2
00130 HxPolyline2d::getPoint(int index) const
00131 {
00132     return _points[index];
00133 }
00134 
00135 inline HxString
00136 makeString(const HxPolyline2d& p)
00137 {
00138     return HxString("HxPolyline2d") + makeString(p.ident());
00139 }
00140 
00141 #endif

Generated on Tue Feb 3 14:18:41 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001