Class PathIteratorAdapter
java.lang.Object
org.apache.sis.internal.feature.jts.PathIteratorAdapter
- All Implemented Interfaces:
PathIterator
Java2D path iterator for JTS geometry.
This iterator gets coordinates from the
CoordinateSequence
associated to each geometry.- Since:
- 1.2
- Version:
- 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
An iterator over the coordinate sequences of a geometry collection.private static final class
An iterator over the coordinate sequences of a polygon. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AffineTransform
The transform to apply on returned coordinate values.private int
Index of the coordinates tuple which closes the current polygon, or -1 if none.private org.locationtech.jts.geom.CoordinateSequence
The sequence of coordinate tuples to return, ornull
if the iteration is finished.private int
Index of current position in the sequence of coordinate tuples.private int
Number of points to return in the sequence.private final Iterator
<org.locationtech.jts.geom.CoordinateSequence> Provider of coordinate sequences.Fields inherited from interface java.awt.geom.PathIterator
SEG_CLOSE, SEG_CUBICTO, SEG_LINETO, SEG_MOVETO, SEG_QUADTO, WIND_EVEN_ODD, WIND_NON_ZERO
-
Constructor Summary
ConstructorsConstructorDescriptionPathIteratorAdapter
(org.locationtech.jts.geom.Geometry geometry, AffineTransform at) Creates a new iterator which will transform coordinates using the given transform. -
Method Summary
Modifier and TypeMethodDescriptionint
currentSegment
(double[] coords) Returns the coordinates and type of the current path segment in the iteration.int
currentSegment
(float[] coords) Returns the coordinates and type of the current path segment in the iteration.int
Returns the winding rule for determining the interior of the path.boolean
isDone()
Returnstrue
if iteration is finished.private static Iterator
<org.locationtech.jts.geom.CoordinateSequence> iterator
(org.locationtech.jts.geom.Geometry geometry) Returns an iterator over the coordinate sequences of the given geometry.void
next()
Moves the iterator to the next segment.private void
Moves to the next sequence of coordinate tuples.
-
Field Details
-
at
The transform to apply on returned coordinate values. Never null (may be the identity transform instead). -
sequences
Provider of coordinate sequences. -
coordinates
private org.locationtech.jts.geom.CoordinateSequence coordinatesThe sequence of coordinate tuples to return, ornull
if the iteration is finished. -
pointCount
private int pointCountNumber of points to return in the sequence. -
closingPoint
private int closingPointIndex of the coordinates tuple which closes the current polygon, or -1 if none. -
currentIndex
private int currentIndexIndex of current position in the sequence of coordinate tuples.
-
-
Constructor Details
-
PathIteratorAdapter
PathIteratorAdapter(org.locationtech.jts.geom.Geometry geometry, AffineTransform at) Creates a new iterator which will transform coordinates using the given transform.- Parameters:
geometry
- the geometry on which to iterator.at
- the transform to apply, ornull
for the identity transform.
-
-
Method Details
-
nextSequence
private void nextSequence()Moves to the next sequence of coordinate tuples. Thecoordinates
sequence should be null when this method is invoked. If there are no more sequences, then thecoordinates
will be left unchanged (i.e. null). -
next
public void next()Moves the iterator to the next segment.- Specified by:
next
in interfacePathIterator
-
isDone
public boolean isDone()Returnstrue
if iteration is finished.- Specified by:
isDone
in interfacePathIterator
-
getWindingRule
public int getWindingRule()Returns the winding rule for determining the interior of the path. Current implementation returns the same rule than the one returned byShapeCollectionPathIterator
.- Specified by:
getWindingRule
in interfacePathIterator
-
currentSegment
public int currentSegment(double[] coords) Returns the coordinates and type of the current path segment in the iteration.- Specified by:
currentSegment
in interfacePathIterator
- Parameters:
coords
- an array where to store the data returned from this method.- Returns:
- the path-segment type of the current path segment.
-
currentSegment
public int currentSegment(float[] coords) Returns the coordinates and type of the current path segment in the iteration.- Specified by:
currentSegment
in interfacePathIterator
- Parameters:
coords
- an array where to store the data returned from this method.- Returns:
- the path-segment type of the current path segment.
-
iterator
private static Iterator<org.locationtech.jts.geom.CoordinateSequence> iterator(org.locationtech.jts.geom.Geometry geometry) Returns an iterator over the coordinate sequences of the given geometry.- Parameters:
geometry
- the geometry for which to get coordinate sequences.- Returns:
- coordinate sequences over the given geometry.
-