public class LinearIterator extends Object
LineStrings and
MultiLineStrings. 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
...
}
| Constructor and Description |
|---|
LinearIterator(Geometry
Creates an iterator initialized to the start of a linear
Geometry
|
LinearIterator(Geometry
Creates an iterator starting at a specified component and vertex in a linear
Geometry
|
LinearIterator(Geometry
Creates an iterator starting at a
LinearLocation on a linear
Geometry
|
| Modifier and Type | Method and Description |
|---|---|
int |
getComponentIndex()
The component index of the vertex the iterator is currently at.
|
LineString |
getLine()
Gets the
LineString component the iterator is current at.
|
Coordinate |
getSegmentEnd()
Gets the second
Coordinate of the current segment.
|
Coordinate |
getSegmentStart()
Gets the first
Coordinate of the current segment.
|
int |
getVertexIndex()
The vertex index of the vertex the iterator is currently at.
|
boolean |
hasNext()
Tests whether there are any vertices left to iterator over.
|
boolean |
isEndOfLine()
Checks whether the iterator cursor is pointing to the endpoint of a component
LineString.
|
void |
next()
Moves the iterator ahead to the next vertex and (possibly) linear component.
|
public LinearIterator(Geometrylinear)
Geometry
linear - the linear geometry to iterate over
IllegalArgumentException - if linearGeom is not lineal
public LinearIterator(Geometrylinear, LinearLocation start)
LinearLocation on a linear
Geometry
linear - the linear geometry to iterate over
start - the location to start at
IllegalArgumentException - if linearGeom is not lineal
public LinearIterator(GeometrylinearGeom, int componentIndex, int vertexIndex)
Geometry
linearGeom - the linear geometry to iterate over
componentIndex - the component to start at
vertexIndex - the vertex to start at
IllegalArgumentException - if linearGeom is not lineal
public boolean hasNext()
true if there are more vertices to scan
public void next()
public boolean isEndOfLine()
LineString.
true if the iterator is at an endpoint
public int getComponentIndex()
public int getVertexIndex()
public LineStringgetLine()
LineString component the iterator is current at.
public CoordinategetSegmentStart()
Coordinate of the current segment. (the coordinate of the current vertex).
Coordinate
public CoordinategetSegmentEnd()
Coordinate of the current segment. (the coordinate of the next vertex). If the iterator is at the end of a line,
null is returned.
Coordinate or
null