Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        /// <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);
        }