Exemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="startDE"></param>
 /// <returns></returns>
 private EdgeRing FindEdgeRing(PolygonizeDirectedEdge startDE)
 {
     PolygonizeDirectedEdge de = startDE;
     EdgeRing er = new EdgeRing(_factory);
     do 
     {
         er.Add(de);
         de.Ring = er;
         de = de.Next;
         Assert.IsTrue(de != null, "found null DE in ring");
         Assert.IsTrue(de == startDE || ! de.IsInRing, "found DE already in ring");
     }
     while (de != startDE);
     return er;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Finds all nodes in a maximal edgering which are self-intersection nodes
 /// </summary>
 /// <param name="startDE"></param>
 /// <param name="label"></param>
 /// <returns> 
 /// The list of intersection nodes found,
 /// or null if no intersection nodes were found.       
 /// </returns>
 private static IList FindIntersectionNodes(PolygonizeDirectedEdge startDE, long label)
 {
     PolygonizeDirectedEdge de = startDE;
     IList intNodes = null;
     do 
     {
         if (de == null) continue;
         Node node = de.FromNode;
         if (GetDegree(node, label) > 1) 
         {
             if (intNodes == null)
                 intNodes = new ArrayList();
             intNodes.Add(node);
         }
         de = de.Next;
         Assert.IsTrue(de != null, "found null DE in ring");
         Assert.IsTrue(de == startDE || !de.IsInRing, "found DE already in ring");
     } 
     while (de != startDE);
     return intNodes;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Traverse a ring of DirectedEdges, accumulating them into a list.
 /// This assumes that all dangling directed edges have been removed
 /// from the graph, so that there is always a next dirEdge.
 /// </summary>
 /// <param name="startDE">The DirectedEdge to start traversing at.</param>
 /// <returns>A List of DirectedEdges that form a ring.</returns>
 private static IList FindDirEdgesInRing(PolygonizeDirectedEdge startDE)
 {
     PolygonizeDirectedEdge de = startDE;
     IList edges = new ArrayList();
     do 
     {
         edges.Add(de);
         de = de.Next;
         Assert.IsTrue(de != null, "found null DE in ring");
         Assert.IsTrue(de == startDE || !de.IsInRing, "found DE already in ring");
     }
     while (de != startDE);
     return edges;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Add a <c>LineString</c> forming an edge of the polygon graph.
        /// </summary>
        /// <param name="line">The line to add.</param>
        public virtual void AddEdge(LineString line)
        {
            if (line.IsEmpty) return;
            IList<Coordinate> linePts = CoordinateArrays.RemoveRepeatedPoints(line.Coordinates);
            Coordinate startPt = linePts[0];
            Coordinate endPt = linePts[linePts.Count - 1];

            Node nStart = GetNode(startPt);
            Node nEnd = GetNode(endPt);

            DirectedEdge de0 = new PolygonizeDirectedEdge(nStart, nEnd, linePts[1], true);
            DirectedEdge de1 = new PolygonizeDirectedEdge(nEnd, nStart, linePts[linePts.Count - 2], false);
            Edge edge = new PolygonizeEdge(line);
            edge.SetDirectedEdges(de0, de1);
            Add(edge);
        }