1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +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)
{
int p;
int ga;
if (!(data[0] == 'A' || data[0] == 'V'))
return false;
if (data[1] == '-')
p = str2int(data + 2, 4);
else
p = str2int(data + 1, 5);
int g = str2int(data + 6, 5);
if (p < 0 || g < 0)
return false;
if (data[6] == '-') {
if ((ga = str2int(data + 7, 4)) < 0)
return false;
ga = -ga;
} else {
if ((ga = str2int(data + 6, 5)) < 0)
return false;
}
if (data[0] == 'A')
ele = (qreal)g;
ele = (qreal)ga;
else
ele = NAN;