public class LinearIterator extends Object implements Iterable<org.locationtech.jts.linearref.LinearLocation>
Constructor and Description |
---|
LinearIterator(org.locationtech.jts.geom.Geometry linear)
Creates an iterator initialized to the start of a linear
Geometry |
LinearIterator(org.locationtech.jts.geom.Geometry linearGeom,
int componentIndex,
int vertexIndex)
Creates an iterator starting at a specified component and vertex in a linear
Geometry |
LinearIterator(org.locationtech.jts.geom.Geometry linear,
org.locationtech.jts.linearref.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.
|
static org.locationtech.jts.linearref.LinearLocation |
getEndLocation(org.locationtech.jts.geom.Geometry linear) |
org.locationtech.jts.geom.LineString |
getLine()
Gets the
LineString component the iterator is current at. |
org.locationtech.jts.linearref.LinearLocation |
getLocation() |
org.locationtech.jts.geom.Coordinate |
getSegmentEnd()
Gets the second
Coordinate of the current segment. |
org.locationtech.jts.geom.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 linestring.
|
boolean |
isValidIndex() |
Iterator<org.locationtech.jts.linearref.LinearLocation> |
iterator() |
void |
next()
Moves the iterator ahead to the next vertex and (possibly) linear component.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public LinearIterator(org.locationtech.jts.geom.Geometry linear)
Geometry
linear
- the linear geometry to iterate overIllegalArgumentException
- if linearGeom is not linealpublic LinearIterator(org.locationtech.jts.geom.Geometry linear, org.locationtech.jts.linearref.LinearLocation start)
LinearLocation
on a linear Geometry
linear
- the linear geometry to iterate overstart
- the location to start atIllegalArgumentException
- if linearGeom is not linealpublic LinearIterator(org.locationtech.jts.geom.Geometry linearGeom, int componentIndex, int vertexIndex)
Geometry
linearGeom
- the linear geometry to iterate overcomponentIndex
- the component to start atvertexIndex
- the vertex to start atIllegalArgumentException
- if linearGeom is not linealpublic boolean hasNext()
true
if there are more vertices to scanpublic boolean isValidIndex()
public void next()
public boolean isEndOfLine()
true if the iterator is at an endpoint
public int getComponentIndex()
public int getVertexIndex()
public org.locationtech.jts.geom.LineString getLine()
LineString
component the iterator is current at.public org.locationtech.jts.geom.Coordinate getSegmentStart()
Coordinate
of the current segment. (the coordinate of the current
vertex).Coordinate
public org.locationtech.jts.geom.Coordinate getSegmentEnd()
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
public org.locationtech.jts.linearref.LinearLocation getLocation()
public Iterator<org.locationtech.jts.linearref.LinearLocation> iterator()
public static org.locationtech.jts.linearref.LinearLocation getEndLocation(org.locationtech.jts.geom.Geometry linear)
Copyright © 2019. All rights reserved.