From b1961ac6a694f1e251dc2c137ca078026e4f7ad1 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 14 Dec 2017 15:44:49 +0200 Subject: [PATCH] Add parameter to collectObjectsFromPoint(); remove copy-paste for combined markers "one tap make active" --- .../plus/activities/MapActivityLayers.java | 4 +-- .../plus/audionotes/AudioNotesLayer.java | 2 +- .../DistanceCalculatorPlugin.java | 4 +-- .../plus/mapillary/MapillaryVectorLayer.java | 2 +- .../measurementtool/MeasurementToolLayer.java | 2 +- .../net/osmand/plus/osmedit/OsmBugsLayer.java | 2 +- .../osmand/plus/osmedit/OsmEditsLayer.java | 2 +- .../osmand/plus/osmo/OsMoPositionLayer.java | 2 +- .../parkingpoint/ParkingPositionLayer.java | 2 +- .../RoutePointsLayer.java | 2 +- .../net/osmand/plus/views/AidlMapLayer.java | 2 +- .../osmand/plus/views/ContextMenuLayer.java | 11 ++++--- .../plus/views/DownloadedRegionsLayer.java | 2 +- .../osmand/plus/views/FavouritesLayer.java | 31 +------------------ .../src/net/osmand/plus/views/GPXLayer.java | 30 +----------------- .../plus/views/ImpassableRoadsLayer.java | 2 +- .../osmand/plus/views/MapMarkersLayer.java | 16 ++++------ .../net/osmand/plus/views/POIMapLayer.java | 2 +- .../osmand/plus/views/PointLocationLayer.java | 2 +- .../plus/views/PointNavigationLayer.java | 2 +- .../plus/views/TransportStopsLayer.java | 2 +- 21 files changed, 33 insertions(+), 93 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java index 64709d883e..3a44bbaf61 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java @@ -136,7 +136,7 @@ public class MapActivityLayers { mapView.addLayer(downloadedRegionsLayer, 0.5f); // 0.9 gpx layer - gpxLayer = new GPXLayer(activity); + gpxLayer = new GPXLayer(); mapView.addLayer(gpxLayer, 0.9f); // 1. route layer @@ -148,7 +148,7 @@ public class MapActivityLayers { poiMapLayer = new POIMapLayer(activity); mapView.addLayer(poiMapLayer, 3); // 4. favorites layer - mFavouritesLayer = new FavouritesLayer(activity); + mFavouritesLayer = new FavouritesLayer(); mapView.addLayer(mFavouritesLayer, 4); // 4.6 measurement tool layer measurementToolLayer = new MeasurementToolLayer(); diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index 046fc39059..5f7d663733 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -188,7 +188,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects, boolean unknownLocation) { if (tileBox.getZoom() >= startZoom) { getRecordingsFromPoint(point, tileBox, objects); } diff --git a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java index c4d2b65033..11c868a74e 100644 --- a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java +++ b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java @@ -499,7 +499,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) { List s = new ArrayList<>(); - collectObjectsFromPoint(point, tileBox, s); + collectObjectsFromPoint(point, tileBox, s, true); if (s.size() == 0 && distanceMeasurementMode == 1 && measurementPoints.size() > 0) { LinkedList lt = measurementPoints.get(measurementPoints.size() - 1); @@ -595,7 +595,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { getMPointsFromPoint(tileBox, point, o); } diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java index 69ff11e771..2fb5cf0407 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java @@ -313,7 +313,7 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects, boolean unknownLocation) { if (map != null && tileBox.getZoom() >= map.getMinimumZoomSupported()) { getImagesFromPoint(tileBox, point, objects); } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index 1cea9008ba..aec0e21e12 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -380,7 +380,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 5ed95ab18b..c84a7aa825 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -518,7 +518,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res, boolean unknownLocation) { if (tileBox.getZoom() >= startZoom) { getBugFromPoint(tileBox, point, res); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 0699f9367a..97ac98fb29 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -166,7 +166,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { if (tileBox.getZoom() >= startZoom) { getOsmEditsFromPoint(point, tileBox, o); } diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java index 35e1368055..fc2e4f1758 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java @@ -218,7 +218,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { getOsmoFromPoint(tileBox, point, o); } diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java index d768f4181d..417f0f9be3 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java @@ -141,7 +141,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { getParkingFromPoint(tileBox, point, o); } diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java index 13b8620a13..64d5b2d04f 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java @@ -48,7 +48,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { } diff --git a/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java b/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java index b11e902931..abdff4324c 100644 --- a/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java @@ -134,7 +134,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { getFromPoint(tileBox, point, o); } diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index 7614f8d7fc..58fca38ac5 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -576,7 +576,7 @@ public class ContextMenuLayer extends OsmandMapLayer { private boolean showContextMenu(PointF point, RotatedTileBox tileBox, boolean showUnknownLocation) { LatLon objectLatLon = null; - Map selectedObjects = selectObjectsForContextMenu(tileBox, point, false); + Map selectedObjects = selectObjectsForContextMenu(tileBox, point, false, showUnknownLocation); NativeOsmandLibrary nativeLib = NativeOsmandLibrary.getLoadedLibrary(); if (nativeLib != null) { MapRenderRepositories maps = activity.getMyApplication().getResourceManager().getRenderer(); @@ -731,7 +731,8 @@ public class ContextMenuLayer extends OsmandMapLayer { } private Map selectObjectsForContextMenu(RotatedTileBox tileBox, - PointF point, boolean acquireObjLatLon) { + PointF point, boolean acquireObjLatLon, + boolean unknownLocation) { List pressedLatLonFull = new ArrayList<>(); List pressedLatLonSmall = new ArrayList<>(); Map selectedObjects = new HashMap<>(); @@ -740,7 +741,7 @@ public class ContextMenuLayer extends OsmandMapLayer { if (lt instanceof ContextMenuLayer.IContextMenuProvider) { s.clear(); final IContextMenuProvider l = (ContextMenuLayer.IContextMenuProvider) lt; - l.collectObjectsFromPoint(point, tileBox, s); + l.collectObjectsFromPoint(point, tileBox, s, unknownLocation); for (Object o : s) { selectedObjects.put(o, l); if (acquireObjLatLon && l.isObjectClickable(o)) { @@ -899,7 +900,7 @@ public class ContextMenuLayer extends OsmandMapLayer { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: if (!mInChangeMarkerPositionMode && !mInGpxDetailsMode) { - selectObjectsForContextMenu(tileBox, new PointF(event.getX(), event.getY()), true); + selectObjectsForContextMenu(tileBox, new PointF(event.getX(), event.getY()), true, true); if (pressedLatLonFull.size() > 0 || pressedLatLonSmall.size() > 0) { view.refreshMap(); } @@ -918,7 +919,7 @@ public class ContextMenuLayer extends OsmandMapLayer { public interface IContextMenuProvider { - void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o); + void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation); LatLon getObjectLocation(Object o); diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java index abbafcdb8e..1451524c41 100644 --- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java @@ -410,7 +410,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe // IContextMenuProvider @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects, boolean unknownLocation) { boolean isMenuVisible = false; if (view.getContext() instanceof MapActivity) { MapActivity mapActivity = (MapActivity) view.getContext(); diff --git a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java index 3ff4c1c3e4..07f72d42db 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java @@ -11,9 +11,7 @@ import android.graphics.PorterDuffColorFilter; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; -import android.view.View; import net.osmand.data.FavouritePoint; import net.osmand.data.LatLon; @@ -23,10 +21,8 @@ import net.osmand.data.QuadTree; import net.osmand.data.RotatedTileBox; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.MapMarkersHelper; -import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; -import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback; import net.osmand.plus.views.MapTextLayer.MapTextProvider; @@ -37,8 +33,6 @@ import java.util.List; public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider, ContextMenuLayer.IMoveObjectProvider, MapTextProvider { - private MapActivity mapActivity; - protected int startZoom = 6; protected OsmandMapTileView view; @@ -63,10 +57,6 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer. return favorites.getFavouritePoints(); } - public FavouritesLayer(MapActivity mapActivity) { - this.mapActivity = mapActivity; - } - @Override public void initLayer(OsmandMapTileView view) { this.view = view; @@ -234,30 +224,11 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer. @Override public boolean runExclusiveAction(Object o, boolean unknownLocation) { - if (unknownLocation || o == null || !(o instanceof FavouritePoint) - || !view.getApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { - return false; - } - MapMarker marker = mapMarkersHelper.getMapMarker((FavouritePoint) o); - if (marker != null) { - final MapMarker old = mapMarkersHelper.getMapMarkers().get(0); - mapMarkersHelper.moveMarkerToTop(marker); - String title = mapActivity.getString(R.string.marker_activated, mapMarkersHelper.getMapMarkers().get(0).getName(mapActivity)); - Snackbar.make(mapActivity.findViewById(R.id.bottomFragmentContainer), title, Snackbar.LENGTH_LONG) - .setAction(R.string.shared_string_cancel, new View.OnClickListener() { - @Override - public void onClick(View v) { - mapMarkersHelper.moveMarkerToTop(old); - } - }) - .show(); - return true; - } return false; } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res, boolean unknownLocation) { if (this.settings.SHOW_FAVORITES.get() && tileBox.getZoom() >= startZoom) { getFavoriteFromPoint(tileBox, point, res); } diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 33eb38ab67..1b89f257a9 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -18,9 +18,7 @@ import android.os.AsyncTask; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; -import android.view.View; import net.osmand.AndroidUtils; import net.osmand.data.LatLon; @@ -38,12 +36,10 @@ import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup; import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem; import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.MapMarkersHelper; -import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.R; -import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu.TrackChartPoints; import net.osmand.plus.render.OsmandRenderer; @@ -63,7 +59,6 @@ import java.util.Map; public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider, ContextMenuLayer.IMoveObjectProvider, MapTextProvider { - private MapActivity mapActivity; private OsmandMapTileView view; private Paint paint; @@ -111,10 +106,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex @ColorInt private int defPointColor; - public GPXLayer(MapActivity mapActivity) { - this.mapActivity = mapActivity; - } - @Override public void initLayer(OsmandMapTileView view) { this.view = view; @@ -588,30 +579,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex @Override public boolean runExclusiveAction(Object o, boolean unknownLocation) { - if (unknownLocation || o == null || !(o instanceof WptPt) - || !view.getApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { - return false; - } - MapMarker marker = mapMarkersHelper.getMapMarker((WptPt) o); - if (marker != null) { - final MapMarker old = mapMarkersHelper.getMapMarkers().get(0); - mapMarkersHelper.moveMarkerToTop(marker); - String title = mapActivity.getString(R.string.marker_activated, mapMarkersHelper.getMapMarkers().get(0).getName(mapActivity)); - Snackbar.make(mapActivity.findViewById(R.id.bottomFragmentContainer), title, Snackbar.LENGTH_LONG) - .setAction(R.string.shared_string_cancel, new View.OnClickListener() { - @Override - public void onClick(View v) { - mapMarkersHelper.moveMarkerToTop(old); - } - }) - .show(); - return true; - } return false; } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res, boolean unknownLocation) { if (tileBox.getZoom() >= startZoom) { getWptFromPoint(tileBox, point, res); } diff --git a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java index 452fbf5181..90ce0fde19 100644 --- a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java @@ -167,7 +167,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { if (tileBox.getZoom() >= startZoom) { int ex = (int) point.x; int ey = (int) point.y; diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 38efc761ff..b75f9e0fb1 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -30,11 +30,11 @@ import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndConstants; import net.osmand.plus.OsmAndFormatter; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.MapActivity; -import net.osmand.plus.base.FavoriteImageDrawable; import net.osmand.plus.base.MapViewTrackingUtilities; import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback; import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider; @@ -511,24 +511,20 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) { return; } - MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper(); - List markers = markersHelper.getMapMarkers(); + OsmandApplication app = map.getMyApplication(); int r = getRadiusPoi(tileBox); - for (int i = 0; i < markers.size(); i++) { - MapMarker marker = markers.get(i); - if (!isSynced(marker)) { + for (MapMarker marker : app.getMapMarkersHelper().getMapMarkers()) { + if ((!unknownLocation && app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) || !isSynced(marker)) { LatLon latLon = marker.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)) { + if (calculateBelongs((int) point.x, (int) point.y, x, y, r)) { o.add(marker); } } diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 8d619e05f8..052fddef22 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -544,7 +544,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects, boolean unknownLocation) { if (tileBox.getZoom() >= startZoom) { getAmenityFromPoint(tileBox, point, objects); } diff --git a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java index 64a0098002..5cd5562533 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java @@ -182,7 +182,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { if (tileBox.getZoom() >= 3) { getMyLocationFromPoint(tileBox, point, o); } diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index 9d70ae0c7f..256f3bd23c 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -184,7 +184,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o, boolean unknownLocation) { if (tileBox.getZoom() >= 3) { TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper(); List intermediatePoints = tg.getAllPoints(); diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java index b43cfae364..be9959b371 100644 --- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java @@ -285,7 +285,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa } @Override - public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res, boolean unknownLocation) { if(tileBox.getZoom() >= startZoomRoute && route != null) { getFromPoint(tileBox, point, res, route.getForwardStops()); } else if (tileBox.getZoom() >= startZoom && data.getResults() != null) {