X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosdroid%2Fsrc%2Forg%2Faltusmetrum%2FAltosDroid%2FAltosMapOffline.java;h=9909ba7fbf8b134ca95ae67753d9f8dc4cfbb3c1;hb=a61217f0a6d0ef48b6471f632c4600255867e831;hp=bde80cfc99146b35c011b744282ffc35886bdd14;hpb=d81f94fd5339d513de9bde5a2e19f8eca526344f;p=fw%2Faltos diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java b/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java index bde80cfc..9909ba7f 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/AltosMapOffline.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,7 +21,7 @@ package org.altusmetrum.AltosDroid; import java.util.*; import java.io.*; -import org.altusmetrum.altoslib_10.*; +import org.altusmetrum.altoslib_12.*; import android.app.Activity; import android.graphics.*; @@ -85,6 +86,8 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal AltosMap map; AltosDroid altos_droid; + static int scale = 2; + AltosLatLon here; AltosLatLon there; AltosLatLon pad; @@ -133,7 +136,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal if (canvas.quickReject(pt.x, pt.y, pt.x + px_size, pt.y + px_size, Canvas.EdgeType.AA)) return; - AltosImage altos_image = cache.get(this, store, px_size, px_size); + AltosImage altos_image = this.get_image(); MapImage map_image = (MapImage) altos_image; @@ -150,8 +153,8 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal if (t.has_location()) { String message = null; switch (status) { - case AltosMapTile.loading: - message = "Loading..."; + case AltosMapTile.fetching: + message = "Fetching..."; break; case AltosMapTile.bad_request: message = "Internal error"; @@ -161,6 +164,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal break; case AltosMapTile.forbidden: message = "Too many requests, try later"; + AltosDebug.debug("Forbidden map response %d\n", AltosMapStore.forbidden_response); break; } if (message != null) { @@ -181,14 +185,14 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal } } - public MapTile(AltosMapTileListener listener, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size) { - super(listener, upper_left, center, zoom, maptype, px_size, 2); + public MapTile(AltosMapCache cache, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size, int scale) { + super(cache, upper_left, center, zoom, maptype, px_size, scale); } } - public AltosMapTile new_tile(AltosMapTileListener listener, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size) { - return new MapTile(listener, upper_left, center, zoom, maptype, px_size); + public AltosMapTile new_tile(AltosMapCache cache, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size, int scale) { + return new MapTile(cache, upper_left, center, zoom, maptype, px_size, scale); } public AltosMapPath new_path() { @@ -473,11 +477,11 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal if (t_state.gps != null) { AltosLatLon latlon = new AltosLatLon(t_state.gps.lat, t_state.gps.lon); rocket.set_position(latlon, t_state.received_time); - if (state.serial == serial) + if (state.cal_data.serial == serial) there = latlon; } if (state != null) - rocket.set_active(state.serial == serial); + rocket.set_active(state.cal_data.serial == serial); } } if (receiver != null) { @@ -492,7 +496,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal public void onCreateView(AltosDroid altos_droid) { this.altos_droid = altos_droid; - map = new AltosMap(this); + map = new AltosMap(this, scale); AltosPreferences.register_map_type_listener(this); map.set_maptype(AltosPreferences.map_type());