Class Polyline.Iter

java.lang.Object
org.apache.sis.internal.feature.j2d.Polyline.Iter
All Implemented Interfaces:
PathIterator
Enclosing class:
Polyline

static final class Polyline.Iter extends Object implements PathIterator
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 Details

    • toUserSpace

      private final AffineTransform toUserSpace
      The user-specified transform, or null if none.
    • inflate

      private AffineTransform inflate
      The transform to apply on each coordinate tuple. This is the concatenation of user-specified transform with Polyline.inflate. Shall not be null, unless the iterator is empty.
    • polylines

      private final Iterator<Polyline> polylines
      Next polylines on which to iterate, or an empty iterator if none.
    • coordinates

      private float[] coordinates
      Coordinates to return (after conversion by inflate) in calls to currentSegment(double[]).
    • position

      private int position
      Current position in coordinates array.
    • closing

      private boolean closing
    • isPolygon

      private boolean isPolygon
      Whether current coordinates make a polygon. If true, then iteration shall emit a closing PathIterator.SEG_CLOSE type before to move to next polyline or polygon.
    • isDone

      private boolean isDone
      Whether 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

      private void setSource(Polyline polyline)
      Initializes the coordinates, isPolygon and inflate 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 interface PathIterator
    • isDone

      public boolean isDone()
      Returns true if there are no more points to iterate.
      Specified by:
      isDone in interface PathIterator
    • next

      public void next()
      Moves to the next point.
      Specified by:
      next in interface PathIterator
    • currentSegment

      public int currentSegment(float[] coords)
      Returns coordinates of current line segment.
      Specified by:
      currentSegment in interface PathIterator
    • currentSegment

      public int currentSegment(double[] coords)
      Returns coordinates of current line segment.
      Specified by:
      currentSegment in interface PathIterator