computeIntersectionNodes method

void computeIntersectionNodes(
  1. GeometryGraph geomGraph,
  2. int argIndex
)

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.

Implementation

void computeIntersectionNodes(GeometryGraph geomGraph, int argIndex) {
  for (Iterator edgeIt = geomGraph.getEdgeIterator(); edgeIt.moveNext();) {
    Edge e = edgeIt.current as Edge;
    int eLoc = e.getLabel()!.getLocation(argIndex);
    for (Iterator eiIt = e.getEdgeIntersectionList().iterator();
        eiIt.moveNext();) {
      EdgeIntersection ei = eiIt.current as EdgeIntersection;
      RelateNode n = nodes.addNodeFromCoordinate(ei.coord) as RelateNode;
      if (eLoc == Location.BOUNDARY)
        n.setLabelBoundary(argIndex);
      else {
        if (n.getLabel()!.isNull(argIndex))
          n.setLabelWithIndex(argIndex, Location.INTERIOR);
      }
//Debug.println(n);
    }
  }
}