1 package tim.prune.gui.profile;
3 import tim.prune.I18nManager;
4 import tim.prune.data.SpeedCalculator;
5 import tim.prune.data.SpeedValue;
6 import tim.prune.data.Track;
7 import tim.prune.data.UnitSet;
10 * Class to provide a source of speed data for the profile chart
12 public class SpeedData extends ProfileData
16 * @param inTrack track object
18 public SpeedData(Track inTrack) {
23 * Get the data and populate the instance arrays
25 public void init(UnitSet inUnitSet)
27 setUnitSet(inUnitSet);
30 _minValue = _maxValue = 0.0;
31 SpeedValue speed = new SpeedValue();
34 for (int i=0; i<_track.getNumPoints(); i++)
36 // Get the speed either from the speed value or from the distances and timestamps
37 SpeedCalculator.calculateSpeed(_track, i, speed);
40 double speedValue = speed.getValue();
41 _pointValues[i] = speedValue;
42 if (speedValue < _minValue || _minValue == 0.0) {_minValue = speedValue;}
43 if (speedValue > _maxValue) {_maxValue = speedValue;}
46 _pointHasData[i] = speed.isValid();
52 * @return text description including units
54 public String getLabel()
56 return I18nManager.getText("fieldname.speed") + " ("
57 + I18nManager.getText(_unitSet.getSpeedUnit().getShortnameKey()) + ")";
61 * @return key for message when no speeds present
63 public String getNoDataKey() {
64 return "display.notimestamps";