altosui: sitemap uses rocket gps if no pad gps
authorAnthony Towns <aj@erisian.com.au>
Tue, 23 Nov 2010 16:13:32 +0000 (02:13 +1000)
committerAnthony Towns <aj@erisian.com.au>
Tue, 23 Nov 2010 16:13:32 +0000 (02:13 +1000)
ao-tools/altosui/AltosSiteMap.java

index 8097060508989859c30ba1ee23efdfc76f549bb0..d4a4cbf43dbaa66b7c0c69ca6da2be09bef08e5c 100644 (file)
@@ -230,16 +230,19 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
                // if insufficient gps data, nothing to update
                if (state.gps == null)
                        return;
-               if (state.pad_lat == 0 && state.pad_lon == 0)
+               if (!state.gps.locked && state.gps.nsat < 4)
                        return;
-               if (!state.gps.locked) {
-                       if (state.gps.nsat < 4)
-                               return;
-               }
 
                if (!initialised) {
-                       initMaps(state.pad_lat, state.pad_lon);
-                       initialised = true;
+                       if (state.pad_lat != 0 || state.pad_lon != 0) {
+                               initMaps(state.pad_lat, state.pad_lon);
+                               initialised = true;
+                       } else if (state.gps.lat != 0 || state.gps.lon != 0) {
+                               initMaps(state.gps.lat, state.gps.lon);
+                               initialised = true;
+                       } else {
+                               return;
+                       }
                }
 
                final Point2D.Double pt = pt(state.gps.lat, state.gps.lon);