diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 048eb706fb..a1e2af0eac 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -73,6 +73,7 @@ public class BinaryMapRouteReaderAdapter { private float floatValue; private int type; private List conditions = null; + private TIntObjectHashMap directions = null; private int forward; public RouteTypeRule() { @@ -165,6 +166,10 @@ public class BinaryMapRouteReaderAdapter { return conditions != null; } + public boolean directional() { + return directions != null; + } + public String getNonConditionalTag() { String tag = getTag(); if(tag != null && tag.endsWith(":conditional")) { @@ -172,7 +177,12 @@ public class BinaryMapRouteReaderAdapter { } return tag; } - + + //TODO implement + public String getNonDirectionalTag() { + return null; + } + public int onewayDirection(){ if(type == ONEWAY){ return intValue; @@ -286,7 +296,12 @@ public class BinaryMapRouteReaderAdapter { if (i > 0) { intValue = Integer.parseInt(v.substring(0, i)); } + } else if (t.endsWith("direction") && v!=null) { + type = TRAFFIC_SIGNALS; + directions = new TIntObjectHashMap(); + } + } } @@ -344,6 +359,7 @@ public class BinaryMapRouteReaderAdapter { while (routeEncodingRules.size() <= id) { routeEncodingRules.add(null); } + /**TODO delete*/ System.out.println(String.format("initRouteIncodingRule=> id: %d, tag: %s, val: %s", id, tags, val)); routeEncodingRules.set(id, new RouteTypeRule(tags, val)); if (tags.equals("name")) { nameTypeRule = id; diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java index 807561e66d..eaf670cca1 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java @@ -541,6 +541,44 @@ public class RouteDataObject { } } + // TODO implement + public void processDirectionalTags() { + if (pointTypes != null) { + for (int i = 0; i < pointTypes.length; i++) { + if (pointTypes[i] != null) { + int[] pTypes = pointTypes[i]; + int pSz = pTypes.length; + if (pSz > 0) { + for (int j = 0; j < pSz; j++) { + RouteTypeRule r = region.quickGetEncodingRule(pTypes[j]); + if (r != null && r.directional()) { +// int vl = r.conditionalValue(conditionalTime); +// if (vl != 0) { +// RouteTypeRule rtr = region.quickGetEncodingRule(vl); +// String nonCondTag = rtr.getTag(); +// int ks; +// for (ks = 0; ks < pointTypes[i].length; ks++) { +// RouteTypeRule toReplace = region.quickGetEncodingRule(pointTypes[i][j]); +// if (toReplace != null && toReplace.getTag().contentEquals(nonCondTag)) { +// break; +// } +// } +// if (ks == pTypes.length) { +// int[] ntypes = new int[pTypes.length + 1]; +// System.arraycopy(pTypes, 0, ntypes, 0, pTypes.length); +// pTypes = ntypes; +// } +// pTypes[ks] = vl; +// } + } + } + } + pointTypes[i] = pTypes; + } + } + } + } + public float getMaximumSpeed(boolean direction) { int sz = types.length; float maxSpeed = 0; @@ -1054,6 +1092,4 @@ public class RouteDataObject { } restrictionsVia[k] = viaWay; } - - } diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java index 232b971f9f..09a1003483 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingConfiguration.java @@ -47,7 +47,7 @@ public class RoutingConfiguration { public float recalculateDistance = 20000f; // 1.6 Time to calculate all access restrictions based on conditions - public long routeCalculationTime = 0; + public long routeCalculationTime = 1592317409;//0; public static class Builder { // Design time storage diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java index 2c44940dff..44bb6846c2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java @@ -17,6 +17,7 @@ import org.apache.commons.logging.Log; import gnu.trove.iterator.TIntObjectIterator; import gnu.trove.iterator.TLongIterator; import gnu.trove.map.TLongObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TLongObjectHashMap; import gnu.trove.set.hash.TLongHashSet; import net.osmand.NativeLibrary; @@ -308,6 +309,7 @@ public class RoutingContext { } ts.excludedIds.add(ro.getId()); } + ro.processDirectionalTags(); } } } @@ -607,6 +609,8 @@ public class RoutingContext { public TLongObjectMap getRoutes() { return routes; } + private TIntObjectHashMap forwardTags; + private TIntObjectHashMap backwardTags; public void loadAllObjects(final List toFillIn, RoutingContext ctx, TLongObjectHashMap excludeDuplications) { if(routes != null) {