use of com.revolsys.geometry.operation.overlay.OverlayNodeFactory 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;
}
}
}
use of com.revolsys.geometry.operation.overlay.OverlayNodeFactory in project com.revolsys.open by revolsys.
the class ConnectedInteriorTester method isInteriorsConnected.
public boolean isInteriorsConnected() {
// node the edges, in case holes touch the shell
final List splitEdges = new ArrayList();
this.geomGraph.computeSplitEdges(splitEdges);
// form the edges into rings
final PlanarGraph graph = new PlanarGraph(new OverlayNodeFactory());
graph.addEdges(splitEdges);
setInteriorEdgesInResult(graph);
graph.linkResultDirectedEdges();
final List edgeRings = buildEdgeRings(graph.getEdgeEnds());
/**
* Mark all the edges for the edgeRings corresponding to the shells
* of the input polygons. Note only ONE ring gets marked for each shell.
*/
visitShellInteriors(this.geomGraph.getGeometry(), graph);
/**
* If there are any unvisited shell edges
* (i.e. a ring which is not a hole and which has the interior
* of the parent area on the RHS)
* this means that one or more holes must have split the interior of the
* polygon into at least two pieces. The polygon is thus invalid.
*/
return !hasUnvisitedShellEdge(edgeRings);
}
Aggregations