summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2010-11-21 15:13:35 +1000
committerAnthony Towns <aj@erisian.com.au>2010-11-21 15:13:35 +1000
commit0393830f85da5efc96bbdf0d9769b66019c34b33 (patch)
treef4ebfbae7c3c64b97e07ad61c08157e21601bbfa
parenta08b2a6363c194195db92029743f6612676373ce (diff)
AltosSiteMap: limit nr of tiles to 200x200
-rw-r--r--ao-tools/altosui/AltosSiteMap.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/ao-tools/altosui/AltosSiteMap.java b/ao-tools/altosui/AltosSiteMap.java
index 0375128e..b2d79043 100644
--- a/ao-tools/altosui/AltosSiteMap.java
+++ b/ao-tools/altosui/AltosSiteMap.java
@@ -40,6 +40,8 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
static final int px_size = 512;
+ static final int MAX_TILE_DELTA = 100;
+
private static Point2D.Double translatePoint(Point2D.Double p,
Point2D.Double d)
{
@@ -282,15 +284,22 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {
}
private void addTileAt(AltosSiteMapTile tile, Point offset) {
+ if (Math.abs(offset.x) >= MAX_TILE_DELTA ||
+ Math.abs(offset.y) >= MAX_TILE_DELTA)
+ {
+ System.out.printf("Rocket too far away from pad (tile %d,%d)\n",
+ offset.x, offset.y);
+ return;
+ }
+
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.BOTH;
-
// put some space between the map tiles, debugging only
// c.insets = new Insets(5, 5, 5, 5);
- //
- c.gridx = offset.x + 100;
- c.gridy = offset.y + 100;
+
+ c.gridx = offset.x + MAX_TILE_DELTA;
+ c.gridy = offset.y + MAX_TILE_DELTA;
layout.setConstraints(tile, c);
comp.add(tile);
}