diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2017-08-10 15:07:48 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2017-08-17 16:48:18 +0200 |
commit | 830bf151be41609526a662c08bfdf04d358defbf (patch) | |
tree | a97f3b5d3381ca8dc7ae2bdc5a614c86453d017c /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java | |
parent | fb05d2e16a403077597ceeba6548b4246c8b1c8c (diff) | |
download | qtlocation-mapboxgl-830bf151be41609526a662c08bfdf04d358defbf.tar.gz |
[android] - create smallest possible LatLngBounds when visible region crosses the dateline
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java index a2d759d006..16c73b1ca5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java @@ -93,8 +93,6 @@ public class Projection { * @return The projection of the viewing frustum in its current state. */ public VisibleRegion getVisibleRegion() { - LatLngBounds.Builder builder = new LatLngBounds.Builder(); - float left = 0; float right = nativeMapView.getWidth(); float top = 0; @@ -105,12 +103,13 @@ public class Projection { LatLng bottomRight = fromScreenLocation(new PointF(right, bottom)); LatLng bottomLeft = fromScreenLocation(new PointF(left, bottom)); - builder.include(topLeft) - .include(topRight) - .include(bottomRight) - .include(bottomLeft); - - return new VisibleRegion(topLeft, topRight, bottomLeft, bottomRight, builder.build()); + return new VisibleRegion(topLeft, topRight, bottomLeft, bottomRight, + LatLngBounds.from( + topRight.getLatitude(), + topRight.getLongitude(), + bottomLeft.getLatitude(), + bottomLeft.getLongitude()) + ); } /** |