* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_7;
+package org.altusmetrum.altosuilib_11;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.concurrent.*;
import javax.imageio.*;
-import org.altusmetrum.altoslib_7.*;
+import org.altusmetrum.altoslib_11.*;
public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, AltosMapInterface {
public void mouseWheelMoved(MouseWheelEvent e) {
int zoom_change = e.getWheelRotation();
- map.notice_user_input();
- AltosLatLon mouse_lat_lon = null;
-
- if (map.transform != null)
- mouse_lat_lon = map.transform.screen_lat_lon(new AltosPointInt(e.getPoint().x, e.getPoint().y));
-
- map.set_zoom(map.get_zoom() - zoom_change);
-
- if (mouse_lat_lon != null) {
- 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 */
}
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, int scale) {
+ super(cache, upper_left, center, zoom, maptype, px_size, scale);
}
public void paint(AltosMapTransform t) {
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;
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";
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, int scale) {
+ return new MapTile(cache, upper_left, center, zoom, maptype, px_size, scale);
}
public int width() {
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() {