diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java index 4fb72e4f4d..b388a64869 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryInspector.java @@ -74,15 +74,16 @@ public class BinaryInspector { in.inspector(new String[] { // "-vpoi", - "-vmap", "-vmapobjects", // "-vmapcoordinates", -// "-vrouting", +// "-vmap", "-vmapobjects", + "-vmapcoordinates", + "-vrouting", // "-vtransport", // "-vaddress", "-vcities","-vstreetgroups", // "-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")+"/diff/2017_08_28_01_00.obf" + System.getProperty("maps.dir")+"/diff/17_08_29_22_00.diff.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", }); @@ -923,7 +924,7 @@ public class BinaryInspector { } - private static void printMapDetails(BinaryMapDataObject obj, StringBuilder b, boolean vmapCoordinates) { + public static void printMapDetails(BinaryMapDataObject obj, StringBuilder b, boolean vmapCoordinates) { boolean multipolygon = obj.getPolygonInnerCoordinates() != null && obj.getPolygonInnerCoordinates().length > 0; if (multipolygon) { b.append("Multipolygon"); diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java index 23866e8f82..594d49464a 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapDataObject.java @@ -200,7 +200,6 @@ public class BinaryMapDataObject { if(this.objectType == thatObj.objectType && this.id == thatObj.id && this.area == thatObj.area - && Arrays.equals(this.polygonInnerCoordinates, thatObj.polygonInnerCoordinates) && Arrays.equals(this.coordinates, thatObj.coordinates) ) { if(mapIndex == null) { throw new IllegalStateException("Illegal binary object: " + id); @@ -208,7 +207,26 @@ public class BinaryMapDataObject { if(thatObj.mapIndex == null) { throw new IllegalStateException("Illegal binary object: " + thatObj.id); } + boolean equals = true; + if(equals) { + if(polygonInnerCoordinates == null || thatObj.polygonInnerCoordinates == null) { + equals = polygonInnerCoordinates == thatObj.polygonInnerCoordinates; + } else if(polygonInnerCoordinates.length != thatObj.polygonInnerCoordinates.length){ + equals = false; + } else { + for(int i = 0; i < polygonInnerCoordinates.length && equals; i++) { + if(polygonInnerCoordinates[i] == null || thatObj.polygonInnerCoordinates[i] == null) { + equals = polygonInnerCoordinates[i] == thatObj.polygonInnerCoordinates[i]; + } else if(polygonInnerCoordinates[i].length != thatObj.polygonInnerCoordinates[i].length){ + equals = false; + } else { + equals = Arrays.equals(polygonInnerCoordinates[i], thatObj.polygonInnerCoordinates[i]); + } + } + } + } + if(equals) { if(types == null || thatObj.types == null) { equals = types == thatObj.types; @@ -218,7 +236,7 @@ public class BinaryMapDataObject { for(int i = 0; i < types.length && equals; i++) { TagValuePair o = mapIndex.decodeType(types[i]); TagValuePair s = thatObj.mapIndex.decodeType(thatObj.types[i]); - equals = o.equals(s); + equals = o.equals(s) && equals; } } } @@ -265,7 +283,8 @@ public class BinaryMapDataObject { return equals; } - +// thatObj.mapIndex.decodeType(thatObj.types[0]) +// mapIndex.decodeType(types[0]) id >>7 return false; } diff --git a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java index 1481ac0404..0c8ec712e6 100644 --- a/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/net/osmand/binary/RouteDataObject.java @@ -77,11 +77,7 @@ public class RouteDataObject { boolean equals = true; equals = equals && Arrays.equals(this.restrictions, thatObj.restrictions); - if (equals) { - if (this.names != null && thatObj.names != null) { - equals = Arrays.equals(this.names.values(), thatObj.names.values()); - } - } + if (equals) { if (this.types == null || thatObj.types == null) { equals = this.types == thatObj.types; @@ -158,7 +154,7 @@ public class RouteDataObject { } } } - + return equals; } return false; }