value.setText("");
}
+ void show() {
+ label.setVisible(true);
+ value.setVisible(true);
+ }
+
+ void hide() {
+ label.setVisible(false);
+ value.setVisible(false);
+ }
+
void show(String format, double v) {
+ show();
value.setText(String.format(format, v));
}
+
public LandedValue (GridBagLayout layout, int y, String text) {
GridBagConstraints c = new GridBagConstraints();
c.weighty = 1;
class Lat extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.gps != null)
value.setText(pos(state.gps.lat,"N", "S"));
else
class Lon extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.gps != null)
value.setText(pos(state.gps.lon,"E", "W"));
else
class Bearing extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.from_pad != null)
show("%3.0f°", state.from_pad.bearing);
else
class Distance extends LandedValue {
void show (AltosState state, int crc_errors) {
+ show();
if (state.from_pad != null)
show("%6.0f m", state.from_pad.distance);
else
}
public void show(AltosState state, int crc_errors) {
- bearing.show(state, crc_errors);
- distance.show(state, crc_errors);
- lat.show(state, crc_errors);
- lon.show(state, crc_errors);
+ if (state.gps != null) {
+ bearing.show(state, crc_errors);
+ distance.show(state, crc_errors);
+ lat.show(state, crc_errors);
+ lon.show(state, crc_errors);
+ } else {
+ bearing.hide();
+ distance.hide();
+ lat.hide();
+ lon.hide();
+ }
height.show(state, crc_errors);
speed.show(state, crc_errors);
accel.show(state, crc_errors);