X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosuilib%2FAltosUIMapNew.java;h=a90e8c91ae76f9c9387db39db1a47a2b646956c7;hb=c457c827a7445098ba5effd410de754ff5c65843;hp=511d8fe683db7d7ab336dcc15c1edf06652ecb73;hpb=4895f443e4a748de2677e51869f20c05d265c944;p=fw%2Faltos diff --git a/altosuilib/AltosUIMapNew.java b/altosuilib/AltosUIMapNew.java index 511d8fe6..a90e8c91 100644 --- a/altosuilib/AltosUIMapNew.java +++ b/altosuilib/AltosUIMapNew.java @@ -15,7 +15,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_7; +package org.altusmetrum.altosuilib_10; import java.awt.*; import java.awt.event.*; @@ -27,7 +27,7 @@ import java.awt.geom.*; import java.util.*; import java.util.concurrent.*; import javax.imageio.*; -import org.altusmetrum.altoslib_7.*; +import org.altusmetrum.altoslib_10.*; public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, AltosMapInterface { @@ -139,18 +139,7 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt public void mouseWheelMoved(MouseWheelEvent e) { int zoom_change = e.getWheelRotation(); - map.notice_user_input(); - AltosLatLon mouse_lat_lon = map.transform.screen_lat_lon(new AltosPointInt(e.getPoint().x, e.getPoint().y)); - map.set_zoom(map.get_zoom() - zoom_change); - - AltosPointDouble new_mouse = map.transform.screen(mouse_lat_lon); - - int dx = getWidth()/2 - e.getPoint().x; - int dy = getHeight()/2 - e.getPoint().y; - - AltosLatLon new_centre = map.transform.screen_lat_lon(new AltosPointInt((int) new_mouse.x + dx, (int) new_mouse.y + dy)); - - map.centre(new_centre); + map.set_zoom_centre(map.get_zoom() - zoom_change, new AltosPointInt(e.getPoint().x, e.getPoint().y)); } /* ComponentListener methods */ @@ -252,8 +241,8 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt } class MapTile extends AltosMapTile { - public MapTile(AltosMapTileListener listener, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size) { - super(listener, upper_left, center, zoom, maptype, px_size); + public MapTile(AltosMapCache cache, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size) { + super(cache, upper_left, center, zoom, maptype, px_size); } public void paint(AltosMapTransform t) { @@ -265,11 +254,9 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt if (!g.hitClip(point.x, point.y, px_size, px_size)) return; - AltosImage altos_image = cache.get(this, store, px_size, px_size); - + AltosImage altos_image = get_image(); AltosUIImage ui_image = (AltosUIImage) altos_image; - - Image image = null; + Image image = null; if (ui_image != null) image = ui_image.image; @@ -283,8 +270,8 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt if (t.has_location()) { String message = null; switch (status) { - case AltosMapTile.loading: - message = "Loading..."; + case AltosMapTile.fetching: + message = "Fetching..."; break; case AltosMapTile.bad_request: message = "Internal error"; @@ -345,8 +332,8 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt return new MapMark(lat, lon, state); } - public AltosMapTile new_tile(AltosMapTileListener listener, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size) { - return new MapTile(listener, upper_left, center, zoom, maptype, px_size); + public AltosMapTile new_tile(AltosMapCache cache, AltosLatLon upper_left, AltosLatLon center, int zoom, int maptype, int px_size) { + return new MapTile(cache, upper_left, center, zoom, maptype, px_size); } public int width() { @@ -369,6 +356,15 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt zoom_label.setText(label); } + public void select_object(AltosLatLon latlon) { + debug("select at %f,%f\n", latlon.lat, latlon.lon); + } + + public void debug(String format, Object ... arguments) { + System.out.printf(format, arguments); + } + + /* AltosFlightDisplay interface */ public void set_font() { @@ -429,10 +425,6 @@ public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, Alt JComboBox maptype_combo; - public void set_load_params(double lat, double lon, int radius, AltosMapTileListener listener) { - map.set_load_params(lat, lon, radius, listener); - } - MapView view; public AltosUIMapNew() {