From 2ca1303cf3dd32a2fd1beb3207ad48699e662f6e Mon Sep 17 00:00:00 2001 From: Kseniia Date: Wed, 17 Feb 2021 23:28:11 +0200 Subject: [PATCH 1/2] fix 10736 --- OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java index fad98d466d..5f51fa02cc 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java @@ -652,7 +652,7 @@ public class GeneralRouter implements VehicleRouter { // more like UT if (diff > 2 * Math.PI / 3) { totalPenalty += getLeftTurn(); - } else if (diff > Math.PI / 3) { + } else if (diff > Math.PI / 2.1) { totalPenalty += getRightTurn(); } } From c28d6d75a963572d35db09357c654600c6c3206b Mon Sep 17 00:00:00 2001 From: Kseniia Date: Thu, 18 Feb 2021 18:46:32 +0200 Subject: [PATCH 2/2] fix 10736 --- .../src/main/java/net/osmand/router/GeneralRouter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java index 5f51fa02cc..be5bba2f5f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java @@ -620,9 +620,7 @@ public class GeneralRouter implements VehicleRouter { public double calculateTurnTime(RouteSegment segment, int segmentEnd, RouteSegment prev, int prevSegmentEnd) { float ts = getPenaltyTransition(segment.getRoad()); float prevTs = getPenaltyTransition(prev.getRoad()); - float totalPenalty = 0; - if (prevTs != ts) { totalPenalty += Math.abs(ts - prevTs) / 2; } @@ -638,7 +636,9 @@ public class GeneralRouter implements VehicleRouter { // } // } // } - + if (shortestRoute) { + return totalPenalty; + } if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) { double rt = getRoundaboutTurn(); if(rt > 0) { @@ -652,7 +652,7 @@ public class GeneralRouter implements VehicleRouter { // more like UT if (diff > 2 * Math.PI / 3) { totalPenalty += getLeftTurn(); - } else if (diff > Math.PI / 2.1) { + } else if (diff > Math.PI / 3) { totalPenalty += getRightTurn(); } }