Changeset 2062 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2009-09-05T11:08:38+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/GpxImporter.java
r1814 r2062 10 10 import java.io.InputStream; 11 11 import java.util.zip.GZIPInputStream; 12 13 import javax.swing.SwingUtilities; 12 14 13 15 import org.openstreetmap.josm.Main; … … 23 25 } 24 26 25 @Override public void importData( File file) throws IOException {26 String fn = file.getName();27 @Override public void importData(final File file) throws IOException { 28 final String fn = file.getName(); 27 29 28 30 try { 29 GpxReader r = null;30 31 InputStream is; 31 32 if (file.getName().endsWith(".gpx.gz")) { … … 44 45 } 45 46 } 46 r = new GpxReader(is, file.getAbsoluteFile().getParentFile());47 final GpxReader r = new GpxReader(is, file.getAbsoluteFile().getParentFile()); 47 48 r.data.storageFile = file; 48 GpxLayer gpxLayer = new GpxLayer(r.data, fn, true); 49 Main.main.addLayer(gpxLayer); 50 if (Main.pref.getBoolean("marker.makeautomarkers", true)) { 51 MarkerLayer ml = new MarkerLayer(r.data, tr("Markers from {0}", fn), file, gpxLayer); 52 if (ml.data.size() > 0) { 53 Main.main.addLayer(ml); 49 final GpxLayer gpxLayer = new GpxLayer(r.data, fn, true); 50 51 // FIXME: remove UI stuff from the IO subsystem 52 // 53 Runnable task = new Runnable() { 54 public void run() { 55 Main.main.addLayer(gpxLayer); 56 if (Main.pref.getBoolean("marker.makeautomarkers", true)) { 57 MarkerLayer ml = new MarkerLayer(r.data, tr("Markers from {0}", fn), file, gpxLayer); 58 if (ml.data.size() > 0) { 59 Main.main.addLayer(ml); 60 } 61 } 54 62 } 63 }; 64 if (SwingUtilities.isEventDispatchThread()) { 65 task.run(); 66 } else { 67 SwingUtilities.invokeLater(task); 55 68 } 56 69 } catch (FileNotFoundException e) {
Note:
See TracChangeset
for help on using the changeset viewer.