createEdgeEndForNext method

void createEdgeEndForNext(
  1. Edge edge,
  2. List l,
  3. EdgeIntersection eiCurr,
  4. EdgeIntersection? eiNext,
)

Create a StubEdge for the edge after the intersection eiCurr. The next intersection is provided in case it is the endpoint for the stub edge. Otherwise, the next point from the parent edge will be the endpoint.
eiCurr will always be an EdgeIntersection, but eiNext may be null.

Implementation

void createEdgeEndForNext(
    Edge edge, List l, EdgeIntersection eiCurr, EdgeIntersection? eiNext) {
  int iNext = eiCurr.segmentIndex + 1;
  // if there is no next edge there is nothing to do
  if (iNext >= edge.getNumPoints() && eiNext == null) return;

  Coordinate pNext = edge.getCoordinateWithIndex(iNext);

  // if the next intersection is in the same segment as the current, use it as the endpoint
  if (eiNext != null && eiNext.segmentIndex == eiCurr.segmentIndex)
    pNext = eiNext.coord;

  EdgeEnd e = new EdgeEnd.withCoordsLabel(
      edge, eiCurr.coord, pNext, new Label.fromLabel(edge.getLabel()!));
//Debug.println(e);
  l.add(e);
}