- Timestamp:
- 2008-07-28T09:31:34+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ExtensionFileFilter.java
r627 r737 21 21 public static final int OSM = 0; 22 22 public static final int GPX = 1; 23 public static final int NMEA = 2; 23 24 24 25 public static ExtensionFileFilter[] filters = { 25 26 new ExtensionFileFilter("osm,xml", "osm", tr("OSM Server Files (.osm .xml)")), 26 27 new ExtensionFileFilter("gpx,gpx.gz", "gpx", tr("GPX Files (.gpx .gpx.gz)")), 28 new ExtensionFileFilter("nmea", "nmea", tr("NMEA-0183 Files (.nmea)")), 27 29 }; 28 30 -
trunk/src/org/openstreetmap/josm/actions/OpenAction.java
r733 r737 18 18 import org.openstreetmap.josm.Main; 19 19 import org.openstreetmap.josm.data.osm.DataSet; 20 import org.openstreetmap.josm.gui.layer.GpxLayer; 20 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 21 import org.openstreetmap.josm.gui.layer.GpxLayer;22 22 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 23 import org.openstreetmap.josm.io.GpxReader; 24 import org.openstreetmap.josm.io.NmeaReader; 23 25 import org.openstreetmap.josm.io.OsmReader; 24 import org.openstreetmap.josm.io.GpxReader;25 26 import org.xml.sax.SAXException; 26 27 … … 56 57 if (asGpxData(file.getName())) 57 58 openFileAsGpx(file); 59 else if (asNmeaData(file.getName())) 60 openFileAsNmea(file); 58 61 else 59 62 openAsData(file); … … 103 106 } 104 107 108 private void openFileAsNmea(File file) throws IOException, FileNotFoundException { 109 String fn = file.getName(); 110 if (ExtensionFileFilter.filters[ExtensionFileFilter.NMEA].acceptName(fn)) { 111 NmeaReader r = new NmeaReader(new FileInputStream(file), file.getAbsoluteFile().getParentFile()); 112 r.data.storageFile = file; 113 GpxLayer gpxLayer = new GpxLayer(r.data, fn); 114 Main.main.addLayer(gpxLayer); 115 if (Main.pref.getBoolean("marker.makeautomarkers", true)) { 116 MarkerLayer ml = new MarkerLayer(r.data, tr("Markers from {0}", fn), file, gpxLayer); 117 if (ml.data.size() > 0) { 118 Main.main.addLayer(ml); 119 } 120 } 121 122 } else { 123 throw new IllegalStateException(); 124 } 125 } 105 126 106 127 private boolean asGpxData(String fn) { … … 108 129 } 109 130 131 private boolean asNmeaData(String fn) { 132 return ExtensionFileFilter.filters[ExtensionFileFilter.NMEA].acceptName(fn); 133 } 134 110 135 111 136 }
Note:
See TracChangeset
for help on using the changeset viewer.