Class GpxImporter
- java.lang.Object
-
- org.openstreetmap.josm.gui.io.importexport.FileImporter
-
- org.openstreetmap.josm.gui.io.importexport.GpxImporter
-
- All Implemented Interfaces:
java.lang.Comparable<FileImporter>
public class GpxImporter extends FileImporter
File importer allowing to import GPX files (*.gpx/gpx.gz files).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GpxImporter.GpxImporterData
Utility class containing imported GPX and marker layers, and a task to run after they are added to MapView.
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.gui.io.importexport.FileImporter
filter, options
-
-
Constructor Summary
Constructors Constructor Description GpxImporter()
Constructs a newGpxImporter
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addLayers(GpxImporter.GpxImporterData data)
Adds the specified GPX and marker layers to Map.mainstatic ExtensionFileFilter
getFileFilter()
Returns a GPX file filter (*.gpx and *.gpx.gz files).void
importData(java.io.File file, ProgressMonitor progressMonitor)
Needs to be implemented if isBatchImporter() returns false.static GpxImporter.GpxImporterData
loadLayers(java.io.InputStream is, java.io.File associatedFile, java.lang.String gpxLayerName, ProgressMonitor progressMonitor)
Replies the new GPX and marker layers corresponding to the specified GPX file.static GpxImporter.GpxImporterData
loadLayers(GpxData data, boolean parsedProperly, java.lang.String gpxLayerName)
Replies the new GPX and marker layers corresponding to the specified GPX data.-
Methods inherited from class org.openstreetmap.josm.gui.io.importexport.FileImporter
acceptFile, compareTo, getPriority, importData, importDataHandleExceptions, importDataHandleExceptions, isBatchImporter, isEnabled, setEnabled, setOptions
-
-
-
-
Constructor Detail
-
GpxImporter
public GpxImporter()
Constructs a newGpxImporter
.
-
-
Method Detail
-
getFileFilter
public static ExtensionFileFilter getFileFilter()
Returns a GPX file filter (*.gpx and *.gpx.gz files).- Returns:
- a GPX file filter
-
importData
public void importData(java.io.File file, ProgressMonitor progressMonitor) throws java.io.IOException
Description copied from class:FileImporter
Needs to be implemented if isBatchImporter() returns false.- Overrides:
importData
in classFileImporter
- Parameters:
file
- file to importprogressMonitor
- progress monitor- Throws:
java.io.IOException
- if any I/O error occurs
-
addLayers
public static void addLayers(GpxImporter.GpxImporterData data)
Adds the specified GPX and marker layers to Map.main- Parameters:
data
- The layers to add- See Also:
loadLayers(org.openstreetmap.josm.data.gpx.GpxData, boolean, java.lang.String)
-
loadLayers
public static GpxImporter.GpxImporterData loadLayers(GpxData data, boolean parsedProperly, java.lang.String gpxLayerName)
Replies the new GPX and marker layers corresponding to the specified GPX data.- Parameters:
data
- The GPX dataparsedProperly
- True if GPX data has been properly parsed byGpxReader.parse(boolean)
gpxLayerName
- The GPX layer name- Returns:
- the new GPX and marker layers corresponding to the specified GPX data, to be used with
addLayers(org.openstreetmap.josm.gui.io.importexport.GpxImporter.GpxImporterData)
- See Also:
addLayers(org.openstreetmap.josm.gui.io.importexport.GpxImporter.GpxImporterData)
-
loadLayers
public static GpxImporter.GpxImporterData loadLayers(java.io.InputStream is, java.io.File associatedFile, java.lang.String gpxLayerName, ProgressMonitor progressMonitor) throws java.io.IOException
Replies the new GPX and marker layers corresponding to the specified GPX file.- Parameters:
is
- input stream to GPX dataassociatedFile
- GPX filegpxLayerName
- The GPX layer nameprogressMonitor
- The progress monitor- Returns:
- the new GPX and marker layers corresponding to the specified GPX file
- Throws:
java.io.IOException
- if an I/O error occurs
-
-