Package com.spatial4j.core.io.jts
Class JtsWKTReaderShapeParser
- java.lang.Object
-
- com.spatial4j.core.io.WKTReader
-
- com.spatial4j.core.io.jts.JtsWKTReader
-
- com.spatial4j.core.io.jts.JtsWKTReaderShapeParser
-
- All Implemented Interfaces:
ShapeIO,ShapeReader
public class JtsWKTReaderShapeParser extends JtsWKTReader
This is an extension ofJtsWKTReaderthat processes the entire string with JTS'sWKTReader. Some differences:- No support for ENVELOPE and BUFFER
- MULTI* shapes use JTS's
GeometryCollectionsubclasses, notShapeCollection - 'Z' coordinates are saved into the geometry
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.spatial4j.core.io.WKTReader
WKTReader.State
-
-
Constructor Summary
Constructors Constructor Description JtsWKTReaderShapeParser(JtsSpatialContext ctx, JtsSpatialContextFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckCoordinates(com.vividsolutions.jts.geom.Geometry geom)ShapeparseIfSupported(String wktString)Parses the wktString, returning the defined Shape.protected ShapeparseIfSupported(String str, com.vividsolutions.jts.io.WKTReader reader)Reads WKT from thestrvia JTS'sWKTReader.-
Methods inherited from class com.spatial4j.core.io.jts.JtsWKTReader
coordinate, coordinateSequence, coordinateSequenceList, getDatelineRule, normDist, parseLineStringShape, parseMulitPolygonShape, parsePolygonShape, parseShapeByType, polygon
-
Methods inherited from class com.spatial4j.core.io.WKTReader
getFormatName, newState, parse, parseBufferShape, parseEnvelopeShape, parseGeometryCollectionShape, parseMultiLineStringShape, parseMultiPointShape, parsePointShape, point, pointList, read, read, readIfSupported, shape
-
-
-
-
Constructor Detail
-
JtsWKTReaderShapeParser
public JtsWKTReaderShapeParser(JtsSpatialContext ctx, JtsSpatialContextFactory factory)
-
-
Method Detail
-
parseIfSupported
public Shape parseIfSupported(String wktString) throws ParseException
Description copied from class:WKTReaderParses the wktString, returning the defined Shape. If it can't because the shape name is unknown or an empty or blank string was passed, then it returns null. If the WKT starts with a supported shape but contains an inner unsupported shape then it will result in aParseException.- Overrides:
parseIfSupportedin classWKTReader- Parameters:
wktString- non-null, can be empty or have surrounding whitespace- Returns:
- Shape, null if unknown / unsupported shape.
- Throws:
ParseException- Thrown if there is an error in the Shape definition
-
parseIfSupported
protected Shape parseIfSupported(String str, com.vividsolutions.jts.io.WKTReader reader) throws ParseException
Reads WKT from thestrvia JTS'sWKTReader.- Parameters:
str-reader-new WKTReader(ctx.getGeometryFactory()))
- Returns:
- Non-Null
- Throws:
ParseException
-
checkCoordinates
protected void checkCoordinates(com.vividsolutions.jts.geom.Geometry geom)
-
-