Always send the UUID of the coordinates to the globe

We were relying in the current_dive to display the
globe coordinates correctly - but this is not always
the case: you can be inserting a new dive site and it
isn't yet inside of the dive until the user presses
accept. So always pass the uuid of the dive site that
we want to display.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2015-06-05 10:52:52 -03:00 committed by Dirk Hohndel
parent 218ad95d7d
commit 6b81fb49d0
6 changed files with 20 additions and 19 deletions

View file

@ -235,25 +235,21 @@ void GlobeGPS::reload()
repopulateLabels();
}
void GlobeGPS::centerOnCurrentDive()
void GlobeGPS::centerOnDiveSite(uint32_t uuid)
{
struct dive_site *ds = get_dive_site_for_dive(current_dive);
// dive has changed, if we had the 'editingDive', hide it.
if (messageWidget->isVisible() && (!ds || dive_site_has_gps_location(ds) || amount_selected != 1))
messageWidget->hide();
editingDiveLocation = false;
if (!ds)
if (uuid == 0)
return;
qreal longitude = ds->longitude.udeg / 1000000.0;
qreal latitude = ds->latitude.udeg / 1000000.0;
struct dive_site *ds = get_dive_site_by_uuid(uuid);
if (!dive_site_has_gps_location(ds)) {
zoomOutForNoGPS();
return;
}
qreal longitude = ds->longitude.udeg / 1000000.0;
qreal latitude = ds->latitude.udeg / 1000000.0;
// if no zoom is set up, set the zoom as seen from 3km above
// if we come back from a dive without GPS data, reset to the last zoom value
// otherwise check to make sure we aren't still running an animation and then remember