Class Polyline.Iter
java.lang.Object
org.apache.sis.internal.feature.j2d.Polyline.Iter
- All Implemented Interfaces:
PathIterator
- Enclosing class:
Polyline
Iterator over polyline(s) or polygon(s) coordinates. This implementation requires that all
Polyline
instances have non-empty coordinates array, otherwise ArrayIndexOutOfBoundsException
will occur.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private float[]
Coordinates to return (after conversion byinflate
) in calls tocurrentSegment(double[])
.private AffineTransform
The transform to apply on each coordinate tuple.private boolean
Whether iteration is finished.private boolean
Whether current coordinates make a polygon.Next polylines on which to iterate, or an empty iterator if none.private int
Current position incoordinates
array.private final AffineTransform
The user-specified transform, ornull
if none.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
currentSegment
(double[] coords) Returns coordinates of current line segment.int
currentSegment
(float[] coords) Returns coordinates of current line segment.int
Arbitrary winding rule, since enclosing class do not yet compute shape interior.boolean
isDone()
Returnstrue
if there are no more points to iterate.void
next()
Moves to the next point.private void
Initializes thecoordinates
,isPolygon
andinflate
fields for iteration over coordinate values given by the specified polyline.
-
Field Details
-
toUserSpace
The user-specified transform, ornull
if none. -
inflate
The transform to apply on each coordinate tuple. This is the concatenation of user-specified transform withPolyline.inflate
. Shall not be null, unless the iterator is empty. -
polylines
Next polylines on which to iterate, or an empty iterator if none. -
coordinates
private float[] coordinatesCoordinates to return (after conversion byinflate
) in calls tocurrentSegment(double[])
. -
position
private int positionCurrent position incoordinates
array. -
closing
private boolean closing -
isPolygon
private boolean isPolygonWhether current coordinates make a polygon. Iftrue
, then iteration shall emit a closingPathIterator.SEG_CLOSE
type before to move to next polyline or polygon. -
isDone
private boolean isDoneWhether iteration is finished.
-
-
Constructor Details
-
Iter
Iter()Creates an empty iterator. -
Iter
Iter(AffineTransform at, Polyline first, Iterator<Polyline> next) Creates a new iterator.- Parameters:
at
- the transform to apply on each coordinate tuple.first
- the first polyline or polygon.next
- all other polylines or polygons.
-
-
Method Details
-
setSource
Initializes thecoordinates
,isPolygon
andinflate
fields for iteration over coordinate values given by the specified polyline. -
getWindingRule
public int getWindingRule()Arbitrary winding rule, since enclosing class do not yet compute shape interior.- Specified by:
getWindingRule
in interfacePathIterator
-
isDone
public boolean isDone()Returnstrue
if there are no more points to iterate.- Specified by:
isDone
in interfacePathIterator
-
next
public void next()Moves to the next point.- Specified by:
next
in interfacePathIterator
-
currentSegment
public int currentSegment(float[] coords) Returns coordinates of current line segment.- Specified by:
currentSegment
in interfacePathIterator
-
currentSegment
public int currentSegment(double[] coords) Returns coordinates of current line segment.- Specified by:
currentSegment
in interfacePathIterator
-