altosuilib: Rename AltosUIMap*New.java to AltosUIMap*.java
authorKeith Packard <keithp@keithp.com>
Wed, 25 May 2016 06:44:50 +0000 (23:44 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 25 May 2016 06:44:50 +0000 (23:44 -0700)
This code isn't really new anymore...

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosFlightUI.java
altosui/AltosGraphUI.java
altosui/AltosIdleMonitorUI.java
altosui/AltosUI.java
altosuilib/AltosUIMap.java [new file with mode: 0644]
altosuilib/AltosUIMapNew.java [deleted file]
altosuilib/AltosUIMapPreload.java [new file with mode: 0644]
altosuilib/AltosUIMapPreloadNew.java [deleted file]
altosuilib/Makefile.am
telegps/TeleGPS.java
telegps/TeleGPSGraphUI.java

index 9b4a18bce172b8a58c62b4d78e944148e4dd2760..63f8c670762794c174946dc27f834dfb151f6906 100644 (file)
@@ -40,7 +40,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
        AltosDescent    descent;
        AltosLanded     landed;
        AltosCompanionInfo      companion;
-       AltosUIMapNew      sitemap;
+       AltosUIMap      sitemap;
        boolean         has_map;
        boolean         has_companion;
        boolean         has_state;
@@ -289,7 +289,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay {
                has_companion = false;
                has_state = false;
 
-               sitemap = new AltosUIMapNew();
+               sitemap = new AltosUIMap();
                displays.add(sitemap);
                has_map = false;
 
index be63c6e655ba6b5a209b59b54fd65dd8ccb2800a..32b59977d2a6ecc49e56e9272b8a7b23837a4542 100644 (file)
@@ -35,7 +35,7 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt
        JTabbedPane             pane;
        AltosGraph              graph;
        AltosUIEnable           enable;
-       AltosUIMapNew           map;
+       AltosUIMap              map;
        AltosState              state;
        AltosGraphDataSet       graphDataSet;
        AltosFlightStats        stats;
@@ -47,7 +47,7 @@ public class AltosGraphUI extends AltosUIFrame implements AltosFontListener, Alt
                for (AltosState state : states) {
                        if (state.gps != null && state.gps.locked && state.gps.nsat >= 4) {
                                if (map == null)
-                                       map = new AltosUIMapNew();
+                                       map = new AltosUIMap();
                                map.show(state, null);
                                has_gps = true;
                        }
index 8d0d807e7e515405831cc6d502fc807f3f88c4b3..1a992946aed33ede8b5bff1806293b45c45c8077 100644 (file)
@@ -35,7 +35,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
        AltosFlightStatus       flightStatus;
        AltosIgnitor            ignitor;
        AltosIdleMonitor        thread;
-       AltosUIMapNew           sitemap;
+       AltosUIMap              sitemap;
        int                     serial;
        boolean                 remote;
        boolean                 has_ignitor;
@@ -275,7 +275,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
 
                ignitor = new AltosIgnitor();
 
-               sitemap = new AltosUIMapNew();
+               sitemap = new AltosUIMap();
 
                /* Make the tabbed pane use the rest of the window space */
                bag.add(pane, constraints(0, 4, GridBagConstraints.BOTH));
index 88ae8530408646958facdb68693400d0aba3f908..5768fd49290ebca1552455e26a8e397e68162a76 100644 (file)
@@ -295,7 +295,7 @@ public class AltosUI extends AltosUIFrame {
        }
 
        void LoadMaps() {
-               new AltosUIMapPreloadNew(AltosUI.this);
+               new AltosUIMapPreload(AltosUI.this);
        }
 
        void LaunchController() {
diff --git a/altosuilib/AltosUIMap.java b/altosuilib/AltosUIMap.java
new file mode 100644 (file)
index 0000000..3645405
--- /dev/null
@@ -0,0 +1,536 @@
+/*
+ * Copyright © 2010 Anthony Towns <aj@erisian.com.au>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altosuilib_11;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import javax.swing.*;
+import java.io.*;
+import java.lang.Math;
+import java.awt.geom.*;
+import java.util.*;
+import java.util.concurrent.*;
+import javax.imageio.*;
+import org.altusmetrum.altoslib_11.*;
+
+public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosMapInterface {
+
+       AltosMap        map;
+       Graphics2D      g;
+       Font            tile_font;
+       Font            line_font;
+
+       static Point2D.Double point2d(AltosPointDouble pt) {
+               return new Point2D.Double(pt.x, pt.y);
+       }
+
+       static final AltosPointDouble point_double(Point pt) {
+               return new AltosPointDouble(pt.x, pt.y);
+       }
+
+       class MapMark extends AltosMapMark {
+               public void paint(AltosMapTransform t) {
+                       AltosPointDouble pt = t.screen(lat_lon);
+
+                       g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                          RenderingHints.VALUE_ANTIALIAS_ON);
+                       g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+
+                       if (0 <= state && state < AltosUIMap.stateColors.length)
+                               g.setColor(AltosUIMap.stateColors[state]);
+                       else
+                               g.setColor(AltosUIMap.stateColors[AltosLib.ao_flight_invalid]);
+
+                       g.drawOval((int)pt.x-5, (int)pt.y-5, 10, 10);
+                       g.drawOval((int)pt.x-20, (int)pt.y-20, 40, 40);
+                       g.drawOval((int)pt.x-35, (int)pt.y-35, 70, 70);
+               }
+
+               MapMark(double lat, double lon, int state) {
+                       super(lat, lon, state);
+               }
+       }
+
+       class MapView extends JComponent implements MouseMotionListener, MouseListener, ComponentListener, MouseWheelListener {
+
+               private VolatileImage create_back_buffer() {
+                       return getGraphicsConfiguration().createCompatibleVolatileImage(getWidth(), getHeight());
+               }
+
+               private void do_paint(Graphics my_g) {
+                       g = (Graphics2D) my_g;
+
+                       map.paint();
+               }
+
+               public void paint(Graphics my_g) {
+                       VolatileImage   back_buffer = create_back_buffer();
+
+                       Graphics2D      top_g = (Graphics2D) my_g;
+
+                       do {
+                               GraphicsConfiguration gc = getGraphicsConfiguration();
+                               int code = back_buffer.validate(gc);
+                               if (code == VolatileImage.IMAGE_INCOMPATIBLE)
+                                       back_buffer = create_back_buffer();
+
+                               Graphics g_back = back_buffer.getGraphics();
+                               g_back.setClip(top_g.getClip());
+                               do_paint(g_back);
+                               g_back.dispose();
+
+                               top_g.drawImage(back_buffer, 0, 0, this);
+                       } while (back_buffer.contentsLost());
+                       back_buffer.flush();
+               }
+
+               public void repaint(AltosRectangle damage) {
+                       repaint(damage.x, damage.y, damage.width, damage.height);
+               }
+
+               private boolean is_drag_event(MouseEvent e) {
+                       return e.getModifiers() == InputEvent.BUTTON1_MASK;
+               }
+
+               /* MouseMotionListener methods */
+
+               public void mouseDragged(MouseEvent e) {
+                       map.touch_continue(e.getPoint().x, e.getPoint().y, is_drag_event(e));
+               }
+
+               public void mouseMoved(MouseEvent e) {
+               }
+
+               /* MouseListener methods */
+               public void mouseClicked(MouseEvent e) {
+               }
+
+               public void mouseEntered(MouseEvent e) {
+               }
+
+               public void mouseExited(MouseEvent e) {
+               }
+
+               public void mousePressed(MouseEvent e) {
+                       map.touch_start(e.getPoint().x, e.getPoint().y, is_drag_event(e));
+               }
+
+               public void mouseReleased(MouseEvent e) {
+               }
+
+               /* MouseWheelListener methods */
+
+               public void mouseWheelMoved(MouseWheelEvent e) {
+                       int     zoom_change = e.getWheelRotation();
+
+                       map.set_zoom_centre(map.get_zoom() - zoom_change, new AltosPointInt(e.getPoint().x, e.getPoint().y));
+               }
+
+               /* ComponentListener methods */
+
+               public void componentHidden(ComponentEvent e) {
+               }
+
+               public void componentMoved(ComponentEvent e) {
+               }
+
+               public void componentResized(ComponentEvent e) {
+                       map.set_transform();
+               }
+
+               public void componentShown(ComponentEvent e) {
+                       map.set_transform();
+               }
+
+               MapView() {
+                       addComponentListener(this);
+                       addMouseMotionListener(this);
+                       addMouseListener(this);
+                       addMouseWheelListener(this);
+               }
+       }
+
+       class MapLine extends AltosMapLine {
+
+               public void paint(AltosMapTransform t) {
+
+                       if (start == null || end == null)
+                               return;
+
+                       g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+
+                       Line2D.Double line = new Line2D.Double(point2d(t.screen(start)),
+                                                              point2d(t.screen(end)));
+
+                       g.setColor(Color.WHITE);
+                       g.setStroke(new BasicStroke(stroke_width+4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+                       g.draw(line);
+
+                       g.setColor(Color.BLUE);
+                       g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+                       g.draw(line);
+
+                       String  message = line_dist();
+                       Rectangle2D     bounds;
+                       bounds = line_font.getStringBounds(message, g.getFontRenderContext());
+
+                       float x = (float) line.x1;
+                       float y = (float) line.y1 + (float) bounds.getHeight() / 2.0f;
+
+                       if (line.x1 < line.x2) {
+                               x -= (float) bounds.getWidth() + 2.0f;
+                       } else {
+                               x += 2.0f;
+                       }
+
+                       g.setFont(line_font);
+                       g.setColor(Color.WHITE);
+                       for (int dy = -2; dy <= 2; dy += 2)
+                               for (int dx = -2; dx <= 2; dx += 2)
+                                       g.drawString(message, x + dx, y + dy);
+                       g.setColor(Color.BLUE);
+                       g.drawString(message, x, y);
+               }
+
+               public MapLine() {
+               }
+       }
+
+       class MapPath extends AltosMapPath {
+               public void paint(AltosMapTransform t) {
+                       Point2D.Double  prev = null;
+
+                       g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                          RenderingHints.VALUE_ANTIALIAS_ON);
+                       g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+
+                       for (AltosMapPathPoint point : points) {
+                               Point2D.Double  cur = point2d(t.screen(point.lat_lon));
+                               if (prev != null) {
+                                       Line2D.Double   line = new Line2D.Double (prev, cur);
+                                       Rectangle       bounds = line.getBounds();
+
+                                       if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) {
+                                               if (0 <= point.state && point.state < AltosUIMap.stateColors.length)
+                                                       g.setColor(AltosUIMap.stateColors[point.state]);
+                                               else
+                                                       g.setColor(AltosUIMap.stateColors[AltosLib.ao_flight_invalid]);
+
+                                               g.draw(line);
+                                       }
+                               }
+                               prev = cur;
+                       }
+               }
+       }
+
+       class MapTile extends AltosMapTile {
+               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) {
+
+                       AltosPointDouble        point_double = t.screen(upper_left);
+                       Point                   point = new Point((int) (point_double.x + 0.5),
+                                                                 (int) (point_double.y + 0.5));
+
+                       if (!g.hitClip(point.x, point.y, px_size, px_size))
+                               return;
+
+                       AltosImage      altos_image = get_image();
+                       AltosUIImage    ui_image = (AltosUIImage) altos_image;
+                       Image           image = null;
+
+                       if (ui_image != null)
+                               image = ui_image.image;
+
+                       if (image != null) {
+                               g.drawImage(image, point.x, point.y, null);
+                       } else {
+                               g.setColor(Color.GRAY);
+                               g.fillRect(point.x, point.y, px_size, px_size);
+
+                               if (t.has_location()) {
+                                       String  message = null;
+                                       switch (status) {
+                                       case AltosMapTile.fetching:
+                                               message = "Fetching...";
+                                               break;
+                                       case AltosMapTile.bad_request:
+                                               message = "Internal error";
+                                               break;
+                                       case AltosMapTile.failed:
+                                               message = "Network error, check connection";
+                                               break;
+                                       case AltosMapTile.forbidden:
+                                               message = "Too many requests, try later";
+                                               break;
+                                       }
+                                       if (message != null && tile_font != null) {
+                                               g.setFont(tile_font);
+                                               g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+                                               Rectangle2D bounds = tile_font.getStringBounds(message, g.getFontRenderContext());
+
+                                               float x = px_size / 2.0f;
+                                               float y = px_size / 2.0f;
+                                               x = x - (float) bounds.getWidth() / 2.0f;
+                                               y = y + (float) bounds.getHeight() / 2.0f;
+                                               g.setColor(Color.BLACK);
+                                               g.drawString(message, (float) point_double.x + x, (float) point_double.y + y);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       public static final Color stateColors[] = {
+               Color.WHITE,  // startup
+               Color.WHITE,  // idle
+               Color.WHITE,  // pad
+               Color.RED,    // boost
+               Color.PINK,   // fast
+               Color.YELLOW, // coast
+               Color.CYAN,   // drogue
+               Color.BLUE,   // main
+               Color.BLACK,  // landed
+               Color.BLACK,  // invalid
+               Color.CYAN,   // stateless
+       };
+
+       /* AltosMapInterface functions */
+
+       public AltosMapPath new_path() {
+               return new MapPath();
+       }
+
+       public AltosMapLine new_line() {
+               return new MapLine();
+       }
+
+       public AltosImage load_image(File file) throws Exception {
+               return new AltosUIImage(ImageIO.read(file));
+       }
+
+       public AltosMapMark new_mark(double lat, double lon, int state) {
+               return new MapMark(lat, lon, state);
+       }
+
+       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() {
+               return view.getWidth();
+       }
+
+       public int height() {
+               return view.getHeight();
+       }
+
+       public void repaint() {
+               view.repaint();
+       }
+
+       public void repaint(AltosRectangle damage) {
+               view.repaint(damage);
+       }
+
+       public void set_zoom_label(String label) {
+               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() {
+               tile_font = AltosUILib.value_font;
+               line_font = AltosUILib.status_font;
+       }
+
+       public void font_size_changed(int font_size) {
+               set_font();
+               repaint();
+       }
+
+       public void units_changed(boolean imperial_units) {
+               repaint();
+       }
+
+       JLabel  zoom_label;
+
+       public void set_maptype(int type) {
+               map.set_maptype(type);
+               maptype_combo.setSelectedIndex(type);
+       }
+
+       /* AltosUIMapPreload functions */
+
+       public void set_zoom(int zoom) {
+               map.set_zoom(zoom);
+       }
+
+       public void add_mark(double lat, double lon, int status) {
+               map.add_mark(lat, lon, status);
+       }
+
+       public void clear_marks() {
+               map.clear_marks();
+       }
+
+       /* AltosFlightDisplay interface */
+       public void reset() {
+               // nothing
+       }
+
+       public void show(AltosState state, AltosListenerState listener_state) {
+               map.show(state, listener_state);
+       }
+
+       public String getName() {
+               return "Map";
+       }
+
+       /* AltosGraphUI interface */
+       public void centre(AltosState state) {
+               map.centre(state);
+       }
+
+       /* internal layout bits */
+       private GridBagLayout layout = new GridBagLayout();
+
+       JComboBox<String>       maptype_combo;
+
+       MapView view;
+
+       public AltosUIMap() {
+
+               set_font();
+
+               view = new MapView();
+
+               view.setPreferredSize(new Dimension(500,500));
+               view.setVisible(true);
+               view.setEnabled(true);
+
+               GridBagLayout   my_layout = new GridBagLayout();
+
+               setLayout(my_layout);
+
+               GridBagConstraints c = new GridBagConstraints();
+               c.anchor = GridBagConstraints.CENTER;
+               c.fill = GridBagConstraints.BOTH;
+               c.gridx = 0;
+               c.gridy = 0;
+               c.gridwidth = 1;
+               c.gridheight = 10;
+               c.weightx = 1;
+               c.weighty = 1;
+               add(view, c);
+
+               int     y = 0;
+
+               zoom_label = new JLabel("", JLabel.CENTER);
+
+               c = new GridBagConstraints();
+               c.anchor = GridBagConstraints.CENTER;
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.gridx = 1;
+               c.gridy = y++;
+               c.weightx = 0;
+               c.weighty = 0;
+               add(zoom_label, c);
+
+               JButton zoom_reset = new JButton("0");
+               zoom_reset.addActionListener(new ActionListener() {
+                               public void actionPerformed(ActionEvent e) {
+                                       map.set_zoom(map.default_zoom);
+                               }
+                       });
+
+               c = new GridBagConstraints();
+               c.anchor = GridBagConstraints.CENTER;
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.gridx = 1;
+               c.gridy = y++;
+               c.weightx = 0;
+               c.weighty = 0;
+               add(zoom_reset, c);
+
+               JButton zoom_in = new JButton("+");
+               zoom_in.addActionListener(new ActionListener() {
+                               public void actionPerformed(ActionEvent e) {
+                                       map.set_zoom(map.get_zoom() + 1);
+                               }
+                       });
+
+               c = new GridBagConstraints();
+               c.anchor = GridBagConstraints.CENTER;
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.gridx = 1;
+               c.gridy = y++;
+               c.weightx = 0;
+               c.weighty = 0;
+               add(zoom_in, c);
+
+               JButton zoom_out = new JButton("-");
+               zoom_out.addActionListener(new ActionListener() {
+                               public void actionPerformed(ActionEvent e) {
+                                       map.set_zoom(map.get_zoom() - 1);
+                               }
+                       });
+               c = new GridBagConstraints();
+               c.anchor = GridBagConstraints.CENTER;
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.gridx = 1;
+               c.gridy = y++;
+               c.weightx = 0;
+               c.weighty = 0;
+               add(zoom_out, c);
+
+               maptype_combo = new JComboBox<String>(map.maptype_labels);
+
+               maptype_combo.setEditable(false);
+               maptype_combo.setMaximumRowCount(maptype_combo.getItemCount());
+               maptype_combo.addItemListener(new ItemListener() {
+                               public void itemStateChanged(ItemEvent e) {
+                                       map.set_maptype(maptype_combo.getSelectedIndex());
+                               }
+                       });
+
+               c = new GridBagConstraints();
+               c.anchor = GridBagConstraints.CENTER;
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.gridx = 1;
+               c.gridy = y++;
+               c.weightx = 0;
+               c.weighty = 0;
+               add(maptype_combo, c);
+
+               map = new AltosMap(this);
+       }
+}
diff --git a/altosuilib/AltosUIMapNew.java b/altosuilib/AltosUIMapNew.java
deleted file mode 100644 (file)
index 42c9aa7..0000000
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * Copyright © 2010 Anthony Towns <aj@erisian.com.au>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altosuilib_11;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-import javax.swing.*;
-import java.io.*;
-import java.lang.Math;
-import java.awt.geom.*;
-import java.util.*;
-import java.util.concurrent.*;
-import javax.imageio.*;
-import org.altusmetrum.altoslib_11.*;
-
-public class AltosUIMapNew extends JComponent implements AltosFlightDisplay, AltosMapInterface {
-
-       AltosMap        map;
-       Graphics2D      g;
-       Font            tile_font;
-       Font            line_font;
-
-       static Point2D.Double point2d(AltosPointDouble pt) {
-               return new Point2D.Double(pt.x, pt.y);
-       }
-
-       static final AltosPointDouble point_double(Point pt) {
-               return new AltosPointDouble(pt.x, pt.y);
-       }
-
-       class MapMark extends AltosMapMark {
-               public void paint(AltosMapTransform t) {
-                       AltosPointDouble pt = t.screen(lat_lon);
-
-                       g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                                          RenderingHints.VALUE_ANTIALIAS_ON);
-                       g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-
-                       if (0 <= state && state < AltosUIMapNew.stateColors.length)
-                               g.setColor(AltosUIMapNew.stateColors[state]);
-                       else
-                               g.setColor(AltosUIMapNew.stateColors[AltosLib.ao_flight_invalid]);
-
-                       g.drawOval((int)pt.x-5, (int)pt.y-5, 10, 10);
-                       g.drawOval((int)pt.x-20, (int)pt.y-20, 40, 40);
-                       g.drawOval((int)pt.x-35, (int)pt.y-35, 70, 70);
-               }
-
-               MapMark(double lat, double lon, int state) {
-                       super(lat, lon, state);
-               }
-       }
-
-       class MapView extends JComponent implements MouseMotionListener, MouseListener, ComponentListener, MouseWheelListener {
-
-               private VolatileImage create_back_buffer() {
-                       return getGraphicsConfiguration().createCompatibleVolatileImage(getWidth(), getHeight());
-               }
-
-               private void do_paint(Graphics my_g) {
-                       g = (Graphics2D) my_g;
-
-                       map.paint();
-               }
-
-               public void paint(Graphics my_g) {
-                       VolatileImage   back_buffer = create_back_buffer();
-
-                       Graphics2D      top_g = (Graphics2D) my_g;
-
-                       do {
-                               GraphicsConfiguration gc = getGraphicsConfiguration();
-                               int code = back_buffer.validate(gc);
-                               if (code == VolatileImage.IMAGE_INCOMPATIBLE)
-                                       back_buffer = create_back_buffer();
-
-                               Graphics g_back = back_buffer.getGraphics();
-                               g_back.setClip(top_g.getClip());
-                               do_paint(g_back);
-                               g_back.dispose();
-
-                               top_g.drawImage(back_buffer, 0, 0, this);
-                       } while (back_buffer.contentsLost());
-                       back_buffer.flush();
-               }
-
-               public void repaint(AltosRectangle damage) {
-                       repaint(damage.x, damage.y, damage.width, damage.height);
-               }
-
-               private boolean is_drag_event(MouseEvent e) {
-                       return e.getModifiers() == InputEvent.BUTTON1_MASK;
-               }
-
-               /* MouseMotionListener methods */
-
-               public void mouseDragged(MouseEvent e) {
-                       map.touch_continue(e.getPoint().x, e.getPoint().y, is_drag_event(e));
-               }
-
-               public void mouseMoved(MouseEvent e) {
-               }
-
-               /* MouseListener methods */
-               public void mouseClicked(MouseEvent e) {
-               }
-
-               public void mouseEntered(MouseEvent e) {
-               }
-
-               public void mouseExited(MouseEvent e) {
-               }
-
-               public void mousePressed(MouseEvent e) {
-                       map.touch_start(e.getPoint().x, e.getPoint().y, is_drag_event(e));
-               }
-
-               public void mouseReleased(MouseEvent e) {
-               }
-
-               /* MouseWheelListener methods */
-
-               public void mouseWheelMoved(MouseWheelEvent e) {
-                       int     zoom_change = e.getWheelRotation();
-
-                       map.set_zoom_centre(map.get_zoom() - zoom_change, new AltosPointInt(e.getPoint().x, e.getPoint().y));
-               }
-
-               /* ComponentListener methods */
-
-               public void componentHidden(ComponentEvent e) {
-               }
-
-               public void componentMoved(ComponentEvent e) {
-               }
-
-               public void componentResized(ComponentEvent e) {
-                       map.set_transform();
-               }
-
-               public void componentShown(ComponentEvent e) {
-                       map.set_transform();
-               }
-
-               MapView() {
-                       addComponentListener(this);
-                       addMouseMotionListener(this);
-                       addMouseListener(this);
-                       addMouseWheelListener(this);
-               }
-       }
-
-       class MapLine extends AltosMapLine {
-
-               public void paint(AltosMapTransform t) {
-
-                       if (start == null || end == null)
-                               return;
-
-                       g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
-
-                       Line2D.Double line = new Line2D.Double(point2d(t.screen(start)),
-                                                              point2d(t.screen(end)));
-
-                       g.setColor(Color.WHITE);
-                       g.setStroke(new BasicStroke(stroke_width+4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-                       g.draw(line);
-
-                       g.setColor(Color.BLUE);
-                       g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-                       g.draw(line);
-
-                       String  message = line_dist();
-                       Rectangle2D     bounds;
-                       bounds = line_font.getStringBounds(message, g.getFontRenderContext());
-
-                       float x = (float) line.x1;
-                       float y = (float) line.y1 + (float) bounds.getHeight() / 2.0f;
-
-                       if (line.x1 < line.x2) {
-                               x -= (float) bounds.getWidth() + 2.0f;
-                       } else {
-                               x += 2.0f;
-                       }
-
-                       g.setFont(line_font);
-                       g.setColor(Color.WHITE);
-                       for (int dy = -2; dy <= 2; dy += 2)
-                               for (int dx = -2; dx <= 2; dx += 2)
-                                       g.drawString(message, x + dx, y + dy);
-                       g.setColor(Color.BLUE);
-                       g.drawString(message, x, y);
-               }
-
-               public MapLine() {
-               }
-       }
-
-       class MapPath extends AltosMapPath {
-               public void paint(AltosMapTransform t) {
-                       Point2D.Double  prev = null;
-
-                       g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
-                                          RenderingHints.VALUE_ANTIALIAS_ON);
-                       g.setStroke(new BasicStroke(stroke_width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
-
-                       for (AltosMapPathPoint point : points) {
-                               Point2D.Double  cur = point2d(t.screen(point.lat_lon));
-                               if (prev != null) {
-                                       Line2D.Double   line = new Line2D.Double (prev, cur);
-                                       Rectangle       bounds = line.getBounds();
-
-                                       if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) {
-                                               if (0 <= point.state && point.state < AltosUIMapNew.stateColors.length)
-                                                       g.setColor(AltosUIMapNew.stateColors[point.state]);
-                                               else
-                                                       g.setColor(AltosUIMapNew.stateColors[AltosLib.ao_flight_invalid]);
-
-                                               g.draw(line);
-                                       }
-                               }
-                               prev = cur;
-                       }
-               }
-       }
-
-       class MapTile extends AltosMapTile {
-               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) {
-
-                       AltosPointDouble        point_double = t.screen(upper_left);
-                       Point                   point = new Point((int) (point_double.x + 0.5),
-                                                                 (int) (point_double.y + 0.5));
-
-                       if (!g.hitClip(point.x, point.y, px_size, px_size))
-                               return;
-
-                       AltosImage      altos_image = get_image();
-                       AltosUIImage    ui_image = (AltosUIImage) altos_image;
-                       Image           image = null;
-
-                       if (ui_image != null)
-                               image = ui_image.image;
-
-                       if (image != null) {
-                               g.drawImage(image, point.x, point.y, null);
-                       } else {
-                               g.setColor(Color.GRAY);
-                               g.fillRect(point.x, point.y, px_size, px_size);
-
-                               if (t.has_location()) {
-                                       String  message = null;
-                                       switch (status) {
-                                       case AltosMapTile.fetching:
-                                               message = "Fetching...";
-                                               break;
-                                       case AltosMapTile.bad_request:
-                                               message = "Internal error";
-                                               break;
-                                       case AltosMapTile.failed:
-                                               message = "Network error, check connection";
-                                               break;
-                                       case AltosMapTile.forbidden:
-                                               message = "Too many requests, try later";
-                                               break;
-                                       }
-                                       if (message != null && tile_font != null) {
-                                               g.setFont(tile_font);
-                                               g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
-                                               Rectangle2D bounds = tile_font.getStringBounds(message, g.getFontRenderContext());
-
-                                               float x = px_size / 2.0f;
-                                               float y = px_size / 2.0f;
-                                               x = x - (float) bounds.getWidth() / 2.0f;
-                                               y = y + (float) bounds.getHeight() / 2.0f;
-                                               g.setColor(Color.BLACK);
-                                               g.drawString(message, (float) point_double.x + x, (float) point_double.y + y);
-                                       }
-                               }
-                       }
-               }
-       }
-
-       public static final Color stateColors[] = {
-               Color.WHITE,  // startup
-               Color.WHITE,  // idle
-               Color.WHITE,  // pad
-               Color.RED,    // boost
-               Color.PINK,   // fast
-               Color.YELLOW, // coast
-               Color.CYAN,   // drogue
-               Color.BLUE,   // main
-               Color.BLACK,  // landed
-               Color.BLACK,  // invalid
-               Color.CYAN,   // stateless
-       };
-
-       /* AltosMapInterface functions */
-
-       public AltosMapPath new_path() {
-               return new MapPath();
-       }
-
-       public AltosMapLine new_line() {
-               return new MapLine();
-       }
-
-       public AltosImage load_image(File file) throws Exception {
-               return new AltosUIImage(ImageIO.read(file));
-       }
-
-       public AltosMapMark new_mark(double lat, double lon, int state) {
-               return new MapMark(lat, lon, state);
-       }
-
-       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() {
-               return view.getWidth();
-       }
-
-       public int height() {
-               return view.getHeight();
-       }
-
-       public void repaint() {
-               view.repaint();
-       }
-
-       public void repaint(AltosRectangle damage) {
-               view.repaint(damage);
-       }
-
-       public void set_zoom_label(String label) {
-               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() {
-               tile_font = AltosUILib.value_font;
-               line_font = AltosUILib.status_font;
-       }
-
-       public void font_size_changed(int font_size) {
-               set_font();
-               repaint();
-       }
-
-       public void units_changed(boolean imperial_units) {
-               repaint();
-       }
-
-       JLabel  zoom_label;
-
-       public void set_maptype(int type) {
-               map.set_maptype(type);
-               maptype_combo.setSelectedIndex(type);
-       }
-
-       /* AltosUIMapPreload functions */
-
-       public void set_zoom(int zoom) {
-               map.set_zoom(zoom);
-       }
-
-       public void add_mark(double lat, double lon, int status) {
-               map.add_mark(lat, lon, status);
-       }
-
-       public void clear_marks() {
-               map.clear_marks();
-       }
-
-       /* AltosFlightDisplay interface */
-       public void reset() {
-               // nothing
-       }
-
-       public void show(AltosState state, AltosListenerState listener_state) {
-               map.show(state, listener_state);
-       }
-
-       public String getName() {
-               return "Map";
-       }
-
-       /* AltosGraphUI interface */
-       public void centre(AltosState state) {
-               map.centre(state);
-       }
-
-       /* internal layout bits */
-       private GridBagLayout layout = new GridBagLayout();
-
-       JComboBox<String>       maptype_combo;
-
-       MapView view;
-
-       public AltosUIMapNew() {
-
-               set_font();
-
-               view = new MapView();
-
-               view.setPreferredSize(new Dimension(500,500));
-               view.setVisible(true);
-               view.setEnabled(true);
-
-               GridBagLayout   my_layout = new GridBagLayout();
-
-               setLayout(my_layout);
-
-               GridBagConstraints c = new GridBagConstraints();
-               c.anchor = GridBagConstraints.CENTER;
-               c.fill = GridBagConstraints.BOTH;
-               c.gridx = 0;
-               c.gridy = 0;
-               c.gridwidth = 1;
-               c.gridheight = 10;
-               c.weightx = 1;
-               c.weighty = 1;
-               add(view, c);
-
-               int     y = 0;
-
-               zoom_label = new JLabel("", JLabel.CENTER);
-
-               c = new GridBagConstraints();
-               c.anchor = GridBagConstraints.CENTER;
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.gridx = 1;
-               c.gridy = y++;
-               c.weightx = 0;
-               c.weighty = 0;
-               add(zoom_label, c);
-
-               JButton zoom_reset = new JButton("0");
-               zoom_reset.addActionListener(new ActionListener() {
-                               public void actionPerformed(ActionEvent e) {
-                                       map.set_zoom(map.default_zoom);
-                               }
-                       });
-
-               c = new GridBagConstraints();
-               c.anchor = GridBagConstraints.CENTER;
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.gridx = 1;
-               c.gridy = y++;
-               c.weightx = 0;
-               c.weighty = 0;
-               add(zoom_reset, c);
-
-               JButton zoom_in = new JButton("+");
-               zoom_in.addActionListener(new ActionListener() {
-                               public void actionPerformed(ActionEvent e) {
-                                       map.set_zoom(map.get_zoom() + 1);
-                               }
-                       });
-
-               c = new GridBagConstraints();
-               c.anchor = GridBagConstraints.CENTER;
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.gridx = 1;
-               c.gridy = y++;
-               c.weightx = 0;
-               c.weighty = 0;
-               add(zoom_in, c);
-
-               JButton zoom_out = new JButton("-");
-               zoom_out.addActionListener(new ActionListener() {
-                               public void actionPerformed(ActionEvent e) {
-                                       map.set_zoom(map.get_zoom() - 1);
-                               }
-                       });
-               c = new GridBagConstraints();
-               c.anchor = GridBagConstraints.CENTER;
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.gridx = 1;
-               c.gridy = y++;
-               c.weightx = 0;
-               c.weighty = 0;
-               add(zoom_out, c);
-
-               maptype_combo = new JComboBox<String>(map.maptype_labels);
-
-               maptype_combo.setEditable(false);
-               maptype_combo.setMaximumRowCount(maptype_combo.getItemCount());
-               maptype_combo.addItemListener(new ItemListener() {
-                               public void itemStateChanged(ItemEvent e) {
-                                       map.set_maptype(maptype_combo.getSelectedIndex());
-                               }
-                       });
-
-               c = new GridBagConstraints();
-               c.anchor = GridBagConstraints.CENTER;
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.gridx = 1;
-               c.gridy = y++;
-               c.weightx = 0;
-               c.weighty = 0;
-               add(maptype_combo, c);
-
-               map = new AltosMap(this);
-       }
-}
diff --git a/altosuilib/AltosUIMapPreload.java b/altosuilib/AltosUIMapPreload.java
new file mode 100644 (file)
index 0000000..42fdd30
--- /dev/null
@@ -0,0 +1,524 @@
+/*
+ * Copyright © 2011 Keith Packard <keithp@keithp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+package org.altusmetrum.altosuilib_11;
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.lang.Math;
+import java.net.URL;
+import java.net.URLConnection;
+import org.altusmetrum.altoslib_11.*;
+
+class AltosUIMapPos extends Box {
+       AltosUIFrame    owner;
+       JLabel          label;
+       JComboBox       hemi;
+       JTextField      deg;
+       JLabel          deg_label;
+       JTextField      min;
+       JLabel          min_label;
+
+       public void set_value(double new_value) {
+               double  d, m;
+               int     h;
+
+               h = 0;
+               if (new_value < 0) {
+                       h = 1;
+                       new_value = -new_value;
+               }
+               d = Math.floor(new_value);
+               deg.setText(String.format("%3.0f", d));
+               m = (new_value - d) * 60.0;
+               min.setText(String.format("%7.4f", m));
+               hemi.setSelectedIndex(h);
+       }
+
+       public double get_value() throws ParseException {
+               int     h = hemi.getSelectedIndex();
+               String  d_t = deg.getText();
+               String  m_t = min.getText();
+               double  d, m, v;
+               try {
+                       d = AltosParse.parse_double_locale(d_t);
+               } catch (ParseException pe) {
+                       JOptionPane.showMessageDialog(owner,
+                                                     String.format("Invalid degrees \"%s\"",
+                                                                   d_t),
+                                                     "Invalid number",
+                                                     JOptionPane.ERROR_MESSAGE);
+                       throw pe;
+               }
+               try {
+                       if (m_t.equals(""))
+                               m = 0;
+                       else
+                               m = AltosParse.parse_double_locale(m_t);
+               } catch (ParseException pe) {
+                       JOptionPane.showMessageDialog(owner,
+                                                     String.format("Invalid minutes \"%s\"",
+                                                                   m_t),
+                                                     "Invalid number",
+                                                     JOptionPane.ERROR_MESSAGE);
+                       throw pe;
+               }
+               v = d + m/60.0;
+               if (h == 1)
+                       v = -v;
+               return v;
+       }
+
+       public AltosUIMapPos(AltosUIFrame in_owner,
+                          String label_value,
+                          String[] hemi_names,
+                          double default_value) {
+               super(BoxLayout.X_AXIS);
+               owner = in_owner;
+               label = new JLabel(label_value);
+               hemi = new JComboBox<String>(hemi_names);
+               hemi.setEditable(false);
+               deg = new JTextField(5);
+               deg.setMinimumSize(deg.getPreferredSize());
+               deg.setHorizontalAlignment(JTextField.RIGHT);
+               deg_label = new JLabel("°");
+               min = new JTextField(9);
+               min.setMinimumSize(min.getPreferredSize());
+               min_label = new JLabel("'");
+               set_value(default_value);
+               add(label);
+               add(Box.createRigidArea(new Dimension(5, 0)));
+               add(hemi);
+               add(Box.createRigidArea(new Dimension(5, 0)));
+               add(deg);
+               add(Box.createRigidArea(new Dimension(5, 0)));
+               add(deg_label);
+               add(Box.createRigidArea(new Dimension(5, 0)));
+               add(min);
+               add(Box.createRigidArea(new Dimension(5, 0)));
+               add(min_label);
+       }
+}
+
+public class AltosUIMapPreload extends AltosUIFrame implements ActionListener, ItemListener, AltosLaunchSiteListener, AltosMapLoaderListener, AltosUnitsListener, AltosFontListener  {
+       AltosUIFrame    owner;
+       AltosUIMap      map;
+
+       AltosUIMapPos   lat;
+       AltosUIMapPos   lon;
+
+       JProgressBar    pbar;
+
+       JLabel          site_list_label;
+       JComboBox<AltosLaunchSite>      site_list;
+
+       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;
+       JLabel                  radius_label;
+       JComboBox<Double>       radius;
+       int scale = 1;
+
+       Integer[]               zooms = { -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6 };
+
+       Double[]        radius_mi = { 1.0, 2.0, 5.0, 10.0, 20.0 };
+       Double          radius_def_mi = 5.0;
+       Double[]        radius_km = { 2.0, 5.0, 10.0, 20.0, 30.0 };
+       Double          radius_def_km = 10.0;
+
+       AltosMapLoader  loader;
+
+       static final String[]   lat_hemi_names = { "N", "S" };
+       static final String[]   lon_hemi_names = { "E", "W" };
+
+       double  latitude, longitude;
+
+       long    loader_notify_time;
+
+       /* AltosMapLoaderListener interfaces */
+       public void loader_start(final int max) {
+               loader_notify_time = System.currentTimeMillis();
+
+               SwingUtilities.invokeLater(new Runnable() {
+                               public void run() {
+                                       pbar.setMaximum(max);
+                                       pbar.setValue(0);
+                                       pbar.setString("");
+                                       map.clear_marks();
+                                       map.add_mark(latitude, longitude, AltosLib.ao_flight_boost);
+                               }
+                       });
+       }
+
+       public void loader_notify(final int cur, final int max, final String name) {
+               long    now = System.currentTimeMillis();
+
+               if (now - loader_notify_time < 100)
+                       return;
+
+               loader_notify_time = now;
+
+               SwingUtilities.invokeLater(new Runnable() {
+                               public void run() {
+                                       pbar.setValue(cur);
+                                       pbar.setString(name);
+                               }
+                       });
+       }
+
+       public void loader_done(int max) {
+               loader = null;
+               SwingUtilities.invokeLater(new Runnable() {
+                               public void run() {
+                                       pbar.setValue(0);
+                                       pbar.setString("");
+                                       load_button.setSelected(false);
+                               }
+                       });
+       }
+
+       public void debug(String format, Object ... arguments) {
+               if (AltosSerial.debug)
+                       System.out.printf(format, arguments);
+       }
+
+
+       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;
+       }
+
+       public void itemStateChanged(ItemEvent e) {
+               int             state = e.getStateChange();
+
+               if (state == ItemEvent.SELECTED) {
+                       Object  o = e.getItem();
+                       if (o instanceof AltosLaunchSite) {
+                               AltosLaunchSite site = (AltosLaunchSite) o;
+                               lat.set_value(site.latitude);
+                               lon.set_value(site.longitude);
+                       }
+               }
+       }
+
+       public void actionPerformed(ActionEvent e) {
+               String  cmd = e.getActionCommand();
+
+               if (cmd.equals("close")) {
+                       if (loader != null)
+                               loader.abort();
+                       setVisible(false);
+               }
+
+               if (cmd.equals("load")) {
+                       if (loader == null) {
+                               try {
+                                       latitude = lat.get_value();
+                                       longitude = lon.get_value();
+                                       int min_z = (Integer) min_zoom.getSelectedItem();
+                                       int max_z = (Integer) max_zoom.getSelectedItem();
+                                       if (max_z < min_z)
+                                               max_z = min_z;
+                                       Double r = (Double) radius.getSelectedItem();
+
+                                       if (AltosPreferences.imperial_units())
+                                               r = AltosConvert.miles_to_meters(r);
+                                       else
+                                               r = r * 1000;
+
+                                       map.map.centre(new AltosLatLon(latitude, longitude));
+
+                                       loader = new AltosMapLoader(this,
+                                                                   latitude, longitude,
+                                                                   min_z, max_z, r,
+                                                                   all_types(), scale);
+
+                               } catch (ParseException pe) {
+                                       load_button.setSelected(false);
+                               }
+                       }
+               }
+       }
+
+       public void notify_launch_sites(final java.util.List<AltosLaunchSite> sites) {
+               SwingUtilities.invokeLater(new Runnable() {
+                               public void run() {
+                                       int     i = 1;
+                                       for (AltosLaunchSite site : sites) {
+                                               site_list.insertItemAt(site, i);
+                                               i++;
+                                       }
+                               }
+                       });
+       }
+
+       private void set_radius_values() {
+               radius_label.setText(String.format("Map Radius (%s)",
+                                                  AltosPreferences.imperial_units() ? "mi" : "km"));
+
+               Double[]        radii;
+
+               if (AltosPreferences.imperial_units())
+                       radii = radius_mi;
+               else
+                       radii = radius_km;
+
+               radius.removeAllItems();
+               for (Double r : radii) {
+                       radius.addItem(r);
+               }
+               radius.setSelectedItem(radii[2]);
+               radius.setMaximumRowCount(radii.length);
+       }
+
+       public void units_changed(boolean imperial_units) {
+               map.units_changed(imperial_units);
+               set_radius_values();
+       }
+
+       public void font_size_changed(int font_size) {
+               map.font_size_changed(font_size);
+       }
+
+       public AltosUIMapPreload(AltosUIFrame in_owner) {
+               owner = in_owner;
+
+               Container               pane = getContentPane();
+               GridBagConstraints      c = new GridBagConstraints();
+               Insets                  i = new Insets(4,4,4,4);
+
+               setTitle("AltOS Load Maps");
+
+               pane.setLayout(new GridBagLayout());
+
+               addWindowListener(new WindowAdapter() {
+                               @Override
+                               public void windowClosing(WindowEvent e) {
+                                       AltosUIPreferences.unregister_font_listener(AltosUIMapPreload.this);
+                                       AltosPreferences.unregister_units_listener(AltosUIMapPreload.this);
+                               }
+                       });
+
+
+               AltosPreferences.register_units_listener(this);
+               AltosUIPreferences.register_font_listener(this);
+
+               map = new AltosUIMap();
+
+               c.fill = GridBagConstraints.BOTH;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 1;
+               c.weighty = 1;
+
+               c.gridx = 0;
+               c.gridy = 0;
+               c.gridwidth = 10;
+               c.anchor = GridBagConstraints.CENTER;
+
+               pane.add(map, c);
+
+               pbar = new JProgressBar();
+               pbar.setMinimum(0);
+               pbar.setMaximum(1);
+               pbar.setValue(0);
+               pbar.setString("");
+               pbar.setStringPainted(true);
+
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 1;
+               c.weighty = 0;
+
+               c.gridx = 0;
+               c.gridy = 1;
+               c.gridwidth = 10;
+
+               pane.add(pbar, c);
+
+               site_list_label = new JLabel ("Known Launch Sites:");
+
+               c.fill = GridBagConstraints.NONE;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 1;
+               c.weighty = 0;
+
+               c.gridx = 0;
+               c.gridy = 2;
+               c.gridwidth = 1;
+
+               pane.add(site_list_label, c);
+
+               site_list = new JComboBox<AltosLaunchSite>(new AltosLaunchSite[] { new AltosLaunchSite("Site List", 0, 0) });
+               site_list.addItemListener(this);
+
+               new AltosLaunchSites(this);
+
+               c.fill = GridBagConstraints.HORIZONTAL;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 1;
+               c.weighty = 0;
+
+               c.gridx = 1;
+               c.gridy = 2;
+               c.gridwidth = 1;
+
+               pane.add(site_list, c);
+
+               lat = new AltosUIMapPos(owner,
+                                       "Latitude:",
+                                       lat_hemi_names,
+                                       37.167833333);
+               c.fill = GridBagConstraints.NONE;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 0;
+               c.weighty = 0;
+
+               c.gridx = 0;
+               c.gridy = 3;
+               c.gridwidth = 1;
+               c.anchor = GridBagConstraints.CENTER;
+
+               pane.add(lat, c);
+
+               lon = new AltosUIMapPos(owner,
+                                       "Longitude:",
+                                       lon_hemi_names,
+                                       -97.73975);
+
+               c.fill = GridBagConstraints.NONE;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 0;
+               c.weighty = 0;
+
+               c.gridx = 1;
+               c.gridy = 3;
+               c.gridwidth = 1;
+               c.anchor = GridBagConstraints.CENTER;
+
+               pane.add(lon, c);
+
+               load_button = new JToggleButton("Load Map");
+               load_button.addActionListener(this);
+               load_button.setActionCommand("load");
+
+               c.fill = GridBagConstraints.NONE;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 1;
+               c.weighty = 0;
+
+               c.gridx = 0;
+               c.gridy = 4;
+               c.gridwidth = 1;
+               c.anchor = GridBagConstraints.CENTER;
+
+               pane.add(load_button, c);
+
+               close_button = new JButton("Close");
+               close_button.addActionListener(this);
+               close_button.setActionCommand("close");
+
+               c.fill = GridBagConstraints.NONE;
+               c.anchor = GridBagConstraints.CENTER;
+               c.insets = i;
+               c.weightx = 1;
+               c.weighty = 0;
+
+               c.gridx = 1;
+               c.gridy = 4;
+               c.gridwidth = 1;
+               c.anchor = GridBagConstraints.CENTER;
+
+               pane.add(close_button, c);
+
+               JLabel  types_label = new JLabel("Map Types");
+               c.gridx = 2;
+               c.gridwidth = 2;
+               c.gridy = 2;
+               pane.add(types_label, c);
+
+               c.gridwidth = 1;
+
+               for (int type = AltosMap.maptype_hybrid; type <= AltosMap.maptype_terrain; type++) {
+                       maptypes[type] = new JCheckBox(AltosMap.maptype_labels[type],
+                                                      type == AltosMap.maptype_hybrid);
+                       c.gridx = 2 + (type >> 1);
+                       c.fill = GridBagConstraints.HORIZONTAL;
+                       c.gridy = (type & 1) + 3;
+                       pane.add(maptypes[type], c);
+               }
+
+               JLabel  min_zoom_label = new JLabel("Minimum Zoom");
+               c.gridx = 4;
+               c.gridy = 2;
+               pane.add(min_zoom_label, c);
+
+               min_zoom = new JComboBox<Integer>(zooms);
+               min_zoom.setSelectedItem(zooms[10]);
+               min_zoom.setEditable(false);
+               c.gridx = 5;
+               c.gridy = 2;
+               pane.add(min_zoom, c);
+
+               JLabel  max_zoom_label = new JLabel("Maximum Zoom");
+               c.gridx = 4;
+               c.gridy = 3;
+               pane.add(max_zoom_label, c);
+
+               max_zoom = new JComboBox<Integer>(zooms);
+               max_zoom.setSelectedItem(zooms[14]);
+               max_zoom.setEditable(false);
+               c.gridx = 5;
+               c.gridy = 3;
+               pane.add(max_zoom, c);
+
+               radius_label = new JLabel();
+
+               c.gridx = 4;
+               c.gridy = 4;
+               pane.add(radius_label, c);
+
+               radius = new JComboBox<Double>();
+               radius.setEditable(true);
+               c.gridx = 5;
+               c.gridy = 4;
+               pane.add(radius, c);
+
+               set_radius_values();
+
+               pack();
+               setLocationRelativeTo(owner);
+               setVisible(true);
+       }
+}
diff --git a/altosuilib/AltosUIMapPreloadNew.java b/altosuilib/AltosUIMapPreloadNew.java
deleted file mode 100644 (file)
index d043e9e..0000000
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altosuilib_11;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.io.*;
-import java.util.*;
-import java.text.*;
-import java.lang.Math;
-import java.net.URL;
-import java.net.URLConnection;
-import org.altusmetrum.altoslib_11.*;
-
-class AltosUIMapPos extends Box {
-       AltosUIFrame    owner;
-       JLabel          label;
-       JComboBox       hemi;
-       JTextField      deg;
-       JLabel          deg_label;
-       JTextField      min;
-       JLabel          min_label;
-
-       public void set_value(double new_value) {
-               double  d, m;
-               int     h;
-
-               h = 0;
-               if (new_value < 0) {
-                       h = 1;
-                       new_value = -new_value;
-               }
-               d = Math.floor(new_value);
-               deg.setText(String.format("%3.0f", d));
-               m = (new_value - d) * 60.0;
-               min.setText(String.format("%7.4f", m));
-               hemi.setSelectedIndex(h);
-       }
-
-       public double get_value() throws ParseException {
-               int     h = hemi.getSelectedIndex();
-               String  d_t = deg.getText();
-               String  m_t = min.getText();
-               double  d, m, v;
-               try {
-                       d = AltosParse.parse_double_locale(d_t);
-               } catch (ParseException pe) {
-                       JOptionPane.showMessageDialog(owner,
-                                                     String.format("Invalid degrees \"%s\"",
-                                                                   d_t),
-                                                     "Invalid number",
-                                                     JOptionPane.ERROR_MESSAGE);
-                       throw pe;
-               }
-               try {
-                       if (m_t.equals(""))
-                               m = 0;
-                       else
-                               m = AltosParse.parse_double_locale(m_t);
-               } catch (ParseException pe) {
-                       JOptionPane.showMessageDialog(owner,
-                                                     String.format("Invalid minutes \"%s\"",
-                                                                   m_t),
-                                                     "Invalid number",
-                                                     JOptionPane.ERROR_MESSAGE);
-                       throw pe;
-               }
-               v = d + m/60.0;
-               if (h == 1)
-                       v = -v;
-               return v;
-       }
-
-       public AltosUIMapPos(AltosUIFrame in_owner,
-                          String label_value,
-                          String[] hemi_names,
-                          double default_value) {
-               super(BoxLayout.X_AXIS);
-               owner = in_owner;
-               label = new JLabel(label_value);
-               hemi = new JComboBox<String>(hemi_names);
-               hemi.setEditable(false);
-               deg = new JTextField(5);
-               deg.setMinimumSize(deg.getPreferredSize());
-               deg.setHorizontalAlignment(JTextField.RIGHT);
-               deg_label = new JLabel("°");
-               min = new JTextField(9);
-               min.setMinimumSize(min.getPreferredSize());
-               min_label = new JLabel("'");
-               set_value(default_value);
-               add(label);
-               add(Box.createRigidArea(new Dimension(5, 0)));
-               add(hemi);
-               add(Box.createRigidArea(new Dimension(5, 0)));
-               add(deg);
-               add(Box.createRigidArea(new Dimension(5, 0)));
-               add(deg_label);
-               add(Box.createRigidArea(new Dimension(5, 0)));
-               add(min);
-               add(Box.createRigidArea(new Dimension(5, 0)));
-               add(min_label);
-       }
-}
-
-public class AltosUIMapPreloadNew extends AltosUIFrame implements ActionListener, ItemListener, AltosLaunchSiteListener, AltosMapLoaderListener, AltosUnitsListener, AltosFontListener  {
-       AltosUIFrame    owner;
-       AltosUIMapNew   map;
-
-       AltosUIMapPos   lat;
-       AltosUIMapPos   lon;
-
-       JProgressBar    pbar;
-
-       JLabel          site_list_label;
-       JComboBox<AltosLaunchSite>      site_list;
-
-       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;
-       JLabel                  radius_label;
-       JComboBox<Double>       radius;
-       int scale = 1;
-
-       Integer[]               zooms = { -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6 };
-
-       Double[]        radius_mi = { 1.0, 2.0, 5.0, 10.0, 20.0 };
-       Double          radius_def_mi = 5.0;
-       Double[]        radius_km = { 2.0, 5.0, 10.0, 20.0, 30.0 };
-       Double          radius_def_km = 10.0;
-
-       AltosMapLoader  loader;
-
-       static final String[]   lat_hemi_names = { "N", "S" };
-       static final String[]   lon_hemi_names = { "E", "W" };
-
-       double  latitude, longitude;
-
-       long    loader_notify_time;
-
-       /* AltosMapLoaderListener interfaces */
-       public void loader_start(final int max) {
-               loader_notify_time = System.currentTimeMillis();
-
-               SwingUtilities.invokeLater(new Runnable() {
-                               public void run() {
-                                       pbar.setMaximum(max);
-                                       pbar.setValue(0);
-                                       pbar.setString("");
-                                       map.clear_marks();
-                                       map.add_mark(latitude, longitude, AltosLib.ao_flight_boost);
-                               }
-                       });
-       }
-
-       public void loader_notify(final int cur, final int max, final String name) {
-               long    now = System.currentTimeMillis();
-
-               if (now - loader_notify_time < 100)
-                       return;
-
-               loader_notify_time = now;
-
-               SwingUtilities.invokeLater(new Runnable() {
-                               public void run() {
-                                       pbar.setValue(cur);
-                                       pbar.setString(name);
-                               }
-                       });
-       }
-
-       public void loader_done(int max) {
-               loader = null;
-               SwingUtilities.invokeLater(new Runnable() {
-                               public void run() {
-                                       pbar.setValue(0);
-                                       pbar.setString("");
-                                       load_button.setSelected(false);
-                               }
-                       });
-       }
-
-       public void debug(String format, Object ... arguments) {
-               if (AltosSerial.debug)
-                       System.out.printf(format, arguments);
-       }
-
-
-       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;
-       }
-
-       public void itemStateChanged(ItemEvent e) {
-               int             state = e.getStateChange();
-
-               if (state == ItemEvent.SELECTED) {
-                       Object  o = e.getItem();
-                       if (o instanceof AltosLaunchSite) {
-                               AltosLaunchSite site = (AltosLaunchSite) o;
-                               lat.set_value(site.latitude);
-                               lon.set_value(site.longitude);
-                       }
-               }
-       }
-
-       public void actionPerformed(ActionEvent e) {
-               String  cmd = e.getActionCommand();
-
-               if (cmd.equals("close")) {
-                       if (loader != null)
-                               loader.abort();
-                       setVisible(false);
-               }
-
-               if (cmd.equals("load")) {
-                       if (loader == null) {
-                               try {
-                                       latitude = lat.get_value();
-                                       longitude = lon.get_value();
-                                       int min_z = (Integer) min_zoom.getSelectedItem();
-                                       int max_z = (Integer) max_zoom.getSelectedItem();
-                                       if (max_z < min_z)
-                                               max_z = min_z;
-                                       Double r = (Double) radius.getSelectedItem();
-
-                                       if (AltosPreferences.imperial_units())
-                                               r = AltosConvert.miles_to_meters(r);
-                                       else
-                                               r = r * 1000;
-
-                                       map.map.centre(new AltosLatLon(latitude, longitude));
-
-                                       loader = new AltosMapLoader(this,
-                                                                   latitude, longitude,
-                                                                   min_z, max_z, r,
-                                                                   all_types(), scale);
-
-                               } catch (ParseException pe) {
-                                       load_button.setSelected(false);
-                               }
-                       }
-               }
-       }
-
-       public void notify_launch_sites(final java.util.List<AltosLaunchSite> sites) {
-               SwingUtilities.invokeLater(new Runnable() {
-                               public void run() {
-                                       int     i = 1;
-                                       for (AltosLaunchSite site : sites) {
-                                               site_list.insertItemAt(site, i);
-                                               i++;
-                                       }
-                               }
-                       });
-       }
-
-       private void set_radius_values() {
-               radius_label.setText(String.format("Map Radius (%s)",
-                                                  AltosPreferences.imperial_units() ? "mi" : "km"));
-
-               Double[]        radii;
-
-               if (AltosPreferences.imperial_units())
-                       radii = radius_mi;
-               else
-                       radii = radius_km;
-
-               radius.removeAllItems();
-               for (Double r : radii) {
-                       System.out.printf("adding radius %f\n",r);
-                       radius.addItem(r);
-               }
-               radius.setSelectedItem(radii[2]);
-               radius.setMaximumRowCount(radii.length);
-       }
-
-       public void units_changed(boolean imperial_units) {
-               map.units_changed(imperial_units);
-               set_radius_values();
-       }
-
-       public void font_size_changed(int font_size) {
-               map.font_size_changed(font_size);
-       }
-
-       public AltosUIMapPreloadNew(AltosUIFrame in_owner) {
-               owner = in_owner;
-
-               Container               pane = getContentPane();
-               GridBagConstraints      c = new GridBagConstraints();
-               Insets                  i = new Insets(4,4,4,4);
-
-               setTitle("AltOS Load Maps");
-
-               pane.setLayout(new GridBagLayout());
-
-               addWindowListener(new WindowAdapter() {
-                               @Override
-                               public void windowClosing(WindowEvent e) {
-                                       AltosUIPreferences.unregister_font_listener(AltosUIMapPreloadNew.this);
-                                       AltosPreferences.unregister_units_listener(AltosUIMapPreloadNew.this);
-                               }
-                       });
-
-
-               AltosPreferences.register_units_listener(this);
-               AltosUIPreferences.register_font_listener(this);
-
-               map = new AltosUIMapNew();
-
-               c.fill = GridBagConstraints.BOTH;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 1;
-               c.weighty = 1;
-
-               c.gridx = 0;
-               c.gridy = 0;
-               c.gridwidth = 10;
-               c.anchor = GridBagConstraints.CENTER;
-
-               pane.add(map, c);
-
-               pbar = new JProgressBar();
-               pbar.setMinimum(0);
-               pbar.setMaximum(1);
-               pbar.setValue(0);
-               pbar.setString("");
-               pbar.setStringPainted(true);
-
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 1;
-               c.weighty = 0;
-
-               c.gridx = 0;
-               c.gridy = 1;
-               c.gridwidth = 10;
-
-               pane.add(pbar, c);
-
-               site_list_label = new JLabel ("Known Launch Sites:");
-
-               c.fill = GridBagConstraints.NONE;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 1;
-               c.weighty = 0;
-
-               c.gridx = 0;
-               c.gridy = 2;
-               c.gridwidth = 1;
-
-               pane.add(site_list_label, c);
-
-               site_list = new JComboBox<AltosLaunchSite>(new AltosLaunchSite[] { new AltosLaunchSite("Site List", 0, 0) });
-               site_list.addItemListener(this);
-
-               new AltosLaunchSites(this);
-
-               c.fill = GridBagConstraints.HORIZONTAL;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 1;
-               c.weighty = 0;
-
-               c.gridx = 1;
-               c.gridy = 2;
-               c.gridwidth = 1;
-
-               pane.add(site_list, c);
-
-               lat = new AltosUIMapPos(owner,
-                                       "Latitude:",
-                                       lat_hemi_names,
-                                       37.167833333);
-               c.fill = GridBagConstraints.NONE;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 0;
-               c.weighty = 0;
-
-               c.gridx = 0;
-               c.gridy = 3;
-               c.gridwidth = 1;
-               c.anchor = GridBagConstraints.CENTER;
-
-               pane.add(lat, c);
-
-               lon = new AltosUIMapPos(owner,
-                                       "Longitude:",
-                                       lon_hemi_names,
-                                       -97.73975);
-
-               c.fill = GridBagConstraints.NONE;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 0;
-               c.weighty = 0;
-
-               c.gridx = 1;
-               c.gridy = 3;
-               c.gridwidth = 1;
-               c.anchor = GridBagConstraints.CENTER;
-
-               pane.add(lon, c);
-
-               load_button = new JToggleButton("Load Map");
-               load_button.addActionListener(this);
-               load_button.setActionCommand("load");
-
-               c.fill = GridBagConstraints.NONE;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 1;
-               c.weighty = 0;
-
-               c.gridx = 0;
-               c.gridy = 4;
-               c.gridwidth = 1;
-               c.anchor = GridBagConstraints.CENTER;
-
-               pane.add(load_button, c);
-
-               close_button = new JButton("Close");
-               close_button.addActionListener(this);
-               close_button.setActionCommand("close");
-
-               c.fill = GridBagConstraints.NONE;
-               c.anchor = GridBagConstraints.CENTER;
-               c.insets = i;
-               c.weightx = 1;
-               c.weighty = 0;
-
-               c.gridx = 1;
-               c.gridy = 4;
-               c.gridwidth = 1;
-               c.anchor = GridBagConstraints.CENTER;
-
-               pane.add(close_button, c);
-
-               JLabel  types_label = new JLabel("Map Types");
-               c.gridx = 2;
-               c.gridwidth = 2;
-               c.gridy = 2;
-               pane.add(types_label, c);
-
-               c.gridwidth = 1;
-
-               for (int type = AltosMap.maptype_hybrid; type <= AltosMap.maptype_terrain; type++) {
-                       maptypes[type] = new JCheckBox(AltosMap.maptype_labels[type],
-                                                      type == AltosMap.maptype_hybrid);
-                       c.gridx = 2 + (type >> 1);
-                       c.fill = GridBagConstraints.HORIZONTAL;
-                       c.gridy = (type & 1) + 3;
-                       pane.add(maptypes[type], c);
-               }
-
-               JLabel  min_zoom_label = new JLabel("Minimum Zoom");
-               c.gridx = 4;
-               c.gridy = 2;
-               pane.add(min_zoom_label, c);
-
-               min_zoom = new JComboBox<Integer>(zooms);
-               min_zoom.setSelectedItem(zooms[10]);
-               min_zoom.setEditable(false);
-               c.gridx = 5;
-               c.gridy = 2;
-               pane.add(min_zoom, c);
-
-               JLabel  max_zoom_label = new JLabel("Maximum Zoom");
-               c.gridx = 4;
-               c.gridy = 3;
-               pane.add(max_zoom_label, c);
-
-               max_zoom = new JComboBox<Integer>(zooms);
-               max_zoom.setSelectedItem(zooms[14]);
-               max_zoom.setEditable(false);
-               c.gridx = 5;
-               c.gridy = 3;
-               pane.add(max_zoom, c);
-
-               radius_label = new JLabel();
-
-               c.gridx = 4;
-               c.gridy = 4;
-               pane.add(radius_label, c);
-
-               radius = new JComboBox<Double>();
-               radius.setEditable(true);
-               c.gridx = 5;
-               c.gridy = 4;
-               pane.add(radius, c);
-
-               set_radius_values();
-
-               pack();
-               setLocationRelativeTo(owner);
-               setVisible(true);
-       }
-}
index a00e4a12f1fdc78a0e9b5dc927a3993e7ad3b627..d18006b584bc0a6797c1d9603848f61a243b1470 100644 (file)
@@ -57,8 +57,8 @@ altosuilib_JAVA = \
        AltosBTDeviceIterator.java \
        AltosBTManage.java \
        AltosBTKnown.java \
-       AltosUIMapNew.java \
-       AltosUIMapPreloadNew.java \
+       AltosUIMap.java \
+       AltosUIMapPreload.java \
        AltosUIFlightTab.java \
        AltosUIIndicator.java \
        AltosUIUnitsIndicator.java \
index d347fe4180be80c419a24aefc6934e79e97ee34e..2897e06a321cf6e0ac7a547e36c65a1e59985dc0 100644 (file)
@@ -72,7 +72,7 @@ public class TeleGPS
 
        JTabbedPane             pane;
 
-       AltosUIMapNew           map;
+       AltosUIMap              map;
        TeleGPSInfo             gps_info;
        TeleGPSState            gps_state;
        AltosInfoTable          info_table;
@@ -174,7 +174,7 @@ public class TeleGPS
        }
 
        void load_maps() {
-               new AltosUIMapPreloadNew(this);
+               new AltosUIMapPreload(this);
        }
 
        void disconnect() {
@@ -567,7 +567,7 @@ public class TeleGPS
                /* Make the tabbed pane use the rest of the window space */
                bag.add(pane, constraints(0, 3, GridBagConstraints.BOTH));
 
-               map = new AltosUIMapNew();
+               map = new AltosUIMap();
                pane.add(map.getName(), map);
                displays.add(map);
 
index 701a7e30164db82774fbaaab0cc6382a028fd59b..8e2f6627d8a369d98f60157478d1452964fe52d6 100644 (file)
@@ -38,7 +38,7 @@ public class TeleGPSGraphUI extends AltosUIFrame
        JTabbedPane             pane;
        AltosGraph              graph;
        AltosUIEnable           enable;
-       AltosUIMapNew           map;
+       AltosUIMap              map;
        AltosState              state;
        AltosFlightStats        stats;
        AltosGraphDataSet       graphDataSet;
@@ -69,7 +69,7 @@ public class TeleGPSGraphUI extends AltosUIFrame
                graph = new AltosGraph(enable, stats, graphDataSet);
                statsTable = new AltosFlightStatsTable(stats);
 
-               map = new AltosUIMapNew();
+               map = new AltosUIMap();
 
                pane.add("Graph", graph.panel);
                pane.add("Configure Graph", enable);