getCoordinateSequenceTryParen method
CoordinateSequence
getCoordinateSequenceTryParen(
- WKTTokenizer tokenizer,
- List<
Ordinate> ordinateFlags, - bool tryParen
Reads a CoordinateSequence
from a stream using the given {@link WKTTokenizer}.
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.
@param tokenizer the tokenizer to use @param ordinateFlags a bit-mask defining the ordinates to read. @param tryParen a value indicating if a starting {@link #L_PAREN} should be probed for each coordinate. @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
Implementation
CoordinateSequence getCoordinateSequenceTryParen(
WKTTokenizer tokenizer, List<Ordinate> ordinateFlags, bool tryParen) {
if (getNextEmptyOrOpener(tokenizer) == EMPTY)
return this.csFactory.createSizeDimMeas(0, toDimension(ordinateFlags),
ordinateFlags.contains(Ordinate.M) ? 1 : 0);
List<CoordinateSequence> coordinates = [];
do {
coordinates.add(getCoordinate(tokenizer, ordinateFlags, tryParen));
} while (getNextCloserOrComma(tokenizer) == COMMA);
return mergeSequences(coordinates, ordinateFlags);
}