00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_GEOM_COORDINATELIST_H
00017 #define GEOS_GEOM_COORDINATELIST_H
00018
00019 #include <geos/export.h>
00020 #include <geos/geom/Coordinate.h>
00021
00022 #include <list>
00023 #include <ostream>
00024 #include <memory>
00025
00026
00027 namespace geos {
00028 namespace geom {
00029
00030 }
00031 }
00032
00033
00034 namespace geos {
00035 namespace geom {
00036
00045 class GEOS_DLL CoordinateList {
00046
00047 public:
00048
00049 typedef std::list<Coordinate>::iterator iterator;
00050 typedef std::list<Coordinate>::const_iterator const_iterator;
00051 typedef std::list<Coordinate>::size_type size_type;
00052
00053 friend std::ostream& operator<< (std::ostream& os,
00054 const CoordinateList& cl);
00055
00056 CoordinateList(const std::vector<Coordinate>& v)
00057 :
00058 coords(v.begin(), v.end())
00059 {
00060 }
00061
00062 CoordinateList()
00063 :
00064 coords()
00065 {
00066 }
00067
00068 size_type size() const
00069 {
00070 return coords.size();
00071 }
00072
00073 iterator begin()
00074 {
00075 return coords.begin();
00076 }
00077
00078 iterator end()
00079 {
00080 return coords.end();
00081 }
00082
00083 const_iterator begin() const
00084 {
00085 return coords.begin();
00086 }
00087
00088 const_iterator end() const
00089 {
00090 return coords.end();
00091 }
00092
00093 iterator insert(iterator pos, const Coordinate& c)
00094 {
00095 return coords.insert(pos, c);
00096 }
00097
00098 iterator erase(iterator pos)
00099 {
00100 return coords.erase(pos);
00101 }
00102
00103 iterator erase(iterator first, iterator last)
00104 {
00105 return coords.erase(first, last);
00106 }
00107
00108 std::auto_ptr<Coordinate::Vect> toCoordinateArray() const
00109 {
00110 std::auto_ptr<Coordinate::Vect> ret(new Coordinate::Vect);
00111 ret->assign(coords.begin(), coords.end());
00112 return ret;
00113 }
00114
00115 private:
00116
00117 std::list<Coordinate> coords;
00118
00119
00120 };
00121
00122 inline
00123 std::ostream& operator<< (std::ostream& os, const CoordinateList& cl)
00124 {
00125 os << "(";
00126 for (CoordinateList::const_iterator
00127 it=cl.begin(), end=cl.end();
00128 it != end;
00129 ++it)
00130 {
00131 const Coordinate& c = *it;
00132 if ( it != cl.begin() ) os << ", ";
00133 os << c;
00134 }
00135 os << ")";
00136
00137 return os;
00138 }
00139
00140 }
00141 }
00142
00143
00144 #endif // ndef GEOS_GEOM_COORDINATELIST_H
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155