altosuilib: Leave some map debug code around for the future
authorKeith Packard <keithp@keithp.com>
Sun, 7 Oct 2018 21:11:03 +0000 (14:11 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 7 Oct 2018 21:12:02 +0000 (14:12 -0700)
Displays lat/lon on each map tile. Commented out for production use.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosuilib/AltosUIMap.java

index b375e1682d7ea37d863b05b3cc7478ae22b1eef9..8dfdba64c8bca8da70beb0f8462e6c2e3882341c 100644 (file)
@@ -264,6 +264,21 @@ public class AltosUIMap extends JComponent implements AltosFlightDisplay, AltosM
 
                        if (image != null) {
                                g.drawImage(image, point.x, point.y, null);
+/*
+ * Useful when debugging map fetching problems
+ *
+                               String message = String.format("%.6f %.6f", center.lat, center.lon);
+                               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.RED);
+                               g.drawString(message, (float) point_double.x + x, (float) point_double.y + y);
+*/
                        } else {
                                g.setColor(Color.GRAY);
                                g.fillRect(point.x, point.y, px_size, px_size);