initMaps(lat, lon);
scrollRocketToVisible(pt(lat, lon));
}
- public void show(final AltosState state, final int crc_errors) {
+ public void show(final AltosState state, final AltosListenerState listener_state) {
// if insufficient gps data, nothing to update
if (!state.gps.locked && state.gps.nsat < 4)
return;
Point2D.Double ref, lref;
ref = translatePoint(pt, tileCoordOffset(offset));
lref = translatePoint(last_pt, tileCoordOffset(offset));
- tile.show(state, crc_errors, lref, ref);
+ tile.show(state, listener_state, lref, ref);
if (0 <= ref.x && ref.x < px_size)
if (0 <= ref.y && ref.y < px_size)
in_any = true;
lref = translatePoint(last_pt, tileCoordOffset(offset));
AltosSiteMapTile tile = createTile(offset);
- tile.show(state, crc_errors, lref, ref);
+ tile.show(state, listener_state, lref, ref);
initMap(offset);
finishTileLater(tile, offset);
}
last_state = state.state;
}
+ public void centre(Point2D.Double pt) {
+ Rectangle r = comp.getVisibleRect();
+ Point2D.Double copt = translatePoint(pt, tileCoordOffset(topleft));
+ int dx = (int)copt.x - r.width/2 - r.x;
+ int dy = (int)copt.y - r.height/2 - r.y;
+ r.x += dx;
+ r.y += dy;
+ comp.scrollRectToVisible(r);
+ }
+
+ public void centre(AltosState state) {
+ if (!state.gps.locked && state.gps.nsat < 4)
+ return;
+ centre(pt(state.gps.lat, state.gps.lon));
+ }
+
public void draw_circle(double lat, double lon) {
final Point2D.Double pt = pt(lat, lon);