- static public final int success = 0;
- static public final int loading = 1;
- static public final int failed = 2;
- static public final int bad_request = 3;
- static public final int forbidden = 4;
-
- private File map_file() {
- double lat = center.lat;
- double lon = center.lon;
- char chlat = lat < 0 ? 'S' : 'N';
- char chlon = lon < 0 ? 'W' : 'E';
-
- if (lat < 0) lat = -lat;
- if (lon < 0) lon = -lon;
- String maptype_string = String.format("%s-", AltosMap.maptype_names[maptype]);
- String format_string;
- if (maptype == AltosMap.maptype_hybrid || maptype == AltosMap.maptype_satellite || maptype == AltosMap.maptype_terrain)
- format_string = "jpg";
- else
- format_string = "png";
- return new File(AltosPreferences.mapdir(),
- String.format("map-%c%.6f,%c%.6f-%s%d.%s",
- chlat, lat, chlon, lon, maptype_string, zoom, format_string));
- }
-
- private String map_url() {
- String format_string;
- if (maptype == AltosMap.maptype_hybrid || maptype == AltosMap.maptype_satellite || maptype == AltosMap.maptype_terrain)
- format_string = "jpg";
- else
- format_string = "png32";
-
- if (AltosVersion.has_google_maps_api_key())
- return String.format("http://maps.google.com/maps/api/staticmap?center=%.6f,%.6f&zoom=%d&size=%dx%d&sensor=false&maptype=%s&format=%s&key=%s",
- center.lat, center.lon, zoom, px_size, px_size, AltosMap.maptype_names[maptype], format_string, AltosVersion.google_maps_api_key);
- else
- return String.format("http://maps.google.com/maps/api/staticmap?center=%.6f,%.6f&zoom=%d&size=%dx%d&sensor=false&maptype=%s&format=%s",
- center.lat, center.lon, zoom, px_size, px_size, AltosMap.maptype_names[maptype], format_string);
+ static public final int loaded = 0; /* loaded from file */
+ static public final int fetched = 1; /* downloaded to file */
+ static public final int fetching = 2; /* downloading from net */
+ static public final int failed = 3; /* loading from file failed */
+ static public final int bad_request = 4;/* downloading failed */
+ static public final int forbidden = 5; /* downloading failed */
+
+ static public String status_name(int status) {
+ switch (status) {
+ case loaded:
+ return "loaded";
+ case fetched:
+ return "fetched";
+ case fetching:
+ return "fetching";
+ case failed:
+ return "failed";
+ case bad_request:
+ return "bad_request";
+ case forbidden:
+ return "forbidden";
+ default:
+ return "unknown";
+ }