* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_2;
+package org.altusmetrum.altosuilib_7;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.util.*;
import java.util.concurrent.*;
-import org.altusmetrum.altoslib_4.*;
+import org.altusmetrum.altoslib_7.*;
-public class AltosUIMapView extends Canvas implements MouseMotionListener, MouseListener, MouseWheelListener, ComponentListener, AltosUIMapTileListener, AltosUIMapStoreListener {
+public class AltosUIMapView extends Component implements MouseMotionListener, MouseListener, MouseWheelListener, ComponentListener, AltosUIMapTileListener, AltosUIMapStoreListener {
AltosUIMapPath path = new AltosUIMapPath();
AltosUIMapLine line = new AltosUIMapLine();
+ AltosUIMapCache cache = new AltosUIMapCache();
+
LinkedList<AltosUIMapMark> marks = new LinkedList<AltosUIMapMark>();
LinkedList<AltosUIMapZoomListener> zoom_listeners = new LinkedList<AltosUIMapZoomListener>();
AltosUILatLon centre;
public void set_font() {
- line.set_font(AltosUILib.value_font);
+ line.set_font(AltosUILib.status_font);
for (AltosUIMapTile tile : tiles.values())
tile.set_font(AltosUILib.value_font);
repaint();
for (Point point : to_remove)
tiles.remove(point);
- AltosUIMapCache.set_cache_size(((lower_right.y - upper_left.y) / px_size + 1) * ((lower_right.x - upper_left.x) / px_size + 1));
+ cache.set_cache_size((getWidth() / px_size + 2) * (getHeight() / px_size + 2));
for (int y = upper_left.y; y <= lower_right.y; y += px_size) {
for (int x = upper_left.x; x <= lower_right.x; x += px_size) {
Point point = new Point(x, y);
}
/* AltosUIMapTileListener methods */
- public void notify_tile(AltosUIMapTile tile, int status) {
+ public synchronized void notify_tile(AltosUIMapTile tile, int status) {
for (Point point : tiles.keySet()) {
if (tile == tiles.get(point)) {
Point screen = transform.screen(point);
}
}
+ public AltosUIMapCache cache() { return cache; }
+
/* AltosUIMapStoreListener methods */
- public void notify_store(AltosUIMapStore store, int status) {
+ public synchronized void notify_store(AltosUIMapStore store, int status) {
if (load_listener != null) {
for (AltosUIMapTile tile : tiles.values())
if (store.equals(tile.store))
}
public void paint(Graphics g) {
-
- VolatileImage back_buffer = create_back_buffer();
- do {
- GraphicsConfiguration gc = getGraphicsConfiguration();
- int code = back_buffer.validate(gc);
- if (code == VolatileImage.IMAGE_INCOMPATIBLE)
- back_buffer = create_back_buffer();
-
- Graphics g_back = back_buffer.getGraphics();
- g_back.setClip(g.getClip());
- do_paint(g_back);
- g_back.dispose();
-
- g.drawImage(back_buffer, 0, 0, this);
- } while (back_buffer.contentsLost());
- back_buffer.flush();
}
public void update(Graphics g) {