/// <summary>
 /// Insert nodes for all intersections on the edges of a Geometry.
 /// Label the created nodes the same as the edge label if they do not already have a label.
 /// This allows nodes created by either self-intersections or
 /// mutual intersections to be labelled.
 /// Endpoint nodes will already be labelled from when they were inserted.
 /// Precondition: edge intersections have been computed.
 /// </summary>
 /// <param name="geomGraph"></param>
 /// <param name="argIndex"></param>
 public void ComputeIntersectionNodes(GeometryGraph geomGraph, int argIndex)
 {
     for (IEnumerator edgeIt = geomGraph.GetEdgeEnumerator(); edgeIt.MoveNext();)
     {
         Edge      e    = (Edge)edgeIt.Current;
         Locations eLoc = e.Label.GetLocation(argIndex);
         for (IEnumerator eiIt = e.EdgeIntersectionList.GetEnumerator(); eiIt.MoveNext();)
         {
             EdgeIntersection ei = (EdgeIntersection)eiIt.Current;
             RelateNode       n  = (RelateNode)nodes.AddNode(ei.Coordinate);
             if (eLoc == Locations.Boundary)
             {
                 n.SetLabelBoundary(argIndex);
             }
             else if (n.Label.IsNull(argIndex))
             {
                 n.SetLabel(argIndex, Locations.Interior);
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// For all intersections on the edges of a Geometry,
 /// label the corresponding node IF it doesn't already have a label.
 /// This allows nodes created by either self-intersections or
 /// mutual intersections to be labelled.
 /// Endpoint nodes will already be labelled from when they were inserted.
 /// </summary>
 /// <param name="argIndex"></param>
 private void LabelIntersectionNodes(int argIndex)
 {
     for (IEnumerator i = arg[argIndex].GetEdgeEnumerator(); i.MoveNext();)
     {
         Edge      e    = (Edge)i.Current;
         Locations eLoc = e.Label.GetLocation(argIndex);
         for (IEnumerator eiIt = e.EdgeIntersectionList.GetEnumerator(); eiIt.MoveNext();)
         {
             EdgeIntersection ei = (EdgeIntersection)eiIt.Current;
             RelateNode       n  = (RelateNode)nodes.Find(ei.Coordinate);
             if (n.Label.IsNull(argIndex))
             {
                 if (eLoc == Locations.Boundary)
                 {
                     n.SetLabelBoundary(argIndex);
                 }
                 else
                 {
                     n.SetLabel(argIndex, Locations.Interior);
                 }
             }
         }
     }
 }