protected Point2D getPointLocation(int index) { Object obj = points.get(index); if (obj instanceof Point2D) { return (Point2D) obj; } else if (obj instanceof VirtualNode) { return ((VirtualNode) obj).getPosition(); } else if (obj instanceof PortView) { VertexView vertex = (VertexView) ((CellView) obj) .getParentView(); if (vertex != null) { return vertex.getCenterPoint(); } } return null; }