nextWord = getNextWord(); if (nextWord.equals(L_PAREN)) { List<Coordinate> coords = getCoordinateList(false); LineString lineString = geometryFactory.createLineString(
/** * Creates a <code>LineString</code> using the next token in the stream. * * @return * @throws IOException * @throws ParseException */ private LineString readCircularStringText() throws IOException, ParseException { List<Coordinate> coordinates = getCoordinateList(true); if (coordinates.size() == 0) { return geometryFactory.createCurvedGeometry( new LiteCoordinateSequence(new Coordinate[0])); } else if (coordinates.size() < 3) { throw new ParseException("A CIRCULARSTRING must contain at least 3 control points"); } else { double[] controlPoints = toControlPoints(coordinates); return geometryFactory.createCurvedGeometry(2, controlPoints); } }
/** * This method will read a LineString, CircularString or CompoundCurve and return the result as * a LinearRing. * * @return LinearRing * <p>This method expects either "EMPTY", "(", "CIRCULARSTRING", or "COMPOIUNDCURVE" to * start out with. * @throws IOException * @throws ParseException */ private LinearRing readCurvedLinearRingText() throws IOException, ParseException { String nextWord = getNextWord(); if (nextWord.equals(L_PAREN)) { List<Coordinate> coords = getCoordinateList(false); return new LinearRing( new CoordinateArraySequence(coords.toArray(new Coordinate[coords.size()])), geometryFactory); } else if (nextWord.equalsIgnoreCase("CIRCULARSTRING")) { return (LinearRing) readCircularStringText(); } else if (nextWord.equalsIgnoreCase("COMPOUNDCURVE")) { return (LinearRing) readCompoundCurveText(); } else { parseError(L_PAREN + ", CIRCULARSTRING or COMPOUNDCURVE"); return null; } }
/** * Creates a <code>LineString</code> using the next token in the stream. * * @return * @throws IOException * @throws ParseException */ private LineString readCircularStringText() throws IOException, ParseException { List<Coordinate> coordinates = getCoordinateList( true ); List<Coordinate> segmentized; if (coordinates.size() < 3) { segmentized = coordinates; } else { segmentized = new ArrayList<Coordinate>(); for (int i = 0; i < coordinates.size() - 1; i += 2) { Coordinate p1 = coordinates.get(i); Coordinate p2 = coordinates.get(i + 1); Coordinate p3 = coordinates.get(i + 2); List<Coordinate> segments = circularSegmentize(p1, p2, p3); segmentized.addAll(segments.subList(0, segments.size() - 1)); } segmentized.add(coordinates.get(coordinates.size() - 1)); } // we can now process these coordinates based on the current precision model Coordinate array[] = segmentized.toArray(new Coordinate[segmentized.size()]); return geometryFactory.createLineString(array); }
nextWord = getNextWord(); if( nextWord.equals(L_PAREN) ){ List<Coordinate> coords = getCoordinateList(false); LineString lineString = geometryFactory.createLineString( coords.toArray( new Coordinate[coords.size()])); lineStrings.add(lineString);
List<Coordinate> coords = getCoordinateList(false); ring = coords.toArray( new Coordinate[coords.size()]);