15#ifndef GEOS_GEOM_COORDINATESEQUENCE_H
16#define GEOS_GEOM_COORDINATESEQUENCE_H
18#include <geos/export.h>
19#include <geos/platform.h>
20#include <geos/inline.h>
22#include <geos/geom/Coordinate.h>
59class GEOS_DLL CoordinateSequence {
63 CoordinateSequence() {}
65 CoordinateSequence(
const CoordinateSequence&) {}
69 typedef std::auto_ptr<CoordinateSequence> AutoPtr;
71 virtual ~CoordinateSequence() {}
76 virtual CoordinateSequence *
clone()
const=0;
89 return getAt(size()-1);
97 const Coordinate& operator[] (std::size_t i)
const {
113 size_t size()
const {
return getSize(); }
135 virtual const std::vector<Coordinate>*
toVector()
const=0;
141 virtual void toVector(std::vector<Coordinate>& coords)
const=0;
150 void add(
const std::vector<Coordinate>* vc,
bool allowRepeated);
167 void add(
const CoordinateSequence *cl,
bool allowRepeated,
190 virtual void add(std::size_t i,
const Coordinate& coord,
bool allowRepeated)=0;
214 virtual void setPoints(
const std::vector<Coordinate> &v)=0;
232 const CoordinateSequence *cl);
251 CoordinateSequence *c);
266 const CoordinateSequence *cl);
273 static bool equals(
const CoordinateSequence *cl1,
274 const CoordinateSequence *cl2);
375 for(std::size_t i=0, n=size(); i<n; ++i)
385GEOS_DLL std::ostream&
operator<< (std::ostream& os,
const CoordinateSequence& cs);
387GEOS_DLL
bool operator== (
const CoordinateSequence& s1,
const CoordinateSequence& s2);
389GEOS_DLL
bool operator!= (
const CoordinateSequence& s1,
const CoordinateSequence& s2);
Definition CoordinateFilter.h:43
virtual bool isEmpty() const =0
Returns true it list contains no coordinates.
static void reverse(CoordinateSequence *cl)
Reverse Coordinate order in given CoordinateSequence.
virtual std::size_t getSize() const =0
Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data...
void add(const CoordinateSequence *cl, bool allowRepeated, bool direction)
Add an array of coordinates.
const Coordinate & front() const
Return first Coordinate in the sequence.
Definition CoordinateSequence.h:93
virtual CoordinateSequence * clone() const =0
Returns a deep copy of this collection.
virtual void deleteAt(std::size_t pos)=0
Delete Coordinate at position pos (list will shrink).
virtual void getAt(std::size_t i, Coordinate &c) const =0
Write Coordinate at position i to given Coordinate.
void add(const std::vector< Coordinate > *vc, bool allowRepeated)
Add an array of coordinates.
static bool hasRepeatedPoints(const CoordinateSequence *cl)
Returns true if given CoordinateSequence contains any two consecutive Coordinate.
virtual double getOrdinate(std::size_t index, std::size_t ordinateIndex) const =0
virtual void setAt(const Coordinate &c, std::size_t pos)=0
Get a reference to Coordinate at position pos.
virtual double getX(std::size_t index) const
Definition CoordinateSequence.h:330
virtual double getY(std::size_t index) const
Definition CoordinateSequence.h:338
virtual std::string toString() const =0
Get a string rapresentation of CoordinateSequence.
virtual const std::vector< Coordinate > * toVector() const =0
Returns a read-only vector with the Coordinates in this collection.
virtual void add(std::size_t i, const Coordinate &coord, bool allowRepeated)=0
Inserts the specified coordinate at the specified position in this list.
virtual void expandEnvelope(Envelope &env) const
void applyCoordinateFilter(T &f)
Apply a fiter to each Coordinate of this sequence. The filter is expected to provide a ....
Definition CoordinateSequence.h:372
virtual void setOrdinate(std::size_t index, std::size_t ordinateIndex, double value)=0
const Coordinate & back() const
Return last Coordinate in the sequence.
Definition CoordinateSequence.h:88
static CoordinateSequence * removeRepeatedPoints(const CoordinateSequence *cl)
Returns a new CoordinateSequence being a copy of the input with any consecutive equal Coordinate remo...
static int increasingDirection(const CoordinateSequence &pts)
Determines which orientation of the Coordinate array is (overall) increasing.
virtual CoordinateSequence & removeRepeatedPoints()=0
Remove consecutive equal Coordinates from the sequence.
static CoordinateSequence * atLeastNCoordinatesOrNothing(std::size_t n, CoordinateSequence *c)
Returns either the given CoordinateSequence if its length is greater than the given amount,...
virtual std::size_t getDimension() const =0
virtual const Coordinate & getAt(std::size_t i) const =0
Returns a read-only reference to Coordinate at position i.
bool hasRepeatedPoints() const
Returns true if contains any two consecutive points.
virtual void toVector(std::vector< Coordinate > &coords) const =0
Pushes all Coordinates of this sequence onto the provided vector.
static void scroll(CoordinateSequence *cl, const Coordinate *firstCoordinate)
Scroll given CoordinateSequence so to start with given Coordinate.
static int indexOf(const Coordinate *coordinate, const CoordinateSequence *cl)
Return position of a Coordinate, or -1 if not found.
virtual void add(const Coordinate &c, bool allowRepeated)
Add a coordinate.
const Coordinate * minCoordinate() const
Returns lower-left Coordinate in list.
virtual void setPoints(const std::vector< Coordinate > &v)=0
Substitute Coordinate list with a copy of the given vector.
static bool equals(const CoordinateSequence *cl1, const CoordinateSequence *cl2)
Returns true if the two arrays are identical, both null, or pointwise equal.
virtual void add(const Coordinate &c)=0
Add a Coordinate to the list.
static const Coordinate * minCoordinate(CoordinateSequence *cl)
Returns lower-left Coordinate in given CoordinateSequence. This is actually the Coordinate with lower...
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:53
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
GEOS_DLL bool operator==(const Coordinate &a, const Coordinate &b)
Equality operator for Coordinate. 2D only.
GEOS_DLL bool operator!=(const Coordinate &a, const Coordinate &b)
Inequality operator for Coordinate. 2D only.
GEOS_DLL std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25