mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mapwidgethelper: change centerOnDiveSite()
Call setSelectedUuid() from C++ also center on coodinates instead on a MapLocation, as there is no point to pass the MapLocation object back to QML. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
f6e269c07a
commit
ff4924f650
2 changed files with 8 additions and 5 deletions
|
@ -153,9 +153,8 @@ Item {
|
||||||
mapAnimationZoomOut.restart()
|
mapAnimationZoomOut.restart()
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerOnMapLocation(mapLocation) {
|
function centerOnCoordinate(coord) {
|
||||||
mapHelper.model.setSelectedUuid(mapLocation.uuid, false)
|
animateMapZoomIn(coord)
|
||||||
animateMapZoomIn(mapLocation.coordinate)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function deselectMapLocation() {
|
function deselectMapLocation() {
|
||||||
|
|
|
@ -22,11 +22,15 @@ MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
|
||||||
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
|
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
|
||||||
{
|
{
|
||||||
if (!dive_site_has_gps_location(ds)) {
|
if (!dive_site_has_gps_location(ds)) {
|
||||||
|
m_mapLocationModel->setSelectedUuid(ds ? ds->uuid : 0, false);
|
||||||
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
|
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MapLocation *location = m_mapLocationModel->getMapLocationForUuid(ds->uuid);
|
m_mapLocationModel->setSelectedUuid(ds->uuid, false);
|
||||||
QMetaObject::invokeMethod(m_map, "centerOnMapLocation", Q_ARG(QVariant, QVariant::fromValue(location)));
|
const qreal latitude = ds->latitude.udeg * 0.000001;
|
||||||
|
const qreal longitude = ds->longitude.udeg * 0.000001;
|
||||||
|
QGeoCoordinate dsCoord(latitude, longitude);
|
||||||
|
QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, QVariant::fromValue(dsCoord)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWidgetHelper::reloadMapLocations()
|
void MapWidgetHelper::reloadMapLocations()
|
||||||
|
|
Loading…
Add table
Reference in a new issue