GEOS: geos::geom::CoordinateArraySequence Class Reference

GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
geos::geom::CoordinateArraySequence Class Reference

The default implementation of CoordinateSequence. More...

`#include <CoordinateArraySequence.h>`

Inheritance diagram for geos::geom::CoordinateArraySequence:

## Public Member Functions
| CoordinateArraySequence (const CoordinateArraySequence &cl)
CoordinateSequence * | clone () const
| Returns a deep copy of this collection.
const Coordinate & | getAt (std::size_t pos) const
| Returns a read-only reference to Coordinate at position i.
virtual void | getAt (std::size_t i, Coordinate &c) const
| Copy Coordinate at position i to Coordinate c.
size_t | getSize () const
| Returns the number of Coordinates (actual or otherwise, as this implementation may not store its data in Coordinate objects).
const std::vector< Coordinate > * | toVector () const
| Returns a read-only vector with the Coordinates in this collection.
void | toVector (std::vector< Coordinate > &) const
| Pushes all Coordinates of this sequence onto the provided vector.
| CoordinateArraySequence ()
| Construct an empty sequence.
| CoordinateArraySequence (std::vector< Coordinate > *coords, std::size_t dimension=0)
| Construct sequence taking ownership of given Coordinate vector.
| CoordinateArraySequence (std::size_t n, std::size_t dimension=0)
| Construct sequence allocating space for n coordinates.
bool | isEmpty () const
| Returns `true` it list contains no coordinates.
bool | empty () const
void | clear ()
| Reset this CoordinateArraySequence to the empty state.
void | add (const Coordinate &c)
| Add a Coordinate to the list.
virtual void | add (const Coordinate &c, bool allowRepeated)
| Add a coordinate.
virtual void | add (std::size_t i, const Coordinate &coord, bool allowRepeated)
| Inserts the specified coordinate at the specified position in this list.
void | setAt (const Coordinate &c, std::size_t pos)
| Get a reference to Coordinate at position pos.
void | deleteAt (std::size_t pos)
| Delete Coordinate at position pos (list will shrink).
std::string | toString () const
| Get a string rapresentation of CoordinateSequence.
void | setPoints (const std::vector< Coordinate > &v)
| Substitute Coordinate list with a copy of the given vector.
double | getOrdinate (std::size_t index, size_t ordinateIndex) const
void | setOrdinate (std::size_t index, std::size_t ordinateIndex, double value)
void | expandEnvelope (Envelope &env) const
std::size_t | getDimension () const
void | apply_rw (const CoordinateFilter *filter)
void | apply_ro (CoordinateFilter *filter) const
virtual CoordinateSequence & | removeRepeatedPoints ()
| Remove consecutive equal Coordinates from the sequence.
Public Member Functions inherited from geos::geom::CoordinateSequence
const Coordinate & | back () const
| Return last Coordinate in the sequence.
const Coordinate & | front () const
| Return first Coordinate in the sequence.
const Coordinate & | operator[] (std::size_t i) const
size_t | size () const
void | add (const std::vector< Coordinate > *vc, bool allowRepeated)
| Add an array of coordinates.
void | add (const CoordinateSequence *cl, bool allowRepeated, bool direction)
| Add an array of coordinates.
bool | hasRepeatedPoints () const
| Returns true if contains any two consecutive points.
const Coordinate * | minCoordinate () const
| Returns lower-left Coordinate in list.
virtual double | getOrdinate (std::size_t index, std::size_t ordinateIndex) const =0
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 fiter to each Coordinate of this sequence. The filter is expected to provide a .filter(Coordinate&) method.

## Additional Inherited Members
Public Types inherited from geos::geom::CoordinateSequence
enum | { X, Y, Z, M }
| Standard ordinate index values.
typedef std::auto_ptr < CoordinateSequence > | AutoPtr
Static Public Member Functions inherited from geos::geom::CoordinateSequence
static CoordinateSequence * | removeRepeatedPoints (const CoordinateSequence *cl)
| Returns a new CoordinateSequence being a copy of the input with any consecutive equal Coordinate removed.
static bool | hasRepeatedPoints (const CoordinateSequence *cl)
| Returns true if given CoordinateSequence contains any two consecutive Coordinate.
static CoordinateSequence * | atLeastNCoordinatesOrNothing (std::size_t n, CoordinateSequence *c)
| Returns either the given CoordinateSequence if its length is greater than the given amount, or an empty CoordinateSequence.
static const Coordinate * | minCoordinate (CoordinateSequence *cl)
| Returns lower-left Coordinate in given CoordinateSequence. This is actually the Coordinate with lower X (and Y if needed) ordinate.
static int | indexOf (const Coordinate *coordinate, const CoordinateSequence *cl)
| Return position of a Coordinate, or -1 if not found.
static bool | equals (const CoordinateSequence *cl1, const CoordinateSequence *cl2)
| Returns true if the two arrays are identical, both null, or pointwise equal.
static void | scroll (CoordinateSequence *cl, const Coordinate *firstCoordinate)
| Scroll given CoordinateSequence so to start with given Coordinate.
static int | increasingDirection (const CoordinateSequence &pts)
| Determines which orientation of the Coordinate array is (overall) increasing.
static void | reverse (CoordinateSequence *cl)
| Reverse Coordinate order in given CoordinateSequence.
Protected Member Functions inherited from geos::geom::CoordinateSequence
| CoordinateSequence (const CoordinateSequence &)

## Detailed Description

The default implementation of CoordinateSequence.

## Member Function Documentation

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

Add a coordinate.

Parameters

  c | The coordinate to add
  allowRepeated | if set to false, repeated coordinates are collapsed

Returns
  true (as by general collection contract)

Reimplemented from geos::geom::CoordinateSequence.

virtual void geos::geom::CoordinateArraySequence::add | ( | std::size_t | i,
|  | const Coordinate & | coord,
|  | bool | allowRepeated
| ) |  |
| virtual

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

Parameters

  i | the position at which to insert
  coord | the coordinate to insert
  allowRepeated | if set to false, repeated coordinates are collapsed

NOTE: this is a CoordinateList interface in JTS

Implements geos::geom::CoordinateSequence.

void geos::geom::CoordinateArraySequence::expandEnvelope | ( | Envelope & | env | ) | const
| virtual

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

Parameters

  env | the envelope to expand

Reimplemented from geos::geom::CoordinateSequence.

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

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.

std::size_t geos::geom::CoordinateArraySequence::getDimension | ( |  | ) | const
| virtual

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

Returns
  the dimension of the sequence.

Implements geos::geom::CoordinateSequence.

virtual CoordinateSequence& geos::geom::CoordinateArraySequence::removeRepeatedPoints | ( |  | ) |
| virtual

Remove consecutive equal Coordinates from the sequence.

Equality test is 2D based. Returns a reference to self.

Implements geos::geom::CoordinateSequence.

void geos::geom::CoordinateArraySequence::setAt | ( | const Coordinate & | c,
|  | std::size_t | pos
| ) |  |
| virtual

Get a reference to Coordinate at position pos.

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
| ) |  |
| virtual

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

Parameters

  index | the coordinate index in the sequence
  ordinateIndex | the ordinate index in the coordinate (in range [0, dimension-1])
  value | the new ordinate value

Implements geos::geom::CoordinateSequence.

const std::vector<Coordinate>* geos::geom::CoordinateArraySequence::toVector | ( |  | ) | const
| virtual

Returns a read-only vector with the Coordinates in this collection.

Whether or not the Coordinates returned are the actual underlying Coordinates or merely copies depends on the implementation. Note that if this implementation does not store its data as an array of Coordinates, this method will incur a performance penalty because the array needs to be built from scratch.

This method is a port of the toCoordinateArray() method of JTS. It is not much used as memory management requires us to know wheter we should or not delete the returned object in a consistent way. Our options are: use shared_ptr<Coordinate> or always keep ownerhips of an eventual newly created vector. We opted for the second, so the returned object is a const, to also ensure that returning an internal pointer doesn't make the object mutable.

Deprecated:
  use toVector(std::vector<Coordinate>&) instead

Implements geos::geom::CoordinateSequence.

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

Pushes all Coordinates of this sequence onto the provided vector.

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

Implements geos::geom::CoordinateSequence.

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

- CoordinateArraySequence.h