Make code more documented
This commit is contained in:
parent
743efb2a1f
commit
aae6a4af30
1 changed files with 7 additions and 4 deletions
|
@ -222,6 +222,11 @@ public class RouteResultPreparation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// decrease speed proportionally from 15ms (50kmh)
|
||||||
|
private static final double SLOW_DOWN_SPEED_THRESHOLD = 15;
|
||||||
|
// reference speed 30ms (108kmh) - 2ms (7kmh)
|
||||||
|
private static final double SLOW_DOWN_SPEED = 2;
|
||||||
|
|
||||||
private void calculateTimeSpeed(RoutingContext ctx, List<RouteSegmentResult> result) throws IOException {
|
private void calculateTimeSpeed(RoutingContext ctx, List<RouteSegmentResult> result) throws IOException {
|
||||||
//for Naismith
|
//for Naismith
|
||||||
boolean usePedestrianHeight = ((((GeneralRouter) ctx.getRouter()).getProfile() == GeneralRouterProfile.PEDESTRIAN) && ((GeneralRouter) ctx.getRouter()).getHeightObstacles());
|
boolean usePedestrianHeight = ((((GeneralRouter) ctx.getRouter()).getProfile() == GeneralRouterProfile.PEDESTRIAN) && ((GeneralRouter) ctx.getRouter()).getHeightObstacles());
|
||||||
|
@ -234,10 +239,8 @@ public class RouteResultPreparation {
|
||||||
if (speed == 0) {
|
if (speed == 0) {
|
||||||
speed = ctx.getRouter().getMinDefaultSpeed();
|
speed = ctx.getRouter().getMinDefaultSpeed();
|
||||||
} else {
|
} else {
|
||||||
if(speed > 15) {
|
if (speed > SLOW_DOWN_SPEED_THRESHOLD) {
|
||||||
// decrease speed proportionally from 15ms=50kmh -
|
speed = speed - (speed / SLOW_DOWN_SPEED_THRESHOLD - 1) * SLOW_DOWN_SPEED;
|
||||||
// reference speed 30ms=108kmh - 7kmh
|
|
||||||
speed = speed - ((speed - 15f) / (30f - 15f) * 2f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean plus = rr.getStartPointIndex() < rr.getEndPointIndex();
|
boolean plus = rr.getStartPointIndex() < rr.getEndPointIndex();
|
||||||
|
|
Loading…
Reference in a new issue