/** * 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); }
return circularSegmentize( p1, p2, p3, center, radius, 32 );