Context menu fixes
This commit is contained in:
parent
dc562279b9
commit
28df425008
11 changed files with 67 additions and 42 deletions
|
@ -169,8 +169,10 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getRecordingsFromPoint(point, tileBox, objects);
|
getRecordingsFromPoint(point, tileBox, objects);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void getRecordingsFromPoint(PointF point, RotatedTileBox tileBox, List<? super Recording> am) {
|
public void getRecordingsFromPoint(PointF point, RotatedTileBox tileBox, List<? super Recording> am) {
|
||||||
int ex = (int) point.x;
|
int ex = (int) point.x;
|
||||||
|
|
|
@ -532,8 +532,10 @@ 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) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getBugFromPoint(tileBox, point, res);
|
getBugFromPoint(tileBox, point, res);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
|
@ -56,13 +56,15 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
||||||
@Override
|
@Override
|
||||||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||||
if (tileBox.getZoom() >= startZoom) {
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
drawPoints(canvas, tileBox, plugin.getDBBug().getOsmbugsPoints());
|
List<LatLon> fullObjectsLatLon = new ArrayList<>();
|
||||||
drawPoints(canvas, tileBox, plugin.getDBPOI().getOpenstreetmapPoints());
|
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<? extends OsmPoint> objects) {
|
private void drawPoints(Canvas canvas, RotatedTileBox tileBox, List<? extends OsmPoint> objects,
|
||||||
List<LatLon> fullObjectsLatLon = new ArrayList<>();
|
List<LatLon> fullObjectsLatLon) {
|
||||||
for (OsmPoint o : objects) {
|
for (OsmPoint o : objects) {
|
||||||
float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
|
float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
|
||||||
float y = tileBox.getPixYFromLatLon(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);
|
canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight() / 2, paintIcon);
|
||||||
fullObjectsLatLon.add(new LatLon(o.getLatitude(), o.getLongitude()));
|
fullObjectsLatLon.add(new LatLon(o.getLatitude(), o.getLongitude()));
|
||||||
}
|
}
|
||||||
this.fullObjectsLatLon = fullObjectsLatLon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,8 +145,10 @@ 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) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getOsmEditsFromPoint(point, tileBox, o);
|
getOsmEditsFromPoint(point, tileBox, o);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
|
@ -280,13 +280,13 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
true).getIntrinsicWidth() * 3 / 2.5f;
|
true).getIntrinsicWidth() * 3 / 2.5f;
|
||||||
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);
|
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);
|
||||||
|
|
||||||
|
List<LatLon> fullObjectsLatLon = new ArrayList<>();
|
||||||
|
List<LatLon> smallObjectsLatLon = new ArrayList<>();
|
||||||
// request to load
|
// request to load
|
||||||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||||
for (SelectedGpxFile g : selectedGPXFiles) {
|
for (SelectedGpxFile g : selectedGPXFiles) {
|
||||||
List<WptPt> pts = getListStarPoints(g);
|
List<WptPt> pts = getListStarPoints(g);
|
||||||
List<WptPt> fullObjects = new ArrayList<>();
|
List<WptPt> fullObjects = new ArrayList<>();
|
||||||
List<LatLon> fullObjectsLatLon = new ArrayList<>();
|
|
||||||
List<LatLon> smallObjectsLatLon = new ArrayList<>();
|
|
||||||
int fcolor = g.getColor() == 0 ? defPointColor : g.getColor();
|
int fcolor = g.getColor() == 0 ? defPointColor : g.getColor();
|
||||||
for (WptPt o : pts) {
|
for (WptPt o : pts) {
|
||||||
if (o.lat >= latLonBounds.bottom && o.lat <= latLonBounds.top
|
if (o.lat >= latLonBounds.bottom && o.lat <= latLonBounds.top
|
||||||
|
@ -315,11 +315,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), pointColor, true);
|
FavoriteImageDrawable fid = FavoriteImageDrawable.getOrCreate(view.getContext(), pointColor, true);
|
||||||
fid.drawBitmapInCenter(canvas, x, y);
|
fid.drawBitmapInCenter(canvas, x, y);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.fullObjectsLatLon = fullObjectsLatLon;
|
this.fullObjectsLatLon = fullObjectsLatLon;
|
||||||
this.smallObjectsLatLon = smallObjectsLatLon;
|
this.smallObjectsLatLon = smallObjectsLatLon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void drawSelectedFilesSegments(Canvas canvas, RotatedTileBox tileBox,
|
private void drawSelectedFilesSegments(Canvas canvas, RotatedTileBox tileBox,
|
||||||
List<SelectedGpxFile> selectedGPXFiles, DrawSettings settings) {
|
List<SelectedGpxFile> selectedGPXFiles, DrawSettings settings) {
|
||||||
|
@ -482,8 +482,10 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getWptFromPoint(tileBox, point, res);
|
getWptFromPoint(tileBox, point, res);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
|
@ -117,6 +117,7 @@ public class ImpassableRoadsLayer 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) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
int ex = (int) point.x;
|
int ex = (int) point.x;
|
||||||
int ey = (int) point.y;
|
int ey = (int) point.y;
|
||||||
int compare = getRadiusPoi(tileBox);
|
int compare = getRadiusPoi(tileBox);
|
||||||
|
@ -132,6 +133,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
|
@ -392,6 +392,10 @@ 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) {
|
||||||
|
if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
|
MapMarkersHelper markersHelper = map.getMyApplication().getMapMarkersHelper();
|
||||||
List<MapMarker> markers = markersHelper.getActiveMapMarkers();
|
List<MapMarker> markers = markersHelper.getActiveMapMarkers();
|
||||||
int r = getRadiusPoi(tileBox);
|
int r = getRadiusPoi(tileBox);
|
||||||
|
|
|
@ -820,6 +820,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (twoFingerTapDetector.onTouchEvent(event)) {
|
if (twoFingerTapDetector.onTouchEvent(event)) {
|
||||||
|
ContextMenuLayer contextMenuLayer = getLayerByClass(ContextMenuLayer.class);
|
||||||
|
if (contextMenuLayer != null) {
|
||||||
|
contextMenuLayer.onTouchEvent(event, getCurrentRotatedTileBox());
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -507,8 +507,10 @@ 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) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getAmenityFromPoint(tileBox, point, objects);
|
getAmenityFromPoint(tileBox, point, objects);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
|
@ -165,8 +165,10 @@ 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) {
|
||||||
|
if (tileBox.getZoom() >= 3) {
|
||||||
getMyLocationFromPoint(tileBox, point, o);
|
getMyLocationFromPoint(tileBox, point, o);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
|
@ -180,6 +180,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
||||||
|
if (tileBox.getZoom() >= 3) {
|
||||||
TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper();
|
||||||
List<TargetPoint> intermediatePoints = tg.getAllPoints();
|
List<TargetPoint> intermediatePoints = tg.getAllPoints();
|
||||||
int r = getRadiusPoi(tileBox);
|
int r = getRadiusPoi(tileBox);
|
||||||
|
@ -196,8 +197,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) {
|
private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) {
|
||||||
|
|
|
@ -205,8 +205,10 @@ 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) {
|
||||||
|
if (tileBox.getZoom() >= startZoom) {
|
||||||
getFromPoint(tileBox, point, res);
|
getFromPoint(tileBox, point, res);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLon getObjectLocation(Object o) {
|
public LatLon getObjectLocation(Object o) {
|
||||||
|
|
Loading…
Reference in a new issue