[android] LatLngBounds: latNorth should be greater or equal than latSouth

This commit is contained in:
Osana Babayan
2018-02-27 18:27:22 +01:00
committed by GitHub
parent 977e9f118c
commit 43a7db0b0b
2 changed files with 13 additions and 0 deletions

View File

@@ -283,6 +283,8 @@ public class LatLngBounds implements Parcelable {
* This values of latNorth and latSouth should be in the range of [-90, 90],
* see {@link GeometryConstants#MIN_LATITUDE} and {@link GeometryConstants#MAX_LATITUDE},
* otherwise IllegalArgumentException will be thrown.
* latNorth should be greater or equal latSouth, otherwise IllegalArgumentException will be thrown.
*
* <p>
* This method doesn't recalculate most east or most west boundaries.
* Note that lonEast and lonWest will be wrapped to be in the range of [-180, 180],
@@ -312,6 +314,10 @@ public class LatLngBounds implements Parcelable {
throw new IllegalArgumentException("latitude must be between -90 and 90");
}
if (latNorth < latSouth) {
throw new IllegalArgumentException("LatSouth cannot be less than latNorth");
}
lonEast = LatLng.wrap(lonEast, GeometryConstants.MIN_LONGITUDE, GeometryConstants.MAX_LONGITUDE);
lonWest = LatLng.wrap(lonWest, GeometryConstants.MIN_LONGITUDE, GeometryConstants.MAX_LONGITUDE);