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 geometryFactory) |
Modifier and Type | Method and Description |
---|---|
Geometry |
read(PathIterator pathIt)
Converts a flat path to a
Geometry . |
static Geometry |
read(PathIterator pathIt,
GeometryFactory geomFact)
Converts a flat path to a
Geometry . |
static Geometry |
read(Shape shp,
double flatness,
GeometryFactory geomFact)
Converts a Shape to a Geometry, flattening it first.
|
static List |
toCoordinates(PathIterator pathIt)
Extracts the points of the paths in a flat
PathIterator into
a list of Coordinate arrays. |
public ShapeReader(GeometryFactory geometryFactory)
public static Geometry read(PathIterator pathIt, GeometryFactory geomFact)
Geometry
.pathIt
- the path to convertgeomFact
- the GeometryFactory to usepublic static Geometry read(Shape shp, double flatness, GeometryFactory geomFact)
shp
- the Java2D shapeflatness
- the flatness parameter to usegeomFact
- the GeometryFactory to usepublic Geometry read(PathIterator pathIt)
Geometry
.pathIt
- the path to convertpublic static List toCoordinates(PathIterator pathIt)
PathIterator
into
a list of Coordinate arrays.pathIt
- a path iteratorIllegalArgumentException
- if a non-linear segment type is encounteredCopyright © 2024. All rights reserved.