Package org.locationtech.spatial4j.io
Class PolyshapeReader
- java.lang.Object
-
- org.locationtech.spatial4j.io.PolyshapeReader
-
- All Implemented Interfaces:
ShapeIO
,ShapeReader
public class PolyshapeReader extends Object implements ShapeReader
- See Also:
PolyshapeWriter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PolyshapeReader.XReader
from Apache 2.0 licensed: https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java
-
Constructor Summary
Constructors Constructor Description PolyshapeReader(SpatialContext ctx, SpatialContextFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFormatName()
Shape
read(Reader r)
Read aShape
from the reader.Shape
read(Object value)
Shape
readIfSupported(Object value)
protected Shape
readPolygon(PolyshapeReader.XReader reader)
-
-
-
Constructor Detail
-
PolyshapeReader
public PolyshapeReader(SpatialContext ctx, SpatialContextFactory factory)
-
-
Method Detail
-
getFormatName
public String getFormatName()
- Specified by:
getFormatName
in interfaceShapeIO
- Returns:
- the format name
-
read
public Shape read(Object value) throws IOException, ParseException, InvalidShapeException
- Specified by:
read
in interfaceShapeReader
- Parameters:
value
- -- the input value, could be a String or other object- Returns:
- a shape valid shape (not null)
- Throws:
IOException
ParseException
InvalidShapeException
-
readIfSupported
public Shape readIfSupported(Object value) throws InvalidShapeException
- Specified by:
readIfSupported
in 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
InvalidShapeException
when we could read a shape, but it was invalid - Throws:
InvalidShapeException
-
read
public final Shape read(Reader r) throws ParseException, IOException
Description copied from interface:ShapeReader
Read aShape
from the reader.- Specified by:
read
in interfaceShapeReader
- Parameters:
r
- -- the input. Note, it will not be closed by this function- Returns:
- a valid Shape (never null)
- Throws:
ParseException
IOException
-
readPolygon
protected Shape readPolygon(PolyshapeReader.XReader reader) throws IOException
- Throws:
IOException
-
-