+ private static Point tile_loc(AltosSiteMapTile tile) {
+ Rectangle r = tile.getBounds();
+ int x = r.x / 512;
+ int y = r.y / 512;
+
+ return new Point (x, y);
+ }
+
+ private static void dump_cache() {
+ int min_x = 1000, max_x = -1000, min_y = 1000, max_y = -1000;
+
+ for (int i = 0; i < cache_size; i++) {
+ AltosSiteMapImage image = images[i];
+ if (image != null) {
+ Point p = tile_loc(image.tile);
+ min_x = min_x < p.x ? min_x : p.x;
+ max_x = max_x > p.x ? max_x : p.x;
+ min_y = min_y < p.y ? min_y : p.y;
+ max_y = max_y > p.y ? max_y : p.y;
+ System.out.printf ("entry %d %d,%d used %d\n", i, p.x, p.y, image.used);
+ } else {
+ System.out.printf ("entry %d empty\n", i);
+ }
+ }
+
+ int[][] map = new int[max_x - min_x + 1][max_y - min_y + 1];
+ for (int i = 0; i < cache_size; i++) {
+ AltosSiteMapImage image = images[i];
+ if (image != null) {
+ Point p = tile_loc(image.tile);
+ map[p.x - min_x][p.y - min_y]++;
+ }
+ }
+
+ for (int y = min_y; y <= max_y; y++) {
+ for (int x = min_x; x <= max_x; x++)
+ System.out.printf (" %2d", map[x - min_x][y - min_y]);
+ System.out.printf("\n");
+ }
+ }
+
+ public static AltosSiteMapImage get_image(AltosSiteMapTile tile, File file, int width, int height) {