X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosuilib%2FAltosUIMapView.java;h=70b8e2e92c8fb7772e387ce9d209df809a472145;hp=701986825ea2c3817286a83b411fe1b644c24523;hb=8a2be4d36a3b116d82529805430c5fb665688267;hpb=6f306b267f63d0f59fb77b1ce41c678042dd6802 diff --git a/altosuilib/AltosUIMapView.java b/altosuilib/AltosUIMapView.java index 70198682..70b8e2e9 100644 --- a/altosuilib/AltosUIMapView.java +++ b/altosuilib/AltosUIMapView.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_2; +package org.altusmetrum.altosuilib_3; import java.awt.*; import java.awt.event.*; @@ -26,14 +26,16 @@ import java.lang.*; import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_4.*; +import org.altusmetrum.altoslib_5.*; -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 marks = new LinkedList(); LinkedList zoom_listeners = new LinkedList(); @@ -65,7 +67,7 @@ public class AltosUIMapView extends Canvas implements MouseMotionListener, Mouse 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(); @@ -368,7 +370,7 @@ public class AltosUIMapView extends Canvas implements MouseMotionListener, Mouse 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); @@ -385,7 +387,7 @@ public class AltosUIMapView extends Canvas implements MouseMotionListener, Mouse } /* 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); @@ -394,8 +396,10 @@ public class AltosUIMapView extends Canvas implements MouseMotionListener, Mouse } } + 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)) @@ -422,7 +426,6 @@ public class AltosUIMapView extends Canvas implements MouseMotionListener, Mouse } public void paint(Graphics g) { - VolatileImage back_buffer = create_back_buffer(); do { GraphicsConfiguration gc = getGraphicsConfiguration();