Search in sources :

Example 6 with RouteInformation

use of com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation in project mapbox-navigation-android by mapbox.

the class DynamicCameraTest method onInformationFromRoute_engineCreatesCorrectTilt.

@Test
public void onInformationFromRoute_engineCreatesCorrectTilt() throws Exception {
    RouteInformation routeInformation = RouteInformation.create(buildDirectionsRoute(), null, null);
    double tilt = cameraEngine.tilt(routeInformation);
    assertEquals(50d, tilt);
}
Also used : RouteInformation(com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation) BaseTest(com.mapbox.services.android.navigation.ui.v5.BaseTest) Test(org.junit.Test)

Example 7 with RouteInformation

use of com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation in project mapbox-navigation-android by mapbox.

the class DynamicCameraTest method onHighDistanceRemaining_engineCreatesCorrectTilt.

@Test
public void onHighDistanceRemaining_engineCreatesCorrectTilt() throws Exception {
    RouteInformation routeInformation = RouteInformation.create(null, buildDefaultLocationUpdate(-77.0339782574523, 38.89993519985637), buildDefaultRouteProgress(1000d));
    double tilt = cameraEngine.tilt(routeInformation);
    assertEquals(50d, tilt);
}
Also used : RouteInformation(com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation) BaseTest(com.mapbox.services.android.navigation.ui.v5.BaseTest) Test(org.junit.Test)

Example 8 with RouteInformation

use of com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation in project mapbox-navigation-android by mapbox.

the class DynamicCameraTest method onInformationFromRoute_engineCreatesCorrectTarget.

@Test
public void onInformationFromRoute_engineCreatesCorrectTarget() throws Exception {
    RouteInformation routeInformation = RouteInformation.create(buildDirectionsRoute(), null, null);
    Point target = cameraEngine.target(routeInformation);
    double lng = target.longitude();
    assertEquals(-122.416686, lng);
    double lat = target.latitude();
    assertEquals(37.783425, lat);
}
Also used : Point(com.mapbox.geojson.Point) RouteInformation(com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation) BaseTest(com.mapbox.services.android.navigation.ui.v5.BaseTest) Test(org.junit.Test)

Example 9 with RouteInformation

use of com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation in project mapbox-navigation-android by mapbox.

the class DynamicCameraTest method onInformationFromRoute_engineCreatesCorrectZoom.

@Test
public void onInformationFromRoute_engineCreatesCorrectZoom() throws Exception {
    RouteInformation routeInformation = RouteInformation.create(buildDirectionsRoute(), null, null);
    double zoom = cameraEngine.zoom(routeInformation);
    assertEquals(15d, zoom);
}
Also used : RouteInformation(com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation) BaseTest(com.mapbox.services.android.navigation.ui.v5.BaseTest) Test(org.junit.Test)

Example 10 with RouteInformation

use of com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation in project mapbox-navigation-android by mapbox.

the class NavigationCamera method animateCameraFromLocation.

/**
 * Creates an animation with the given {@link RouteInformation#location()}.
 * <p>
 * This animation that fires for new progress update.
 *
 * @param routeInformation with location data
 */
private void animateCameraFromLocation(RouteInformation routeInformation) {
    Camera cameraEngine = navigation.getCameraEngine();
    Point targetPoint = cameraEngine.target(routeInformation);
    LatLng target = new LatLng(targetPoint.latitude(), targetPoint.longitude());
    double bearing = cameraEngine.bearing(routeInformation);
    float tilt = (float) cameraEngine.tilt(routeInformation);
    double zoom = cameraEngine.zoom(routeInformation);
    CameraPosition position = new CameraPosition.Builder().target(target).bearing(bearing).tilt(tilt).zoom(zoom).build();
    easeMapCameraPosition(position);
}
Also used : CameraPosition(com.mapbox.mapboxsdk.camera.CameraPosition) Camera(com.mapbox.services.android.navigation.v5.navigation.camera.Camera) Point(com.mapbox.geojson.Point) LatLng(com.mapbox.mapboxsdk.geometry.LatLng)

Aggregations

BaseTest (com.mapbox.services.android.navigation.ui.v5.BaseTest)9 RouteInformation (com.mapbox.services.android.navigation.v5.navigation.camera.RouteInformation)9 Test (org.junit.Test)9 Point (com.mapbox.geojson.Point)4 CameraPosition (com.mapbox.mapboxsdk.camera.CameraPosition)2 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)2 Camera (com.mapbox.services.android.navigation.v5.navigation.camera.Camera)2 MapboxMap (com.mapbox.mapboxsdk.maps.MapboxMap)1