mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
mapwidgethelper: pass a MapLocation object to QML in centerOnDiveSite()
The function in QML centerOnCoordinate() is now renamed centerOnMapLocation() and accepts a MapLocation object, so that a marker is selected (based on UUID). In MapWidgetHelper::centerOnDiveSite(), the pointer to a MapLocation is retrieved via MapLocationModel::getMapLocationForUuid(). Added in the previous commit. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
4a126b553f
commit
b4740803a1
2 changed files with 5 additions and 7 deletions
|
@ -70,10 +70,11 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerOnCoordinate(coordinate) {
|
function centerOnMapLocation(mapLocation) {
|
||||||
map.newCenter = coordinate;
|
map.newCenter = mapLocation.coordinate;
|
||||||
map.zoomLevel = 2;
|
map.zoomLevel = 2;
|
||||||
mapAnimation.restart();
|
mapAnimation.restart();
|
||||||
|
mapHelper.model.selectedUuid = mapLocation.uuid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,8 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
|
||||||
{
|
{
|
||||||
if (!dive_site_has_gps_location(ds))
|
if (!dive_site_has_gps_location(ds))
|
||||||
return;
|
return;
|
||||||
|
MapLocation *location = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
|
||||||
qreal longitude = ds->longitude.udeg / 1000000.0;
|
QMetaObject::invokeMethod(m_map, "centerOnMapLocation", Q_ARG(QVariant, QVariant::fromValue(location)));
|
||||||
qreal latitude = ds->latitude.udeg / 1000000.0;
|
|
||||||
QVariant coord = QVariant::fromValue(QGeoCoordinate(latitude, longitude));
|
|
||||||
QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, coord));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidgetHelper::reloadMapLocations()
|
void MapWidgetHelper::reloadMapLocations()
|
||||||
|
|
Loading…
Reference in a new issue