use of net.osmand.GPXUtilities.Elevation in project OsmAnd-tools by osmandapp.
the class GpxController method cleanupFromNan.
public void cleanupFromNan(GPXTrackAnalysis analysis) {
// process analysis
if (Double.isNaN(analysis.minHdop)) {
analysis.minHdop = -1;
analysis.maxHdop = -1;
}
if (analysis.minSpeed > analysis.maxSpeed) {
analysis.minSpeed = analysis.maxSpeed;
}
if (analysis.startTime > analysis.endTime) {
analysis.startTime = analysis.endTime = 0;
}
cleanupFromNan(analysis.locationStart);
cleanupFromNan(analysis.locationEnd);
Iterator<Speed> itS = analysis.speedData.iterator();
float sumDist = 0;
while (itS.hasNext()) {
Speed sp = itS.next();
if (Float.isNaN(sp.speed)) {
sumDist += sp.distance;
itS.remove();
} else if (sumDist > 0) {
sp.distance += sumDist;
sumDist = 0;
}
}
Iterator<Elevation> itE = analysis.elevationData.iterator();
sumDist = 0;
while (itE.hasNext()) {
Elevation e = itE.next();
if (Float.isNaN(e.elevation)) {
sumDist += e.distance;
itE.remove();
} else if (sumDist > 0) {
e.distance += sumDist;
sumDist = 0;
}
}
}