Package org.locationtech.spatial4j.io
Class PolyshapeReader
- java.lang.Object
-
- org.locationtech.spatial4j.io.PolyshapeReader
-
- All Implemented Interfaces:
ShapeIO,ShapeReader
public class PolyshapeReader extends java.lang.Object implements ShapeReader
- See Also:
PolyshapeWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPolyshapeReader.XReaderfrom Apache 2.0 licensed: https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java
-
Field Summary
Fields Modifier and Type Field Description (package private) SpatialContextctx(package private) ShapeFactoryshpFactory
-
Constructor Summary
Constructors Constructor Description PolyshapeReader(SpatialContext ctx, SpatialContextFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFormatName()Shaperead(java.io.Reader r)Read aShapefrom the reader.Shaperead(java.lang.Object value)ShapereadIfSupported(java.lang.Object value)protected ShapereadPolygon(PolyshapeReader.XReader reader)
-
-
-
Field Detail
-
ctx
final SpatialContext ctx
-
shpFactory
final ShapeFactory shpFactory
-
-
Constructor Detail
-
PolyshapeReader
public PolyshapeReader(SpatialContext ctx, SpatialContextFactory factory)
-
-
Method Detail
-
getFormatName
public java.lang.String getFormatName()
- Specified by:
getFormatNamein interfaceShapeIO- Returns:
- the format name
-
read
public Shape read(java.lang.Object value) throws java.io.IOException, java.text.ParseException, InvalidShapeException
- Specified by:
readin interfaceShapeReader- Parameters:
value- -- the input value, could be a String or other object- Returns:
- a shape valid shape (not null)
- Throws:
java.io.IOExceptionjava.text.ParseExceptionInvalidShapeException
-
readIfSupported
public Shape readIfSupported(java.lang.Object value) throws InvalidShapeException
- Specified by:
readIfSupportedin interfaceShapeReader- Parameters:
value- -- the input value, could be a String or other object- Returns:
- a shape or null, if the input was un readable.
This will throw
InvalidShapeExceptionwhen we could read a shape, but it was invalid - Throws:
InvalidShapeException
-
read
public final Shape read(java.io.Reader r) throws java.text.ParseException, java.io.IOException
Description copied from interface:ShapeReaderRead aShapefrom the reader.- Specified by:
readin interfaceShapeReader- Parameters:
r- -- the input. Note, it will not be closed by this function- Returns:
- a valid Shape (never null)
- Throws:
java.text.ParseExceptionjava.io.IOException
-
readPolygon
protected Shape readPolygon(PolyshapeReader.XReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
-