1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Do not require GPSAltitudeRef (assume positive if missing)

This commit is contained in:
Martin Tůma 2019-03-13 22:01:05 +01:00
parent 541e658741
commit 51c88e7c7c

View File

@ -54,8 +54,7 @@ QDate EXIFParser::date(TIFFFile &file, const IFDEntry &ds) const
double EXIFParser::altitude(TIFFFile &file, const IFDEntry &alt, double EXIFParser::altitude(TIFFFile &file, const IFDEntry &alt,
const IFDEntry &altRef) const const IFDEntry &altRef) const
{ {
if (!(alt.type == TIFF_RATIONAL && alt.count == 1 if (!(alt.type == TIFF_RATIONAL && alt.count == 1))
&& altRef.type == TIFF_BYTE && altRef.count == 1))
return NAN; return NAN;
if (!file.seek(alt.offset)) if (!file.seek(alt.offset))
@ -67,7 +66,8 @@ double EXIFParser::altitude(TIFFFile &file, const IFDEntry &alt,
if (!file.readValue(den)) if (!file.readValue(den))
return NAN; return NAN;
return altRef.offset ? -num/(double)den : num/(double)den; return (altRef.type == TIFF_BYTE && altRef.count == 1 && altRef.offset)
? -num/(double)den : num/(double)den;
} }
double EXIFParser::coordinate(TIFFFile &file, const IFDEntry &ll) const double EXIFParser::coordinate(TIFFFile &file, const IFDEntry &ll) const