diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-02-14 12:36:23 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-02-20 16:22:09 +0100 |
commit | d9e4c61923813b61ffccb6439d0fd3e9993a1a05 (patch) | |
tree | 8ecd311f0ee45f6371f5c4bde08e8a79ea134150 /platform/android/MapboxGLAndroidSDK/src | |
parent | 2e3145db475e296552db9d1c65c483b3f51b5237 (diff) | |
download | qtlocation-mapboxgl-d9e4c61923813b61ffccb6439d0fd3e9993a1a05.tar.gz |
[android] - remove camera api from MapboxMap, refactor test app code to CameraUpdateFactory api
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src')
2 files changed, 22 insertions, 61 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 50e33f4f9f..8ef0d5b523 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -148,6 +148,26 @@ public final class CameraUpdateFactory { return new ZoomUpdate(ZoomUpdate.ZOOM_TO, zoom); } + /** + * Returns a CameraUpdate that moves the camera viewpoint to a particular bearing. + * + * @param bearing Bearing to change to + * @return CameraUpdate Final Camera Position + */ + public static CameraUpdate bearingTo(double bearing) { + return new CameraPositionUpdate(bearing, null, -1, -1); + } + + /** + * Returns a CameraUpdate that moves the camera viewpoint to a particular tilt. + * + * @param tilt Tilt to change to + * @return CameraUpdate Final Camera Position + */ + public static CameraUpdate tiltTo(double tilt) { + return new CameraPositionUpdate(-1, null, tilt, -1); + } + // // CameraUpdate types // diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 4f2c940ea3..6085e2c2d8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -16,6 +16,7 @@ import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; +import com.mapbox.android.core.location.LocationEngine; import com.mapbox.geojson.Feature; import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.annotations.Annotation; @@ -43,7 +44,6 @@ import com.mapbox.mapboxsdk.style.layers.Filter; import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.light.Light; import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.android.core.location.LocationEngine; import java.lang.reflect.ParameterizedType; import java.util.HashMap; @@ -601,7 +601,7 @@ public final class MapboxMap { } // - // + // Light // /** @@ -619,65 +619,6 @@ public final class MapboxMap { // /** - * Moves the center of the screen to a latitude and longitude specified by a LatLng object. This centers the - * camera on the LatLng object. - * <p> - * Note that at low zoom levels, setLatLng is constrained so that the entire viewport shows map data. - * </p> - * - * @param latLng Target location to change to - */ - public void setLatLng(@NonNull LatLng latLng) { - nativeMapView.setLatLng(latLng); - } - - /** - * Moves the camera viewpoint to a particular zoom level. - * - * @param zoom Zoom level to change to - */ - public void setZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - if (focalPoint == null) { - focalPoint = new PointF(nativeMapView.getWidth() / 2, nativeMapView.getHeight() / 2); - } - nativeMapView.setZoom(zoom, focalPoint, 0); - } - - /** - * Moves the center and the zoom of the camera specified by a LatLng object and double zoom. - * <p> - * Note that at low zoom levels, setLatLng is constrained so that the entire viewport shows map data. - * </p> - * - * @param latLng Target location to change to - */ - public void setLatLngZoom(@NonNull LatLng latLng, - @FloatRange(from = MapboxConstants.MINIMUM_ZOOM, - to = MapboxConstants.MAXIMUM_ZOOM) double zoom) { - setZoom(zoom); - setLatLng(latLng); - } - - /** - * Moves the camera viewpoint angle to a particular angle in degrees. - * - * @param tilt Tilt angle to change to - */ - public void setTilt(@FloatRange(from = MapboxConstants.MINIMUM_TILT, to = MapboxConstants.MAXIMUM_TILT) double tilt) { - nativeMapView.setPitch(tilt, 0); - } - - /** - * Moves the camera viewpoint direction to a particular angle in degrees. - * - * @param bearing Direction angle to change to - */ - public void setBearing(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) - double bearing) { - nativeMapView.setBearing(bearing); - } - - /** * Cancels ongoing animations. * <p> * This invokes the {@link CancelableCallback} for ongoing camera updates. |