diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapDataObject.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapDataObject.java index 5e18b1ee96..c3797a5017 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapDataObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapDataObject.java @@ -19,6 +19,7 @@ public class BinaryMapDataObject { protected int[] types = null; protected int[] additionalTypes = null; protected int objectType = RenderingRulesStorage.POINT_RULES; + protected int[] labelCoordinates = null; protected TIntObjectHashMap objectNames = null; protected TIntArrayList namesOrder = null; @@ -33,7 +34,7 @@ public class BinaryMapDataObject { public BinaryMapDataObject(long id, int[] coordinates, int[][] polygonInnerCoordinates, int objectType, boolean area, - int[] types, int[] additionalTypes){ + int[] types, int[] additionalTypes, int[] labelCoordinates){ this.polygonInnerCoordinates = polygonInnerCoordinates; this.coordinates = coordinates; this.additionalTypes = additionalTypes; @@ -41,6 +42,7 @@ public class BinaryMapDataObject { this.id = id; this.objectType = objectType; this.area = area; + this.labelCoordinates = labelCoordinates; } protected void setCoordinates(int[] coordinates) { @@ -282,6 +284,18 @@ public class BinaryMapDataObject { } } + //do we need it? use precision? + if (equals) { + if (labelCoordinates == null || thatObj.labelCoordinates == null) { + equals = labelCoordinates == thatObj.labelCoordinates; + //do we need it? precision? +// } else { +// for(int i = 0; i < labelCoordinates.length && equals; i++) { +// equals = labelCoordinates[i] == thatObj.labelCoordinates[i]; +// } + } + } + return equals; } // thatObj.mapIndex.decodeType(thatObj.types[0]) @@ -367,4 +381,8 @@ public class BinaryMapDataObject { public int getObjectType() { return objectType; } + + public int[] getLabelCoordinates() { + return labelCoordinates; + } } diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java index 69841ad906..5da9e92aa9 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapIndexReader.java @@ -1917,7 +1917,8 @@ public class BinaryMapIndexReader { BinaryMapDataObject bm = new BinaryMapDataObject(o.id, o.coordinates, o.polygonInnerCoordinates, o.objectType, o.area, - types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray()); + types.toArray(), additionalTypes.isEmpty() ? null : additionalTypes.toArray(), + o.labelCoordinates); if (o.namesOrder != null) { bm.objectNames = new TIntObjectHashMap<>(); bm.namesOrder = new TIntArrayList(); diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java b/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java index 3460774594..06a2f6a08e 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/edit/OsmMapUtils.java @@ -50,7 +50,7 @@ public class OsmMapUtils { } public static LatLon getComplexPolyCenter(Collection nodes) { - double precision = 1e-4; //where to put constant? + double precision = 1e-4; //where to set precision constant? final List> rings = new ArrayList<>(); List outerRing = new ArrayList<>(); @@ -59,7 +59,6 @@ public class OsmMapUtils { } rings.add(outerRing); return getPolylabelPoint(rings, precision); - //return getPolylabelPoint(new Polygon(points), precision); } public static LatLon getWeightCenter(Collection nodes) {