Changeset 30013 in osm for applications/editors/josm/plugins/smed2/src/panels/ShowFrame.java
- Timestamp:
- 2013-10-07T16:48:51+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/panels/ShowFrame.java
r30012 r30013 8 8 9 9 import javax.swing.JFrame; 10 import javax.swing.JPanel; 10 11 11 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 16 17 import seamap.SeaMap.*; 17 18 18 public class ShowFrame extends JFrame implements MapHelper{19 public class ShowFrame extends JFrame { 19 20 20 public SeaMap showMap; 21 class Picture extends JPanel implements MapHelper { 22 23 public void drawPicture(OsmPrimitive osm, SeaMap map) { 24 long id; 25 Feature feature; 26 27 id = osm.getUniqueId(); 28 feature = map.index.get(id); 29 showMap = new SeaMap(); 30 showMap.nodes = map.nodes; 31 showMap.edges = map.edges; 32 showMap.areas = map.areas; 33 showMap.index = map.index; 34 if (feature != null) { 35 showMap.features.put(feature.type, new ArrayList<Feature>()); 36 showMap.features.get(feature.type).add(feature); 37 } 38 repaint(); 39 } 40 41 public void paintComponent(Graphics g) { 42 Graphics2D g2 = (Graphics2D)g; 43 g2.setBackground(new Color(0xb5d0d0)); 44 g2.clearRect(0, 0, 300, 300); 45 Renderer.reRender(g2, 16, 32, showMap, this); 46 } 47 48 @Override 49 public Point2D getPoint(Snode coord) { 50 return new Point2D.Double(150, 150); 51 } 52 } 53 54 SeaMap showMap; 55 Picture picture; 21 56 22 57 public ShowFrame(String title) { 23 58 super(title); 59 picture = new Picture(); 60 picture.setVisible(true); 61 add(picture); 62 pack(); 24 63 } 25 64 26 65 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(); 66 picture.drawPicture(osm, map); 42 67 } 43 68 44 @Override45 public Point2D getPoint(Snode coord) {46 return new Point2D.Double(150, 150);47 }48 69 49 public void paint(Graphics g) {50 super.paint(g);51 Graphics2D g2 = (Graphics2D)g;52 g2.setBackground(new Color(0xb5d0d0));53 g2.clearRect(0, 0, 300, 300);54 Renderer.reRender(g2, 16, 32, showMap, this);55 }56 57 70 }
Note:
See TracChangeset
for help on using the changeset viewer.