1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Added support for negative altitude values.

Fixes #46
This commit is contained in:
Martin Tůma 2018-01-06 21:51:07 +01:00
parent de2278ba04
commit b1d1cae9dd

View File

@ -47,22 +47,22 @@ static bool readLon(const char *data, qreal &lon)
static bool readAltitude(const char *data, qreal &ele) static bool readAltitude(const char *data, qreal &ele)
{ {
int p; int ga;
if (!(data[0] == 'A' || data[0] == 'V')) if (!(data[0] == 'A' || data[0] == 'V'))
return false; return false;
if (data[1] == '-') if (data[6] == '-') {
p = str2int(data + 2, 4); if ((ga = str2int(data + 7, 4)) < 0)
else
p = str2int(data + 1, 5);
int g = str2int(data + 6, 5);
if (p < 0 || g < 0)
return false; return false;
ga = -ga;
} else {
if ((ga = str2int(data + 6, 5)) < 0)
return false;
}
if (data[0] == 'A') if (data[0] == 'A')
ele = (qreal)g; ele = (qreal)ga;
else else
ele = NAN; ele = NAN;