Changeset 7033 in josm for trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
- Timestamp:
- 2014-05-01T02:34:43+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
r6798 r7033 7 7 import java.io.FileInputStream; 8 8 import java.io.IOException; 9 import java.io.InputStream; 9 10 10 11 import javax.swing.JOptionPane; … … 35 36 public void importData(File file, ProgressMonitor progressMonitor) throws IOException { 36 37 final String fn = file.getName(); 37 final NmeaReader r = new NmeaReader(new FileInputStream(file)); 38 if (r.getNumberOfCoordinates() > 0) { 39 r.data.storageFile = file; 40 final GpxLayer gpxLayer = new GpxLayer(r.data, fn, true); 41 final File fileFinal = file; 42 43 GuiHelper.runInEDT(new Runnable() { 44 @Override 45 public void run() { 46 Main.main.addLayer(gpxLayer); 47 if (Main.pref.getBoolean("marker.makeautomarkers", true)) { 48 MarkerLayer ml = new MarkerLayer(r.data, tr("Markers from {0}", fn), fileFinal, gpxLayer); 49 if (!ml.data.isEmpty()) { 50 Main.main.addLayer(ml); 38 try (InputStream fis = new FileInputStream(file)) { 39 final NmeaReader r = new NmeaReader(fis); 40 if (r.getNumberOfCoordinates() > 0) { 41 r.data.storageFile = file; 42 final GpxLayer gpxLayer = new GpxLayer(r.data, fn, true); 43 final File fileFinal = file; 44 45 GuiHelper.runInEDT(new Runnable() { 46 @Override 47 public void run() { 48 Main.main.addLayer(gpxLayer); 49 if (Main.pref.getBoolean("marker.makeautomarkers", true)) { 50 MarkerLayer ml = new MarkerLayer(r.data, tr("Markers from {0}", fn), fileFinal, gpxLayer); 51 if (!ml.data.isEmpty()) { 52 Main.main.addLayer(ml); 53 } 51 54 } 52 55 } 53 } 54 }); 56 }); 57 } 58 showNmeaInfobox(r.getNumberOfCoordinates() > 0, r); 55 59 } 56 showNmeaInfobox(r.getNumberOfCoordinates() > 0, r);57 60 } 58 61
Note:
See TracChangeset
for help on using the changeset viewer.