Package org.locationtech.spatial4j.io
Class LegacyShapeReader
- java.lang.Object
-
- org.locationtech.spatial4j.io.LegacyShapeReader
-
- All Implemented Interfaces:
ShapeIO
,ShapeReader
@Deprecated public class LegacyShapeReader extends java.lang.Object implements ShapeReader
Deprecated.Reads a shape from the old format.- Point: X Y
1.23 4.56 - Rect: XMin YMin XMax YMax
1.23 4.56 7.87 4.56 - {CIRCLE} '(' {POINT} {DISTANCE} ')'
CIRCLE is "CIRCLE" or "Circle" (no other case), and POINT is "X Y" order pair of doubles, or "Y,X" (lat,lon) pair of doubles, and DISTANCE is "d=RADIUS" or "distance=RADIUS" where RADIUS is a double that is the distance radius in degrees.
-
-
Constructor Summary
Constructors Constructor Description LegacyShapeReader(SpatialContext ctx, SpatialContextFactory factory)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getFormatName()
Deprecated.Shape
read(java.io.Reader reader)
Deprecated.Read aShape
from the reader.Shape
read(java.lang.Object value)
Deprecated.Shape
readIfSupported(java.lang.Object value)
Deprecated.private static Point
readLatCommaLonPoint(java.lang.String value, SpatialContext ctx)
Deprecated.Reads geospatial latitude then a comma then longitude.static Shape
readShapeOrNull(java.lang.String str, SpatialContext ctx)
Deprecated.Reads the shape specification as defined in the class javadocs.
-
-
-
Field Detail
-
ctx
final SpatialContext ctx
Deprecated.
-
-
Constructor Detail
-
LegacyShapeReader
public LegacyShapeReader(SpatialContext ctx, SpatialContextFactory factory)
Deprecated.
-
-
Method Detail
-
readShapeOrNull
public static Shape readShapeOrNull(java.lang.String str, SpatialContext ctx) throws InvalidShapeException
Deprecated.Reads the shape specification as defined in the class javadocs. If the first character is a letter but it doesn't complete out "Circle" or "CIRCLE" then this method returns null, offering the caller the opportunity to potentially try additional parsing. If the first character is not a letter then it's assumed to be a point or rectangle. If that doesn't work out then anInvalidShapeException
is thrown.- Throws:
InvalidShapeException
-
readLatCommaLonPoint
private static Point readLatCommaLonPoint(java.lang.String value, SpatialContext ctx) throws InvalidShapeException
Deprecated.Reads geospatial latitude then a comma then longitude.- Throws:
InvalidShapeException
-
getFormatName
public java.lang.String getFormatName()
Deprecated.- 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
Deprecated.- 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
Deprecated.- 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 Shape read(java.io.Reader reader) throws java.io.IOException, java.text.ParseException, InvalidShapeException
Deprecated.Description copied from interface:ShapeReader
Read aShape
from the reader.- Specified by:
read
in interfaceShapeReader
- Parameters:
reader
- -- the input. Note, it will not be closed by this function- Returns:
- a valid Shape (never null)
- Throws:
java.io.IOException
java.text.ParseException
InvalidShapeException
-
-