From 782b3a6236e86242683a5f8691529bd94a165a91 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Sat, 1 Feb 2020 21:11:59 +0300 Subject: [PATCH] Fix precision error --- OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java | 4 ++-- OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java b/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java index ccf51b5b94..aeb0570950 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/MapUtils.java @@ -172,11 +172,11 @@ public class MapUtils { } public static double get31LongitudeX(int tileX) { - return MapUtils.getLongitudeFromTile(21, tileX / 1024f); + return MapUtils.getLongitudeFromTile(21, tileX / 1024.0); } public static double get31LatitudeY(int tileY) { - return MapUtils.getLatitudeFromTile(21, tileY / 1024f); + return MapUtils.getLatitudeFromTile(21, tileY / 1024.0); } diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index e5f5655738..3bb2509fe2 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -677,10 +677,8 @@ public class ContextMenuLayer extends OsmandMapLayer { RenderingContext rc = maps.getVisibleRenderingContext(); RenderedObject[] renderedObjects = null; if (rc != null && rc.zoom == tileBox.getZoom()) { - double lat = MapUtils.get31LatitudeY((int) (rc.topY * rc.tileDivisor)); - double lon = MapUtils.get31LongitudeX((int) (rc.leftX * rc.tileDivisor)); - float x = tileBox.getPixXFromLatLon(lat, lon); - float y = tileBox.getPixYFromLatLon(lat, lon); + float x = tileBox.getPixXFrom31((int) (rc.leftX * rc.tileDivisor), (int) (rc.topY * rc.tileDivisor)); + float y = tileBox.getPixYFrom31((int) (rc.leftX * rc.tileDivisor), (int) (rc.topY * rc.tileDivisor)); renderedObjects = nativeLib.searchRenderedObjectsFromContext(rc, (int) (point.x - x), (int) (point.y - y)); } if (renderedObjects != null) {