Merge branch 'buttonbox' of git://git.gag.com/fw/altos into buttonbox
[fw/altos] / ao-tools / altosui / AltosSiteMap.java
1 /*
2  * Copyright © 2010 Anthony Towns <aj@erisian.com.au>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 package altosui;
19
20 import java.awt.*;
21 import java.awt.image.*;
22 import java.awt.event.*;
23 import javax.swing.*;
24 import javax.imageio.ImageIO;
25 import javax.swing.table.*;
26 import java.io.*;
27 import java.util.*;
28 import java.text.*;
29 import java.util.prefs.*;
30 import java.lang.Math;
31 import java.awt.geom.Point2D;
32 import java.awt.geom.Line2D;
33
34 public class AltosSiteMap extends JComponent implements AltosFlightDisplay {
35     public void reset() {
36         // nothing
37     }
38     public void show(AltosState state, int crc_errors) {
39         for (int x = 0; x < mapTiles.length; x++) {
40             mapTiles[x].show(state, crc_errors);
41         }
42     }
43   
44     AltosSiteMapTile [] mapTiles = new AltosSiteMapTile[9];
45
46     public AltosSiteMap() {
47
48         GridBagLayout layout = new GridBagLayout();
49         setLayout(layout);
50
51         GridBagConstraints c = new GridBagConstraints();
52         c.anchor = GridBagConstraints.CENTER;
53         c.fill = GridBagConstraints.BOTH;
54
55         for (int x = 0; x < 9; x++) {
56             c.gridx = x % 3; c.gridy = x / 3;
57             mapTiles[x] = new AltosSiteMapTile((x%3)-1, (x/3)-1);
58             layout.setConstraints(mapTiles[x], c);
59             add(mapTiles[x]);
60         }
61     }
62 }
63