1 | package panels;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 | import java.awt.Graphics;
|
---|
5 | import java.awt.Graphics2D;
|
---|
6 | import java.awt.geom.Point2D;
|
---|
7 | import java.util.ArrayList;
|
---|
8 |
|
---|
9 | import javax.swing.JFrame;
|
---|
10 |
|
---|
11 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
12 |
|
---|
13 | import seamap.MapHelper;
|
---|
14 | import seamap.Renderer;
|
---|
15 | import seamap.SeaMap;
|
---|
16 | import seamap.SeaMap.*;
|
---|
17 |
|
---|
18 | public class ShowFrame extends JFrame implements MapHelper {
|
---|
19 |
|
---|
20 | public SeaMap showMap;
|
---|
21 |
|
---|
22 | public ShowFrame(String title) {
|
---|
23 | super(title);
|
---|
24 | }
|
---|
25 |
|
---|
26 | public void showFeature(OsmPrimitive osm, SeaMap map) {
|
---|
27 | long id;
|
---|
28 | Feature feature;
|
---|
29 |
|
---|
30 | id = osm.getUniqueId();
|
---|
31 | feature = map.index.get(id);
|
---|
32 | showMap = new SeaMap();
|
---|
33 | showMap.nodes = map.nodes;
|
---|
34 | showMap.edges = map.edges;
|
---|
35 | showMap.areas = map.areas;
|
---|
36 | showMap.index = map.index;
|
---|
37 | if (feature != null) {
|
---|
38 | showMap.features.put(feature.type, new ArrayList<Feature>());
|
---|
39 | showMap.features.get(feature.type).add(feature);
|
---|
40 | }
|
---|
41 | repaint();
|
---|
42 | }
|
---|
43 |
|
---|
44 | @Override
|
---|
45 | public Point2D getPoint(Snode coord) {
|
---|
46 | return new Point2D.Double(150, 150);
|
---|
47 | }
|
---|
48 |
|
---|
49 | public void paint(Graphics g) {
|
---|
50 | Graphics2D g2 = (Graphics2D)g;
|
---|
51 | g2.setBackground(new Color(0xb5d0d0));
|
---|
52 | g2.clearRect(0, 0, 300, 300);
|
---|
53 | Renderer.reRender(g2, 16, 32, showMap, this);
|
---|
54 | }
|
---|
55 |
|
---|
56 | }
|
---|