LinkedList<AltosMapMark> marks = new LinkedList<AltosMapMark>();
- AltosMapPath path;
- AltosMapLine line;
+ AltosMapPath path;
+ AltosMapLine line;
+ public AltosLatLon last_position;
boolean have_boost = false;
boolean have_landed = false;
if (!gps.locked && gps.nsat < 4)
return;
- AltosMapRectangle damage = path.add(gps.lat, gps.lon, state.state);
-
switch (state.state) {
case AltosLib.ao_flight_boost:
if (!have_boost) {
break;
}
- if (damage != null)
- repaint(damage, AltosMapPath.stroke_width);
+ if (path != null) {
+ AltosMapRectangle damage = path.add(gps.lat, gps.lon, state.state);
+
+ if (damage != null)
+ repaint(damage, AltosMapPath.stroke_width);
+ }
+
+ last_position = new AltosLatLon(gps.lat, gps.lon);
+
maybe_centre(gps.lat, gps.lon);
}
mark.paint(transform);
}
- path.paint(transform);
+ if (path != null)
+ path.paint(transform);
- line.paint(transform);
+ if (line != null)
+ line.paint(transform);
}
/* AltosMapTileListener methods */
}
private void line_start(int x, int y) {
- line.pressed(new AltosPointInt(x, y), transform);
- repaint();
+ if (line != null) {
+ line.pressed(new AltosPointInt(x, y), transform);
+ repaint();
+ }
}
private void line(int x, int y) {
- line.dragged(new AltosPointInt(x, y), transform);
- repaint();
+ if (line != null) {
+ line.dragged(new AltosPointInt(x, y), transform);
+ repaint();
+ }
}
public void touch_start(int x, int y, boolean is_drag) {