protected List routeLoop(GraphLayoutCache cache, EdgeView edge) { List newPoints = new ArrayList(); newPoints.add(edge.getSource()); CellView sourceParent = (edge.getSource() != null) ? edge .getSource().getParentView() : edge.getSourceParentView(); if (sourceParent != null) { Point2D from = AbstractCellView.getCenterPoint(sourceParent); Rectangle2D rect = sourceParent.getBounds(); double width = rect.getWidth(); double height2 = rect.getHeight() / 2; double loopWidth = Math.min(20, Math.max(10, width / 8)); double loopHeight = Math.min(30, Math.max(12, Math.max( loopWidth + 4, height2 / 2))); newPoints.add(edge.getAttributes().createPoint( from.getX() - loopWidth, from.getY() - height2 - loopHeight * 1.2)); newPoints.add(edge.getAttributes().createPoint(from.getX(), from.getY() - height2 - 1.5 * loopHeight)); newPoints.add(edge.getAttributes().createPoint( from.getX() + loopWidth, from.getY() - height2 - loopHeight * 1.2)); newPoints.add(edge.getTarget()); return newPoints; } return null; }
for (int i = 0; i < n; i++) p[i] = tmp.getAttributes().createPoint(tmp.getPoint(i));
} else if (edge.getSource() != null) { Rectangle2D b = edge.getSource().getBounds(); from = edge.getAttributes().createPoint(b.getCenterX(), b.getCenterY()); else if (target != null) { Rectangle2D b = target.getBounds(); to = edge.getAttributes().createPoint(b.getCenterX(), b.getCenterY()); routed[0] = edge.getAttributes().createPoint(x2, from.getY()); routed[1] = edge.getAttributes().createPoint(x2, to.getY()); if (targetBounds.contains(routed[0]) || targetBounds.contains(routed[1]) || (sourceBounds.contains(routed[1]))) { routed[0] = edge.getAttributes().createPoint( from.getX(), y2); routed[1] = edge.getAttributes().createPoint( to.getX(), y2); routed[0] = edge.getAttributes().createPoint( from.getX(), y2); routed[1] = edge.getAttributes().createPoint(to.getX(), y2); if (targetBounds.contains(routed[0])