Changeset 33030 in osm for applications/editors/josm/plugins/seachartedit/src/panels/ShowFrame.java
- Timestamp:
- 2016-10-09T04:25:33+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/seachartedit/src/panels/ShowFrame.java
r32231 r33030 25 25 import render.Renderer; 26 26 import s57.S57map; 27 import s57.S57map.*; 27 import s57.S57map.Feature; 28 import s57.S57map.Snode; 28 29 29 30 public class ShowFrame extends JFrame { 30 31 S57map showMap;32 Picture picture;33 31 34 class Picture extends JPanel implements ChartContext { 32 S57map showMap; 33 Picture picture; 35 34 36 public void drawPicture(OsmPrimitive osm, S57map map) { 37 long id; 38 Feature feature; 39 40 id = osm.getUniqueId(); 41 feature = map.index.get(id); 42 showMap = new S57map(true); 43 showMap.nodes = map.nodes; 44 showMap.edges = map.edges; 45 showMap.index = map.index; 46 if (feature != null) { 47 showMap.features.put(feature.type, new ArrayList<Feature>()); 48 showMap.features.get(feature.type).add(feature); 49 } 50 repaint(); 51 } 52 53 public void paintComponent(Graphics g) { 54 Graphics2D g2 = (Graphics2D)g; 55 g2.setBackground(new Color(0xb5d0d0)); 56 Rectangle rect = new Rectangle(0, 0, 300, 300); 57 g2.clearRect(rect.x, rect.y, rect.width, rect.height); 58 Renderer.reRender(g2, rect, 16, 32, showMap, this); 59 } 35 class Picture extends JPanel implements ChartContext { 60 36 61 publicPoint2D getPoint(Snode coord) {62 return new Point2D.Double(150, 150);63 } 37 public void drawPicture(OsmPrimitive osm, S57map map) { 38 long id; 39 Feature feature; 64 40 65 public double mile(Feature feature) { 66 return 1000; 67 } 41 id = osm.getUniqueId(); 42 feature = map.index.get(id); 43 showMap = new S57map(true); 44 showMap.nodes = map.nodes; 45 showMap.edges = map.edges; 46 showMap.index = map.index; 47 if (feature != null) { 48 showMap.features.put(feature.type, new ArrayList<Feature>()); 49 showMap.features.get(feature.type).add(feature); 50 } 51 repaint(); 52 } 68 53 69 @Override 70 public boolean clip() { 71 // TODO Auto-generated method stub 72 return false; 73 } 54 @Override 55 public void paintComponent(Graphics g) { 56 Graphics2D g2 = (Graphics2D) g; 57 g2.setBackground(new Color(0xb5d0d0)); 58 Rectangle rect = new Rectangle(0, 0, 300, 300); 59 g2.clearRect(rect.x, rect.y, rect.width, rect.height); 60 Renderer.reRender(g2, rect, 16, 32, showMap, this); 61 } 74 62 75 @Override 76 public Color background(S57map map) { 77 // TODO Auto-generated method stub 78 return null; 79 } 63 @Override 64 public Point2D getPoint(Snode coord) { 65 return new Point2D.Double(150, 150); 66 } 80 67 81 @Override 82 public RuleSet ruleset() { 83 // TODO Auto-generated method stub 84 return null; 85 } 86 } 68 @Override 69 public double mile(Feature feature) { 70 return 1000; 71 } 87 72 88 public ShowFrame(String title) { 89 super(title); 90 picture = new Picture(); 91 picture.setVisible(true); 92 add(picture); 93 pack(); 94 } 95 96 public void showFeature(OsmPrimitive osm, S57map map) { 97 picture.drawPicture(osm, map); 98 } 73 @Override 74 public boolean clip() { 75 // TODO Auto-generated method stub 76 return false; 77 } 78 79 @Override 80 public Color background(S57map map) { 81 // TODO Auto-generated method stub 82 return null; 83 } 84 85 @Override 86 public RuleSet ruleset() { 87 // TODO Auto-generated method stub 88 return null; 89 } 90 } 91 92 public ShowFrame(String title) { 93 super(title); 94 picture = new Picture(); 95 picture.setVisible(true); 96 add(picture); 97 pack(); 98 } 99 100 public void showFeature(OsmPrimitive osm, S57map map) { 101 picture.drawPicture(osm, map); 102 } 99 103 }
Note:
See TracChangeset
for help on using the changeset viewer.
