// ------------------// // isCompatibleWith // // ------------------// private boolean isCompatibleWith(SystemPoint point) { // Check x-proximity and y-alignment Scale scale = getSystem().getScale(); int dx = scale.toUnits(constants.maxDx); int dy = scale.toUnits(constants.maxDy); // Horizontal distance int xDist = Math.min(Math.abs(getBox().x - point.x), Math.abs((getBox().x + getBox().width) - point.x)); // Vertical distance int yDist = Math.abs(getReferencePoint().y - point.y); return (xDist <= dx) && (yDist <= dy); }