From bdc16bb4ccec8127e700ea0445e023f4b21c16e9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 26 Aug 2017 12:50:05 +0200 Subject: [PATCH] Fix obf 2 osm binary inspector --- .../net/osmand/binary/BinaryInspector.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java index e0926b5197..b52e20c3b7 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java @@ -81,8 +81,8 @@ public class BinaryInspector { // "-vstreets", "-vbuildings", "-vintersections", // "-lang=ru", // "-bbox=30.4981,50.4424,30.5195,50.4351", -// "-osm="+System.getProperty("maps.dir")+"/map_full.obf.osm", - System.getProperty("maps.dir")+"/Map.obf" + "-osm="+System.getProperty("maps.dir")+"/map_full.obf.osm", + System.getProperty("maps.dir")+"/2017_08_24_15_00.obf" // System.getProperty("maps.dir")+"../temp/kiev/Ukraine_kiev-city_europe_17_06_05.obf", // System.getProperty("maps.dir")+"Ukraine_kiev-city_europe_2.obf", }); @@ -1004,7 +1004,8 @@ public class BinaryInspector { if (rt == null) { throw new NullPointerException("Type " + types[j] + "was not found"); } - tags.append("\t\n"); + String value = quoteName(rt.getValue()); + tags.append("\t\n"); } TIntObjectHashMap names = obj.getNames(); if (names != null && !names.isEmpty()) { @@ -1042,7 +1043,8 @@ public class BinaryInspector { int[] keys = obj.getPointTypes(i); for (int j = 0; j < keys.length; j++) { RouteTypeRule rt = obj.region.quickGetEncodingRule(keys[j]); - tags.append("\t\t\n"); + String value = quoteName(rt.getValue()); + tags.append("\t\t\n"); } } b.append("\t\n"); @@ -1068,7 +1070,12 @@ public class BinaryInspector { } private String quoteName(String name) { + if(name == null || name.length() == 0) { + return "EMPTY"; + } name = name.replace("'", "'"); + name = name.replace("<", "<"); + name = name.replace(">", ">"); name = name.replace("&", "&"); return name; } @@ -1083,7 +1090,7 @@ public class BinaryInspector { if (pair == null) { throw new NullPointerException("Type " + types[j] + "was not found"); } - tags.append("\t\n"); + tags.append("\t\n"); } if (obj.getAdditionalTypes() != null && obj.getAdditionalTypes().length > 0) { for (int j = 0; j < obj.getAdditionalTypes().length; j++) { @@ -1092,7 +1099,7 @@ public class BinaryInspector { if (pair == null) { throw new NullPointerException("Type " + obj.getAdditionalTypes()[j] + "was not found"); } - tags.append("\t\n"); + tags.append("\t\n"); } } TIntObjectHashMap names = obj.getObjectNames();