Changeset 30285 in osm for applications/editors/josm/plugins/smed2/src/panels
- Timestamp:
- 2014-02-17T14:27:01+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/panels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/panels/PanelMain.java
r30269 r30285 1 /* Copyright 2014 Malcolm Herring 2 * 3 * This is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, version 3 of the License. 6 * 7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. 8 */ 9 1 10 package panels; 2 11 … … 9 18 import java.awt.event.ActionListener; 10 19 import java.awt.image.BufferedImage; 11 import java.io.File; 12 import java.util.ArrayList; 13 import java.util.Iterator; 20 import java.io.*; 14 21 15 22 import javax.imageio.ImageIO; … … 20 27 import org.openstreetmap.josm.Main; 21 28 22 import s57.S57att.Att; 23 import s57.S57obj.Obj; 24 import s57.S57val.*; 29 import s57.S57att.*; 30 import s57.S57obj.*; 25 31 import s57.S57map.*; 26 32 import render.Renderer; … … 29 35 public class PanelMain extends JPanel { 30 36 31 Smed2Action dlg;32 37 BufferedImage img; 33 38 int w, h, z, f; … … 42 47 }; 43 48 private JButton importButton = null; 44 finalJFileChooser ifc = new JFileChooser();49 JFileChooser ifc = new JFileChooser(Main.pref.get("smed2plugin.file")); 45 50 private ActionListener alImport = new ActionListener() { 46 51 public void actionPerformed(java.awt.event.ActionEvent e) { 47 52 if (e.getSource() == importButton) { 48 messageBar.setText("Select file"); 49 int returnVal = ifc.showOpenDialog(Main.parent); 50 if (returnVal == JFileChooser.APPROVE_OPTION) { 51 // xxx.startImport(ifc.getSelectedFile()); 52 } else { 53 messageBar.setText(""); 54 } 55 } 53 Smed2Action.panelS57.setVisible(true); 54 messageBar.setText("Select S-57 ENC file for import"); 55 int returnVal = ifc.showOpenDialog(Main.parent); 56 if (returnVal == JFileChooser.APPROVE_OPTION) { 57 try { 58 Main.pref.put("smed2plugin.file", ifc.getSelectedFile().getPath()); 59 Smed2Action.panelS57.startImport(ifc.getSelectedFile()); 60 } catch (IOException e1) { 61 Smed2Action.panelS57.setVisible(false); 62 messageBar.setText("IO Exception"); 63 } 64 } else { 65 Smed2Action.panelS57.setVisible(false); 66 messageBar.setText(""); 67 } 68 } 56 69 } 57 70 }; … … 62 75 public void actionPerformed(java.awt.event.ActionEvent e) { 63 76 if (e.getSource() == exportButton) { 64 messageBar.setText("Select file"); 77 Smed2Action.panelS57.setVisible(true); 78 messageBar.setText("Select S-57 ENC file for export"); 65 79 int returnVal = efc.showOpenDialog(Main.parent); 66 80 if (returnVal == JFileChooser.APPROVE_OPTION) { 67 // xxx.startExport(efc.getSelectedFile()); 81 try { 82 Smed2Action.panelS57.startExport(efc.getSelectedFile()); 83 } catch (IOException e1) { 84 Smed2Action.panelS57.setVisible(false); 85 messageBar.setText("IO Exception"); 86 } 68 87 } else { 69 messageBar.setText(""); 88 Smed2Action.panelS57.setVisible(false); 89 messageBar.setText(""); 70 90 } 71 91 } … … 73 93 }; 74 94 75 public PanelMain(Smed2Action dia) { 76 dlg = dia; 95 public PanelMain() { 77 96 setLayout(null); 78 97 setSize(new Dimension(480, 480)); … … 120 139 img = new BufferedImage(Integer.parseInt(wt.getText()), Integer.parseInt(ht.getText()), BufferedImage.TYPE_INT_ARGB); 121 140 Graphics2D g2 = img.createGraphics(); 122 Renderer.reRender(g2, Integer.parseInt(zt.getText()), Integer.parseInt(ft.getText()), dlg.map, dlg.rendering);141 Renderer.reRender(g2, Integer.parseInt(zt.getText()), Integer.parseInt(ft.getText()), Smed2Action.map, Smed2Action.rendering); 123 142 try { 124 143 ImageIO.write(img, "png", new File("/Users/mherring/Desktop/export.png")); -
applications/editors/josm/plugins/smed2/src/panels/ShowFrame.java
r30215 r30285 1 /* Copyright 2014 Malcolm Herring 2 * 3 * This is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, version 3 of the License. 6 * 7 * For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. 8 */ 9 1 10 package panels; 2 11
Note:
See TracChangeset
for help on using the changeset viewer.