Dive site: replace UUID by pointer in mobile code

Replace UUIDs by pointers to dive-site in mobile code. In both
cases, the value is transported via a QVariant. The function
getCoordinatesForUUID(), which was only used from mobile, can
be replaced by a getCoordinatesFor() function taking a variant
supposed to contain a dive-site pointer. Likewise, the variant
of the centerOnDiveSite function is now supposed to wrap a
pointer-to-divesite.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-25 20:46:12 +02:00 committed by Dirk Hohndel
parent 872d56de01
commit 75b5d61522
7 changed files with 19 additions and 21 deletions

View file

@ -40,19 +40,19 @@ Kirigami.Page {
mapWidget.mapHelper.reloadMapLocations()
}
function centerOnDiveSiteUUID(uuid) {
if (!uuid) {
console.warn("main.qml: centerOnDiveSiteUUI(): uuid is undefined!")
function centerOnDiveSite(ds) {
if (!ds) {
console.warn("main.qml: centerOnDiveSite(): dive site is undefined!")
return
}
// on firstRun, hard pan/center the map to the desired location so that
// we don't start at an arbitrary location such as [0,0] or London.
if (firstRun) {
var coord = mapWidget.mapHelper.getCoordinatesForUUID(uuid)
var coord = mapWidget.mapHelper.getCoordinates(ds)
centerOnLocationHard(coord.latitude, coord.longitude)
firstRun = false
} // continue here as centerOnDiveSiteUUID() also does marker selection.
mapWidget.mapHelper.centerOnDiveSiteUUID(uuid)
} // continue here as centerOnDiveSite() also does marker selection.
mapWidget.mapHelper.centerOnDiveSite(ds)
}
function centerOnLocation(lat, lon) {