Make code more documented

This commit is contained in:
Victor Shcherb 2019-06-10 11:58:14 +02:00
parent 743efb2a1f
commit aae6a4af30

View file

@ -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 {
//for Naismith
boolean usePedestrianHeight = ((((GeneralRouter) ctx.getRouter()).getProfile() == GeneralRouterProfile.PEDESTRIAN) && ((GeneralRouter) ctx.getRouter()).getHeightObstacles());
@ -234,10 +239,8 @@ public class RouteResultPreparation {
if (speed == 0) {
speed = ctx.getRouter().getMinDefaultSpeed();
} else {
if(speed > 15) {
// decrease speed proportionally from 15ms=50kmh -
// reference speed 30ms=108kmh - 7kmh
speed = speed - ((speed - 15f) / (30f - 15f) * 2f);
if (speed > SLOW_DOWN_SPEED_THRESHOLD) {
speed = speed - (speed / SLOW_DOWN_SPEED_THRESHOLD - 1) * SLOW_DOWN_SPEED;
}
}
boolean plus = rr.getStartPointIndex() < rr.getEndPointIndex();