labelIntersectionNodes method

void labelIntersectionNodes(
  1. int argIndex
)

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.

Implementation

void labelIntersectionNodes(int argIndex) {
  for (Iterator i = arg[argIndex].getEdgeIterator(); i.moveNext();) {
    Edge e = i.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.find(ei.coord) as RelateNode;
      if (n.getLabel()!.isNull(argIndex)) {
        if (eLoc == Location.BOUNDARY)
          n.setLabelBoundary(argIndex);
        else
          n.setLabelWithIndex(argIndex, Location.INTERIOR);
      }
//n.print(System.out);
    }
  }
}