extendMeters method
Creates a BoundingBox that is a fixed meter amount larger on all sides (but does not cross date line/poles).
@param meters extension (must be >= 0) @return an extended BoundingBox or this (if meters == 0)
Implementation
BoundingBox extendMeters(int meters) {
assert(meters >= 0);
if (meters == 0) {
return this;
}
double verticalExpansion = Projection.latitudeDistance(meters);
double horizontalExpansion = Projection.longitudeDistance(
meters, max(minLatitude.abs(), maxLatitude.abs()));
double minLat =
max(Projection.LATITUDE_MIN, this.minLatitude - verticalExpansion);
double minLon =
max(Projection.LONGITUDE_MIN, this.minLongitude - horizontalExpansion);
double maxLat =
min(Projection.LATITUDE_MAX, this.maxLatitude + verticalExpansion);
double maxLon =
min(Projection.LONGITUDE_MAX, this.maxLongitude + horizontalExpansion);
return new BoundingBox(minLat, minLon, maxLat, maxLon);
}