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 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
-
Field Summary
Fields Modifier and Type Field Description (package private) SpatialContext
ctx
(package private) ShapeFactory
shpFactory
-
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.String
getFormatName()
Shape
read(java.io.Reader r)
Read aShape
from the reader.Shape
read(java.lang.Object value)
Shape
readIfSupported(java.lang.Object value)
protected Shape
readPolygon(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:
getFormatName
in interfaceShapeIO
- Returns:
- the format name
-
read
public Shape read(java.lang.Object value) throws java.io.IOException, java.text.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:
java.io.IOException
java.text.ParseException
InvalidShapeException
-
readIfSupported
public Shape readIfSupported(java.lang.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(java.io.Reader r) throws java.text.ParseException, java.io.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:
java.text.ParseException
java.io.IOException
-
readPolygon
protected Shape readPolygon(PolyshapeReader.XReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
-