X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FSpeedCalculator.java;h=6f81d5a32187d60b43d0a686deb6e8a3e59571ba;hp=49fd05665a90e8788e3806e5f740d773f7c4cc0f;hb=1a735a99408fd3b0c5ac4fe7b2fdbdbb23d38f40;hpb=ff33ebba6b7c62834f6dae16ce33eb2c710b160e diff --git a/tim/prune/data/SpeedCalculator.java b/tim/prune/data/SpeedCalculator.java index 49fd056..6f81d5a 100644 --- a/tim/prune/data/SpeedCalculator.java +++ b/tim/prune/data/SpeedCalculator.java @@ -16,7 +16,10 @@ public abstract class SpeedCalculator */ public static void calculateSpeed(Track inTrack, int inIndex, SpeedValue inValue) { - inValue.setInvalid(); + if (inValue != null) + { + inValue.setInvalid(); + } if (inTrack == null || inIndex < 0 || inValue == null) { System.err.println("Cannot calculate speed for index " + inIndex); @@ -79,7 +82,7 @@ public abstract class SpeedCalculator lateStamp = p.getTimestamp(); } - stop = (p == null) || p.getSegmentStart() || hasSufficientTimeDifference(point, p); + stop = (p == null) || p.getSegmentStart() || hasSufficientTimeDifference(point, p); index++; if (p != null && !p.isWaypoint()) { q = p; @@ -153,7 +156,7 @@ public abstract class SpeedCalculator if (p.hasAltitude()) firstAlt = p.getAltitude(); } - stop = (p == null) || p.getSegmentStart() || hasSufficientTimeDifference(p, point); + stop = (p == null) || p.getSegmentStart() || hasSufficientTimeDifference(p, point); index--; } while (!stop); @@ -173,7 +176,7 @@ public abstract class SpeedCalculator if (p.hasAltitude()) lastAlt = p.getAltitude(); } - stop = (p == null) || p.getSegmentStart() || hasSufficientTimeDifference(point, p); + stop = (p == null) || p.getSegmentStart() || hasSufficientTimeDifference(point, p); index++; } while (!stop);