summaryrefslogtreecommitdiff
path: root/altoslib/AltosMap.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-05-28 01:01:23 -0700
committerKeith Packard <keithp@keithp.com>2015-05-28 01:01:23 -0700
commitba698c2cc48677735046d0881df9c180674e4082 (patch)
tree7c93f1349c5b0df541b101052dd1c3eeaf044831 /altoslib/AltosMap.java
parentc63617415553d97f9be2f19b94365b53d4480c68 (diff)
altoslib: Pass all map loader params to set_load_params
Add zoom and map type to the param list so we don't call set_zoom and set_maptype separately, which only causes lots of extra image loads to get started unnecessarily. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosMap.java')
-rw-r--r--altoslib/AltosMap.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java
index d39c3302..85f95eef 100644
--- a/altoslib/AltosMap.java
+++ b/altoslib/AltosMap.java
@@ -248,7 +248,9 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
public void add_mark(double lat, double lon, int state) {
synchronized(marks) {
- marks.add(map_interface.new_mark(lat, lon, state));
+ AltosMapMark mark = map_interface.new_mark(lat, lon, state);
+ if (mark != null)
+ marks.add(mark);
}
repaint();
}
@@ -303,11 +305,15 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
}
}
- public void set_load_params(double lat, double lon, int radius, AltosMapTileListener listener) {
+ public void set_load_params(int new_zoom, int new_type, double lat, double lon, int radius, AltosMapTileListener listener) {
+ if (AltosMap.min_zoom <= new_zoom && new_zoom <= AltosMap.max_zoom)
+ zoom = new_zoom;
+ maptype = new_type;
load_centre = new AltosLatLon(lat, lon);
load_radius = radius;
load_listener = listener;
centre(lat, lon);
+ tiles.clear();
make_tiles();
for (AltosMapTile tile : tiles.values()) {
tile.add_store_listener(this);