Align turn announcement with finish annoucement and add scale factor setting #8749
This commit is contained in:
parent
62ef1e4710
commit
31e10f507f
3 changed files with 19 additions and 19 deletions
|
@ -66,7 +66,6 @@ public class ApplicationMode {
|
|||
private int iconRes = R.drawable.ic_world_globe_dark;
|
||||
|
||||
private int minDistanceForTurn = 50;
|
||||
private int arrivalDistance = 90;
|
||||
private int offRouteDistance = 350;
|
||||
|
||||
private ApplicationMode(int key, String stringKey) {
|
||||
|
@ -78,21 +77,21 @@ public class ApplicationMode {
|
|||
* DEFAULT("Browse map"), CAR("Car"), BICYCLE("Bicycle"), PEDESTRIAN("Pedestrian"); NAUTICAL("boat"); PUBLIC_TRANSPORT("Public transport"); AIRCRAFT("Aircraft")
|
||||
*/
|
||||
public static final ApplicationMode DEFAULT = createBase(R.string.app_mode_default, "default")
|
||||
.distanceForTurn(5).arrivalDistance(90)
|
||||
.distanceForTurn(5).offRouteDistance(350)
|
||||
.icon(R.drawable.ic_world_globe_dark).reg();
|
||||
|
||||
public static final ApplicationMode CAR = createBase(R.string.app_mode_car, "car")
|
||||
.distanceForTurn(35)
|
||||
.distanceForTurn(35).offRouteDistance(350)
|
||||
.icon(R.drawable.ic_action_car_dark)
|
||||
.description(R.string.base_profile_descr_car).reg();
|
||||
|
||||
public static final ApplicationMode BICYCLE = createBase(R.string.app_mode_bicycle, "bicycle")
|
||||
.distanceForTurn(15).arrivalDistance(60).offRouteDistance(50)
|
||||
.distanceForTurn(15).offRouteDistance(50)
|
||||
.icon(R.drawable.ic_action_bicycle_dark)
|
||||
.description(R.string.base_profile_descr_bicycle).reg();
|
||||
|
||||
public static final ApplicationMode PEDESTRIAN = createBase(R.string.app_mode_pedestrian, "pedestrian")
|
||||
.distanceForTurn(5).arrivalDistance(45).offRouteDistance(20)
|
||||
.distanceForTurn(5).offRouteDistance(20)
|
||||
.icon(R.drawable.ic_action_pedestrian_dark)
|
||||
.description(R.string.base_profile_descr_pedestrian).reg();
|
||||
|
||||
|
@ -111,7 +110,7 @@ public class ApplicationMode {
|
|||
.description(R.string.base_profile_descr_aircraft).reg();
|
||||
|
||||
public static final ApplicationMode SKI = createBase(R.string.app_mode_skiing, "ski")
|
||||
.distanceForTurn(15).arrivalDistance(60).offRouteDistance(50)
|
||||
.distanceForTurn(15).offRouteDistance(50)
|
||||
.icon(R.drawable.ic_action_skiing)
|
||||
.description(R.string.base_profile_descr_ski).reg();
|
||||
|
||||
|
@ -372,9 +371,6 @@ public class ApplicationMode {
|
|||
return minDistanceForTurn;
|
||||
}
|
||||
|
||||
public int getArrivalDistance() {
|
||||
return arrivalDistance;
|
||||
}
|
||||
|
||||
public int getOffRouteDistance() {
|
||||
return offRouteDistance;
|
||||
|
@ -741,11 +737,6 @@ public class ApplicationMode {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ApplicationModeBuilder arrivalDistance(int arrivalDistance) {
|
||||
applicationMode.arrivalDistance = arrivalDistance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApplicationModeBuilder offRouteDistance(int offRouteDistance) {
|
||||
applicationMode.offRouteDistance = offRouteDistance;
|
||||
return this;
|
||||
|
|
|
@ -45,6 +45,9 @@ public class RoutingHelper {
|
|||
private static final int CACHE_RADIUS = 100000;
|
||||
public static final float ALLOWED_DEVIATION = 2;
|
||||
|
||||
// This should be correlated with RoutingHelper.updateCurrentRouteStatus ( when processed turn now is not announced)
|
||||
public static int GPS_TOLERANCE = 12;
|
||||
|
||||
private List<WeakReference<IRouteInformationListener>> listeners = new LinkedList<>();
|
||||
private List<WeakReference<IRoutingDataUpdateListener>> updateListeners = new LinkedList<>();
|
||||
private OsmandApplication app;
|
||||
|
@ -729,7 +732,14 @@ public class RoutingHelper {
|
|||
}
|
||||
|
||||
private float getArrivalDistance() {
|
||||
return ((float)settings.getApplicationMode().getArrivalDistance()) * settings.ARRIVAL_DISTANCE_FACTOR.get();
|
||||
ApplicationMode m = mode == null ? settings.getApplicationMode() : mode;
|
||||
float defaultSpeed = Math.max(0.3f, m.getDefaultSpeed());
|
||||
|
||||
/// Used to be: car - 90 m, bicycle - 50 m, pedestrian - 20 m
|
||||
// return ((float)settings.getApplicationMode().getArrivalDistance()) * settings.ARRIVAL_DISTANCE_FACTOR.getModeValue(m);
|
||||
// GPS_TOLERANCE - 12 m
|
||||
// 5 seconds: car - 80 m @ 50 kmh, bicyle - 45 m @ 25 km/h, bicyle - 25 m @ 10 km/h, pedestrian - 18 m @ 4 km/h,
|
||||
return (float) (GPS_TOLERANCE + defaultSpeed * 5) * settings.ARRIVAL_DISTANCE_FACTOR.getModeValue(m);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -191,14 +191,13 @@ public class VoiceRouter {
|
|||
|
||||
// Turn now: 3.5 sec normal speed, 7 second for halfspeed (default)
|
||||
float TURN_NOW_TIME = 7;
|
||||
// This should be correlated with RoutingHelper.updateCurrentRouteStatus ( when processed turn now is not announced)
|
||||
int GPS_TOLERANCE = 12;
|
||||
|
||||
// ** #8749 to keep 1m / 1 sec precision
|
||||
// ** #8749 to keep 1m / 1 sec precision (GPS_TOLERANCE - 12 m)
|
||||
// 1 kmh - 1 m, 4 kmh - 4 m (pedestrian), 10 kmh - 10 m (bicycle), 50 kmh - 50 m (car)
|
||||
// TURN_NOW_DISTANCE = (int) (DEFAULT_SPEED * 3.6); // 3.6 sec
|
||||
// 50 kmh - 48 m (car), 10 kmh - 20 m, 4 kmh - 15 m, 1 kmh - 12 m
|
||||
TURN_NOW_DISTANCE = (int) (GPS_TOLERANCE + DEFAULT_SPEED * 2.5); // 3.6 sec
|
||||
float factor = settings.ARRIVAL_DISTANCE_FACTOR.getModeValue(appMode);
|
||||
TURN_NOW_DISTANCE = (int) ((RoutingHelper.GPS_TOLERANCE + DEFAULT_SPEED * 2.5) * factor); // 3.6 sec
|
||||
// 1 kmh - 1 sec, 4 kmh - 2 sec (pedestrian), 10 kmh - 3 sec (*bicycle), 50 kmh - 7 sec (car)
|
||||
TURN_NOW_TIME = (float) Math.min(Math.sqrt(DEFAULT_SPEED * 3.6), 8);
|
||||
|
||||
|
|
Loading…
Reference in a new issue