#10230 Change leftTurn

This commit is contained in:
Kseniia 2020-12-28 21:05:54 +02:00
parent 85999f4787
commit cb5e2f0a8e

View file

@ -63,9 +63,9 @@ public class GeneralRouter implements VehicleRouter {
// cached values // cached values
private boolean restrictionsAware = true; private boolean restrictionsAware = true;
private float leftTurn; private float sharpTurn;
private float roundaboutTurn; private float roundaboutTurn;
private float rightTurn; private float slightTurn;
// speed in m/s // speed in m/s
private float minSpeed = 0.28f; private float minSpeed = 0.28f;
// speed in m/s // speed in m/s
@ -222,10 +222,10 @@ public class GeneralRouter implements VehicleRouter {
attributes.put(k, v); attributes.put(k, v);
if(k.equals("restrictionsAware")) { if(k.equals("restrictionsAware")) {
restrictionsAware = parseSilentBoolean(v, restrictionsAware); restrictionsAware = parseSilentBoolean(v, restrictionsAware);
} else if(k.equals("leftTurn")) { } else if(k.equals("sharpTurn")) {
leftTurn = parseSilentFloat(v, leftTurn); sharpTurn = parseSilentFloat(v, sharpTurn);
} else if(k.equals("rightTurn")) { } else if(k.equals("slightTurn")) {
rightTurn = parseSilentFloat(v, rightTurn); slightTurn = parseSilentFloat(v, slightTurn);
} else if(k.equals("roundaboutTurn")) { } else if(k.equals("roundaboutTurn")) {
roundaboutTurn = parseSilentFloat(v, roundaboutTurn); roundaboutTurn = parseSilentFloat(v, roundaboutTurn);
} else if(k.equals("minDefaultSpeed") || k.equals("defaultSpeed")) { } else if(k.equals("minDefaultSpeed") || k.equals("defaultSpeed")) {
@ -605,11 +605,11 @@ public class GeneralRouter implements VehicleRouter {
} }
public double getLeftTurn() { public double getLeftTurn() {
return leftTurn; return sharpTurn;
} }
public double getRightTurn() { public double getRightTurn() {
return rightTurn; return slightTurn;
} }
public double getRoundaboutTurn() { public double getRoundaboutTurn() {
@ -620,9 +620,7 @@ public class GeneralRouter implements VehicleRouter {
public double calculateTurnTime(RouteSegment segment, int segmentEnd, RouteSegment prev, int prevSegmentEnd) { public double calculateTurnTime(RouteSegment segment, int segmentEnd, RouteSegment prev, int prevSegmentEnd) {
float ts = getPenaltyTransition(segment.getRoad()); float ts = getPenaltyTransition(segment.getRoad());
float prevTs = getPenaltyTransition(prev.getRoad()); float prevTs = getPenaltyTransition(prev.getRoad());
if(prevTs != ts) {
return Math.abs(ts - prevTs) / 2;
}
// int[] pt = prev.getRoad().getPointTypes(prevSegmentEnd); // int[] pt = prev.getRoad().getPointTypes(prevSegmentEnd);
// if(pt != null) { // if(pt != null) {
// RouteRegion reg = prev.getRoad().region; // RouteRegion reg = prev.getRoad().region;
@ -654,6 +652,11 @@ public class GeneralRouter implements VehicleRouter {
} }
return 0; return 0;
} }
if (ts != prevTs) {
return prevTs + ts;
}
return 0; return 0;
} }