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 linear)
Creates an iterator initialized to the start of a linear
Geometry |
LinearIterator(Geometry linearGeom,
int componentIndex,
int vertexIndex)
Creates an iterator starting at
a specified component and vertex in a linear
Geometry |
LinearIterator(Geometry linear,
LinearLocation start)
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. |
Point |
getSegmentEnd()
Gets the second
Coordinates of the current segment. |
Point |
getSegmentStart()
Gets the first
Coordinates 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(Geometry linear)
Geometrylinear - the linear geometry to iterate overIllegalArgumentException - if linearGeom is not linealpublic LinearIterator(Geometry linearGeom, int componentIndex, int vertexIndex)
GeometrylinearGeom - the linear geometry to iterate overcomponentIndex - the component to start atvertexIndex - the vertex to start atIllegalArgumentException - if linearGeom is not linealpublic LinearIterator(Geometry linear, LinearLocation start)
LinearLocation on a linear Geometrylinear - the linear geometry to iterate overstart - the location to start atIllegalArgumentException - if linearGeom is not linealpublic int getComponentIndex()
public LineString getLine()
LineString component the iterator is current at.public Point getSegmentEnd()
Coordinates of the current segment.
(the coordinate of the next vertex).
If the iterator is at the end of a line, null is returned.Coordinates or nullpublic Point getSegmentStart()
Coordinates of the current segment.
(the coordinate of the current vertex).Coordinatespublic int getVertexIndex()
public boolean hasNext()
true if there are more vertices to scanpublic boolean isEndOfLine()
LineString.true if the iterator is at an endpointpublic void next()
Copyright © 2015 Revolution Systems Inc.. All rights reserved.