diff options
author | Keith Packard <keithp@keithp.com> | 2012-09-10 09:16:04 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-09-10 09:16:04 -0700 |
commit | 67da878f740a387d0092631ad672e024d26e4192 (patch) | |
tree | ec0ad1f63620768c1d5af94e5bdfb920d0ff4aed /altosui/AltosDescent.java | |
parent | 66a1e07efcac9324d33a1eca0dfb58a2724b667a (diff) |
altosui: Use units conversion functions everywhere.
Provide a configuration option to select imperial units and use them everywhere
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosDescent.java')
-rw-r--r-- | altosui/AltosDescent.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index 664c5ea6..62258814 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -119,6 +119,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { value.setVisible(false); } + void show(AltosUnits units, double v) { + value.setText(units.show(8, v)); + } + void show(String format, double v) { value.setText(String.format(format, v)); } @@ -239,7 +243,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { class Height extends DescentValue { void show (AltosState state, int crc_errors) { - show("%6.0f m", state.height); + show(AltosConvert.height, state.height); } public Height (GridBagLayout layout, int x, int y) { super (layout, x, y, "Height"); @@ -253,7 +257,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { double speed = state.speed; if (!state.ascent) speed = state.baro_speed; - show("%6.0f m/s", speed); + show(AltosConvert.speed, speed); } public Speed (GridBagLayout layout, int x, int y) { super (layout, x, y, "Speed"); @@ -346,7 +350,7 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { class Range extends DescentValue { void show (AltosState state, int crc_errors) { - show("%6.0f m", state.range); + show(AltosConvert.distance, state.range); } public Range (GridBagLayout layout, int x, int y) { super (layout, x, y, "Range"); |