mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-11-22 13:01:00 -05:00
parent
325f295ee8
commit
f101680521
1 changed files with 13 additions and 6 deletions
|
|
@ -773,15 +773,22 @@ void GeoMap::clear_markers() {
|
||||||
MapMarkerStored GeoMap::store_marker(GeoMarker& marker) {
|
MapMarkerStored GeoMap::store_marker(GeoMarker& marker) {
|
||||||
const auto r = screen_rect();
|
const auto r = screen_rect();
|
||||||
MapMarkerStored ret;
|
MapMarkerStored ret;
|
||||||
|
|
||||||
// Check if it could be on screen
|
// Check if it could be on screen
|
||||||
// (Shows more distant planes when zoomed out)
|
// (Shows more distant planes when zoomed out)
|
||||||
|
bool can_see_on_map = true;
|
||||||
|
if (!use_osm) {
|
||||||
GeoPoint mapPoint = lat_lon_to_map_pixel(marker.lat, marker.lon);
|
GeoPoint mapPoint = lat_lon_to_map_pixel(marker.lat, marker.lon);
|
||||||
int x_dist = abs((int)mapPoint.x - (int)x_pos);
|
int x_dist = abs((int)mapPoint.x - (int)x_pos);
|
||||||
int y_dist = abs((int)mapPoint.y - (int)y_pos);
|
int y_dist = abs((int)mapPoint.y - (int)y_pos);
|
||||||
int zoom_out = (map_zoom < 0) ? -map_zoom : 1;
|
int zoom_out = (map_zoom < 0) ? -map_zoom : 1;
|
||||||
|
|
||||||
if ((x_dist >= (zoom_out * r.width() / 2)) || (y_dist >= (zoom_out * r.height() / 2))) {
|
if ((x_dist >= (zoom_out * r.width() / 2)) || (y_dist >= (zoom_out * r.height() / 2))) {
|
||||||
|
can_see_on_map = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// osm is so zoomable, we try to store all possible. maybe need to refine it a bit more later
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!can_see_on_map) {
|
||||||
ret = MARKER_NOT_STORED;
|
ret = MARKER_NOT_STORED;
|
||||||
} else if (markerListLen < NumMarkerListElements) {
|
} else if (markerListLen < NumMarkerListElements) {
|
||||||
markerList[markerListLen] = marker;
|
markerList[markerListLen] = marker;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue