- LatLng map_latlng = asm.latlng(
- -asm.centre.x + x*px_size + px_size/2,
- -asm.centre.y + y*px_size + px_size/2);
- File pngfile = asm.MapFile(map_latlng.lat, map_latlng.lng);
- String pngurl = asm.MapURL(map_latlng.lat, map_latlng.lng);
- if (pngfile.exists()) {
- System.out.printf("Already have %s\n", pngfile);
- } else if (AltosSiteMapCache.fetchMap(pngfile, pngurl)) {
- System.out.printf("Fetched map %s\n", pngfile);
- } else {
- System.out.printf("# Failed to fetch file %s\n", pngfile);
- System.out.printf(" wget -O '%s' ''\n", pngfile, pngurl);
+ int r = asm.prefetchMap(x, y);
+ switch (r) {
+ case 1:
+ System.out.printf("Already have %s\n", asm.pngfile);
+ break;
+ case 0:
+ System.out.printf("Fetched map %s\n", asm.pngfile);
+ break;
+ case -1:
+ System.out.printf("# Failed to fetch file %s\n", asm.pngfile);
+ System.out.printf(" wget -O '%s' ''\n", asm.pngfile, asm.pngurl);
+ break;