Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android]Inconsistent parameters to LatLng.union
Browse files Browse the repository at this point in the history
  • Loading branch information
“osana” committed Dec 19, 2017
1 parent 752069d commit f1b6e45
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,17 @@ public LatLngBounds union(LatLngBounds bounds) {
* Returns a new LatLngBounds that stretches to include another LatLngBounds,
* given by corner points.
*
* @param lonNorth Northern Longitude
* @param latEast Eastern Latitude
* @param lonSouth Southern Longitude
* @param latWest Western Longitude
* @param latNorth Northern Latitude
* @param lonEast Eastern Longitude
* @param latSouth Southern Latitude
* @param lonWest Western Longitude
* @return BoundingBox
*/
public LatLngBounds union(final double lonNorth, final double latEast, final double lonSouth, final double latWest) {
return new LatLngBounds((this.latitudeNorth < lonNorth) ? lonNorth : this.latitudeNorth,
(this.longitudeEast < latEast) ? latEast : this.longitudeEast,
(this.latitudeSouth > lonSouth) ? lonSouth : this.latitudeSouth,
(this.longitudeWest > latWest) ? latWest : this.longitudeWest);
public LatLngBounds union(final double latNorth, final double lonEast, final double latSouth, final double lonWest) {
return new LatLngBounds((this.latitudeNorth < latNorth) ? latNorth : this.latitudeNorth,
(this.longitudeEast < lonEast) ? lonEast : this.longitudeEast,
(this.latitudeSouth > latSouth) ? latSouth : this.latitudeSouth,
(this.longitudeWest > lonWest) ? lonWest : this.longitudeWest);
}

/**
Expand All @@ -345,13 +345,13 @@ public LatLngBounds union(final double lonNorth, final double latEast, final dou
*/
@Nullable
public LatLngBounds intersect(LatLngBounds box) {
double minLatWest = Math.max(getLonWest(), box.getLonWest());
double maxLatEast = Math.min(getLonEast(), box.getLonEast());
if (maxLatEast > minLatWest) {
double minLonSouth = Math.max(getLatSouth(), box.getLatSouth());
double maxLonNorth = Math.min(getLatNorth(), box.getLatNorth());
if (maxLonNorth > minLonSouth) {
return new LatLngBounds(maxLonNorth, maxLatEast, minLonSouth, minLatWest);
double minLonWest = Math.max(getLonWest(), box.getLonWest());
double maxLonEast = Math.min(getLonEast(), box.getLonEast());
if (maxLonEast > minLonWest) {
double minLatSouth = Math.max(getLatSouth(), box.getLatSouth());
double maxLatNorth = Math.min(getLatNorth(), box.getLatNorth());
if (maxLatNorth > minLatSouth) {
return new LatLngBounds(maxLatNorth, maxLonEast, minLatSouth, minLonWest);
}
}
return null;
Expand Down

0 comments on commit f1b6e45

Please sign in to comment.