/// <summary> /// /// </summary> /// <returns></returns> public virtual bool IsInteriorsConnected() { // node the edges, in case holes touch the shell IList splitEdges = new ArrayList(); geomGraph.ComputeSplitEdges(splitEdges); // form the edges into rings PlanarGraph graph = new PlanarGraph(new OverlayNodeFactory()); graph.AddEdges(splitEdges); SetInteriorEdgesInResult(graph); graph.LinkResultDirectedEdges(); IList 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)); }
/** * Use a GeometryGraph to node the created edges, * and create split edges between the nodes */ private ArrayList NodeEdges(ArrayList edges) { // intersect edges again to ensure they are noded correctly GeometryGraph graph = new GeometryGraph(0, _geomFact.PrecisionModel, 0); //for (Iterator i = edges.iterator(); i.hasNext(); ) foreach (object obj in edges) { Edge e = (Edge)obj; graph.AddEdge(e); } SegmentIntersector si = graph.ComputeSelfNodes(_li); /* * if (si.hasProperIntersection()) * Debug.println("proper intersection found"); * else * Debug.println("no proper intersection found"); */ ArrayList newEdges = new ArrayList(); graph.ComputeSplitEdges(newEdges); return(newEdges); }