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;
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) {
Color.BLACK // landed
};
+ boolean drawn_landed_circle = false;
+ 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);
}
g2d.draw(new Line2D.Double(last_pt, pt));
}
+
+ if (state.state == 8 && !drawn_landed_circle) {
+ drawn_landed_circle = true;
+ g2d.setColor(Color.RED);
+ g2d.drawOval((int)pt.x-5, (int)pt.y-5, 10, 10);
+ g2d.drawOval((int)pt.x-20, (int)pt.y-20, 40, 40);
+ g2d.drawOval((int)pt.x-35, (int)pt.y-35, 70, 70);
+ }
+
last_pt = pt;
repaint();
}