mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mapwidgethelper: fix wrong logic in selectVisibleLocations()
Looking for already existing locations with m_mapLocationModel->getMapLocationForUuid() will not cover dive sites which are too close to each other and are skipped when creating MapLocations. See reloadMapLocations() and the usage of MIN_DISTANCE_BETWEEN_DIVE_SITES_M. Constructing a new QGeoCoordinate for the already retrieved dive site (ds) coordinates ensures that we are traversing *all* dive sites at the backend and not only those visible on the map. Fixes the issue where not all dives in the DiveList are selected, even if a dive clearly happened on a location currently visible in the map viewport (map -> context menu -> select visible dive locations). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
f21ae69f7b
commit
98e869d4f1
1 changed files with 11 additions and 11 deletions
|
@ -154,18 +154,18 @@ void MapWidgetHelper::selectVisibleLocations()
|
||||||
struct dive_site *ds = get_dive_site_for_dive(dive);
|
struct dive_site *ds = get_dive_site_for_dive(dive);
|
||||||
if (!dive_site_has_gps_location(ds))
|
if (!dive_site_has_gps_location(ds))
|
||||||
continue;
|
continue;
|
||||||
MapLocation *loc = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
|
const qreal latitude = ds->latitude.udeg * 0.000001;
|
||||||
if (loc) {
|
const qreal longitude = ds->longitude.udeg * 0.000001;
|
||||||
QPointF point;
|
QGeoCoordinate dsCoord(latitude, longitude);
|
||||||
QMetaObject::invokeMethod(m_map, "fromCoordinate", Q_RETURN_ARG(QPointF, point),
|
QPointF point;
|
||||||
Q_ARG(QGeoCoordinate, loc->coordinate()));
|
QMetaObject::invokeMethod(m_map, "fromCoordinate", Q_RETURN_ARG(QPointF, point),
|
||||||
if (!qIsNaN(point.x())) {
|
Q_ARG(QGeoCoordinate, dsCoord));
|
||||||
if (!selectedFirst) {
|
if (!qIsNaN(point.x())) {
|
||||||
m_mapLocationModel->setSelectedUuid(ds->uuid, false);
|
if (!selectedFirst) {
|
||||||
selectedFirst = true;
|
m_mapLocationModel->setSelectedUuid(ds->uuid, false);
|
||||||
}
|
selectedFirst = true;
|
||||||
m_selectedDiveIds.append(idx);
|
|
||||||
}
|
}
|
||||||
|
m_selectedDiveIds.append(idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emit selectedDivesChanged(m_selectedDiveIds);
|
emit selectedDivesChanged(m_selectedDiveIds);
|
||||||
|
|
Loading…
Reference in a new issue