1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Added support for negative altitude values.

Fixes #43.
This commit is contained in:
Martin Tůma 2018-01-06 21:44:03 +01:00
parent e90f152432
commit 84f41b5aa9

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;