JTS Topology Suite version 1.13

## com.vividsolutions.jts.awt
Class ShapeReader

    java.lang.Object
      com.vividsolutions.jts.awt.ShapeReader

    public class ShapeReader

extends java.lang.Object

Converts a Java2D `Shape` or the more general `PathIterator` into a `Geometry`.

The coordinate system for Java2D is typically screen coordinates, which has the Y axis inverted relative to the usual JTS coordinate system. This is rectified during conversion.

PathIterators to be converted are expected to be linear or flat. That is, they should contain only `SEG_MOVETO`, `SEG_LINETO`, and `SEG_CLOSE` segment types. Any other segment types will cause an exception.

Author:
  Martin Davis

Constructor Summary
`ShapeReader(GeometryFactory geometryFactory)`

Method Summary
`Geometry` `read(java.awt.geom.PathIterator pathIt)` Converts a flat path to a `Geometry`.
`static Geometry` `read(java.awt.geom.PathIterator pathIt, GeometryFactory geomFact)` Converts a flat path to a `Geometry`.
`static Geometry` `read(java.awt.Shape shp, double flatness, GeometryFactory geomFact)` Converts a Shape to a Geometry, flattening it first.
`static java.util.List` `toCoordinates(java.awt.geom.PathIterator pathIt)` Extracts the points of the paths in a flat `PathIterator` into a list of Coordinate arrays.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ShapeReader

    public ShapeReader(GeometryFactory geometryFactory)

Method Detail

### read

    public static Geometry read(java.awt.geom.PathIterator pathIt,
                                GeometryFactory geomFact)

  Converts a flat path to a `Geometry`.

  Parameters:
    `pathIt` - the path to convert
    `geomFact` - the GeometryFactory to use
  Returns:
    a Geometry representing the path

### read

    public static Geometry read(java.awt.Shape shp,
                                double flatness,
                                GeometryFactory geomFact)

  Converts a Shape to a Geometry, flattening it first.

  Parameters:
    `shp` - the Java2D shape
    `flatness` - the flatness parameter to use
    `geomFact` - the GeometryFactory to use
  Returns:
    a Geometry representing the shape

### read

    public Geometry read(java.awt.geom.PathIterator pathIt)

  Converts a flat path to a `Geometry`.

  Parameters:
    `pathIt` - the path to convert
  Returns:
    a Geometry representing the path

### toCoordinates

    public static java.util.List toCoordinates(java.awt.geom.PathIterator pathIt)

  Extracts the points of the paths in a flat `PathIterator` into a list of Coordinate arrays.

  Parameters:
    `pathIt` - a path iterator
  Returns:
    a List of Coordinate arrays
  Throws:
    `java.lang.IllegalArgumentException` - if a non-linear segment type is encountered

JTS Topology Suite version 1.13