java.lang.Object
org.apache.lucene.geo.SimpleWKTShapeParser
Parses shape geometry represented in WKT format
complies with OGC® document: 12-063r5 and ISO/IEC 13249-3:2016 standard located at http://docs.opengeospatial.org/is/12-063r5/12-063r5.html
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enumerated type for Shapes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkEOF
(StreamTokenizer stream) next word in the streamprivate static boolean
isNumberNext
(StreamTokenizer stream) checks if the next token is a numberprivate static String
nextCloser
(StreamTokenizer stream) checks if next token is a closing parenprivate static String
nextCloserOrComma
(StreamTokenizer stream) expects either a closing LPAREN or comma as the next tokenprivate static String
nextComma
(StreamTokenizer stream) expects a comma as next tokenprivate static String
nextEmptyOrOpen
(StreamTokenizer stream) checks if next token is an EMPTY or open parenprivate static double
nextNumber
(StreamTokenizer stream) next number in the streamprivate static String
nextOpener
(StreamTokenizer stream) expects an open RPAREN as the next tokeprivate static String
nextWord
(StreamTokenizer stream) next word in the streamstatic Object
private static Rectangle
parseBBox
(StreamTokenizer stream) parses an ENVELOPEprivate static void
parseCoordinate
(StreamTokenizer stream, ArrayList<Double> lats, ArrayList<Double> lons) parses a single coordinate, w/ optional 3rd dimensionprivate static void
parseCoordinates
(StreamTokenizer stream, ArrayList<Double> lats, ArrayList<Double> lons) Parses a list of points into latitude and longitude arraylistsstatic Object
parseExpectedType
(String wkt, SimpleWKTShapeParser.ShapeType shapeType) private static Object
parseGeometry
(StreamTokenizer stream, SimpleWKTShapeParser.ShapeType shapeType) parse geometry from the stream tokenizerprivate static Object[]
parses a GEOMETRYCOLLECTIONprivate static Line
parseLine
(StreamTokenizer stream) parses a LINESTRINGprivate static Line[]
parseMultiLine
(StreamTokenizer stream) parses a MULTILINESTRINGprivate static double[][]
parseMultiPoint
(StreamTokenizer stream) parses a MULTIPOINT typeprivate static Polygon[]
parseMultiPolygon
(StreamTokenizer stream) parses a MULTIPOLYGONprivate static double[]
parsePoint
(StreamTokenizer stream) Parses a point as a double arrayprivate static Polygon
parsePolygon
(StreamTokenizer stream) parses a POLYGONprivate static Polygon
parsePolygonHole
(StreamTokenizer stream) parses the hole of a polygonprivate static String
tokenString
(StreamTokenizer stream) next token in the stream
-
Field Details
-
EMPTY
- See Also:
-
SPACE
- See Also:
-
LPAREN
- See Also:
-
RPAREN
- See Also:
-
COMMA
- See Also:
-
NAN
- See Also:
-
NUMBER
- See Also:
-
EOF
- See Also:
-
EOL
- See Also:
-
-
Constructor Details
-
SimpleWKTShapeParser
private SimpleWKTShapeParser()
-
-
Method Details
-
parse
- Throws:
IOException
ParseException
-
parseExpectedType
public static Object parseExpectedType(String wkt, SimpleWKTShapeParser.ShapeType shapeType) throws IOException, ParseException - Throws:
IOException
ParseException
-
parseGeometry
private static Object parseGeometry(StreamTokenizer stream, SimpleWKTShapeParser.ShapeType shapeType) throws IOException, ParseException parse geometry from the stream tokenizer- Throws:
IOException
ParseException
-
parsePoint
Parses a point as a double array- Throws:
IOException
ParseException
-
parseCoordinates
private static void parseCoordinates(StreamTokenizer stream, ArrayList<Double> lats, ArrayList<Double> lons) throws IOException, ParseException Parses a list of points into latitude and longitude arraylists- Throws:
IOException
ParseException
-
parseCoordinate
private static void parseCoordinate(StreamTokenizer stream, ArrayList<Double> lats, ArrayList<Double> lons) throws IOException, ParseException parses a single coordinate, w/ optional 3rd dimension- Throws:
IOException
ParseException
-
parseMultiPoint
private static double[][] parseMultiPoint(StreamTokenizer stream) throws IOException, ParseException parses a MULTIPOINT type- Throws:
IOException
ParseException
-
parseLine
parses a LINESTRING- Throws:
IOException
ParseException
-
parseMultiLine
parses a MULTILINESTRING- Throws:
IOException
ParseException
-
parsePolygonHole
parses the hole of a polygon- Throws:
IOException
ParseException
-
parsePolygon
parses a POLYGON- Throws:
IOException
ParseException
-
parseMultiPolygon
private static Polygon[] parseMultiPolygon(StreamTokenizer stream) throws IOException, ParseException parses a MULTIPOLYGON- Throws:
IOException
ParseException
-
parseBBox
parses an ENVELOPE- Throws:
IOException
ParseException
-
parseGeometryCollection
private static Object[] parseGeometryCollection(StreamTokenizer stream) throws IOException, ParseException parses a GEOMETRYCOLLECTION- Throws:
IOException
ParseException
-
nextWord
next word in the stream- Throws:
ParseException
IOException
-
nextNumber
next number in the stream- Throws:
IOException
ParseException
-
tokenString
next token in the stream -
isNumberNext
checks if the next token is a number- Throws:
IOException
-
nextEmptyOrOpen
checks if next token is an EMPTY or open paren- Throws:
IOException
ParseException
-
nextCloser
checks if next token is a closing paren- Throws:
IOException
ParseException
-
nextComma
expects a comma as next token- Throws:
IOException
ParseException
-
nextOpener
expects an open RPAREN as the next toke- Throws:
IOException
ParseException
-
nextCloserOrComma
expects either a closing LPAREN or comma as the next token- Throws:
IOException
ParseException
-
checkEOF
next word in the stream- Throws:
ParseException
IOException
-