From 15cb7e4e920105e81fe31821ee077cc74243e9fd Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 5 May 2019 12:59:47 +0200 Subject: 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 --- map-widget/qmlmapwidgethelper.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'map-widget') 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 selDS; + QVector selDS = m_mapLocationModel->selectedDs(); QVector 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"); -- cgit v1.2.3-70-g09d2