2 * Copyright © 2014 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.altosuilib_2;
21 import java.awt.image.*;
22 import javax.imageio.ImageIO;
25 import org.altusmetrum.altoslib_4.*;
27 public class AltosSiteMapImage {
28 AltosSiteMapTile tile;
37 public boolean validate(final int serial) {
39 AltosSiteMap.debug_component(tile, "valid");
42 AltosSiteMap.debug_component(tile, "loading");
43 load_thread = new Thread() {
46 image = ImageIO.read(file);
47 } catch (Exception e) {
49 SwingUtilities.invokeLater( new Runnable() {
51 AltosSiteMap.debug_component(tile, file.toString());
52 Graphics2D g2d = (Graphics2D) tile.getGraphics();
54 tile.paint_graphics(g2d, image, serial);
66 if (load_thread == null) {
67 AltosSiteMap.debug_component(tile, "flush");
73 public AltosSiteMapImage (AltosSiteMapTile tile, File file, int w, int h) throws IOException {