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.StringgetFormatName()Deprecated.Shaperead(java.io.Reader reader)Deprecated.Read aShapefrom the reader.Shaperead(java.lang.Object value)Deprecated.ShapereadIfSupported(java.lang.Object value)Deprecated.private static PointreadLatCommaLonPoint(java.lang.String value, SpatialContext ctx)Deprecated.Reads geospatial latitude then a comma then longitude.static ShapereadShapeOrNull(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 anInvalidShapeExceptionis 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:
getFormatNamein interfaceShapeIO- Returns:
- the format name
-
read
public Shape read(java.lang.Object value) throws java.io.IOException, java.text.ParseException, InvalidShapeException
Deprecated.- 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
Deprecated.- 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 Shape read(java.io.Reader reader) throws java.io.IOException, java.text.ParseException, InvalidShapeException
Deprecated.Description copied from interface:ShapeReaderRead aShapefrom the reader.- Specified by:
readin interfaceShapeReader- Parameters:
reader- -- the input. Note, it will not be closed by this function- Returns:
- a valid Shape (never null)
- Throws:
java.io.IOExceptionjava.text.ParseExceptionInvalidShapeException
-
-