#10230 Change leftTurn
This commit is contained in:
parent
cb5e2f0a8e
commit
a94e3ace11
1 changed files with 20 additions and 20 deletions
|
@ -222,9 +222,9 @@ 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("sharpTurn")) {
|
} else if (k.equals("sharpTurn") || k.equals("leftTurn")) {
|
||||||
sharpTurn = parseSilentFloat(v, sharpTurn);
|
sharpTurn = parseSilentFloat(v, sharpTurn);
|
||||||
} else if(k.equals("slightTurn")) {
|
} else if (k.equals("slightTurn") || k.equals("rightTurn")) {
|
||||||
slightTurn = parseSilentFloat(v, slightTurn);
|
slightTurn = parseSilentFloat(v, slightTurn);
|
||||||
} else if (k.equals("roundaboutTurn")) {
|
} else if (k.equals("roundaboutTurn")) {
|
||||||
roundaboutTurn = parseSilentFloat(v, roundaboutTurn);
|
roundaboutTurn = parseSilentFloat(v, roundaboutTurn);
|
||||||
|
@ -621,6 +621,12 @@ public class GeneralRouter implements VehicleRouter {
|
||||||
float ts = getPenaltyTransition(segment.getRoad());
|
float ts = getPenaltyTransition(segment.getRoad());
|
||||||
float prevTs = getPenaltyTransition(prev.getRoad());
|
float prevTs = getPenaltyTransition(prev.getRoad());
|
||||||
|
|
||||||
|
float totalPenalty = 0;
|
||||||
|
|
||||||
|
if (prevTs != ts) {
|
||||||
|
totalPenalty += 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;
|
||||||
|
@ -633,31 +639,25 @@ public class GeneralRouter implements VehicleRouter {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) {
|
if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) {
|
||||||
double rt = getRoundaboutTurn();
|
double rt = getRoundaboutTurn();
|
||||||
if(rt > 0) {
|
if(rt > 0) {
|
||||||
return rt;
|
totalPenalty += rt;
|
||||||
}
|
}
|
||||||
}
|
} else if (getLeftTurn() > 0 || getRightTurn() > 0) {
|
||||||
if (getLeftTurn() > 0 || getRightTurn() > 0) {
|
double a1 = segment.getRoad().directionRoute(segment.getSegmentStart(),
|
||||||
double a1 = segment.getRoad().directionRoute(segment.getSegmentStart(), segment.getSegmentStart() < segmentEnd);
|
segment.getSegmentStart() < segmentEnd);
|
||||||
double a2 = prev.getRoad().directionRoute(prevSegmentEnd, prevSegmentEnd < prev.getSegmentStart());
|
double a2 = prev.getRoad().directionRoute(prevSegmentEnd, prevSegmentEnd < prev.getSegmentStart());
|
||||||
double diff = Math.abs(MapUtils.alignAngleDifference(a1 - a2 - Math.PI));
|
double diff = Math.abs(MapUtils.alignAngleDifference(a1 - a2 - Math.PI));
|
||||||
// more like UT
|
// more like UT
|
||||||
if (diff > 2 * Math.PI / 3) {
|
if (diff > 2 * Math.PI / 3) {
|
||||||
return getLeftTurn();
|
totalPenalty += getLeftTurn();
|
||||||
} else if (diff > Math.PI / 3) {
|
} else if (diff > Math.PI / 3) {
|
||||||
return getRightTurn();
|
totalPenalty += getRightTurn();
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ts != prevTs) {
|
return totalPenalty;
|
||||||
return prevTs + ts;
|
|
||||||
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue