computeNodeDepth method

void computeNodeDepth(
  1. Node n
)

Implementation

void computeNodeDepth(Node n) {
  // find a visited dirEdge to start at
  DirectedEdge? startEdge = null;
  for (Iterator i = (n.getEdges() as DirectedEdgeStar).iterator();
      i.moveNext();) {
    DirectedEdge de = i.current;
    if (de.isVisited() || de.getSym().isVisited()) {
      startEdge = de;
      break;
    }
  }
  // MD - testing  Result: breaks algorithm
  //if (startEdge == null) return;

  // only compute string append if assertion would fail
  if (startEdge == null)
    throw new TopologyException("unable to find edge to compute depths at " +
        n.getCoordinate().toString());

  (n.getEdges() as DirectedEdgeStar).computeDepths(startEdge);

  // copy depths to sym edges
  for (Iterator i = (n.getEdges() as DirectedEdgeStar).iterator();
      i.moveNext();) {
    DirectedEdge de = i.current;
    de.setVisited(true);
    copySymDepths(de);
  }
}