mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Plot the current dive site in edit mode
We were ignoring the displayed_dive_site as we were adding it and the changes weren't accepted yet. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
48d2d4a942
commit
03147d69ba
1 changed files with 13 additions and 4 deletions
|
@ -187,9 +187,6 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
|
||||||
|
|
||||||
void GlobeGPS::repopulateLabels()
|
void GlobeGPS::repopulateLabels()
|
||||||
{
|
{
|
||||||
if (!current_dive)
|
|
||||||
return;
|
|
||||||
|
|
||||||
struct dive_site *ds;
|
struct dive_site *ds;
|
||||||
int idx;
|
int idx;
|
||||||
QMap<QString, GeoDataPlacemark *> locationMap;
|
QMap<QString, GeoDataPlacemark *> locationMap;
|
||||||
|
@ -200,9 +197,12 @@ void GlobeGPS::repopulateLabels()
|
||||||
loadedDives = new GeoDataDocument;
|
loadedDives = new GeoDataDocument;
|
||||||
|
|
||||||
for_each_dive_site(idx, ds) {
|
for_each_dive_site(idx, ds) {
|
||||||
|
if (ds->uuid == displayed_dive_site.uuid)
|
||||||
|
continue;
|
||||||
if (dive_site_has_gps_location(ds)) {
|
if (dive_site_has_gps_location(ds)) {
|
||||||
GeoDataPlacemark *place = new GeoDataPlacemark(ds->name);
|
GeoDataPlacemark *place = new GeoDataPlacemark(ds->name);
|
||||||
place->setCoordinate(ds->longitude.udeg / 1000000.0, ds->latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree);
|
place->setCoordinate(ds->longitude.udeg / 1000000.0, ds->latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree);
|
||||||
|
|
||||||
// don't add dive locations twice, unless they are at least 50m apart
|
// don't add dive locations twice, unless they are at least 50m apart
|
||||||
if (locationMap[QString(ds->name)]) {
|
if (locationMap[QString(ds->name)]) {
|
||||||
GeoDataCoordinates existingLocation = locationMap[QString(ds->name)]->coordinate();
|
GeoDataCoordinates existingLocation = locationMap[QString(ds->name)]->coordinate();
|
||||||
|
@ -221,9 +221,18 @@ void GlobeGPS::repopulateLabels()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (displayed_dive_site.uuid && dive_site_has_gps_location(&displayed_dive_site)) {
|
||||||
|
GeoDataPlacemark *place = new GeoDataPlacemark(displayed_dive_site.name);
|
||||||
|
place->setCoordinate(displayed_dive_site.longitude.udeg / 1000000.0,
|
||||||
|
displayed_dive_site.latitude.udeg / 1000000.0, 0, GeoDataCoordinates::Degree);
|
||||||
|
locationMap[QString(displayed_dive_site.name)] = place;
|
||||||
|
loadedDives->append(place);
|
||||||
|
}
|
||||||
model()->treeModel()->addDocument(loadedDives);
|
model()->treeModel()->addDocument(loadedDives);
|
||||||
|
|
||||||
struct dive_site *center = displayed_dive_site.uuid != 0 ?
|
struct dive_site *center = displayed_dive_site.uuid != 0 ?
|
||||||
&displayed_dive_site : get_dive_site_by_uuid(current_dive->dive_site_uuid);
|
&displayed_dive_site : current_dive ?
|
||||||
|
get_dive_site_by_uuid(current_dive->dive_site_uuid) : NULL;
|
||||||
if(center)
|
if(center)
|
||||||
centerOn(displayed_dive_site.longitude.udeg / 1000000.0, displayed_dive_site.latitude.udeg / 1000000.0, true);
|
centerOn(displayed_dive_site.longitude.udeg / 1000000.0, displayed_dive_site.latitude.udeg / 1000000.0, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue