aboutsummaryrefslogtreecommitdiffstats
path: root/core/metadata.cpp
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-10-20 14:12:15 -0400
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-10-21 19:55:09 +0300
commit28e3413ff66552f392fecee25068d634cdfe59fc (patch)
tree5fe303d1e7dc1c371e13b534b85c232e29aea884 /core/metadata.cpp
parentc9869406301ff72f76b399097f0845fc1102ced1 (diff)
downloadsubsurface-28e3413ff66552f392fecee25068d634cdfe59fc.tar.gz
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>
Diffstat (limited to 'core/metadata.cpp')
-rw-r--r--core/metadata.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/metadata.cpp b/core/metadata.cpp
index b549a5b3b..dae261b93 100644
--- a/core/metadata.cpp
+++ b/core/metadata.cpp
@@ -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);