public static MapBounds adjustBoundsToScaleAndMapSize(
final MapAttribute.MapAttributeValues mapValues, final double dpiOfRequestor,
final Rectangle paintArea, final MapBounds bounds) {
MapBounds newBounds = bounds;
if (mapValues.isUseNearestScale()) {
newBounds = newBounds.adjustBoundsToNearestScale(
mapValues.getZoomLevels(),
mapValues.getZoomSnapTolerance(),
mapValues.getZoomLevelSnapStrategy(), paintArea, dpiOfRequestor);
}