diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java index 4fad96be36..47e295b882 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java @@ -66,9 +66,9 @@ public class BinaryInspector { // test cases show info if(args.length == 1 && "test".equals(args[0])) { in.inspector(new String[]{ - "-vpoi", +// "-vpoi", // "-vmap", "-vmapobjects", // "-vmapcoordinates", -// "-vrouting", + "-vrouting", // "-vaddress", "-vcities",//"-vstreetgroups", // "-vstreets", "-vbuildings", "-vintersections", // "-zoom=15", @@ -535,16 +535,15 @@ public class BinaryInspector { b.setLength(0); b.append("Road "); b.append(obj.id); - for(int i = 0; i < obj.getTypes().length; i++) { + for (int i = 0; i < obj.getTypes().length; i++) { RouteTypeRule rr = obj.region.quickGetEncodingRule(obj.getTypes()[i]); b.append(" ").append(rr.getTag()).append("='").append(rr.getValue()).append("'"); } - if (obj.getNames() != null) { - TIntObjectIterator it = obj.getNames().iterator(); - while (it.hasNext()) { - it.advance(); - RouteTypeRule rr = obj.region.quickGetEncodingRule(it.key()); - b.append(" ").append(rr.getTag()).append("='").append(it.value()).append("'"); + int[] nameIds = obj.getNameIds(); + if (nameIds != null) { + for (int key : nameIds) { + RouteTypeRule rr = obj.region.quickGetEncodingRule(key); + b.append(" ").append(rr.getTag()).append("='").append(obj.getNames().get(key)).append("'"); } } println(b.toString()); diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java index 0adb877759..e17e884fda 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapRouteReaderAdapter.java @@ -451,11 +451,14 @@ public class BinaryMapRouteReaderAdapter { o.names = new TIntObjectHashMap(); int sizeL = codedIS.readRawVarint32(); int old = codedIS.pushLimit(sizeL); + TIntArrayList list = new TIntArrayList(); while (codedIS.getBytesUntilLimit() > 0) { int stag = codedIS.readRawVarint32(); int pId = codedIS.readRawVarint32(); o.names.put(stag, ((char)pId)+""); + list.add(stag); } + o.nameIds = list.toArray(); codedIS.popLimit(old); break; case RouteData.POINTS_FIELD_NUMBER: diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index c5c6465b96..4542915cf9 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -26,6 +26,7 @@ public class RouteDataObject { public long id; public TIntObjectHashMap names; public final static float NONE_MAX_SPEED = 40f; + public int[] nameIds; public RouteDataObject(RouteRegion region) { this.region = region; @@ -33,6 +34,7 @@ public class RouteDataObject { public RouteDataObject(RouteRegion region, int[] nameIds, String[] nameValues) { this.region = region; + this.nameIds = nameIds; if (nameIds.length > 0) { names = new TIntObjectHashMap(); } @@ -86,6 +88,10 @@ public class RouteDataObject { return null; } + public int[] getNameIds() { + return nameIds; + } + public TIntObjectHashMap getNames() { return names; }