diff options
Diffstat (limited to 'map-widget')
-rw-r--r-- | map-widget/qmlmapwidgethelper.cpp | 9 | ||||
-rw-r--r-- | map-widget/qmlmapwidgethelper.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index e8187a679..fa0616202 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -23,6 +23,15 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent) this, SLOT(selectedLocationChanged(MapLocation *))); } +QGeoCoordinate MapWidgetHelper::getCoordinatesForUUID(QVariant dive_site_uuid) +{ + const uint32_t uuid = qvariant_cast<uint32_t>(dive_site_uuid); + struct dive_site *ds = get_dive_site_by_uuid(uuid); + if (!ds || !dive_site_has_gps_location(ds)) + return QGeoCoordinate(0.0, 0.0); + return QGeoCoordinate(ds->latitude.udeg * 0.000001, ds->longitude.udeg * 0.000001); +} + void MapWidgetHelper::centerOnDiveSiteUUID(QVariant dive_site_uuid) { const uint32_t uuid = qvariant_cast<uint32_t>(dive_site_uuid); diff --git a/map-widget/qmlmapwidgethelper.h b/map-widget/qmlmapwidgethelper.h index d5cdb35bc..eb57dcd88 100644 --- a/map-widget/qmlmapwidgethelper.h +++ b/map-widget/qmlmapwidgethelper.h @@ -22,6 +22,7 @@ public: explicit MapWidgetHelper(QObject *parent = NULL); void centerOnDiveSite(struct dive_site *); + Q_INVOKABLE QGeoCoordinate getCoordinatesForUUID(QVariant dive_site_uuid); Q_INVOKABLE void centerOnDiveSiteUUID(QVariant dive_site_uuid); Q_INVOKABLE void reloadMapLocations(); Q_INVOKABLE void copyToClipboardCoordinates(QGeoCoordinate coord, bool formatTraditional); |