/** * Reads a <code>Coordinate</Code> from a stream using the given {@link StreamTokenizer}. * <p> * All ordinate values are read, but -depending on the {@link CoordinateSequenceFactory} of the * underlying {@link GeometryFactory}- not necessarily all can be handled. Those are silently dropped. * </p> * <p> * * </p> * @param tokenizer the tokenizer to use * @param ordinateFlags a bit-mask defining the ordinates to read. * @return a {@link CoordinateSequence} of length 1 containing the read ordinate values * *@throws IOException if an I/O error occurs *@throws ParseException if an unexpected token was encountered */ private CoordinateSequence getCoordinateSequence(StreamTokenizer tokenizer, EnumSet<Ordinate> ordinateFlags) throws IOException, ParseException { return getCoordinateSequence(tokenizer, ordinateFlags, false); }
/** * Creates a <code>LineString</code> using the next token in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <LineString Text>. *@return a <code>LineString</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 LineString readLineStringText(StreamTokenizer tokenizer, EnumSet<Ordinate> ordinateFlags) throws IOException, ParseException { return geometryFactory.createLineString(getCoordinateSequence(tokenizer, ordinateFlags)); }
/** * Creates a <code>Point</code> using the next token in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <Point Text>. *@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(StreamTokenizer tokenizer, EnumSet<Ordinate> ordinateFlags) throws IOException, ParseException { Point point = geometryFactory.createPoint(getCoordinateSequence(tokenizer, ordinateFlags)); return point; }
/** * Creates a <code>MultiPoint</code> using the next tokens in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <MultiPoint Text>. *@return a <code>MultiPoint</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 MultiPoint readMultiPointText(StreamTokenizer tokenizer, EnumSet<Ordinate> ordinateFlags) throws IOException, ParseException { return geometryFactory.createMultiPoint( getCoordinateSequence(tokenizer, ordinateFlags, this.isAllowOldJtsMultipointSyntax)); }
/** * Creates a <code>LinearRing</code> using the next token in the stream. * *@param tokenizer tokenizer over a stream of text in Well-known Text * format. The next tokens must form a <LineString Text>. *@return a <code>LinearRing</code> specified by the next * token in the stream *@throws IOException if an I/O error occurs *@throws ParseException if the coordinates used to create the <code>LinearRing</code> * do not form a closed linestring, or if an unexpected token was * encountered */ private LinearRing readLinearRingText(StreamTokenizer tokenizer, EnumSet<Ordinate> ordinateFlags) throws IOException, ParseException { return geometryFactory.createLinearRing(getCoordinateSequence(tokenizer, ordinateFlags)); }