diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java index fa600cee80..d9bef77fc2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java @@ -1527,7 +1527,7 @@ public class SearchCoreFactory { sp.location = new LatLon(pnt.getLatitude(), pnt.getLongitude()); sp.localeName = ((float)pnt.getLatitude()) +", " + ((float) pnt.getLongitude()); if (pnt.getZoom() > 0) { - sp.preferredZoom = pnt.getZoom(); + sp.preferredZoom = (int) pnt.getZoom(); } sp.objectType = ObjectType.LOCATION; resultMatcher.publish(sp); diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchResult.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchResult.java index c716adf1e1..d84ef029f0 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchResult.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchResult.java @@ -32,7 +32,8 @@ public class SearchResult { public double priorityDistance; public LatLon location; - public double preferredZoom = 15; + public float pZ = 15; + public int preferredZoom = Math.round(pZ); public String localeName; public String alternateName; diff --git a/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java b/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java index f5e77ad877..3248f7ca05 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/GeoPointParserUtil.java @@ -142,7 +142,7 @@ public class GeoPointParserUtil { } else { // data in the query and/or feature strings double lat = 0; double lon = 0; - double zoom = GeoParsedPoint.NO_ZOOM; + float zoom = GeoParsedPoint.NO_ZOOM; Map queryMap = getQueryParameters(uri); if (fragment != null) { if (fragment.startsWith("map=")) { @@ -187,7 +187,7 @@ public class GeoPointParserUtil { if (vls != null && vls.length >= 2) { double lat = parseSilentInt(vls[0]) / 100000.; double lon = parseSilentInt(vls[1]) / 100000.; - double zoom = parseZoom(zm); + float zoom = parseZoom(zm); return new GeoParsedPoint(lat, lon, zoom); } } else if (simpleDomains.contains(host)) { @@ -198,11 +198,11 @@ public class GeoPointParserUtil { if (params.containsKey("lat") && params.containsKey("lon")) { final double lat = parseSilentDouble(params.get("lat")); final double lon = parseSilentDouble(params.get("lon")); - double zoom = GeoParsedPoint.NO_ZOOM; + float zoom = GeoParsedPoint.NO_ZOOM; if (params.containsKey("z")) { - zoom = parseZoom(params.get("z")); + zoom = (float) parseZoom(params.get("z")); } else if (params.containsKey("zoom")) { - zoom = parseZoom(params.get("zoom")); + zoom = (float) parseZoom(params.get("zoom")); } return new GeoParsedPoint(lat, lon, zoom); } @@ -459,7 +459,7 @@ public class GeoPointParserUtil { lon = Double.valueOf(positionMatcher.group(2)); } - double zoom = GeoParsedPoint.NO_ZOOM; + float zoom = GeoParsedPoint.NO_ZOOM; String searchRequest = null; for (String param : queryPart.split("&")) { String paramName; @@ -475,7 +475,7 @@ public class GeoPointParserUtil { if ("z".equals(paramName) && paramValue != null) { // zoom = Double.valueOf(paramValue).intValue(); - zoom = Double.valueOf(paramValue); + zoom = Float.valueOf(paramValue); } else if ("q".equals(paramName) && paramValue != null) { searchRequest = URLDecoder.decode(paramValue); } @@ -541,7 +541,7 @@ public class GeoPointParserUtil { if (vls.length >= 2) { double lat = parseSilentDouble(vls[0], Double.NaN); double lon = parseSilentDouble(vls[1], Double.NaN); - double zoom = GeoParsedPoint.NO_ZOOM; + float zoom = GeoParsedPoint.NO_ZOOM; if (vls.length >= 3 || zmPart.length() > 0) { if (zmPart.length() == 0) { zmPart = vls[2]; @@ -567,10 +567,10 @@ public class GeoPointParserUtil { return vl.split(split); } - private static double parseZoom(String zoom) { + private static float parseZoom(String zoom) { try { if (zoom != null) { - return Double.valueOf(zoom); + return Float.valueOf(zoom); } } catch (NumberFormatException e) { } @@ -584,7 +584,7 @@ public class GeoPointParserUtil { private static double parseSilentDouble(String zoom, double vl) { try { if (zoom != null) { - return Double.valueOf(zoom); + return Float.valueOf(zoom); } } catch (NumberFormatException e) { } @@ -602,11 +602,11 @@ public class GeoPointParserUtil { } public static class GeoParsedPoint { - public static final double NO_ZOOM = -1; + public static final float NO_ZOOM = -1; private double lat = 0; private double lon = 0; - private double zoom = NO_ZOOM; + private float zoom = NO_ZOOM; private String label; private String query; private boolean geoPoint; @@ -625,12 +625,12 @@ public class GeoPointParserUtil { this.label = label.replaceAll("\\+", " "); } - public GeoParsedPoint(double lat, double lon, double zoom) { + public GeoParsedPoint(double lat, double lon, float zoom) { this(lat, lon); this.zoom = zoom; } - public GeoParsedPoint(double lat, double lon, double zoom, String label) { + public GeoParsedPoint(double lat, double lon, float zoom, String label) { this(lat, lon, label); this.zoom = zoom; } diff --git a/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java b/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java index 4a5bd723ec..9c642788b2 100644 --- a/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java +++ b/OsmAnd-java/src/test/java/net/osmand/util/GeoPointParserUtilTest.java @@ -39,7 +39,7 @@ public class GeoPointParserUtilTest { final double dlat = 34.99393, dlon = -106.61568; final double longLat = 34.993933029174805, longLon = -106.615680694580078; final String name = "Treasure Island"; - double z = GeoParsedPoint.NO_ZOOM; + float z = GeoParsedPoint.NO_ZOOM; String url; String noQueryParameters[] = {