From 6c02e1caa116554d3e736effcaf70710761e7725 Mon Sep 17 00:00:00 2001 From: crimean Date: Tue, 9 Oct 2018 12:37:52 +0300 Subject: [PATCH] Fix skipped slight turns with gpx routing. Reduced distance off route announcement for bikes and peds. --- OsmAnd/src/net/osmand/plus/ApplicationMode.java | 14 ++++++++++++-- .../plus/routing/RouteCalculationResult.java | 2 +- .../src/net/osmand/plus/routing/RoutingHelper.java | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/ApplicationMode.java index 0ca973cdbc..fc608c9340 100644 --- a/OsmAnd/src/net/osmand/plus/ApplicationMode.java +++ b/OsmAnd/src/net/osmand/plus/ApplicationMode.java @@ -27,10 +27,10 @@ public class ApplicationMode { public static final ApplicationMode CAR = create(R.string.app_mode_car, "car").speed(15.3f, 35).carLocation(). icon(R.drawable.map_action_car_dark, R.drawable.ic_action_car_dark).reg(); - public static final ApplicationMode BICYCLE = create(R.string.app_mode_bicycle, "bicycle").speed(5.5f, 15).arrivalDistance(60).bicycleLocation(). + public static final ApplicationMode BICYCLE = create(R.string.app_mode_bicycle, "bicycle").speed(5.5f, 15).arrivalDistance(60).offRouteDistance(50).bicycleLocation(). icon(R.drawable.map_action_bicycle_dark, R.drawable.ic_action_bicycle_dark).reg(); - public static final ApplicationMode PEDESTRIAN = create(R.string.app_mode_pedestrian, "pedestrian").speed(1.5f, 5).arrivalDistance(45). + public static final ApplicationMode PEDESTRIAN = create(R.string.app_mode_pedestrian, "pedestrian").speed(1.5f, 5).arrivalDistance(45).offRouteDistance(20). icon(R.drawable.map_action_pedestrian_dark, R.drawable.ic_action_pedestrian_dark).reg(); public static final ApplicationMode AIRCRAFT = create(R.string.app_mode_aircraft, "aircraft").speed(40f, 100).carLocation(). @@ -169,6 +169,11 @@ public class ApplicationMode { applicationMode.arrivalDistance = arrivalDistance; return this; } + + public ApplicationModeBuilder offRouteDistance(int offRouteDistance) { + applicationMode.offRouteDistance = offRouteDistance; + return this; + } } private static ApplicationModeBuilder create(int key, String stringKey) { @@ -361,6 +366,10 @@ public class ApplicationMode { return arrivalDistance; } + public int getOffRouteDistance() { + return offRouteDistance; + } + public boolean isDerivedRoutingFrom(ApplicationMode mode) { return this == mode || getParent() == mode; } @@ -374,6 +383,7 @@ public class ApplicationMode { private float defaultSpeed = 10f; private int minDistanceForTurn = 50; private int arrivalDistance = 90; + private int offRouteDistance = 350; private int bearingIconDay = R.drawable.map_pedestrian_bearing; private int bearingIconNight = R.drawable.map_pedestrian_bearing_night; private int headingIconDay = R.drawable.map_pedestrian_location_view_angle; diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index 645a8c17eb..07beecfc44 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -404,7 +404,7 @@ public class RouteCalculationResult { } - if(delta > 45 && delta < 315){ + if(delta > 30 && delta < 330){ if(delta < 60){ type = TurnType.valueOf(TurnType.TSLL, leftSide); diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 12f95f64e9..df11e56b6e 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -363,7 +363,7 @@ public class RoutingHelper { voiceRouter.interruptRouteCommands(); voiceRouterStopped = true; // Prevents excessive execution of stop() code } - if (distOrth > 350) { + if (distOrth > mode.getOffRouteDistance()) { voiceRouter.announceOffRoute(distOrth); } }