Ignore:
Timestamp:
2014-07-22T00:17:42+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10292 - allow to load a session with NMEA file + enhance reading/writing unit tests for sessions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/NMEAImporter.java

    r7033 r7326  
    2020import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2121import org.openstreetmap.josm.gui.util.GuiHelper;
     22import org.openstreetmap.josm.io.GpxImporter.GpxImporterData;
    2223
     24/**
     25 * File importer allowing to import NMEA-0183 files (*.nmea/nme/nma/log/txt files).
     26 * @since 1637
     27 */
    2328public class NMEAImporter extends FileImporter {
    2429
     30    /**
     31     * The NMEA file filter (*.nmea *.nme *.nma *.log *.txt files).
     32     */
    2533    public static final ExtensionFileFilter FILE_FILTER = new ExtensionFileFilter(
    2634            "nmea,nme,nma,log,txt", "nmea", tr("NMEA-0183 Files") + " (*.nmea *.nme *.nma *.log *.txt)");
     
    4250                final GpxLayer gpxLayer = new GpxLayer(r.data, fn, true);
    4351                final File fileFinal = file;
    44    
     52
    4553                GuiHelper.runInEDT(new Runnable() {
    4654                    @Override
     
    8896        }
    8997    }
     98
     99    public static GpxImporterData loadLayers(InputStream is, final File associatedFile,
     100            final String gpxLayerName, String markerLayerName) throws IOException {
     101        final NmeaReader r = new NmeaReader(is);
     102        final boolean parsedProperly = r.getNumberOfCoordinates() > 0;
     103        r.data.storageFile = associatedFile;
     104        return GpxImporter.loadLayers(r.data, parsedProperly, gpxLayerName, markerLayerName);
     105    }
    90106}
Note: See TracChangeset for help on using the changeset viewer.