diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index 62bc990b99..1ec25d1200 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -169,7 +169,9 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { - getRecordingsFromPoint(point, tileBox, objects); + if (tileBox.getZoom() >= startZoom) { + getRecordingsFromPoint(point, tileBox, objects); + } } public void getRecordingsFromPoint(PointF point, RotatedTileBox tileBox, List am) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 33bdf603c6..1588e750dd 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -532,7 +532,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { - getBugFromPoint(tileBox, point, res); + if (tileBox.getZoom() >= startZoom) { + getBugFromPoint(tileBox, point, res); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 1649986e56..24e59d1d59 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -56,13 +56,15 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC @Override public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { if (tileBox.getZoom() >= startZoom) { - drawPoints(canvas, tileBox, plugin.getDBBug().getOsmbugsPoints()); - drawPoints(canvas, tileBox, plugin.getDBPOI().getOpenstreetmapPoints()); + List fullObjectsLatLon = new ArrayList<>(); + drawPoints(canvas, tileBox, plugin.getDBBug().getOsmbugsPoints(), fullObjectsLatLon); + drawPoints(canvas, tileBox, plugin.getDBPOI().getOpenstreetmapPoints(), fullObjectsLatLon); + this.fullObjectsLatLon = fullObjectsLatLon; } } - private void drawPoints(Canvas canvas, RotatedTileBox tileBox, List objects) { - List fullObjectsLatLon = new ArrayList<>(); + private void drawPoints(Canvas canvas, RotatedTileBox tileBox, List objects, + List fullObjectsLatLon) { for (OsmPoint o : objects) { float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude()); float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude()); @@ -77,7 +79,6 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight() / 2, paintIcon); fullObjectsLatLon.add(new LatLon(o.getLatitude(), o.getLongitude())); } - this.fullObjectsLatLon = fullObjectsLatLon; } @Override @@ -144,7 +145,9 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { - getOsmEditsFromPoint(point, tileBox, o); + if (tileBox.getZoom() >= startZoom) { + getOsmEditsFromPoint(point, tileBox, o); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 6366f6b7c4..0c1221ffcd 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -280,13 +280,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex true).getIntrinsicWidth() * 3 / 2.5f; QuadTree boundIntersections = initBoundIntersections(tileBox); + List fullObjectsLatLon = new ArrayList<>(); + List smallObjectsLatLon = new ArrayList<>(); // request to load final QuadRect latLonBounds = tileBox.getLatLonBounds(); for (SelectedGpxFile g : selectedGPXFiles) { List pts = getListStarPoints(g); List fullObjects = new ArrayList<>(); - List fullObjectsLatLon = new ArrayList<>(); - List smallObjectsLatLon = new ArrayList<>(); int fcolor = g.getColor() == 0 ? defPointColor : g.getColor(); for (WptPt o : pts) { if (o.lat >= latLonBounds.bottom && o.lat <= latLonBounds.top @@ -315,9 +315,9 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), pointColor, true); fid.drawBitmapInCenter(canvas, x, y); } - this.fullObjectsLatLon = fullObjectsLatLon; - this.smallObjectsLatLon = smallObjectsLatLon; } + this.fullObjectsLatLon = fullObjectsLatLon; + this.smallObjectsLatLon = smallObjectsLatLon; } } @@ -482,7 +482,9 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { - getWptFromPoint(tileBox, point, res); + if (tileBox.getZoom() >= startZoom) { + getWptFromPoint(tileBox, point, res); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java index 63278b6ef6..aabae12daa 100644 --- a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java @@ -117,18 +117,20 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { - int ex = (int) point.x; - int ey = (int) point.y; - int compare = getRadiusPoi(tileBox); - int radius = compare * 3 / 2; + if (tileBox.getZoom() >= startZoom) { + int ex = (int) point.x; + int ey = (int) point.y; + int compare = getRadiusPoi(tileBox); + int radius = compare * 3 / 2; - for (RouteDataObject road : getMissingRoads()) { - Location location = getMissingRoadLocations().get(road.getId()); - int x = (int) tileBox.getPixXFromLatLon(location.getLatitude(), location.getLongitude()); - int y = (int) tileBox.getPixYFromLatLon(location.getLatitude(), location.getLongitude()); - if (calculateBelongs(ex, ey, x, y, compare)) { - compare = radius; - o.add(road); + for (RouteDataObject road : getMissingRoads()) { + Location location = getMissingRoadLocations().get(road.getId()); + int x = (int) tileBox.getPixXFromLatLon(location.getLatitude(), location.getLongitude()); + int y = (int) tileBox.getPixYFromLatLon(location.getLatitude(), location.getLongitude()); + if (calculateBelongs(ex, ey, x, y, compare)) { + compare = radius; + o.add(road); + } } } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 10256c8e5d..f7f7f21194 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -392,6 +392,10 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) { + return; + } + MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); List markers = markersHelper.getActiveMapMarkers(); int r = getRadiusPoi(tileBox); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 70c643f70e..c732bdbae0 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -820,6 +820,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback { } } if (twoFingerTapDetector.onTouchEvent(event)) { + ContextMenuLayer contextMenuLayer = getLayerByClass(ContextMenuLayer.class); + if (contextMenuLayer != null) { + contextMenuLayer.onTouchEvent(event, getCurrentRotatedTileBox()); + } return true; } diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 8ce9038f2f..5b01766d98 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -507,7 +507,9 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { - getAmenityFromPoint(tileBox, point, objects); + if (tileBox.getZoom() >= startZoom) { + getAmenityFromPoint(tileBox, point, objects); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java index 6213054f96..53195f2773 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java @@ -165,7 +165,9 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { - getMyLocationFromPoint(tileBox, point, o); + if (tileBox.getZoom() >= 3) { + getMyLocationFromPoint(tileBox, point, o); + } } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index 8eafc1e8d8..462d6d3383 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -180,24 +180,24 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { - TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper(); - List intermediatePoints = tg.getAllPoints(); - int r = getRadiusPoi(tileBox); - for (int i = 0; i < intermediatePoints.size(); i++) { - TargetPoint tp = intermediatePoints.get(i); - LatLon latLon = tp.point; - if (latLon != null) { - int ex = (int) point.x; - int ey = (int) point.y; - int x = (int) tileBox.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); - int y = (int) tileBox.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); - if (calculateBelongs(ex, ey, x, y, r)) { - o.add(tp); + if (tileBox.getZoom() >= 3) { + TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper(); + List intermediatePoints = tg.getAllPoints(); + int r = getRadiusPoi(tileBox); + for (int i = 0; i < intermediatePoints.size(); i++) { + TargetPoint tp = intermediatePoints.get(i); + LatLon latLon = tp.point; + if (latLon != null) { + int ex = (int) point.x; + int ey = (int) point.y; + int x = (int) tileBox.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); + int y = (int) tileBox.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); + if (calculateBelongs(ex, ey, x, y, r)) { + o.add(tp); + } } } } - - } private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) { diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java index 6f162c6193..cbff8448f3 100644 --- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java @@ -205,7 +205,9 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { - getFromPoint(tileBox, point, res); + if (tileBox.getZoom() >= startZoom) { + getFromPoint(tileBox, point, res); + } } @Override