use of com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector in project mapbox-navigation-android by mapbox.
the class MapboxNavigation method initialize.
/**
* In-charge of initializing all variables needed to begin a navigation session. Many values can
* be changed later on using their corresponding setter. An internal progressChangeListeners used
* to prevent users from removing it.
*/
private void initialize() {
// Initialize event dispatcher and add internal listeners
navigationEventDispatcher = new NavigationEventDispatcher();
initializeDefaultLocationEngine();
initializeDefaultCameraEngine();
initializeTelemetry();
// Create and add default milestones if enabled.
milestones = new ArrayList<>();
if (options.defaultMilestonesEnabled()) {
addMilestone(new VoiceInstructionMilestone.Builder().setIdentifier(VOICE_INSTRUCTION_MILESTONE_ID).build());
addMilestone(new BannerInstructionMilestone.Builder().setIdentifier(BANNER_INSTRUCTION_MILESTONE_ID).build());
}
if (options.snapToRoute()) {
snapEngine = new SnapToRoute();
}
if (options.enableOffRouteDetection()) {
offRouteEngine = new OffRouteDetector();
}
if (options().enableFasterRouteDetection()) {
fasterRouteEngine = new FasterRouteDetector();
}
}
use of com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector 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);
}
use of com.mapbox.services.android.navigation.v5.offroute.OffRouteDetector in project mapbox-navigation-android by mapbox.
the class OffRouteDetectorTest method setupStepPoints.
private void setupStepPoints(OffRouteDetector offRouteDetector) throws Exception {
RouteProgress routeProgress = buildDefaultRouteProgress();
LegStep currentStep = routeProgress.currentLegProgress().currentStep();
LineString lineString = LineString.fromPolyline(currentStep.geometry(), Constants.PRECISION_6);
List<Point> stepPoints = lineString.coordinates();
offRouteDetector.updateStepPoints(stepPoints);
}
Aggregations