/// <summary> /// /// </summary> /// <param name="maxEdgeRings"></param> /// <param name="shellList"></param> /// <param name="freeHoleList"></param> /// <returns></returns> private static IList BuildMinimalEdgeRings(IEnumerable maxEdgeRings, IList shellList, IList freeHoleList) { IList edgeRings = new ArrayList(); for (IEnumerator it = maxEdgeRings.GetEnumerator(); it.MoveNext();) { MaximalEdgeRing er = (MaximalEdgeRing)it.Current; if (er.MaxNodeDegree > 2) { er.LinkDirectedEdgesForMinimalEdgeRings(); IList 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.addAll(minEdgeRings); foreach (object obj in minEdgeRings) { freeHoleList.Add(obj); } } } else { edgeRings.Add(er); } } return(edgeRings); }
/// <summary> /// For all DirectedEdges in result, form them into MaximalEdgeRings. /// </summary> /// <param name="dirEdges"></param> /// <returns></returns> private IList BuildMaximalEdgeRings(IEnumerable dirEdges) { IList maxEdgeRings = new ArrayList(); for (IEnumerator it = dirEdges.GetEnumerator(); it.MoveNext();) { DirectedEdge de = (DirectedEdge)it.Current; if (!de.IsInResult || !de.Label.IsArea()) { continue; } // if this edge has not yet been processed if (de.EdgeRing != null) { continue; } MaximalEdgeRing er = new MaximalEdgeRing(de, _geometryFactory); maxEdgeRings.Add(er); er.SetInResult(); } return(maxEdgeRings); }
/// <summary> /// Form <see cref="DirectedEdge" />s in graph into Minimal EdgeRings. /// (Minimal Edgerings must be used, because only they are guaranteed to provide /// a correct isHole computation). /// </summary> /// <param name="dirEdges"></param> /// <returns></returns> private IList BuildEdgeRings(IList dirEdges) { IList edgeRings = new ArrayList(); foreach (DirectedEdge de in dirEdges) { // if this edge has not yet been processed if (de.IsInResult && de.EdgeRing == null) { MaximalEdgeRing er = new MaximalEdgeRing(de, _geometryFactory); er.LinkDirectedEdgesForMinimalEdgeRings(); IList minEdgeRings = er.BuildMinimalRings(); foreach (object o in minEdgeRings) edgeRings.Add(o); } } return edgeRings; }
/// <summary> /// For all DirectedEdges in result, form them into MaximalEdgeRings. /// </summary> /// <param name="dirEdges"></param> /// <returns></returns> private IList BuildMaximalEdgeRings(IEnumerable dirEdges) { IList maxEdgeRings = new ArrayList(); for (IEnumerator it = dirEdges.GetEnumerator(); it.MoveNext(); ) { DirectedEdge de = (DirectedEdge)it.Current; if (!de.IsInResult || !de.Label.IsArea()) continue; // if this edge has not yet been processed if (de.EdgeRing != null) continue; MaximalEdgeRing er = new MaximalEdgeRing(de, _geometryFactory); maxEdgeRings.Add(er); er.SetInResult(); } return maxEdgeRings; }