Update min speed definition

This commit is contained in:
Victor Shcherb 2019-06-25 15:56:21 +02:00
parent 32e0c5e774
commit fd5d7fc517

View file

@ -56,9 +56,9 @@ public class GeneralRouter implements VehicleRouter {
private float roundaboutTurn;
private float rightTurn;
// speed in m/s
private float defaultSpeed = 0.28f;
private float minSpeed = 0.28f;
// speed in m/s
private float minSpeed = 1f;
private float defaultSpeed = 1f;
// speed in m/s
private float maxSpeed = 10f;
@ -196,13 +196,10 @@ public class GeneralRouter implements VehicleRouter {
rightTurn = parseSilentFloat(v, rightTurn);
} else if(k.equals("roundaboutTurn")) {
roundaboutTurn = parseSilentFloat(v, roundaboutTurn);
} else if(k.equals("defaultSpeed")) {
} else if(k.equals("minDefaultSpeed") || k.equals("defaultSpeed")) {
defaultSpeed = parseSilentFloat(v, defaultSpeed * 3.6f) / 3.6f;
} else if(k.equals("minDefaultSpeed") || k.equals("minSpeed")) {
} else if( k.equals("minSpeed")) {
minSpeed = parseSilentFloat(v, minSpeed * 3.6f) / 3.6f;
if (k.equals("minDefaultSpeed")) {
defaultSpeed = minSpeed;
}
} else if(k.equals("maxDefaultSpeed") || k.equals("maxSpeed")) {
maxSpeed = parseSilentFloat(v, maxSpeed * 3.6f) / 3.6f;
}
@ -390,7 +387,7 @@ public class GeneralRouter implements VehicleRouter {
@Override
public float defineRoutingSpeed(RouteDataObject road) {
return Math.min(defineVehicleSpeed(road), maxSpeed);
return Math.max(Math.min(defineVehicleSpeed(road), maxSpeed), minSpeed);
}