Class ShapeReader

Hierarchy: Object , ShapeReader
public class ShapeReader
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.

Authors:
Martin Davis
public ShapeReader(GeometryFactory geometryFactory)
public static Geometry read(PathIterator pathIt, GeometryFactory geomFact)
Converts a flat path to a Geometry.
Parameters:
pathIt - pathIt the path to convert
geomFact - geomFact the GeometryFactory to use
Returns:
a Geometry representing the path
public static Geometry read(Shape shp, double flatness, GeometryFactory geomFact)
Converts a Shape to a Geometry, flattening it first.
Parameters:
shp - shp the Java2D shape
flatness - flatness the flatness parameter to use
geomFact - geomFact the GeometryFactory to use
Returns:
a Geometry representing the shape
public Geometry read(PathIterator pathIt)
Converts a flat path to a Geometry.
Parameters:
pathIt - pathIt the path to convert
Returns:
a Geometry representing the path
public static List toCoordinates(PathIterator pathIt)
Extracts the points of the paths in a flat PathIterator into a list of Coordinate arrays.
Parameters:
pathIt - pathIt a path iterator
Returns:
a List of Coordinate arrays
Throws:
IllegalArgumentException - IllegalArgumentException if a non-linear segment type is encountered