public bool IsInteriorsConnected() { // node the edges, in case holes touch the shell ArrayList splitEdges = new ArrayList(); _geomGraph.ComputeSplitEdges(splitEdges); // polygonize the edges PlanarGraph graph = new PlanarGraph(new OverlayNodeFactory()); graph.AddEdges(splitEdges); SetAllEdgesInResult(graph); graph.LinkAllDirectedEdges(); ArrayList edgeRings = buildEdgeRings(graph.EdgeEnds); /** * 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.Geometry, 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)); }