altosui: Wait for valid callsign/flight when graphing
authorKeith Packard <keithp@keithp.com>
Sat, 11 May 2013 02:21:18 +0000 (19:21 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 11 May 2013 02:21:18 +0000 (19:21 -0700)
Wait for the data record to indicate that the flight value is valid
before setting the graph callsign/flight/serial data.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosGraphDataSet.java

index 092b7c74418e504b6202f337a72bc163fa6bb442..dc047e9aeebb5a0bd4c8fdb9ba2c89bf5103908d 100644 (file)
@@ -36,14 +36,16 @@ class AltosGraphIterator implements Iterator<AltosUIDataPoint> {
        public AltosUIDataPoint next() {
                state = new AltosState(iterator.next(), state);
 
-               if (dataSet.callsign == null && state.data.callsign != null)
-                       dataSet.callsign = state.data.callsign;
+               if ((state.data.seen & AltosRecord.seen_flight) != 0) {
+                       if (dataSet.callsign == null && state.data.callsign != null)
+                               dataSet.callsign = state.data.callsign;
 
-               if (dataSet.serial == 0 && state.data.serial != 0)
-                       dataSet.serial = state.data.serial;
+                       if (dataSet.serial == 0 && state.data.serial != 0)
+                               dataSet.serial = state.data.serial;
 
-               if (dataSet.flight == 0 && state.data.flight != 0)
-                       dataSet.flight = state.data.flight;
+                       if (dataSet.flight == 0 && state.data.flight != 0)
+                               dataSet.flight = state.data.flight;
+               }
 
                return new AltosGraphDataPoint(state);
        }