+ {
+ if (currentPointIndex > 0 && currentPointIndex < (_trackInfo.getTrack().getNumPoints()-1))
+ {
+ DataPoint prevPoint = _trackInfo.getTrack().getPoint(currentPointIndex - 1);
+ DataPoint nextPoint = _trackInfo.getTrack().getPoint(currentPointIndex + 1);
+ if (prevPoint.getTimestamp().isValid() && nextPoint.getTimestamp().isValid())
+ {
+ // use total distance and total time between neighbouring points
+ long diff = nextPoint.getTimestamp().getSecondsSince(prevPoint.getTimestamp());
+ if (diff < 1000 && diff > 0)
+ {
+ double rads = DataPoint.calculateRadiansBetween(prevPoint, currentPoint) +
+ DataPoint.calculateRadiansBetween(currentPoint, nextPoint);
+ double dist = Distance.convertRadiansToDistance(rads, distUnits);
+ String speed = roundedNumber(3600 * dist / diff) + " " + speedUnitsStr;
+ _speedLabel.setText(I18nManager.getText("fieldname.speed") + ": " + speed);
+ }
+ }
+ }