Class PathIteratorAdapter

java.lang.Object
org.apache.sis.internal.feature.jts.PathIteratorAdapter
All Implemented Interfaces:
PathIterator

final class PathIteratorAdapter extends Object implements 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 Classes
    Modifier and Type
    Class
    Description
    private 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

    Fields
    Modifier and Type
    Field
    Description
    private 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, or null 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

    Constructors
    Constructor
    Description
    PathIteratorAdapter(org.locationtech.jts.geom.Geometry geometry, AffineTransform at)
    Creates a new iterator which will transform coordinates using the given transform.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    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
    Returns true 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
    Moves the iterator to the next segment.
    private void
    Moves to the next sequence of coordinate tuples.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • at

      private final AffineTransform at
      The transform to apply on returned coordinate values. Never null (may be the identity transform instead).
    • sequences

      private final Iterator<org.locationtech.jts.geom.CoordinateSequence> sequences
      Provider of coordinate sequences.
    • coordinates

      private org.locationtech.jts.geom.CoordinateSequence coordinates
      The sequence of coordinate tuples to return, or null if the iteration is finished.
    • pointCount

      private int pointCount
      Number of points to return in the sequence.
    • closingPoint

      private int closingPoint
      Index of the coordinates tuple which closes the current polygon, or -1 if none.
    • currentIndex

      private int currentIndex
      Index 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, or null for the identity transform.
  • Method Details

    • nextSequence

      private void nextSequence()
      Moves to the next sequence of coordinate tuples. The coordinates sequence should be null when this method is invoked. If there are no more sequences, then the coordinates will be left unchanged (i.e. null).
    • next

      public void next()
      Moves the iterator to the next segment.
      Specified by:
      next in interface PathIterator
    • isDone

      public boolean isDone()
      Returns true if iteration is finished.
      Specified by:
      isDone in interface PathIterator
    • 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 by ShapeCollectionPathIterator.
      Specified by:
      getWindingRule in interface PathIterator
    • currentSegment

      public int currentSegment(double[] coords)
      Returns the coordinates and type of the current path segment in the iteration.
      Specified by:
      currentSegment in interface PathIterator
      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 interface PathIterator
      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.