Changeset 29215 in osm for applications/editors/josm/plugins/smed2/src/s57
- Timestamp:
- 2013-01-29T21:49:08+01:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/smed2/src/s57
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed2/src/s57/S57att.java
r29209 r29215 246 246 247 247 public static Att enumAttribute(String attribute, Obj obj) { // Convert OSeaM attribute string to OSeaM enumeration 248 if ((attribute != null) && (attribute.length() > 0)) {248 if ((attribute != null) && !attribute.isEmpty()) { 249 249 for (Att att : AttStr.keySet()) { 250 250 if (AttStr.get(att).equals(attribute) && (verifyAttribute(obj, att) != Ver.NON )) -
applications/editors/josm/plugins/smed2/src/s57/S57dat.java
r29074 r29215 7 7 import java.io.File; 8 8 import java.io.FileInputStream; 9 import java.io.File NotFoundException;9 import java.io.FileOutputStream; 10 10 import java.io.IOException; 11 11 … … 66 66 private File importFile; 67 67 private FileInputStream inp; 68 private File exportFile; 69 private FileOutputStream outp; 68 70 private OsmDataLayer layer; 69 71 private DataSet data; … … 74 76 if (e.getSource() == importButton) { 75 77 readFile(); 76 Smed2Action.panelS57.setVisible( false);77 Smed2Action.panelMain.setVisible( true);78 Smed2Action.panelS57.setVisible(true); 79 Smed2Action.panelMain.setVisible(false); 78 80 PanelMain.messageBar.setText("File imported"); 81 } 82 } 83 }; 84 private JButton exportButton; 85 private ActionListener alExport = new ActionListener() { 86 public void actionPerformed(java.awt.event.ActionEvent e) { 87 if (e.getSource() == exportButton) { 88 writeFile(); 89 Smed2Action.panelS57.setVisible(true); 90 Smed2Action.panelMain.setVisible(false); 91 PanelMain.messageBar.setText("File exported"); 79 92 } 80 93 } … … 89 102 Smed2Action.panelS57.setVisible(false); 90 103 Smed2Action.panelMain.setVisible(true); 91 PanelMain.messageBar.setText(" Importcancelled");104 PanelMain.messageBar.setText("Operation cancelled"); 92 105 } 93 106 } … … 108 121 importButton.addActionListener(alImport); 109 122 add(importButton); 123 exportButton = new JButton(); 124 exportButton.setBounds(370, 430, 100, 20); 125 exportButton.setText(tr("Export")); 126 exportButton.addActionListener(alExport); 127 add(exportButton); 110 128 } 111 129 … … 120 138 Smed2Action.panelMain.setVisible(false); 121 139 Smed2Action.panelS57.setVisible(true); 140 } 141 142 public void startExport(File file) { 143 exportFile = file; 144 try { 145 outp = new FileOutputStream(file); 146 } catch (IOException e) { 147 PanelMain.messageBar.setText("Failed to open file"); 148 return; 149 } 150 Smed2Action.panelMain.setVisible(false); 151 Smed2Action.panelS57.setVisible(true); 152 } 153 154 private void writeFile() { 122 155 } 123 156 -
applications/editors/josm/plugins/smed2/src/s57/S57obj.java
r29209 r29215 150 150 static { 151 151 for (Map.Entry<Obj, String> entry : ObjStr.entrySet()) { 152 StrObj.put(entry.getValue(), entry.getKey()); 152 if (!entry.getValue().isEmpty()) 153 StrObj.put(entry.getValue(), entry.getKey()); 153 154 } 154 155 } … … 173 174 174 175 public static Obj enumType(String type) { // Convert OSeaM object string to OSeaM object enumeration 175 if (StrObj.containsKey(type)) 176 if ((type != null) && !type.isEmpty() && (StrObj.containsKey(type))) 176 177 return StrObj.get(type); 177 178 else
Note:
See TracChangeset
for help on using the changeset viewer.