summaryrefslogtreecommitdiffstats
path: root/map-widget
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-05-05 12:59:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-05-11 12:06:19 -0700
commit15cb7e4e920105e81fe31821ee077cc74243e9fd (patch)
treeeceb10aa9807698583ad97bb3fe58990dbd11c41 /map-widget
parent83926213ea7a97624ae5b52ac0979d5075855c50 (diff)
downloadsubsurface-15cb7e4e920105e81fe31821ee077cc74243e9fd.tar.gz
Map: don't recalculate selected dive sites
In MapWidgetHelper::centerOnSelectedDiveSite() the selected dive sites were recalculated. Simply use the ones we already know are selected. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'map-widget')
-rw-r--r--map-widget/qmlmapwidgethelper.cpp16
1 files changed, 1 insertions, 15 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp
index 6f5f1804e..a7ef00bf8 100644
--- a/map-widget/qmlmapwidgethelper.cpp
+++ b/map-widget/qmlmapwidgethelper.cpp
@@ -47,23 +47,9 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
void MapWidgetHelper::centerOnSelectedDiveSite()
{
- QVector<struct dive_site *> selDS;
+ QVector<struct dive_site *> selDS = m_mapLocationModel->selectedDs();
QVector<QGeoCoordinate> selGC;
- int idx;
- struct dive *dive;
- for_each_dive (idx, dive) {
- if (!dive->selected)
- continue;
- struct dive_site *dss = get_dive_site_for_dive(dive);
- if (!dive_site_has_gps_location(dss))
- continue;
- // only store dive sites with GPS
- selDS.append(dss);
- selGC.append(QGeoCoordinate(dss->location.lat.udeg * 0.000001,
- dss->location.lon.udeg * 0.000001));
- }
-
if (selDS.isEmpty()) {
// no selected dives with GPS coordinates
QMetaObject::invokeMethod(m_map, "deselectMapLocation");