diff options
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.cpp | 15 | ||||
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index 3a0e4aa71..c560c5aaf 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -23,3 +23,18 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds) Q_ARG(QVariant, latitude),
Q_ARG(QVariant, longitude));
}
+
+void MapWidgetHelper::reloadMapLocations()
+{
+ struct dive_site *ds;
+ int idx;
+ m_mapLocationModel->clear();
+
+ for_each_dive_site(idx, ds) {
+ if (!dive_site_has_gps_location(ds))
+ continue;
+ const qreal longitude = ds->longitude.udeg / 1000000.0;
+ const qreal latitude = ds->latitude.udeg / 1000000.0;
+ m_mapLocationModel->add(new MapLocation(QGeoCoordinate(latitude, longitude)));
+ }
+}
diff --git a/mobile-widgets/qmlmapwidgethelper.h b/mobile-widgets/qmlmapwidgethelper.h index d0f450ed6..bd575c624 100644 --- a/mobile-widgets/qmlmapwidgethelper.h +++ b/mobile-widgets/qmlmapwidgethelper.h @@ -17,6 +17,7 @@ public: explicit MapWidgetHelper(QObject *parent = NULL);
void centerOnDiveSite(struct dive_site *);
+ void reloadMapLocations();
private:
QObject *m_map;
|