public class ShapeReader extends Object
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.
| Constructor and Description |
|---|
ShapeReader(GeometryFactory
|
| Modifier and Type | Method and Description |
|---|---|
Geometry |
read(PathIterator
Converts a flat path to a
Geometry.
|
static Geometry |
read(PathIterator
Converts a flat path to a
Geometry.
|
static Geometry |
read(Shape
Converts a Shape to a Geometry, flattening it first.
|
static List |
toCoordinates(PathIterator
Extracts the points of the paths in a flat
PathIterator into a list of Coordinate arrays.
|
public ShapeReader(GeometryFactorygeometryFactory)
public static Geometryread(PathIterator pathIt, GeometryFactory geomFact)
Geometry.
pathIt - the path to convert
geomFact - the GeometryFactory to use
public static Geometryread(Shape shp, double flatness, GeometryFactory geomFact)
shp - the Java2D shape
flatness - the flatness parameter to use
geomFact - the GeometryFactory to use
public Geometryread(PathIterator pathIt)
Geometry.
pathIt - the path to convert
public static ListtoCoordinates(PathIterator pathIt)
PathIterator into a list of Coordinate arrays.
pathIt - a path iterator
IllegalArgumentException - if a non-linear segment type is encountered