altoslib: Add all known launch sites and names to map preload
[fw/altos] / altosdroid / app / src / main / java / org / altusmetrum / AltosDroid / AltosMapOffline.java
index c3204336a1a99878b10f0a153abd8de71b71305d..60c209e105cf22fee5cb891be1d008c5cff87657 100644 (file)
@@ -21,7 +21,7 @@ package org.altusmetrum.AltosDroid;
 import java.util.*;
 import java.io.*;
 
-import org.altusmetrum.altoslib_13.*;
+import org.altusmetrum.altoslib_14.*;
 
 import android.graphics.*;
 import android.view.*;
@@ -223,12 +223,20 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                MapMark(double lat, double lon, int state) {
                        super(lat, lon, state);
                }
+
+               MapMark(double lat, double lon, int state, String label) {
+                       super(lat, lon, state, label);
+               }
        }
 
        public AltosMapMark new_mark(double lat, double lon, int state) {
                return new MapMark(lat, lon, state);
        }
 
+       public AltosMapMark new_mark(double lat, double lon, int state, String label) {
+               return new MapMark(lat, lon, state, label);
+       }
+
        public int width() {
                return getWidth();
        }
@@ -346,18 +354,6 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                draw_bitmap(here, here_bitmap, here_off_x, here_off_y);
        }
 
-       @Override public void invalidate() {
-               Rect r = new Rect();
-               getDrawingRect(r);
-               super.invalidate();
-       }
-
-       @Override public void invalidate(int l, int t, int r, int b) {
-               Rect rect = new Rect();
-               getDrawingRect(rect);
-               super.invalidate();
-       }
-
        @Override
        protected void onDraw(Canvas view_canvas) {
                if (map == null) {
@@ -449,11 +445,11 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
 
                if (telem_state != null) {
                        Integer[] old_serial = rockets.keySet().toArray(new Integer[0]);
-                       Integer[] new_serial = telem_state.states.keySet().toArray(new Integer[0]);
+                       Integer[] new_serial = telem_state.keySet().toArray(new Integer[0]);
 
                        /* remove deleted keys */
                        for (int serial : old_serial) {
-                               if (!telem_state.states.containsKey(serial))
+                               if (!telem_state.containsKey(serial))
                                        rockets.remove(serial);
                        }
 
@@ -461,7 +457,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
 
                        for (int serial : new_serial) {
                                Rocket          rocket;
-                               AltosState      t_state = telem_state.states.get(serial);
+                               AltosState      t_state = telem_state.get(serial);
                                if (rockets.containsKey(serial))
                                        rocket = rockets.get(serial);
                                else {
@@ -471,7 +467,7 @@ public class AltosMapOffline extends View implements ScaleGestureDetector.OnScal
                                if (t_state.gps != null) {
                                        AltosLatLon     latlon = new AltosLatLon(t_state.gps.lat, t_state.gps.lon);
                                        rocket.set_position(latlon, t_state.received_time);
-                                       if (state.cal_data().serial == serial)
+                                       if (state != null && state.cal_data().serial == serial)
                                                there = latlon;
                                }
                                if (state != null)