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 booleanprivate float[]Coordinates to return (after conversion byinflate) in calls tocurrentSegment(double[]).private AffineTransformThe transform to apply on each coordinate tuple.private booleanWhether iteration is finished.private booleanWhether current coordinates make a polygon.Next polylines on which to iterate, or an empty iterator if none.private intCurrent position incoordinatesarray.private final AffineTransformThe user-specified transform, ornullif 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 TypeMethodDescriptionintcurrentSegment(double[] coords) Returns coordinates of current line segment.intcurrentSegment(float[] coords) Returns coordinates of current line segment.intArbitrary winding rule, since enclosing class do not yet compute shape interior.booleanisDone()Returnstrueif there are no more points to iterate.voidnext()Moves to the next point.private voidInitializes thecoordinates,isPolygonandinflatefields for iteration over coordinate values given by the specified polyline.
-
Field Details
-
toUserSpace
The user-specified transform, ornullif 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 incoordinatesarray. -
closing
private boolean closing -
isPolygon
private boolean isPolygonWhether current coordinates make a polygon. Iftrue, then iteration shall emit a closingPathIterator.SEG_CLOSEtype 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,isPolygonandinflatefields 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:
getWindingRulein interfacePathIterator
-
isDone
public boolean isDone()Returnstrueif there are no more points to iterate.- Specified by:
isDonein interfacePathIterator
-
next
public void next()Moves to the next point.- Specified by:
nextin interfacePathIterator
-
currentSegment
public int currentSegment(float[] coords) Returns coordinates of current line segment.- Specified by:
currentSegmentin interfacePathIterator
-
currentSegment
public int currentSegment(double[] coords) Returns coordinates of current line segment.- Specified by:
currentSegmentin interfacePathIterator
-