altosui/altosdroid: Disable offline map type selections
authorKeith Packard <keithp@keithp.com>
Sun, 7 Oct 2018 17:01:30 +0000 (10:01 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 7 Oct 2018 17:01:30 +0000 (10:01 -0700)
Our server only supports hybrid maps for now. If that changes, we can
re-add this support easily enough.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosdroid/res/layout/map_preload.xml
altosdroid/src/org/altusmetrum/AltosDroid/PreloadMapActivity.java
altoslib/AltosMap.java
altoslib/AltosMapLoader.java
altosuilib/AltosUIMap.java
altosuilib/AltosUIMapPreload.java

index 321e5ee3f824c22f603b3f67ed06c1d6392af192..4e60df2df4324ae9948c01f2a00bbb57c1f9c367 100644 (file)
@@ -62,6 +62,7 @@
                android:layout_height="wrap_content"
                android:text="@string/preload_types"
                />
+<!--
       <CheckBox android:id="@+id/preload_hybrid"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
@@ -82,6 +83,7 @@
                android:layout_height="wrap_content"
                android:text="@string/preload_terrain"
                />
+-->
       <TextView android:id="@+id/preload_min_zoom_label"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
index 7bc9ab5c8b1fd6c74cb127b6a1243ff80fec6920..e393b566ba9362c3017603dfbe5eada5180c4810 100644 (file)
@@ -54,10 +54,12 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe
 
        private ArrayAdapter<AltosLaunchSite> known_sites_adapter;
 
+/*
        private CheckBox        hybrid;
        private CheckBox        satellite;
        private CheckBox        roadmap;
        private CheckBox        terrain;
+*/
 
        private Spinner         known_sites_spinner;
        private Spinner         min_zoom;
@@ -196,17 +198,22 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe
                return r;
        }
 
+/*
        private int bit(CheckBox box, int value) {
                if (box.isChecked())
                        return 1 << value;
                return 0;
        }
+*/
 
        private int types() {
+/*
                return (bit(hybrid, AltosMap.maptype_hybrid) |
                        bit(satellite, AltosMap.maptype_satellite) |
                        bit(roadmap, AltosMap.maptype_roadmap) |
                        bit(terrain, AltosMap.maptype_terrain));
+*/
+               return 1 << AltosMap.maptype_hybrid;
        }
 
        private void load() {
@@ -318,12 +325,14 @@ public class PreloadMapActivity extends Activity implements AltosLaunchSiteListe
                latitude = (EditText) findViewById(R.id.preload_latitude);
                longitude = (EditText) findViewById(R.id.preload_longitude);
 
+/*
                hybrid = (CheckBox) findViewById(R.id.preload_hybrid);
                satellite = (CheckBox) findViewById(R.id.preload_satellite);
                roadmap = (CheckBox) findViewById(R.id.preload_roadmap);
                terrain = (CheckBox) findViewById(R.id.preload_terrain);
 
                hybrid.setChecked(true);
+*/
 
                min_zoom = (Spinner) findViewById(R.id.preload_min_zoom);
                add_numbers(min_zoom,
index e183e9334d2b8f03debfe0c423cc828d0c631366..9e5f578d67131fb415d6017f16510eb366e5b67d 100644 (file)
@@ -211,12 +211,14 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
        }
 
        public boolean set_maptype(int maptype) {
+/*
                if (maptype != this.maptype) {
                        this.maptype = maptype;
                        tiles.clear();
                        repaint();
                        return true;
                }
+*/
                return false;
        }
 
@@ -350,7 +352,7 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
        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;
+/*             maptype = new_type; */
                load_centre = new AltosLatLon(lat, lon);
                load_radius = radius;
                load_listener = listener;
index 727dfbcb4cf559a0e6064e53c71fa6281aef6683..4047907d89d4a92fea4ca5b5f60f783d784e10ed 100644 (file)
@@ -214,7 +214,10 @@ public class AltosMapLoader extends Thread implements AltosMapStoreListener {
                this.min_z = min_z;
                this.max_z = max_z;
                this.radius = radius;
+/*
                this.all_types = all_types;
+*/
+               this.all_types = 1 << AltosMap.maptype_hybrid;
                this.scale = scale;
                this.abort = false;
                start();
index 3fb33d4a221a88ebd11f5aa89dd15ec4cd6dac75..7f114e3745a3b915208dd4740b9f5ba8dbe5afc7 100644 (file)
@@ -386,8 +386,10 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM
        JLabel  zoom_label;
 
        public void set_maptype(int type) {
+/*
                map.set_maptype(type);
                maptype_combo.setSelectedIndex(type);
+*/
        }
 
        /* AltosUIMapPreload functions */
@@ -433,7 +435,9 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM
        /* internal layout bits */
        private GridBagLayout layout = new GridBagLayout();
 
+/*
        JComboBox<String>       maptype_combo;
+*/
 
        MapView view;
 
@@ -522,6 +526,7 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM
                c.weighty = 0;
                add(zoom_out, c);
 
+/*
                maptype_combo = new JComboBox<String>(map.maptype_labels);
 
                maptype_combo.setEditable(false);
@@ -540,7 +545,7 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM
                c.weightx = 0;
                c.weighty = 0;
                add(maptype_combo, c);
-
+*/
                map = new AltosMap(this);
        }
 }
index 36b32c85337c6d8a190a152ee1f4d0208f8b5ca0..ffd974acd16855aaa6f8386b70a25a81aae596a7 100644 (file)
@@ -144,7 +144,9 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I
        JToggleButton   load_button;
        JButton         close_button;
 
+/*
        JCheckBox[]     maptypes = new JCheckBox[AltosMap.maptype_terrain - AltosMap.maptype_hybrid + 1];
+*/
 
        JComboBox<Integer>      min_zoom;
        JComboBox<Integer>      max_zoom;
@@ -215,11 +217,14 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I
 
 
        private int all_types() {
+/*
                int all_types = 0;
                for (int t = AltosMap.maptype_hybrid; t <= AltosMap.maptype_terrain; t++)
                        if (maptypes[t].isSelected())
                                all_types |= (1 << t);
                return all_types;
+*/
+               return 1 << AltosMap.maptype_hybrid;
        }
 
        void center_map(double latitude, double longitude) {
@@ -485,6 +490,7 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I
 
                pane.add(close_button, c);
 
+/*
                JLabel  types_label = new JLabel("Map Types");
                c.gridx = 2;
                c.gridwidth = 2;
@@ -501,6 +507,7 @@ public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, I
                        c.gridy = (type & 1) + 3;
                        pane.add(maptypes[type], c);
                }
+*/
 
                JLabel  min_zoom_label = new JLabel("Minimum Zoom");
                c.gridx = 4;