use of com.revolsys.geometry.operation.overlay.PolygonBuilder in project com.revolsys.open by revolsys.
the class Buffer method buffer.
private static Geometry buffer(final Noder noder, final GeometryFactory precisionModel, final Geometry geometry, final double distance, final BufferParameters parameters) {
final GeometryFactory geometryFactory = geometry.getGeometryFactory();
final OffsetCurveSetBuilder curveSetBuilder = new OffsetCurveSetBuilder(geometry, distance, precisionModel, parameters);
final List<NodedSegmentString> curves = curveSetBuilder.getCurves();
if (curves.size() == 0) {
return geometryFactory.polygon();
} else {
final EdgeList edgeList = new EdgeList();
computeNodedEdges(noder, edgeList, curves);
final PlanarGraph graph = new PlanarGraph(new OverlayNodeFactory());
final List<Edge> edges = edgeList.getEdges();
graph.addEdges(edges);
final List<BufferSubgraph> subgraphList = newSubgraphs(graph);
final PolygonBuilder polyBuilder = new PolygonBuilder(geometryFactory);
buildSubgraphs(subgraphList, polyBuilder);
final List<Polygon> polygons = polyBuilder.getPolygons();
if (polygons.size() == 0) {
return geometryFactory.polygon();
} else {
final Geometry resultGeom = geometryFactory.buildGeometry(polygons);
return resultGeom;
}
}
}
Aggregations