altosui: Mark preload site location with red circles (like launch)
authorKeith Packard <keithp@keithp.com>
Sun, 17 Jul 2011 22:45:07 +0000 (15:45 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 17 Jul 2011 22:45:07 +0000 (15:45 -0700)
Just to show where on the map the official launch location is.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosSiteMap.java
altosui/AltosSiteMapPreload.java
altosui/AltosSiteMapTile.java

index 188902e9e535f0ceb3e9fc3dd8852d6f4c8b1569..b3fb3c5470db9824d94e59ca329a377415c158e8 100644 (file)
@@ -320,6 +320,16 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
                last_state = state.state;
        }
 
+       public void draw_circle(double lat, double lon) {
+               final Point2D.Double pt = pt(lat, lon);
+
+               for (Point offset : mapTiles.keySet()) {
+                       AltosSiteMapTile tile = mapTiles.get(offset);
+                       Point2D.Double ref = translatePoint(pt, tileCoordOffset(offset));
+                       tile.draw_circle(ref);
+               }
+       }
+
        private AltosSiteMapTile createTile(Point offset) {
                AltosSiteMapTile tile = new AltosSiteMapTile(px_size);
                mapTiles.put(offset, tile);
index 972765aea446fc28e80b94e81ecee9fe7175003f..5d437e175f4863d47eb79d8d1cf32913951d1741 100644 (file)
@@ -312,6 +312,7 @@ public class AltosSiteMapPreload extends JDialog implements ActionListener, Item
                                        final double    latitude = lat.get_value();
                                        final double    longitude = lon.get_value();
                                        map.setBaseLocation(latitude,longitude);
+                                       map.draw_circle(latitude,longitude);
                                        loading = true;
                                        bgLoad thread = new bgLoad(map);
                                        thread.start();
index 66da7c54f01db2362941610adaf68a71ad91a91d..9e62bb47c751fdfa967ae358af80467cbd443409 100644 (file)
@@ -43,6 +43,10 @@ public class AltosSiteMapTile extends JLayeredPane {
 
        public void clearMap() {
                fillLabel(mapLabel, Color.GRAY, px_size);
+               g2d = fillLabel(draw, new Color(127,127,127,0), px_size);
+               g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                                    RenderingHints.VALUE_ANTIALIAS_ON);
+               g2d.setStroke(new BasicStroke(6, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
        }
 
        static Color stateColors[] = {
@@ -85,6 +89,13 @@ public class AltosSiteMapTile extends JLayeredPane {
                repaint();
        }
 
+       public void draw_circle(Point2D.Double pt) {
+               g2d.setColor(Color.RED);
+               g2d.drawOval((int)pt.x-5, (int)pt.y-5, 10, 10);
+               g2d.drawOval((int)pt.x-20, (int)pt.y-20, 40, 40);
+               g2d.drawOval((int)pt.x-35, (int)pt.y-35, 70, 70);
+       }
+
        public static Graphics2D fillLabel(JLabel l, Color c, int px_size) {
                BufferedImage img = new BufferedImage(px_size, px_size,
                                                      BufferedImage.TYPE_INT_ARGB);