20 #ifndef GEOS_GEOM_COORDINATELIST_H 21 #define GEOS_GEOM_COORDINATELIST_H 23 #include <geos/export.h> 24 #include <geos/geom/Coordinate.h> 32 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 59 typedef std::list<Coordinate>::iterator iterator;
60 typedef std::list<Coordinate>::const_iterator const_iterator;
61 typedef std::list<Coordinate>::size_type size_type;
63 friend std::ostream&
operator<< (std::ostream& os,
77 coords(v.begin(), v.end())
87 size_type size()
const 94 return coords.empty();
99 return coords.begin();
107 const_iterator begin()
const 109 return coords.begin();
112 const_iterator end()
const 132 if ( !allowRepeated && pos != coords.begin() ) {
133 iterator prev = pos; --prev;
134 if ( c.equals2D(*prev) )
return prev;
136 return coords.insert(pos, c);
139 iterator insert(iterator pos,
const Coordinate& c)
141 return coords.insert(pos, c);
144 iterator erase(iterator pos)
146 return coords.erase(pos);
149 iterator erase(iterator first, iterator last)
151 return coords.erase(first, last);
154 std::auto_ptr<Coordinate::Vect> toCoordinateArray()
const 157 ret->assign(coords.begin(), coords.end());
162 if(!coords.empty() && ! (*(coords.begin())).equals(*(coords.rbegin())))
164 const Coordinate &c = *(coords.begin());
165 coords.insert(coords.end(),c);
172 std::list<Coordinate> coords;
176 std::ostream&
operator<< (std::ostream& os,
const CoordinateList& cl)
179 for (CoordinateList::const_iterator
180 it=cl.begin(), end=cl.end();
184 const Coordinate& c = *it;
185 if ( it != cl.begin() ) os <<
", ";
200 #endif // ndef GEOS_GEOM_COORDINATELIST_H iterator insert(iterator pos, const Coordinate &c, bool allowRepeated)
Inserts the specified coordinate at the specified position in this list.
Definition: CoordinateList.h:130
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
GEOS_DLL std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
CoordinateList(const std::vector< Coordinate > &v)
Constructs a new list from an array of Coordinates, allowing repeated points.
Definition: CoordinateList.h:75
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
std::vector< Coordinate > Vect
A vector of Coordinate objects (real object, not pointers)
Definition: Coordinate.h:77
A list of Coordinates, which may be set to prevent repeated coordinates from occuring in the list...
Definition: CoordinateList.h:55