+ boolean in_any = false;
+ for (Point offset : mapTiles.keySet()) {
+ AltosSiteMapTile tile = mapTiles.get(offset);
+ Point2D.Double ref, lref;
+ ref = translatePoint(pt, tileCoordOffset(offset));
+ lref = translatePoint(last_pt, tileCoordOffset(offset));
+ tile.show(state, crc_errors, lref, ref);
+ if (0 <= ref.x && ref.x < px_size)
+ if (0 <= ref.y && ref.y < px_size)
+ in_any = true;
+ }
+ if (!in_any) {
+ final AltosSiteMapTile tile = new AltosSiteMapTile(px_size);
+ final Point offset = tileOffset(pt);
+ mapTiles.put(offset, tile);
+
+ Point2D.Double ref, lref;
+ ref = translatePoint(pt, tileCoordOffset(offset));
+ lref = translatePoint(last_pt, tileCoordOffset(offset));
+ tile.show(state, crc_errors, lref, ref);
+
+ initMap(tile, offset);
+
+ SwingUtilities.invokeLater( new Runnable() {
+ public void run() {
+ addTileAt(tile, offset);
+ setViewportView(comp);
+ }
+ } );
+ }
+ last_pt = pt;
+ last_state = state.state;
+ }
+
+ private void addTileAt(AltosSiteMapTile tile, Point offset) {
+ GridBagConstraints c = new GridBagConstraints();
+ c.anchor = GridBagConstraints.CENTER;
+ c.fill = GridBagConstraints.BOTH;
+
+ // put some space between the map tiles, debugging only
+ // c.insets = new Insets(5, 5, 5, 5);
+ //
+ c.gridx = offset.x + 100;
+ c.gridy = offset.y + 100;
+ layout.setConstraints(tile, c);
+ comp.add(tile);