/**
   * Process an edge and its labels.
   *
   * @param edge an edge
   * @param edgeRouting the global edge routing setting
   */
  private KVector processEdge(final KEdge edge, final EdgeRouting edgeRouting) {
    KEdgeLayout edgeLayout = edge.getData(KEdgeLayout.class);
    boolean sameHierarchy = edge.getSource().getParent() == edge.getTarget().getParent();
    KVector maxv = new KVector();
    KVectorChain bendPoints = edgeLayout.getProperty(LayoutOptions.BEND_POINTS);
    // we need at least two bend points, since the source point and target point must be included
    if (bendPoints != null && bendPoints.size() >= 2) {
      edgeLayout.applyVectorChain(bendPoints);
    }

    // determine maximal coordinates
    if (sameHierarchy) {
      for (KPoint point : edgeLayout.getBendPoints()) {
        maxv.x = Math.max(maxv.x, point.getX());
        maxv.y = Math.max(maxv.y, point.getY());
      }
    }

    // set the fixed position of the edge labels, or leave them as they are
    for (KLabel label : edge.getLabels()) {
      KShapeLayout labelLayout = label.getData(KShapeLayout.class);
      KVector pos = labelLayout.getProperty(LayoutOptions.POSITION);
      if (pos != null) {
        labelLayout.applyVector(pos);
      }
      if (sameHierarchy) {
        maxv.x = Math.max(maxv.x, labelLayout.getXpos() + labelLayout.getWidth());
        maxv.y = Math.max(maxv.y, labelLayout.getYpos() + labelLayout.getHeight());
      }
    }

    return maxv;
  }