/** * Returns the cached points for this edge. */ public Point2D getPoint(int index) { Object obj = points.get(index); if (index == 0 && sourceParentView != null) { return sourceParentView.getPerimeterPoint(this, getCenterPoint(sourceParentView), getNearestPoint(index == 0)); } else if (index == getPointCount() - 1 && targetParentView != null) { return targetParentView.getPerimeterPoint(this, getCenterPoint(targetParentView), getNearestPoint(index == 0)); } else if (obj instanceof PortView) // Port Location Seen From This Edge return ((PortView) obj).getLocation(this, getNearestPoint(index == 0)); else if (obj instanceof CellView) { // Should not happen Rectangle2D r = ((CellView) obj).getBounds(); return new Point2D.Double(r.getX(), r.getY()); } else if (obj instanceof Point2D) // Regular Point return (Point2D) obj; return null; }