mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: create new dive site at location from GPS data
Some dive computers save GPS data. Currently, this is stored by libdivecomputer in an "extra field". When generating a new dive site for a dive try to use this data to place the dive site. To do so, create a "dive_get_gps_location()" function. This function can be extended later to use e.g. event. When creating a dive site, use the result of this function over a potential pre-existing dive site. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c529cfd361
commit
bab7033ccb
3 changed files with 56 additions and 0 deletions
|
@ -341,6 +341,14 @@ static struct dive_site *createDiveSite(const QString &name)
|
|||
copy_dive_site(old, ds);
|
||||
free(ds->name); // Free name, as we will overwrite it with our own version
|
||||
}
|
||||
|
||||
// If the current dive has a location, use that as location for the new dive site
|
||||
if (current_dive) {
|
||||
location_t loc = dive_get_gps_location(current_dive);
|
||||
if (has_location(&loc))
|
||||
ds->location = loc;
|
||||
}
|
||||
|
||||
ds->name = copy_qstring(name);
|
||||
return ds;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue