diff options
author | Brad Leege <bleege@gmail.com> | 2015-12-03 14:40:18 -0600 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-12-03 16:57:44 -0600 |
commit | c6a658087e103882b3bc16782151ec7eb4df1135 (patch) | |
tree | 921ba16ffe25996a9e536fd7ada31b938d3a28bb /android | |
parent | cdfdd86de134e4670933c20dc18f5334a567a554 (diff) | |
download | qtlocation-mapboxgl-c6a658087e103882b3bc16782151ec7eb4df1135.tar.gz |
[android] #2805 - Removing Camera API for now
Diffstat (limited to 'android')
5 files changed, 3 insertions, 287 deletions
diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java deleted file mode 100644 index adaf1afa50..0000000000 --- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraPosition.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.mapbox.mapboxsdk.camera; - -import android.os.Parcel; -import android.os.Parcelable; -import android.support.annotation.FloatRange; -import com.mapbox.mapboxsdk.geometry.LatLng; - -public final class CameraPosition implements Parcelable { - - public static final Parcelable.Creator<CameraPosition> CREATOR - = new Parcelable.Creator<CameraPosition>() { - public CameraPosition createFromParcel(Parcel in) { - float bearing = in.readFloat(); - LatLng target = in.readParcelable(LatLng.class.getClassLoader()); - float tilt = in.readFloat(); - float zoom = in.readFloat(); - return new CameraPosition(target, zoom, tilt, bearing); - } - - public CameraPosition[] newArray(int size) { - return new CameraPosition[size]; - } - }; - - - /** - * Direction that the camera is pointing in, in degrees clockwise from north. - */ - public final float bearing; - - /** - * The location that the camera is pointing at. - */ - public final LatLng target; - - /** - * The angle, in degrees, of the camera angle from the nadir (directly facing the Earth). See tilt(float) for details of restrictions on the range of values. - */ - public final float tilt; - - /** - * Zoom level near the center of the screen. See zoom(float) for the definition of the camera's zoom level. - */ - public final float zoom; - - /** - * - * Constructs a CameraPosition. - * @param target The target location to align with the center of the screen. - * @param zoom Zoom level at target. See zoom(float) for details of restrictions. - * @param tilt The camera angle, in degrees, from the nadir (directly down). See tilt(float) for details of restrictions. - * @param bearing Direction that the camera is pointing in, in degrees clockwise from north. This value will be normalized to be within 0 degrees inclusive and 360 degrees exclusive. - * @throws NullPointerException if target is null - * @throws IllegalArgumentException if tilt is outside the range of 0 to 90 degrees inclusive. - */ - public CameraPosition (LatLng target, float zoom, float tilt, float bearing) throws NullPointerException, IllegalArgumentException{ - super(); - if (target == null) { - throw new NullPointerException("target is NULL"); - } - this.target = target; - - if (tilt < 0.0f || tilt > 90.0f) { - throw new IllegalArgumentException("tilt is outside of 0 to 90 degrees range"); - } - this.tilt = tilt; - - this.bearing = bearing; - this.zoom = zoom; - } - - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel out, int flags) { - out.writeFloat(bearing); - out.writeParcelable(target, flags); - out.writeFloat(tilt); - out.writeFloat(zoom); - } - - /** - * Builds camera position. - */ - public static final class Builder { - - private float bearing; - private LatLng target; - private float tilt; - private float zoom; - - /** - * Creates an empty builder. - */ - public Builder() { - super(); - } - - /** - * Create Builder with an existing CameraPosition data. - * @param previous Existing CameraPosition values to use - */ - public Builder(CameraPosition previous) { - super(); - if (previous != null) { - this.bearing = previous.bearing; - this.target = previous.target; - this.tilt = previous.tilt; - this.zoom = previous.zoom; - } - } - - /** - * Sets the direction that the camera is pointing in, in degrees clockwise from north. - * @param bearing Bearing - * @return Builder - */ - public Builder bearing (float bearing) { - this.bearing = bearing; - return this; - } - - /** - * Builds a CameraPosition. - * @return CameraPosition - */ - public CameraPosition build() { - return new CameraPosition(target, zoom, tilt, bearing); - } - - /** - * Sets the location that the camera is pointing at. - * @param location Location - * @return Builder - */ - public Builder target(LatLng location) { - this.target = location; - return this; - } - - /** - * Set the tilt - * @param tilt Tilt value - * @return Builder - */ - @FloatRange(from = 0.0, to = 60.0) - public Builder tilt(float tilt) { - this.tilt = tilt; - return this; - } - - /** - * Set the zoom - * @param zoom Zoom value - * @return Builder - */ - public Builder zoom(float zoom) { - this.zoom = zoom; - return this; - } - } -} diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java deleted file mode 100644 index 33f551550b..0000000000 --- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdate.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.mapbox.mapboxsdk.camera; - -import com.mapbox.mapboxsdk.geometry.LatLng; - -public final class CameraUpdate { - - /** - * Direction that the camera is pointing in, in degrees clockwise from north. - */ - private final float bearing; - - /** - * The location that the camera is pointing at. - */ - private final LatLng target; - - /** - * The angle, in degrees, of the camera angle from the nadir (directly facing the Earth). See tilt(float) for details of restrictions on the range of values. - */ - private final float tilt; - - /** - * Zoom level near the center of the screen. See zoom(float) for the definition of the camera's zoom level. - */ - private final float zoom; - - /** - * Package Private Constructor to only be used CameraUpdateFactory - * @param bearing Final Bearing - * @param target Final Target - * @param tilt Final Tilt - * @param zoom Final Zoom - */ - CameraUpdate(float bearing, LatLng target, float tilt, float zoom) { - this.bearing = bearing; - this.target = target; - this.tilt = tilt; - this.zoom = zoom; - } - - public float getBearing() { - return bearing; - } - - public LatLng getTarget() { - return target; - } - - public float getTilt() { - return tilt; - } - - public float getZoom() { - return zoom; - } -} diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java deleted file mode 100644 index 3ba2090bd2..0000000000 --- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.mapbox.mapboxsdk.camera; - -import android.support.annotation.NonNull; - -public class CameraUpdateFactory { - - /** - * Returns a CameraUpdate that moves the camera to a specified CameraPosition. - * @param cameraPosition Camera Position to change to - * @return CameraUpdate Final Camera Position data - */ - public static CameraUpdate newCameraPosition (@NonNull CameraPosition cameraPosition) { - return new CameraUpdate(cameraPosition.bearing, cameraPosition.target, cameraPosition.tilt, cameraPosition.zoom); - } -} diff --git a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java index efff19236d..6d7c666db6 100644 --- a/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java +++ b/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java @@ -66,7 +66,6 @@ import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.annotations.PolylineOptions; import com.mapbox.mapboxsdk.annotations.Sprite; import com.mapbox.mapboxsdk.annotations.SpriteFactory; -import com.mapbox.mapboxsdk.camera.CameraUpdate; import com.mapbox.mapboxsdk.constants.MyBearingTracking; import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.constants.Style; @@ -1137,26 +1136,6 @@ public final class MapView extends FrameLayout { } // - // Mirrored Google Map's Camera API - // - - /** - * Animates the movement of the camera from the current position to the position defined in the update. - * See CameraUpdateFactory for a set of updates. - * @param update The change that should be applied to the camera. - */ - @UiThread - public final void animateCamera (CameraUpdate update) { - - LatLngZoom llz = new LatLngZoom(update.getTarget(), update.getZoom()); - setCenterCoordinate(llz); - - setBearing(update.getBearing()); - - setTilt((double)update.getTilt(), null); - } - - // // Rotation // diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java index 07c6625fdf..ff0ad223f4 100644 --- a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java +++ b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/TiltActivity.java @@ -4,10 +4,7 @@ import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import android.util.Log; import android.view.MenuItem; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.utils.ApiAccess; @@ -31,41 +28,15 @@ public class TiltActivity extends AppCompatActivity { actionBar.setDisplayShowHomeEnabled(true); } - // Target LatLng dc = new LatLng(38.90252, -77.02291); - LatLng nyc = new LatLng(40.73581, -73.99155); // Set up the map mMapView = (MapView) findViewById(R.id.tiltMapView); mMapView.setAccessToken(ApiAccess.getToken(this)); mMapView.setStyleUrl(Style.MAPBOX_STREETS); - // Initialize map to Washington, DC and different zoom level so that it's obvious that animateCamera works mMapView.setCenterCoordinate(dc); mMapView.setZoomLevel(11); mMapView.onCreate(savedInstanceState); - - Log.i(TiltActivity.class.getCanonicalName(), "Original Tilt = " + mMapView.getTilt()); - // Tilt Map 45 degrees over 10 seconds - mMapView.setTilt(45.0, 10000l); - Log.i(TiltActivity.class.getCanonicalName(), "Changed Tilt = " + mMapView.getTilt()); - - /* - * Our tilt API follows Google's Android API: - * https://developers.google.com/maps/documentation/android-api/views#updating_the_camera_view - */ - -/* - // Construct a CameraPosition focusing on target and animate the camera to that position. - CameraPosition cameraPosition = new CameraPosition.Builder() - .target(nyc) // Sets the center of the map to target - .zoom(17) // Sets the zoom - .bearing(90) // Sets the orientation of the camera to east - .tilt(30) // Sets the tilt of the camera to 30 degrees - .build(); // Creates a CameraPosition from the builder - - // Triggers tilt - mMapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); -*/ } @Override @@ -90,6 +61,9 @@ public class TiltActivity extends AppCompatActivity { public void onResume() { super.onResume(); mMapView.onResume(); + + // Tilt Map 45 degrees over 10 seconds + mMapView.setTilt(45.0, 10000l); } @Override |