isInteriorsConnected method
bool
isInteriorsConnected(
)
Implementation
bool isInteriorsConnected() {
// node the edges, in case holes touch the shell
List splitEdges = [];
geomGraph.computeSplitEdges(splitEdges);
// form the edges into rings
PlanarGraph graph = new PlanarGraph.withFactory(new OverlayNodeFactory());
graph.addEdges(splitEdges);
setInteriorEdgesInResult(graph);
graph.linkResultDirectedEdges();
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(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);
}