GEOS
3.6.1
|
An iterator over the components and coordinates of a linear geometry (LineString or MultiLineString). More...
#include <LinearIterator.h>
Public Member Functions | |
LinearIterator (const geom::Geometry *linear) | |
LinearIterator (const geom::Geometry *linear, const LinearLocation &start) | |
LinearIterator (const geom::Geometry *linear, unsigned int componentIndex, unsigned int vertexIndex) | |
bool | hasNext () const |
void | next () |
bool | isEndOfLine () const |
unsigned int | getComponentIndex () const |
unsigned int | getVertexIndex () const |
const geom::LineString * | getLine () const |
geom::Coordinate | getSegmentStart () const |
geom::Coordinate | getSegmentEnd () const |
An iterator over the components and coordinates of a linear geometry (LineString or MultiLineString).
The standard usage pattern for a LinearIterator is:
for (LinearIterator it = new LinearIterator(...); it.hasNext(); it.next()) { ... int ci = it.getComponentIndex(); // for example int vi = it.getVertexIndex(); // for example ... }
geos::linearref::LinearIterator::LinearIterator | ( | const geom::Geometry * | linear | ) |
Creates an iterator initialized to the start of a linear Geometry
linear | the linear geometry to iterate over |
geos::linearref::LinearIterator::LinearIterator | ( | const geom::Geometry * | linear, |
const LinearLocation & | start | ||
) |
Creates an iterator starting at a LinearLocation on a linear Geometry
linear | the linear geometry to iterate over |
start | the location to start at |
geos::linearref::LinearIterator::LinearIterator | ( | const geom::Geometry * | linear, |
unsigned int | componentIndex, | ||
unsigned int | vertexIndex | ||
) |
Creates an iterator starting at a component and vertex in a linear Geometry
linear | the linear geometry to iterate over |
componentIndex | the component to start at |
vertexIndex | the vertex to start at |
unsigned int geos::linearref::LinearIterator::getComponentIndex | ( | ) | const |
The component index of the vertex the iterator is currently at.
const geom::LineString* geos::linearref::LinearIterator::getLine | ( | ) | const |
Gets the LineString component the iterator is current at.
geom::Coordinate geos::linearref::LinearIterator::getSegmentEnd | ( | ) | const |
Gets the second Coordinate of the current segment. (the coordinate of the next vertex). If the iterator is at the end of a line, null
is returned.
null
geom::Coordinate geos::linearref::LinearIterator::getSegmentStart | ( | ) | const |
Gets the first Coordinate of the current segment. (the coordinate of the current vertex).
unsigned int geos::linearref::LinearIterator::getVertexIndex | ( | ) | const |
The vertex index of the vertex the iterator is currently at.
bool geos::linearref::LinearIterator::hasNext | ( | ) | const |
Tests whether there are any vertices left to iterator over.
true
if there are more vertices to scan bool geos::linearref::LinearIterator::isEndOfLine | ( | ) | const |
Checks whether the iterator cursor is pointing to the endpoint of a component LineString.
true</true> if the iterator is at an endpoint
void geos::linearref::LinearIterator::next | ( | ) |
Moves the iterator ahead to the next vertex and (possibly) linear component.