GEOS  3.3.8
Public Member Functions
geos::linearref::LinearIterator Class Reference

An iterator over the components and coordinates of a linear geometry (LineString or MultiLineString). More...

#include <LinearIterator.h>

List of all members.

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::LineStringgetLine () const
geom::Coordinate getSegmentStart () const
geom::Coordinate getSegmentEnd () const

Detailed Description

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
   ...
 }
 
Version:
1.7

Constructor & Destructor Documentation

Creates an iterator initialized to the start of a linear Geometry

Parameters:
linearthe linear geometry to iterate over

Creates an iterator starting at a LinearLocation on a linear Geometry

Parameters:
linearthe linear geometry to iterate over
startthe 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

Parameters:
linearthe linear geometry to iterate over
componentIndexthe component to start at
vertexIndexthe vertex to start at

Member Function Documentation

The component index of the vertex the iterator is currently at.

Returns:
the current component index

Gets the LineString component the iterator is current at.

Returns:
a linestring

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.

Returns:
a Coordinate or null

Gets the first Coordinate of the current segment. (the coordinate of the current vertex).

Returns:
a Coordinate

The vertex index of the vertex the iterator is currently at.

Returns:
the current vertex index

Tests whether there are any vertices left to iterator over.

Returns:
true if there are more vertices to scan

Checks whether the iterator cursor is pointing to the endpoint of a linestring.

Returns:
true</true> if the iterator is at an endpoint

Moves the iterator ahead to the next vertex and (possibly) linear component.


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