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 vertical speed data for the profile chart
12 public class VerticalSpeedData extends ProfileData
16 * @param inTrack track object
18 public VerticalSpeedData(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 SpeedCalculator.calculateVerticalSpeed(_track, i, speed);
37 // Check whether we got a value from either method
40 // Store the value and maintain max and min values
41 double speedValue = speed.getValue();
42 _pointValues[i] = speedValue;
43 if (speedValue < _minValue || _minValue == 0.0) {_minValue = speedValue;}
44 if (speedValue > _maxValue) {_maxValue = speedValue;}
47 _pointHasData[i] = speed.isValid();
53 * @return text description including units
55 public String getLabel()
57 return I18nManager.getText("fieldname.verticalspeed") + " ("
58 + I18nManager.getText(_unitSet.getVerticalSpeedUnit().getShortnameKey()) + ")";
62 * @return key for message when no speeds present
64 public String getNoDataKey()
66 if (!_track.hasAltitudeData()) {
67 return "display.noaltitudes";
69 return "display.notimestamps";