private Coordinate getPreciseCoordinate() throws IOException, ParseException { return getPreciseCoordinate(false); }
private List<Coordinate> getCoordinateList(boolean openExpected) throws IOException, ParseException { String nextToken; if (openExpected) { nextToken = getNextEmptyOrOpener(); if (nextToken.equals(EMPTY)) { return Collections.emptyList(); } } ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>(); coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); while (nextToken.equals(COMMA)) { coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); } Coordinate[] array = new Coordinate[coordinates.size()]; return coordinates; }
/** * Returns the next array of <code>Coordinate</code>s in the stream. * * @param measures TRUE if measures are available * @return the next array of <code>Coordinate</code>s in the stream, or an empty array if EMPTY * is the next element returned by the stream. * @throws IOException if an I/O error occurs * @throws ParseException if an unexpected token was encountered */ private Coordinate[] getCoordinates(boolean measures) throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(); if (nextToken.equals(EMPTY)) { return new Coordinate[] {}; } ArrayList coordinates = new ArrayList(); coordinates.add(getPreciseCoordinate(measures)); nextToken = getNextCloserOrComma(); while (nextToken.equals(COMMA)) { coordinates.add(getPreciseCoordinate(measures)); nextToken = getNextCloserOrComma(); } Coordinate[] array = new Coordinate[coordinates.size()]; return (Coordinate[]) coordinates.toArray(array); }
/** * Creates a <code>Point</code> using the next token in the stream. * * @return a <code>Point</code> specified by the next token in the stream * @throws IOException if an I/O error occurs * @throws ParseException if an unexpected token was encountered */ private Point readPointText() throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(); if (nextToken.equals(EMPTY)) { return geometryFactory.createPoint((Coordinate) null); } Point point = geometryFactory.createPoint(getPreciseCoordinate()); getNextCloser(); return point; }
} else { ArrayList coordinates = new ArrayList(); coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); while (nextToken.equals(COMMA)) { coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma();
private List<Coordinate> getCoordinateList(boolean openExpected) throws IOException, ParseException { String nextToken; if( openExpected ){ nextToken = getNextEmptyOrOpener(); if (nextToken.equals(EMPTY)) { return Collections.emptyList(); } } ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>(); coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); while (nextToken.equals(COMMA)) { coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); } Coordinate[] array = new Coordinate[coordinates.size()]; return coordinates; }
/** * Creates a <code>Point</code> using the next token in the stream. * *@return a <code>Point</code> specified by the next token in the stream *@throws IOException * if an I/O error occurs *@throws ParseException * if an unexpected token was encountered */ private Point readPointText() throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(); if (nextToken.equals(EMPTY)) { return geometryFactory.createPoint((Coordinate) null); } Point point = geometryFactory.createPoint(getPreciseCoordinate()); getNextCloser(); return point; }
/** * Returns the next array of <code>Coordinate</code>s in the stream. * *@return the next array of <code>Coordinate</code>s in the stream, or an empty array if EMPTY * is the next element returned by the stream. *@throws IOException * if an I/O error occurs *@throws ParseException * if an unexpected token was encountered */ private Coordinate[] getCoordinates() throws IOException, ParseException { String nextToken = getNextEmptyOrOpener(); if (nextToken.equals(EMPTY)) { return new Coordinate[] {}; } ArrayList coordinates = new ArrayList(); coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); while (nextToken.equals(COMMA)) { coordinates.add(getPreciseCoordinate()); nextToken = getNextCloserOrComma(); } Coordinate[] array = new Coordinate[coordinates.size()]; return (Coordinate[]) coordinates.toArray(array); }