X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fdata%2FSpeedCalculator.java;h=6f81d5a32187d60b43d0a686deb6e8a3e59571ba;hb=2d8cb72e84d5cc1089ce77baf1e34ea3ea2f8465;hp=49fd05665a90e8788e3806e5f740d773f7c4cc0f;hpb=83fe7ed9d291abe6b082713e1df34e831a03c319;p=GpsPrune.git 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);