Shape componentBoundsShape = base.createTransformedShape(componentBounds);
Point2D componentCenter = new Point2D.Double(componentBoundsShape.getBounds().getCenterX(),
componentBoundsShape.getBounds().getCenterY());
if(componentBoundsShape.contains(ip)) {
double distanceSq = componentCenter.distanceSq(ip);
if(distanceSq < closestDistance) {
closestDistance = distanceSq;
closestAnnotation = annotation;
}
}