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

Commit

Permalink
[android] #2805 - Removing Camera API for now
Browse files Browse the repository at this point in the history
  • Loading branch information
bleege committed Dec 3, 2015
1 parent cdfdd86 commit c6a6580
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 287 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
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;
Expand Down Expand Up @@ -1136,26 +1135,6 @@ public void setTilt(Double pitch, @Nullable Long duration) {
mNativeMapView.setPitch(pitch, actualDuration);
}

//
// 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
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
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;
Expand All @@ -31,41 +28,15 @@ protected void onCreate(Bundle savedInstanceState) {
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
Expand All @@ -90,6 +61,9 @@ public void onPause() {
public void onResume() {
super.onResume();
mMapView.onResume();

// Tilt Map 45 degrees over 10 seconds
mMapView.setTilt(45.0, 10000l);
}

@Override
Expand Down

0 comments on commit c6a6580

Please sign in to comment.