mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mapwidget.qml: add the function centerOnCoordinates()
This function can be called to center the map on a specific coordinates. For the C++ version call it via QMetaObject::invokeMethod() in centerOnDiveSite(). TODO: add QML property animations. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
5cc2c02dfb
commit
5f2e60142a
2 changed files with 9 additions and 0 deletions
|
@ -26,5 +26,10 @@ Item {
|
|||
Component.onCompleted: {
|
||||
map.activeMapType = map.supportedMapTypes[esriMapTypeIndexes.SATELLITE];
|
||||
}
|
||||
|
||||
function centerOnCoordinates(latitude, longitude) {
|
||||
map.center = QtPositioning.coordinate(latitude, longitude);
|
||||
map.zoomLevel = map.maximumZoomLevel * 0.9;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,8 @@ void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
|
|||
|
||||
qreal longitude = ds->longitude.udeg / 1000000.0;
|
||||
qreal latitude = ds->latitude.udeg / 1000000.0;
|
||||
|
||||
QMetaObject::invokeMethod(m_map, "centerOnCoordinates",
|
||||
Q_ARG(QVariant, latitude),
|
||||
Q_ARG(QVariant, longitude));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue