mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Save and parse dive site structures to XML
Read and write divesite sections in the XML file. Read divelogs of version 2 and create dive site structures on the fly. Read version 3 files that have divesiteid instead of location / gps. Saves version 3 files where dives no longer have location and gps but instead refer to a divesiteid The commit contains quite a few fprintf(stderr,...) in order to allow better monitoring of the parsing / transforming of locations and gps to dive sites. This will need to be removed later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e720c82aa1
commit
4b15b9dfe9
3 changed files with 166 additions and 68 deletions
16
dive.h
16
dive.h
|
|
@ -8,6 +8,7 @@
|
|||
#include <zip.h>
|
||||
#include <sqlite3.h>
|
||||
#include <string.h>
|
||||
#include "divesite.h"
|
||||
|
||||
/* Windows has no MIN/MAX macros - so let's just roll our own */
|
||||
#define MIN(x, y) ({ \
|
||||
|
|
@ -387,11 +388,6 @@ extern void dive_set_geodata_from_picture(struct dive *d, struct picture *pic);
|
|||
|
||||
extern int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc);
|
||||
|
||||
static inline int dive_has_gps_location(struct dive *dive)
|
||||
{
|
||||
return dive->latitude.udeg || dive->longitude.udeg;
|
||||
}
|
||||
|
||||
static inline void copy_gps_location(struct dive *from, struct dive *to)
|
||||
{
|
||||
if (from && to) {
|
||||
|
|
@ -607,6 +603,16 @@ static inline int get_idx_by_uniq_id(int id)
|
|||
return i;
|
||||
}
|
||||
|
||||
static inline bool dive_site_has_gps_location(struct dive_site *ds)
|
||||
{
|
||||
return ds && (ds->latitude.udeg || ds->longitude.udeg);
|
||||
}
|
||||
|
||||
static inline int dive_has_gps_location(struct dive *dive)
|
||||
{
|
||||
return dive_site_has_gps_location(get_dive_site_by_uuid(dive->dive_site_uuid));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue