mergeLabelWithIndex method

void mergeLabelWithIndex(
  1. Label deLabel,
  2. int geomIndex
)

Merge the RHS label from a DirectedEdge into the label for this EdgeRing. The DirectedEdge label may be null. This is acceptable - it results from a node which is NOT an intersection node between the Geometries (e.g. the end node of a LinearRing). In this case the DirectedEdge label does not contribute any information to the overall labelling, and is simply skipped.

Implementation

void mergeLabelWithIndex(Label deLabel, int geomIndex) {
  int loc = deLabel.getLocationWithPosIndex(geomIndex, Position.RIGHT);
  // no information to be had from this label
  if (loc == Location.NONE) return;
  // if there is no current RHS value, set it
  if (label.getLocation(geomIndex) == Location.NONE) {
    label.setLocationWithIndex(geomIndex, loc);
    return;
  }
}