Search in sources :

Example 1 with OffRoute

use of com.mapbox.services.android.navigation.v5.offroute.OffRoute in project mapbox-navigation-android by mapbox.

the class NavigationHelper method isUserOffRoute.

static boolean isUserOffRoute(NewLocationModel newLocationModel, RouteProgress routeProgress, OffRouteCallback callback) {
    MapboxNavigationOptions options = newLocationModel.mapboxNavigation().options();
    if (!options.enableOffRouteDetection()) {
        return false;
    }
    Location location = newLocationModel.location();
    OffRoute offRoute = newLocationModel.mapboxNavigation().getOffRouteEngine();
    setOffRouteDetectorCallback(offRoute, callback);
    return offRoute.isUserOffRoute(location, routeProgress, options);
}
Also used : OffRoute(com.mapbox.services.android.navigation.v5.offroute.OffRoute) Location(android.location.Location)

Example 2 with OffRoute

use of com.mapbox.services.android.navigation.v5.offroute.OffRoute in project mapbox-navigation-android by mapbox.

the class MapboxNavigationTest method setOffRouteEngine_doesReplaceDefaultEngine.

@Test
public void setOffRouteEngine_doesReplaceDefaultEngine() throws Exception {
    OffRoute offRoute = navigation.getOffRouteEngine();
    assertTrue(offRoute instanceof OffRouteDetector);
    offRoute = mock(OffRoute.class);
    navigation.setOffRouteEngine(offRoute);
    assertTrue(!(navigation.getOffRouteEngine() instanceof OffRouteDetector));
    assertTrue(navigation.getOffRouteEngine() instanceof OffRoute);
}
Also used : OffRoute(com.mapbox.services.android.navigation.v5.offroute.OffRoute) OffRouteDetector(com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector) Test(org.junit.Test) BaseTest(com.mapbox.services.android.navigation.v5.BaseTest)

Aggregations

OffRoute (com.mapbox.services.android.navigation.v5.offroute.OffRoute)2 Location (android.location.Location)1 BaseTest (com.mapbox.services.android.navigation.v5.BaseTest)1 OffRouteDetector (com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector)1 Test (org.junit.Test)1