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 enumEnumerated type for Shapes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckEOF(StreamTokenizer stream) next word in the streamprivate static booleanisNumberNext(StreamTokenizer stream) checks if the next token is a numberprivate static StringnextCloser(StreamTokenizer stream) checks if next token is a closing parenprivate static StringnextCloserOrComma(StreamTokenizer stream) expects either a closing LPAREN or comma as the next tokenprivate static StringnextComma(StreamTokenizer stream) expects a comma as next tokenprivate static StringnextEmptyOrOpen(StreamTokenizer stream) checks if next token is an EMPTY or open parenprivate static doublenextNumber(StreamTokenizer stream) next number in the streamprivate static StringnextOpener(StreamTokenizer stream) expects an open RPAREN as the next tokeprivate static StringnextWord(StreamTokenizer stream) next word in the streamstatic Objectprivate static RectangleparseBBox(StreamTokenizer stream) parses an ENVELOPEprivate static voidparseCoordinate(StreamTokenizer stream, ArrayList<Double> lats, ArrayList<Double> lons) parses a single coordinate, w/ optional 3rd dimensionprivate static voidparseCoordinates(StreamTokenizer stream, ArrayList<Double> lats, ArrayList<Double> lons) Parses a list of points into latitude and longitude arraylistsstatic ObjectparseExpectedType(String wkt, SimpleWKTShapeParser.ShapeType shapeType) private static ObjectparseGeometry(StreamTokenizer stream, SimpleWKTShapeParser.ShapeType shapeType) parse geometry from the stream tokenizerprivate static Object[]parses a GEOMETRYCOLLECTIONprivate static LineparseLine(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 PolygonparsePolygon(StreamTokenizer stream) parses a POLYGONprivate static PolygonparsePolygonHole(StreamTokenizer stream) parses the hole of a polygonprivate static StringtokenString(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:
IOExceptionParseException
-
parseExpectedType
public static Object parseExpectedType(String wkt, SimpleWKTShapeParser.ShapeType shapeType) throws IOException, ParseException - Throws:
IOExceptionParseException
-
parseGeometry
private static Object parseGeometry(StreamTokenizer stream, SimpleWKTShapeParser.ShapeType shapeType) throws IOException, ParseException parse geometry from the stream tokenizer- Throws:
IOExceptionParseException
-
parsePoint
Parses a point as a double array- Throws:
IOExceptionParseException
-
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:
IOExceptionParseException
-
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:
IOExceptionParseException
-
parseMultiPoint
private static double[][] parseMultiPoint(StreamTokenizer stream) throws IOException, ParseException parses a MULTIPOINT type- Throws:
IOExceptionParseException
-
parseLine
parses a LINESTRING- Throws:
IOExceptionParseException
-
parseMultiLine
parses a MULTILINESTRING- Throws:
IOExceptionParseException
-
parsePolygonHole
parses the hole of a polygon- Throws:
IOExceptionParseException
-
parsePolygon
parses a POLYGON- Throws:
IOExceptionParseException
-
parseMultiPolygon
private static Polygon[] parseMultiPolygon(StreamTokenizer stream) throws IOException, ParseException parses a MULTIPOLYGON- Throws:
IOExceptionParseException
-
parseBBox
parses an ENVELOPE- Throws:
IOExceptionParseException
-
parseGeometryCollection
private static Object[] parseGeometryCollection(StreamTokenizer stream) throws IOException, ParseException parses a GEOMETRYCOLLECTION- Throws:
IOExceptionParseException
-
nextWord
next word in the stream- Throws:
ParseExceptionIOException
-
nextNumber
next number in the stream- Throws:
IOExceptionParseException
-
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:
IOExceptionParseException
-
nextCloser
checks if next token is a closing paren- Throws:
IOExceptionParseException
-
nextComma
expects a comma as next token- Throws:
IOExceptionParseException
-
nextOpener
expects an open RPAREN as the next toke- Throws:
IOExceptionParseException
-
nextCloserOrComma
expects either a closing LPAREN or comma as the next token- Throws:
IOExceptionParseException
-
checkEOF
next word in the stream- Throws:
ParseExceptionIOException
-