diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-07-11 14:52:17 +0200 |
---|---|---|
committer | Tobrun <tobrun.van.nuland@gmail.com> | 2016-07-11 15:52:23 +0200 |
commit | caba8c11b92e628e3fbc0f8843d265c4e10043bf (patch) | |
tree | e1ca17e44df3bed18db2ed96ffafe7c55580c636 | |
parent | 5d64cde6d94d8cc648bb734894f8111be3326262 (diff) | |
download | qtlocation-mapboxgl-caba8c11b92e628e3fbc0f8843d265c4e10043bf.tar.gz |
[android] - remove duplicate bearing/direction API from MapView
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 66 |
1 files changed, 21 insertions, 45 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index b3b91205b4..057efe07b0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -457,7 +457,7 @@ public class MapView extends FrameLayout { } else if (change == REGION_IS_CHANGING || change == REGION_DID_CHANGE || change == DID_FINISH_LOADING_MAP) { mMapboxMap.getMarkerViewManager().scheduleViewMarkerInvalidation(); - mCompassView.update(getDirection()); + mCompassView.update(getBearing()); mMyLocationView.update(); mMapboxMap.getMarkerViewManager().update(); @@ -634,45 +634,6 @@ public class MapView extends FrameLayout { mNativeMapView.setPitch(pitch, 0); } - - // - // Direction - // - - double getDirection() { - if (mDestroyed) { - return 0; - } - - double direction = -mNativeMapView.getBearing(); - - while (direction > 360) { - direction -= 360; - } - while (direction < 0) { - direction += 360; - } - - return direction; - } - - void setDirection(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) double direction) { - if (mDestroyed) { - return; - } - setDirection(direction, false); - } - - void setDirection(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) double direction, boolean animated) { - if (mDestroyed) { - return; - } - long duration = animated ? MapboxConstants.ANIMATION_DURATION : 0; - mNativeMapView.cancelTransitions(); - // Out of range directions are normalised in setBearing - mNativeMapView.setBearing(-direction, duration); - } - void resetNorth() { if (mDestroyed) { return; @@ -1405,7 +1366,17 @@ public class MapView extends FrameLayout { if (mDestroyed) { return 0; } - return mNativeMapView.getBearing(); + + double direction = -mNativeMapView.getBearing(); + + while (direction > 360) { + direction -= 360; + } + while (direction < 0) { + direction += 360; + } + + return direction; } void setBearing(float bearing) { @@ -1422,6 +1393,13 @@ public class MapView extends FrameLayout { mNativeMapView.setBearing(bearing, duration); } + void setBearing(double bearing, float focalX, float focalY) { + if (mDestroyed) { + return; + } + mNativeMapView.setBearing(bearing, focalX, focalY); + } + // // View events // @@ -1931,12 +1909,10 @@ public class MapView extends FrameLayout { // Rotate the map if (mFocalPoint != null) { // User provided focal point - mNativeMapView.setBearing(bearing, mFocalPoint.x / mScreenDensity, mFocalPoint.y / mScreenDensity); + setBearing(bearing, mFocalPoint.x / mScreenDensity, mFocalPoint.y / mScreenDensity); } else { // around gesture - mNativeMapView.setBearing(bearing, - detector.getFocusX() / mScreenDensity, - detector.getFocusY() / mScreenDensity); + setBearing(bearing, detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity); } return true; } |