use of com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress in project mapbox-navigation-android by mapbox.
the class RouteUtilsTest method isNewRoute_returnsFalseWhenGeometriesEqualEachOther.
@Test
public void isNewRoute_returnsFalseWhenGeometriesEqualEachOther() throws Exception {
RouteProgress previousRouteProgress = buildDefaultRouteProgress();
boolean isNewRoute = RouteUtils.isNewRoute(previousRouteProgress, previousRouteProgress);
assertFalse(isNewRoute);
}
use of com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress in project mapbox-navigation-android by mapbox.
the class InstructionStepResources method formatStepDistance.
private void formatStepDistance(Context context, RouteProgress progress, Locale locale, @NavigationUnitType.UnitType int unitType) {
if (distanceUtils == null || !this.locale.equals(locale) || this.unitType != unitType) {
distanceUtils = new DistanceUtils(context, locale, unitType);
this.locale = locale;
this.unitType = unitType;
}
stepDistanceRemaining = distanceUtils.formatDistance(progress.currentLegProgress().currentStepProgress().distanceRemaining());
}
use of com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress in project mapbox-navigation-android by mapbox.
the class BaseTest method buildDefaultRouteProgress.
protected RouteProgress buildDefaultRouteProgress() throws Exception {
DirectionsRoute aRoute = buildDirectionsRoute();
RouteProgress defaultRouteProgress = RouteProgress.builder().stepDistanceRemaining(100).legDistanceRemaining(100).distanceRemaining(100).directionsRoute(aRoute).stepIndex(0).legIndex(0).build();
return defaultRouteProgress;
}
use of com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress in project mapbox-navigation-android by mapbox.
the class FasterRouteDetectorTest method onSlowerRouteResponse_isFasterRouteIsFalse.
@Test
public void onSlowerRouteResponse_isFasterRouteIsFalse() throws Exception {
FasterRoute fasterRouteEngine = navigation.getFasterRouteEngine();
// Create current progress
RouteProgress currentProgress = obtainDefaultRouteProgress();
DirectionsRoute longerRoute = currentProgress.directionsRoute().toBuilder().duration(// Current route duration is very short
1000d).build();
currentProgress = currentProgress.toBuilder().directionsRoute(longerRoute).build();
// Create new direction response
DirectionsResponse response = obtainADirectionsResponse();
boolean isFasterRoute = fasterRouteEngine.isFasterRoute(response, currentProgress);
assertFalse(isFasterRoute);
}
use of com.mapbox.services.android.navigation.v5.routeprogress.RouteProgress in project mapbox-navigation-android by mapbox.
the class RouteUtilsTest method isNewRoute_returnsTrueWhenGeometriesDoNotEqual.
@Test
public void isNewRoute_returnsTrueWhenGeometriesDoNotEqual() throws Exception {
DirectionsRoute aRoute = buildDirectionsRoute();
RouteProgress defaultRouteProgress = buildDefaultRouteProgress();
RouteProgress previousRouteProgress = defaultRouteProgress.toBuilder().directionsRoute(aRoute.toBuilder().geometry("vfejnqiv").build()).build();
boolean isNewRoute = RouteUtils.isNewRoute(previousRouteProgress, defaultRouteProgress);
assertTrue(isNewRoute);
}
Aggregations