From ddef3e4ec1b3ff86b164f83807c34c2a78f73eb8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 17 Jul 2011 15:45:07 -0700 Subject: [PATCH 1/1] altosui: Mark preload site location with red circles (like launch) Just to show where on the map the official launch location is. Signed-off-by: Keith Packard --- altosui/AltosSiteMap.java | 10 ++++++++++ altosui/AltosSiteMapPreload.java | 1 + altosui/AltosSiteMapTile.java | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/altosui/AltosSiteMap.java b/altosui/AltosSiteMap.java index 188902e9..b3fb3c54 100644 --- a/altosui/AltosSiteMap.java +++ b/altosui/AltosSiteMap.java @@ -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); diff --git a/altosui/AltosSiteMapPreload.java b/altosui/AltosSiteMapPreload.java index 972765ae..5d437e17 100644 --- a/altosui/AltosSiteMapPreload.java +++ b/altosui/AltosSiteMapPreload.java @@ -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(); diff --git a/altosui/AltosSiteMapTile.java b/altosui/AltosSiteMapTile.java index 66da7c54..9e62bb47 100644 --- a/altosui/AltosSiteMapTile.java +++ b/altosui/AltosSiteMapTile.java @@ -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); -- 2.30.2