From e9eee09a4046d5fc470fe97eb8d38a30d87c4a48 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 21 Apr 2013 13:08:21 +0200 Subject: [PATCH] Fix slight turns on motorway --- OsmAnd-java/.gitignore | 1 + .../src/net/osmand/router/RouteResultPreparation.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/OsmAnd-java/.gitignore b/OsmAnd-java/.gitignore index ba077a4031..e736691bd7 100644 --- a/OsmAnd-java/.gitignore +++ b/OsmAnd-java/.gitignore @@ -1 +1,2 @@ bin +OsmAnd-core.jar diff --git a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java index 19dfd4f533..6a6dc90b95 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java @@ -481,6 +481,7 @@ public class RouteResultPreparation { // } double devation = Math.abs(MapUtils.degreesDiff(prevSegm.getBearingEnd(), currentSegm.getBearingBegin())); + boolean makeSlightTurn = devation > 5 && (!isMotorway(prevSegm) || !isMotorway(currentSegm)); if (kl) { t = TurnType.valueOf(devation > 5 ? TurnType.TSLL : TurnType.KL, leftSide); t.setSkipToSpeak(!speak); @@ -494,6 +495,13 @@ public class RouteResultPreparation { } return t; } + + private boolean isMotorway(RouteSegmentResult s){ + String h = s.getObject().getHighway(); + return "motorway".equals(h) || "motorway_link".equals(h) || + "trunk".equals(h) || "trunk_link".equals(h); + + } private void attachRoadSegments(RoutingContext ctx, List result, int routeInd, int pointInd, boolean plus) throws IOException {