private List<PolyLine> processPolyLine(final Geometry intersections) { final List<PolyLine> result = new ArrayList<>(); if (intersections instanceof GeometryCollection) { final GeometryCollection collection = (GeometryCollection) intersections; final int numGeometries = collection.getNumGeometries(); for (int n = 0; n < numGeometries; n++) { final Geometry geometry = collection.getGeometryN(n); result.addAll(processPolyLine(geometry)); } } else if (intersections instanceof LineString) { result.add(new JtsPolyLineConverter().backwardConvert((LineString) intersections)); } return result; }
private List<? extends PolyLine> processResult(final Geometry intersections) { final List<PolyLine> result = new ArrayList<>(); if (intersections instanceof GeometryCollection) { final GeometryCollection collection = (GeometryCollection) intersections; final int numGeometries = collection.getNumGeometries(); for (int n = 0; n < numGeometries; n++) { final Geometry geometry = collection.getGeometryN(n); result.addAll(processResult(geometry)); } } else if (intersections instanceof com.vividsolutions.jts.geom.Polygon) { result.add(new JtsPolygonConverter() .backwardConvert((com.vividsolutions.jts.geom.Polygon) intersections)); } else if (intersections instanceof LineString) { result.add(new JtsPolyLineConverter().backwardConvert((LineString) intersections)); } return result; } }
@Override public PolyLine backwardConvert(final String wkt) { LineString geometry = null; final WKTReader myReader = new WKTReader(); try { geometry = (LineString) myReader.read(wkt); } catch (final ParseException | ClassCastException e) { throw new CoreException("Cannot parse wkt : {}", wkt); } return new JtsPolyLineConverter().backwardConvert(geometry); }
.backwardConvert((LineString) geometry); final Iterable<? extends Shard> shards = sharding.shardsIntersecting(polyline); for (final Shard shard : shards)