LinearIterator class
An iterator over the components and coordinates of a linear geometry ({@link LineString}s and {@link MultiLineString}s.
The standard usage pattern for a {@link 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
Constructors
- LinearIterator(Geometry linear)
- Creates an iterator initialized to the start of a linear {@link Geometry}
- LinearIterator.withIndexes(Geometry linearGeom, int componentIndex, int vertexIndex)
- Creates an iterator starting at a specified component and vertex in a linear {@link Geometry}
- LinearIterator.withStart(Geometry linear, LinearLocation start)
- Creates an iterator starting at a {@link LinearLocation} on a linear {@link Geometry}
Properties
- componentIndex ↔ int
-
getter/setter pair
- currentLine ↔ LineString?
-
Invariant: currentLine <> null if the iterator is pointing at a valid coordinate
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- linearGeom ↔ Geometry
-
getter/setter pair
- numLines ↔ int
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- vertexIndex ↔ int
-
getter/setter pair
Methods
-
getComponentIndex(
) → int - The component index of the vertex the iterator is currently at. @return the current component index
-
getLine(
) → LineString - Gets the {@link LineString} component the iterator is current at. @return a linestring
-
getSegmentEnd(
) → Coordinate? -
Gets the second {@link Coordinate} of the current segment.
(the coordinate of the next vertex).
If the iterator is at the end of a line,
null
is returned. -
getSegmentStart(
) → Coordinate - Gets the first {@link Coordinate} of the current segment. (the coordinate of the current vertex). @return a {@link Coordinate}
-
getVertexIndex(
) → int - The vertex index of the vertex the iterator is currently at. @return the current vertex index
-
hasNext(
) → bool - Tests whether there are any vertices left to iterator over. Specifically, hasNext() return true if the current state of the iterator represents a valid location on the linear geometry.
-
isEndOfLine(
) → bool - Checks whether the iterator cursor is pointing to the endpoint of a component {@link LineString}.
-
loadCurrentLine(
) → void -
next(
) → void - Moves the iterator ahead to the next vertex and (possibly) linear component.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited