Truncate Altitude values

We know the highesst point on Earth, so any activity that
contains an altitude greater than that is definitely incorrect.

This patch truncates the altitude to the maximum possible, this
has the happy by product of curing a major mem alloc crash in QWT
when trying to plot altitudes with very large values.

Fixes #700
This commit is contained in:
Mark Liversedge
2013-10-27 20:06:37 +00:00
parent 7a240f83e2
commit cc2a0efe3e

View File

@@ -510,6 +510,11 @@ void RideFile::appendPoint(double secs, double cad, double hr, double km,
if (!isfinite(watts) || watts<0) watts=0;
if (!isfinite(interval) || interval<0) interval=0;
// truncate alt out of bounds -- ? should do for all, but uncomfortable about
// setting an absolute max. At least We know the highest
// point on Earth (Mt Everest).
if (alt > RideFile::maximumFor(RideFile::alt)) alt = RideFile::maximumFor(RideFile::alt);
RideFilePoint* point = new RideFilePoint(secs, cad, hr, km, kph,
nm, watts, alt, lon, lat, headwind, slope, temp, lrbalance, interval);
dataPoints_.append(point);