diff options
author | Anthony Towns <aj@erisian.com.au> | 2010-11-12 23:42:42 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2010-11-12 23:42:42 +1000 |
commit | 991541f57f065f429c6ec425efd6ac731280b2c1 (patch) | |
tree | 9bd60ddb14b5bb54cb641b6938ac297371c7093b | |
parent | 1bcfa22de7821984149db10cb79913efed36b41e (diff) |
better error behaviour if no map
-rw-r--r-- | ao-tools/altosui/AltosSiteMap.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ao-tools/altosui/AltosSiteMap.java b/ao-tools/altosui/AltosSiteMap.java index 420bfc81..1fb70b35 100644 --- a/ao-tools/altosui/AltosSiteMap.java +++ b/ao-tools/altosui/AltosSiteMap.java @@ -40,7 +40,7 @@ public class AltosSiteMap extends JComponent implements AltosFlightDisplay { Graphics2D g2d; - private void setLocation(double new_lat, double new_lng) { + private boolean setLocation(double new_lat, double new_lng) { int new_zoom = 15; lat = new_lat; lng = new_lng; @@ -60,8 +60,10 @@ public class AltosSiteMap extends JComponent implements AltosFlightDisplay { picLabel.setIcon(new ImageIcon( myPicture )); g2d = myPicture.createGraphics(); } catch (Exception e) { - throw new RuntimeException(e); - }; + // throw new RuntimeException(e); + return false; + } + return true; } private static double limit(double v, double lo, double hi) { @@ -116,14 +118,20 @@ public class AltosSiteMap extends JComponent implements AltosFlightDisplay { Color.BLACK // landed }; + boolean nomaps = false; public void show(AltosState state, int crc_errors) { + if (nomaps) + return; if (!state.gps_ready && state.pad_lat == 0 && state.pad_lon == 0) return; double plat = (int)(state.pad_lat*200)/200.0; double plon = (int)(state.pad_lon*200)/200.0; if (last_pt == null) { - setLocation(plat, plon); + if (!setLocation(plat, plon)) { + nomaps = true; + return; + } } Point2D.Double pt = pt(state.gps.lat, state.gps.lon); |