Class OsmImporter
- java.lang.Object
-
- org.openstreetmap.josm.gui.io.importexport.FileImporter
-
- org.openstreetmap.josm.gui.io.importexport.OsmImporter
-
- All Implemented Interfaces:
java.lang.Comparable<FileImporter>
- Direct Known Subclasses:
GeoJSONImporter
,OsmPbfImporter
public class OsmImporter extends FileImporter
File importer that reads *.osm data files. (main storage format for OSM data in JOSM)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OsmImporter.OsmImporterData
Utility class containing imported OSM layer, and a task to run after it is added to MapView.
-
Field Summary
Fields Modifier and Type Field Description static ExtensionFileFilter
FILE_FILTER
The OSM file filter (*.osm and *.xml files).-
Fields inherited from class org.openstreetmap.josm.gui.io.importexport.FileImporter
filter, options
-
-
Constructor Summary
Constructors Constructor Description OsmImporter()
Constructs a newOsmImporter
.OsmImporter(ExtensionFileFilter filter)
Constructs a newOsmImporter
with the given extension file filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected OsmDataLayer
createLayer(DataSet dataSet, java.io.File associatedFile, java.lang.String layerName)
protected java.lang.Runnable
createPostLayerTask(DataSet dataSet, java.io.File associatedFile, java.lang.String layerName, OsmDataLayer layer)
void
importData(java.io.File file, ProgressMonitor progressMonitor)
Imports OSM data from fileprotected void
importData(java.io.InputStream in, java.io.File associatedFile, ProgressMonitor pm)
Imports OSM data from streamOsmImporter.OsmImporterData
loadLayer(java.io.InputStream in, java.io.File associatedFile, java.lang.String layerName, ProgressMonitor progressMonitor)
Load osm data layer from InputStream.protected DataSet
parseDataSet(java.io.InputStream in, ProgressMonitor progressMonitor)
-
Methods inherited from class org.openstreetmap.josm.gui.io.importexport.FileImporter
acceptFile, compareTo, getPriority, importData, importDataHandleExceptions, importDataHandleExceptions, isBatchImporter, isEnabled, setEnabled, setOptions
-
-
-
-
Field Detail
-
FILE_FILTER
public static final ExtensionFileFilter FILE_FILTER
The OSM file filter (*.osm and *.xml files).
-
-
Constructor Detail
-
OsmImporter
public OsmImporter()
Constructs a newOsmImporter
.
-
OsmImporter
public OsmImporter(ExtensionFileFilter filter)
Constructs a newOsmImporter
with the given extension file filter.- Parameters:
filter
- The extension file filter
-
-
Method Detail
-
importData
public void importData(java.io.File file, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
Imports OSM data from file- Overrides:
importData
in classFileImporter
- Parameters:
file
- file to read data fromprogressMonitor
- handler for progress monitoring and canceling- Throws:
java.io.IOException
- if any I/O error occursIllegalDataException
- if invalid data is read
-
importData
protected void importData(java.io.InputStream in, java.io.File associatedFile, ProgressMonitor pm) throws IllegalDataException
Imports OSM data from stream- Parameters:
in
- input streamassociatedFile
- filename of data (layer name will be generated from name of file)pm
- handler for progress monitoring and canceling- Throws:
IllegalDataException
- if an error was found while parsing the OSM data
-
loadLayer
public OsmImporter.OsmImporterData loadLayer(java.io.InputStream in, java.io.File associatedFile, java.lang.String layerName, ProgressMonitor progressMonitor) throws IllegalDataException
Load osm data layer from InputStream.- Parameters:
in
- input streamassociatedFile
- filename of data (can benull
if the stream does not come from a file)layerName
- name of generated layerprogressMonitor
- handler for progress monitoring and canceling- Returns:
- Utility class containing imported OSM layer, and a task to run after it is added to MapView
- Throws:
IllegalDataException
- if an error was found while parsing the OSM data
-
parseDataSet
protected DataSet parseDataSet(java.io.InputStream in, ProgressMonitor progressMonitor) throws IllegalDataException
- Throws:
IllegalDataException
-
createLayer
protected OsmDataLayer createLayer(DataSet dataSet, java.io.File associatedFile, java.lang.String layerName)
-
createPostLayerTask
protected java.lang.Runnable createPostLayerTask(DataSet dataSet, java.io.File associatedFile, java.lang.String layerName, OsmDataLayer layer)
-
-