GEOS  3.9.1dev
Public Member Functions | Private Attributes | List of all members
geos::geom::CoordinateArraySequence Class Reference

The default implementation of CoordinateSequence. More...

#include <CoordinateArraySequence.h>

Inheritance diagram for geos::geom::CoordinateArraySequence:
[legend]
Collaboration diagram for geos::geom::CoordinateArraySequence:
[legend]

Public Member Functions

 CoordinateArraySequence (const CoordinateArraySequence &cl)
 
 CoordinateArraySequence (const CoordinateSequence &cl)
 
std::unique_ptr< CoordinateSequenceclone () const override
 Returns a deep copy of this collection. More...
 
const CoordinategetAt (std::size_t pos) const override
 Returns a read-only reference to Coordinate at position i. More...
 
void getAt (std::size_t i, Coordinate &c) const override
 Copy Coordinate at position i to Coordinate c. More...
 
size_t getSize () const override
 Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data in Coordinate objects). More...
 
void toVector (std::vector< Coordinate > &) const override
 
 CoordinateArraySequence ()
 Construct an empty sequence. More...
 
 CoordinateArraySequence (std::vector< Coordinate > &&coords, std::size_t dimension=0)
 Construct sequence moving from given Coordinate vector. More...
 
 CoordinateArraySequence (std::vector< Coordinate > *coords, std::size_t dimension=0)
 Construct sequence taking ownership of given Coordinate vector. More...
 
 CoordinateArraySequence (std::size_t n, std::size_t dimension=0)
 Construct sequence allocating space for n coordinates. More...
 
 ~CoordinateArraySequence () override=default
 
bool isEmpty () const override
 Returns true it list contains no coordinates. More...
 
bool empty () const
 
void clear ()
 Reset this CoordinateArraySequence to the empty state. More...
 
void add (const Coordinate &c)
 Add a Coordinate to the list. More...
 
void add (const Coordinate &c, bool allowRepeated)
 Add a coordinate. More...
 
void add (std::size_t i, const Coordinate &coord, bool allowRepeated)
 Inserts the specified coordinate at the specified position in this list. More...
 
void add (const CoordinateSequence *cl, bool allowRepeated, bool direction)
 
void setAt (const Coordinate &c, std::size_t pos) override
 Copy Coordinate c to position pos. More...
 
void setPoints (const std::vector< Coordinate > &v) override
 Substitute Coordinate list with a copy of the given vector. More...
 
void setOrdinate (std::size_t index, std::size_t ordinateIndex, double value) override
 
void expandEnvelope (Envelope &env) const override
 
std::size_t getDimension () const override
 
void apply_rw (const CoordinateFilter *filter) override
 
void apply_ro (CoordinateFilter *filter) const override
 
- Public Member Functions inherited from geos::geom::CoordinateSequence
virtual ~CoordinateSequence ()
 
const Coordinateback () const
 Return last Coordinate in the sequence. More...
 
const Coordinatefront () const
 Return first Coordinate in the sequence. More...
 
const Coordinateoperator[] (std::size_t i) const
 
virtual Envelope getEnvelope () const
 
size_t size () const
 
std::string toString () const
 Get a string representation of CoordinateSequence. More...
 
bool hasRepeatedPoints () const
 Returns true if contains any two consecutive points. More...
 
const CoordinateminCoordinate () const
 Returns lower-left Coordinate in list. More...
 
bool hasZ () const
 
virtual double getOrdinate (std::size_t index, std::size_t ordinateIndex) const
 
virtual double getX (std::size_t index) const
 
virtual double getY (std::size_t index) const
 
template<class T >
void applyCoordinateFilter (T &f)
 Apply a filter to each Coordinate of this sequence. The filter is expected to provide a .filter(Coordinate&) method. More...
 

Private Attributes

std::vector< Coordinatevect
 
std::size_t dimension
 

Additional Inherited Members

- Public Types inherited from geos::geom::CoordinateSequence
enum  { X, Y, Z, M }
 Standard ordinate index values. More...
 
typedef std::unique_ptr< CoordinateSequencePtr
 
- Static Public Member Functions inherited from geos::geom::CoordinateSequence
static bool hasRepeatedPoints (const CoordinateSequence *cl)
 Returns true if given CoordinateSequence contains any two consecutive Coordinate. More...
 
static CoordinateSequenceatLeastNCoordinatesOrNothing (std::size_t n, CoordinateSequence *c)
 Returns either the given CoordinateSequence if its length is greater than the given amount, or an empty CoordinateSequence. More...
 
static size_t indexOf (const Coordinate *coordinate, const CoordinateSequence *cl)
 
static bool equals (const CoordinateSequence *cl1, const CoordinateSequence *cl2)
 Returns true if the two arrays are identical, both null, or pointwise equal. More...
 
static void scroll (CoordinateSequence *cl, const Coordinate *firstCoordinate)
 Scroll given CoordinateSequence so to start with given Coordinate. More...
 
static int increasingDirection (const CoordinateSequence &pts)
 Determines which orientation of the Coordinate array is (overall) increasing. More...
 
static bool isRing (const CoordinateSequence *pts)
 Tests whether an array of Coordinates forms a ring, by checking length and closure. Self-intersection is not checked. More...
 
static void reverse (CoordinateSequence *cl)
 Reverse Coordinate order in given CoordinateSequence. More...
 
- Protected Member Functions inherited from geos::geom::CoordinateSequence
 CoordinateSequence ()
 
 CoordinateSequence (const CoordinateSequence &)
 

Detailed Description

The default implementation of CoordinateSequence.

Definition at line 37 of file CoordinateArraySequence.h.

Constructor & Destructor Documentation

geos::geom::CoordinateArraySequence::CoordinateArraySequence ( const CoordinateArraySequence cl)
geos::geom::CoordinateArraySequence::CoordinateArraySequence ( const CoordinateSequence cl)
geos::geom::CoordinateArraySequence::CoordinateArraySequence ( )

Construct an empty sequence.

geos::geom::CoordinateArraySequence::CoordinateArraySequence ( std::vector< Coordinate > &&  coords,
std::size_t  dimension = 0 
)

Construct sequence moving from given Coordinate vector.

geos::geom::CoordinateArraySequence::CoordinateArraySequence ( std::vector< Coordinate > *  coords,
std::size_t  dimension = 0 
)

Construct sequence taking ownership of given Coordinate vector.

geos::geom::CoordinateArraySequence::CoordinateArraySequence ( std::size_t  n,
std::size_t  dimension = 0 
)

Construct sequence allocating space for n coordinates.

geos::geom::CoordinateArraySequence::~CoordinateArraySequence ( )
overridedefault

Member Function Documentation

void geos::geom::CoordinateArraySequence::add ( const Coordinate c)

Add a Coordinate to the list.

Referenced by geos::operation::buffer::OffsetSegmentString::addPt(), and geos::operation::buffer::OffsetSegmentString::closeRing().

Here is the caller graph for this function:

void geos::geom::CoordinateArraySequence::add ( const Coordinate c,
bool  allowRepeated 
)

Add a coordinate.

Parameters
cthe coordinate to add
allowRepeatedif set to false, repeated coordinates are collapsed
void geos::geom::CoordinateArraySequence::add ( std::size_t  i,
const Coordinate coord,
bool  allowRepeated 
)

Inserts the specified coordinate at the specified position in this list.

Parameters
ithe position at which to insert
coordthe coordinate to insert
allowRepeatedif set to false, repeated coordinates are collapsed
Note
this is a CoordinateList interface in JTS
void geos::geom::CoordinateArraySequence::add ( const CoordinateSequence cl,
bool  allowRepeated,
bool  direction 
)
void geos::geom::CoordinateArraySequence::apply_ro ( CoordinateFilter filter) const
overridevirtual
void geos::geom::CoordinateArraySequence::apply_rw ( const CoordinateFilter filter)
overridevirtual
void geos::geom::CoordinateArraySequence::clear ( )
inline

Reset this CoordinateArraySequence to the empty state.

Definition at line 86 of file CoordinateArraySequence.h.

Referenced by geos::operation::buffer::OffsetSegmentString::reset().

Here is the caller graph for this function:

std::unique_ptr<CoordinateSequence> geos::geom::CoordinateArraySequence::clone ( ) const
overridevirtual

Returns a deep copy of this collection.

Implements geos::geom::CoordinateSequence.

bool geos::geom::CoordinateArraySequence::empty ( ) const
inline

Definition at line 79 of file CoordinateArraySequence.h.

void geos::geom::CoordinateArraySequence::expandEnvelope ( Envelope env) const
overridevirtual

Expands the given Envelope to include the coordinates in the sequence. Allows implementing classes to optimize access to coordinate values.

Parameters
envthe envelope to expand

Reimplemented from geos::geom::CoordinateSequence.

const Coordinate& geos::geom::CoordinateArraySequence::getAt ( std::size_t  i) const
overridevirtual

Returns a read-only reference to Coordinate at position i.

Whether or not the Coordinate returned is the actual underlying Coordinate or merely a copy depends on the implementation.

Implements geos::geom::CoordinateSequence.

void geos::geom::CoordinateArraySequence::getAt ( std::size_t  i,
Coordinate c 
) const
overridevirtual

Copy Coordinate at position i to Coordinate c.

Implements geos::geom::CoordinateSequence.

std::size_t geos::geom::CoordinateArraySequence::getDimension ( ) const
overridevirtual

Returns the dimension (number of ordinates in each coordinate) for this sequence.

Returns
the dimension of the sequence.

Implements geos::geom::CoordinateSequence.

size_t geos::geom::CoordinateArraySequence::getSize ( ) const
overridevirtual

Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data in Coordinate objects).

Implements geos::geom::CoordinateSequence.

bool geos::geom::CoordinateArraySequence::isEmpty ( ) const
inlineoverridevirtual

Returns true it list contains no coordinates.

Implements geos::geom::CoordinateSequence.

Definition at line 73 of file CoordinateArraySequence.h.

void geos::geom::CoordinateArraySequence::setAt ( const Coordinate c,
std::size_t  pos 
)
overridevirtual

Copy Coordinate c to position pos.

Implements geos::geom::CoordinateSequence.

void geos::geom::CoordinateArraySequence::setOrdinate ( std::size_t  index,
std::size_t  ordinateIndex,
double  value 
)
overridevirtual

Sets the value for a given ordinate of a coordinate in this sequence.

Parameters
indexthe coordinate index in the sequence
ordinateIndexthe ordinate index in the coordinate (in range [0, dimension-1])
valuethe new ordinate value

Implements geos::geom::CoordinateSequence.

void geos::geom::CoordinateArraySequence::setPoints ( const std::vector< Coordinate > &  v)
overridevirtual

Substitute Coordinate list with a copy of the given vector.

Implements geos::geom::CoordinateSequence.

void geos::geom::CoordinateArraySequence::toVector ( std::vector< Coordinate > &  coords) const
overridevirtual

Pushes all Coordinates of this sequence into the provided vector.

This method is a port of the toCoordinateArray() method of JTS.

Implements geos::geom::CoordinateSequence.

Member Data Documentation

std::size_t geos::geom::CoordinateArraySequence::dimension
mutableprivate

Definition at line 134 of file CoordinateArraySequence.h.

std::vector<Coordinate> geos::geom::CoordinateArraySequence::vect
private

Definition at line 133 of file CoordinateArraySequence.h.


The documentation for this class was generated from the following file: