From f69fecaceabe81b6338201c59c77f6a0311a1526 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 10 Oct 2012 01:53:36 +0200 Subject: [PATCH] Adjust number of lanes displayed for both way roads --- .../src/net/osmand/osm/MapRoutingTypes.java | 2 ++ .../src/net/osmand/router/BinaryRoutePlanner.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/DataExtractionOSM/src/net/osmand/osm/MapRoutingTypes.java b/DataExtractionOSM/src/net/osmand/osm/MapRoutingTypes.java index 3e015c04eb..7d0ea63979 100644 --- a/DataExtractionOSM/src/net/osmand/osm/MapRoutingTypes.java +++ b/DataExtractionOSM/src/net/osmand/osm/MapRoutingTypes.java @@ -47,6 +47,8 @@ public class MapRoutingTypes { TAGS_TO_SAVE.add("hgv"); TAGS_TO_SAVE.add("horse"); TAGS_TO_SAVE.add("lanes"); + TAGS_TO_SAVE.add("lanes:forward"); + TAGS_TO_SAVE.add("lanes:backward"); TAGS_TO_SAVE.add("maxspeed"); TAGS_TO_SAVE.add("maxweight"); TAGS_TO_SAVE.add("minspeed"); diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index b26074c56d..69ea262d14 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -1082,6 +1082,9 @@ public class BinaryRoutePlanner { boolean kr = false; List attachedRoutes = rr.getAttachedRoutes(rr.getStartPointIndex()); int ls = prev.getObject().getLanes(); + if(ls >= 0 && prev.getObject().getOneway() == 0) { + ls = (ls + 1) / 2; + } int left = 0; int right = 0; boolean speak = false; @@ -1095,6 +1098,9 @@ public class BinaryRoutePlanner { if ((ex < TURN_DEGREE_MIN || mpi < TURN_DEGREE_MIN) && ex >= 0) { kl = true; int lns = rs.getObject().getLanes(); + if(rs.getObject().getOneway() == 0) { + lns = (lns + 1) / 2; + } if (lns > 0) { right += lns; } @@ -1102,6 +1108,9 @@ public class BinaryRoutePlanner { } else if ((ex > -TURN_DEGREE_MIN || mpi < TURN_DEGREE_MIN) && ex <= 0) { kr = true; int lns = rs.getObject().getLanes(); + if(rs.getObject().getOneway() == 0) { + lns = (lns + 1) / 2; + } if (lns > 0) { left += lns; } @@ -1116,6 +1125,9 @@ public class BinaryRoutePlanner { right = 1; } int current = rr.getObject().getLanes(); + if(rr.getObject().getOneway() == 0) { + current = (current + 1) / 2; + } if (current <= 0) { current = 1; }