Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9eb1e7ddaa
21 changed files with 33 additions and 93 deletions
|
@ -136,7 +136,7 @@ public class MapActivityLayers {
|
||||||
mapView.addLayer(downloadedRegionsLayer, 0.5f);
|
mapView.addLayer(downloadedRegionsLayer, 0.5f);
|
||||||
|
|
||||||
// 0.9 gpx layer
|
// 0.9 gpx layer
|
||||||
gpxLayer = new GPXLayer(activity);
|
gpxLayer = new GPXLayer();
|
||||||
mapView.addLayer(gpxLayer, 0.9f);
|
mapView.addLayer(gpxLayer, 0.9f);
|
||||||
|
|
||||||
// 1. route layer
|
// 1. route layer
|
||||||
|
@ -148,7 +148,7 @@ public class MapActivityLayers {
|
||||||
poiMapLayer = new POIMapLayer(activity);
|
poiMapLayer = new POIMapLayer(activity);
|
||||||
mapView.addLayer(poiMapLayer, 3);
|
mapView.addLayer(poiMapLayer, 3);
|
||||||
// 4. favorites layer
|
// 4. favorites layer
|
||||||
mFavouritesLayer = new FavouritesLayer(activity);
|
mFavouritesLayer = new FavouritesLayer();
|
||||||
mapView.addLayer(mFavouritesLayer, 4);
|
mapView.addLayer(mFavouritesLayer, 4);
|
||||||
// 4.6 measurement tool layer
|
// 4.6 measurement tool layer
|
||||||
measurementToolLayer = new MeasurementToolLayer();
|
measurementToolLayer = new MeasurementToolLayer();
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getRecordingsFromPoint(point, tileBox, objects);
|
getRecordingsFromPoint(point, tileBox, objects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,7 +499,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) {
|
||||||
|
|
||||||
List<Object> s = new ArrayList<>();
|
List<Object> s = new ArrayList<>();
|
||||||
collectObjectsFromPoint(point, tileBox, s);
|
collectObjectsFromPoint(point, tileBox, s, true);
|
||||||
|
|
||||||
if (s.size() == 0 && distanceMeasurementMode == 1 && measurementPoints.size() > 0) {
|
if (s.size() == 0 && distanceMeasurementMode == 1 && measurementPoints.size() > 0) {
|
||||||
LinkedList<WptPt> lt = measurementPoints.get(measurementPoints.size() - 1);
|
LinkedList<WptPt> lt = measurementPoints.get(measurementPoints.size() - 1);
|
||||||
|
@ -595,7 +595,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
getMPointsFromPoint(tileBox, point, o);
|
getMPointsFromPoint(tileBox, point, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects, boolean unknownLocation) {
|
||||||
if (map != null && tileBox.getZoom() >= map.getMinimumZoomSupported()) {
|
if (map != null && tileBox.getZoom() >= map.getMinimumZoomSupported()) {
|
||||||
getImagesFromPoint(tileBox, point, objects);
|
getImagesFromPoint(tileBox, point, objects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -518,7 +518,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getBugFromPoint(tileBox, point, res);
|
getBugFromPoint(tileBox, point, res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getOsmEditsFromPoint(point, tileBox, o);
|
getOsmEditsFromPoint(point, tileBox, o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
getOsmoFromPoint(tileBox, point, o);
|
getOsmoFromPoint(tileBox, point, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
getParkingFromPoint(tileBox, point, o);
|
getParkingFromPoint(tileBox, point, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
getFromPoint(tileBox, point, o);
|
getFromPoint(tileBox, point, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -576,7 +576,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private boolean showContextMenu(PointF point, RotatedTileBox tileBox, boolean showUnknownLocation) {
|
private boolean showContextMenu(PointF point, RotatedTileBox tileBox, boolean showUnknownLocation) {
|
||||||
LatLon objectLatLon = null;
|
LatLon objectLatLon = null;
|
||||||
Map<Object, IContextMenuProvider> selectedObjects = selectObjectsForContextMenu(tileBox, point, false);
|
Map<Object, IContextMenuProvider> selectedObjects = selectObjectsForContextMenu(tileBox, point, false, showUnknownLocation);
|
||||||
NativeOsmandLibrary nativeLib = NativeOsmandLibrary.getLoadedLibrary();
|
NativeOsmandLibrary nativeLib = NativeOsmandLibrary.getLoadedLibrary();
|
||||||
if (nativeLib != null) {
|
if (nativeLib != null) {
|
||||||
MapRenderRepositories maps = activity.getMyApplication().getResourceManager().getRenderer();
|
MapRenderRepositories maps = activity.getMyApplication().getResourceManager().getRenderer();
|
||||||
|
@ -731,7 +731,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Object, IContextMenuProvider> selectObjectsForContextMenu(RotatedTileBox tileBox,
|
private Map<Object, IContextMenuProvider> selectObjectsForContextMenu(RotatedTileBox tileBox,
|
||||||
PointF point, boolean acquireObjLatLon) {
|
PointF point, boolean acquireObjLatLon,
|
||||||
|
boolean unknownLocation) {
|
||||||
List<LatLon> pressedLatLonFull = new ArrayList<>();
|
List<LatLon> pressedLatLonFull = new ArrayList<>();
|
||||||
List<LatLon> pressedLatLonSmall = new ArrayList<>();
|
List<LatLon> pressedLatLonSmall = new ArrayList<>();
|
||||||
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
||||||
|
@ -740,7 +741,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
||||||
s.clear();
|
s.clear();
|
||||||
final IContextMenuProvider l = (ContextMenuLayer.IContextMenuProvider) lt;
|
final IContextMenuProvider l = (ContextMenuLayer.IContextMenuProvider) lt;
|
||||||
l.collectObjectsFromPoint(point, tileBox, s);
|
l.collectObjectsFromPoint(point, tileBox, s, unknownLocation);
|
||||||
for (Object o : s) {
|
for (Object o : s) {
|
||||||
selectedObjects.put(o, l);
|
selectedObjects.put(o, l);
|
||||||
if (acquireObjLatLon && l.isObjectClickable(o)) {
|
if (acquireObjLatLon && l.isObjectClickable(o)) {
|
||||||
|
@ -899,7 +900,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
if (!mInChangeMarkerPositionMode && !mInGpxDetailsMode) {
|
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) {
|
if (pressedLatLonFull.size() > 0 || pressedLatLonSmall.size() > 0) {
|
||||||
view.refreshMap();
|
view.refreshMap();
|
||||||
}
|
}
|
||||||
|
@ -918,7 +919,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public interface IContextMenuProvider {
|
public interface IContextMenuProvider {
|
||||||
|
|
||||||
void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o);
|
void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation);
|
||||||
|
|
||||||
LatLon getObjectLocation(Object o);
|
LatLon getObjectLocation(Object o);
|
||||||
|
|
||||||
|
|
|
@ -410,7 +410,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
|
||||||
|
|
||||||
// IContextMenuProvider
|
// IContextMenuProvider
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects, boolean unknownLocation) {
|
||||||
boolean isMenuVisible = false;
|
boolean isMenuVisible = false;
|
||||||
if (view.getContext() instanceof MapActivity) {
|
if (view.getContext() instanceof MapActivity) {
|
||||||
MapActivity mapActivity = (MapActivity) view.getContext();
|
MapActivity mapActivity = (MapActivity) view.getContext();
|
||||||
|
|
|
@ -11,9 +11,7 @@ import android.graphics.PorterDuffColorFilter;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
@ -23,10 +21,8 @@ import net.osmand.data.QuadTree;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback;
|
import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback;
|
||||||
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
||||||
|
@ -37,8 +33,6 @@ import java.util.List;
|
||||||
public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
||||||
ContextMenuLayer.IMoveObjectProvider, MapTextProvider<FavouritePoint> {
|
ContextMenuLayer.IMoveObjectProvider, MapTextProvider<FavouritePoint> {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
|
||||||
|
|
||||||
protected int startZoom = 6;
|
protected int startZoom = 6;
|
||||||
|
|
||||||
protected OsmandMapTileView view;
|
protected OsmandMapTileView view;
|
||||||
|
@ -63,10 +57,6 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
return favorites.getFavouritePoints();
|
return favorites.getFavouritePoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FavouritesLayer(MapActivity mapActivity) {
|
|
||||||
this.mapActivity = mapActivity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initLayer(OsmandMapTileView view) {
|
public void initLayer(OsmandMapTileView view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
@ -234,30 +224,11 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean runExclusiveAction(Object o, boolean unknownLocation) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||||
if (this.settings.SHOW_FAVORITES.get() && tileBox.getZoom() >= startZoom) {
|
if (this.settings.SHOW_FAVORITES.get() && tileBox.getZoom() >= startZoom) {
|
||||||
getFavoriteFromPoint(tileBox, point, res);
|
getFavoriteFromPoint(tileBox, point, res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,7 @@ import android.os.AsyncTask;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.data.LatLon;
|
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.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
|
||||||
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
|
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu.TrackChartPoints;
|
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu.TrackChartPoints;
|
||||||
import net.osmand.plus.render.OsmandRenderer;
|
import net.osmand.plus.render.OsmandRenderer;
|
||||||
|
@ -63,7 +59,6 @@ import java.util.Map;
|
||||||
public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
||||||
ContextMenuLayer.IMoveObjectProvider, MapTextProvider<WptPt> {
|
ContextMenuLayer.IMoveObjectProvider, MapTextProvider<WptPt> {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
|
||||||
private OsmandMapTileView view;
|
private OsmandMapTileView view;
|
||||||
|
|
||||||
private Paint paint;
|
private Paint paint;
|
||||||
|
@ -111,10 +106,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
@ColorInt
|
@ColorInt
|
||||||
private int defPointColor;
|
private int defPointColor;
|
||||||
|
|
||||||
public GPXLayer(MapActivity mapActivity) {
|
|
||||||
this.mapActivity = mapActivity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initLayer(OsmandMapTileView view) {
|
public void initLayer(OsmandMapTileView view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
|
@ -588,30 +579,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean runExclusiveAction(Object o, boolean unknownLocation) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getWptFromPoint(tileBox, point, res);
|
getWptFromPoint(tileBox, point, res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
int ex = (int) point.x;
|
int ex = (int) point.x;
|
||||||
int ey = (int) point.y;
|
int ey = (int) point.y;
|
||||||
|
|
|
@ -30,11 +30,11 @@ import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback;
|
import net.osmand.plus.views.ContextMenuLayer.ApplyMovedObjectCallback;
|
||||||
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider;
|
||||||
|
@ -511,24 +511,20 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
|
OsmandApplication app = map.getMyApplication();
|
||||||
List<MapMarker> markers = markersHelper.getMapMarkers();
|
|
||||||
int r = getRadiusPoi(tileBox);
|
int r = getRadiusPoi(tileBox);
|
||||||
for (int i = 0; i < markers.size(); i++) {
|
for (MapMarker marker : app.getMapMarkersHelper().getMapMarkers()) {
|
||||||
MapMarker marker = markers.get(i);
|
if ((!unknownLocation && app.getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) || !isSynced(marker)) {
|
||||||
if (!isSynced(marker)) {
|
|
||||||
LatLon latLon = marker.point;
|
LatLon latLon = marker.point;
|
||||||
if (latLon != null) {
|
if (latLon != null) {
|
||||||
int ex = (int) point.x;
|
|
||||||
int ey = (int) point.y;
|
|
||||||
int x = (int) tileBox.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
int x = (int) tileBox.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
int y = (int) tileBox.getPixYFromLatLon(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);
|
o.add(marker);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getAmenityFromPoint(tileBox, point, objects);
|
getAmenityFromPoint(tileBox, point, objects);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= 3) {
|
if (tileBox.getZoom() >= 3) {
|
||||||
getMyLocationFromPoint(tileBox, point, o);
|
getMyLocationFromPoint(tileBox, point, o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||||
if (tileBox.getZoom() >= 3) {
|
if (tileBox.getZoom() >= 3) {
|
||||||
TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper();
|
||||||
List<TargetPoint> intermediatePoints = tg.getAllPoints();
|
List<TargetPoint> intermediatePoints = tg.getAllPoints();
|
||||||
|
|
|
@ -285,7 +285,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||||
if(tileBox.getZoom() >= startZoomRoute && route != null) {
|
if(tileBox.getZoom() >= startZoomRoute && route != null) {
|
||||||
getFromPoint(tileBox, point, res, route.getForwardStops());
|
getFromPoint(tileBox, point, res, route.getForwardStops());
|
||||||
} else if (tileBox.getZoom() >= startZoom && data.getResults() != null) {
|
} else if (tileBox.getZoom() >= startZoom && data.getResults() != null) {
|
||||||
|
|
Loading…
Reference in a new issue