private EdgeRingCollection BuildMinimalEdgeRings(EdgeRingCollection maxEdgeRings, EdgeRingCollection shellList, EdgeRingCollection freeHoleList) { EdgeRingCollection edgeRings = new EdgeRingCollection(); for (IEdgeRingEnumerator it = maxEdgeRings.GetEnumerator(); it.MoveNext();) { MaximalEdgeRing er = (MaximalEdgeRing)it.Current; if (er.MaxNodeDegree > 2) { er.LinkDirectedEdgesForMinimalEdgeRings(); EdgeRingCollection minEdgeRings = er.BuildMinimalRings(); // at this point we can go ahead and attempt to place holes, if this EdgeRing is a polygon EdgeRing shell = FindShell(minEdgeRings); if (shell != null) { PlacePolygonHoles(shell, minEdgeRings); shellList.Add(shell); } else { freeHoleList.AddRange(minEdgeRings); } } else { edgeRings.Add(er); } } return(edgeRings); }
/// <summary> For all rings in the input list, /// determine whether the ring is a shell or a hole /// and Add it to the appropriate list. /// Due to the way the DirectedEdges were linked, /// a ring is a shell if it is oriented CW, a hole otherwise. /// </summary> private void SortShellsAndHoles(EdgeRingCollection edgeRings, EdgeRingCollection shellList, EdgeRingCollection freeHoleList) { for (IEdgeRingEnumerator it = edgeRings.GetEnumerator(); it.MoveNext();) { EdgeRing er = it.Current; // er.SetInResult(); if (er.IsHole) { freeHoleList.Add(er); } else { shellList.Add(er); } } }
public EdgeRingCollection BuildMinimalRings() { EdgeRingCollection minEdgeRings = new EdgeRingCollection(); DirectedEdge de = startDe; do { if (de.MinEdgeRing == null) { EdgeRing minEr = new MinimalEdgeRing(de, geometryFactory); minEdgeRings.Add(minEr); } de = de.Next; }while (de != startDe); return(minEdgeRings); }
/// <summary> /// For all DirectedEdges in result, form them into MaximalEdgeRings /// </summary> private EdgeRingCollection BuildMaximalEdgeRings(ArrayList dirEdges) { EdgeRingCollection maxEdgeRings = new EdgeRingCollection(); for (IEnumerator it = dirEdges.GetEnumerator(); it.MoveNext();) { DirectedEdge de = (DirectedEdge)it.Current; if (de.InResult && de.Label.IsArea()) { // if this edge has not yet been processed if (de.EdgeRing == null) { MaximalEdgeRing er = new MaximalEdgeRing(de, geometryFactory); maxEdgeRings.Add(er); er.SetInResult(); } } } return(maxEdgeRings); }