Add 'location_t' data structure

Instead of having people treat latitude and longitude as separate
things, just add a 'location_t' data structure that contains both.

Almost all cases want to always act on them together.

This is really just prep-work for adding a few more locations that we
track: I want to add a entry/exit location to each dive (independent of
the dive site) because of how the Garmin Descent gives us the
information (and hopefully, some day, other dive computers too).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2018-10-20 14:12:15 -04:00 committed by Lubomir I. Ivanov
parent c986940630
commit 28e3413ff6
40 changed files with 251 additions and 264 deletions

View file

@ -97,8 +97,7 @@ static bool parseExif(QFile &f, struct metadata *metadata)
easyexif::EXIFInfo exif;
if (exif.parseFromEXIFSegment(reinterpret_cast<const unsigned char *>(data.constData()), len) != PARSE_EXIF_SUCCESS)
return false;
metadata->longitude.udeg = lrint(1000000.0 * exif.GeoLocation.Longitude);
metadata->latitude.udeg = lrint(1000000.0 * exif.GeoLocation.Latitude);
metadata->location = create_location(exif.GeoLocation.Latitude, exif.GeoLocation.Longitude);
metadata->timestamp = exif.epoch();
return true;
}
@ -521,8 +520,8 @@ extern "C" mediatype_t get_metadata(const char *filename_in, metadata *data)
{
data->timestamp = 0;
data->duration.seconds = 0;
data->latitude.udeg = 0;
data->longitude.udeg = 0;
data->location.lat.udeg = 0;
data->location.lon.udeg = 0;
QString filename = localFilePath(QString(filename_in));
QFile f(filename);