Class ImageImporter
- java.lang.Object
-
- org.openstreetmap.josm.gui.io.importexport.FileImporter
-
- org.openstreetmap.josm.gui.io.importexport.ImageImporter
-
- All Implemented Interfaces:
java.lang.Comparable<FileImporter>
public class ImageImporter extends FileImporter
File importer allowing to import geotagged images- Since:
- 17548
-
-
Field Summary
Fields Modifier and Type Field Description static ExtensionFileFilterFILE_FILTERThe default file filterstatic ExtensionFileFilterFILE_FILTER_WITH_FOLDERSAn alternate file filter that also includes folders.private GpxLayergpxstatic java.util.List<java.lang.String>SUPPORTED_FILE_TYPESThe supported image file types on the current systemprivate static java.util.regex.PatternURL_START_BADCheck if the filename starts with a borked path (File(java.net.URI)drops consecutive/characters).private static java.util.regex.PatternURL_START_GOODCheck for the beginning of a "good" url-
Fields inherited from class org.openstreetmap.josm.gui.io.importexport.FileImporter
filter, options
-
-
Constructor Summary
Constructors Constructor Description ImageImporter()Constructs a newImageImporter.ImageImporter(boolean includeFolders)Constructs a newImageImporterwith folders selection, if wanted.ImageImporter(GpxLayer gpx)Constructs a newImageImporterfor the given GPX layer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptFile(java.io.File pathname)Determines if this file importer accepts the given file.(package private) static voidaddRecursiveFiles(java.util.List<java.io.File> files, java.util.Set<java.lang.String> visitedDirs, java.util.List<java.io.File> sel, ProgressMonitor progressMonitor)(package private) static voidaddRecursiveFiles(java.util.Set<Options> options, java.util.List<java.io.File> files, java.util.Set<java.lang.String> visitedDirs, java.util.List<java.io.File> sel, ProgressMonitor progressMonitor)private static ExtensionFileFiltergetFileFilters(boolean folder)doublegetPriority()Needs to be the last, to avoid problems.voidimportData(java.util.List<java.io.File> sel, ProgressMonitor progressMonitor)Needs to be implemented if isBatchImporter() returns true.booleanisBatchImporter()A batch importer is a file importer that prefers to read multiple files at the same time.-
Methods inherited from class org.openstreetmap.josm.gui.io.importexport.FileImporter
compareTo, importData, importDataHandleExceptions, importDataHandleExceptions, isEnabled, setEnabled, setOptions
-
-
-
-
Field Detail
-
URL_START_BAD
private static final java.util.regex.Pattern URL_START_BAD
Check if the filename starts with a borked path (File(java.net.URI)drops consecutive/characters).
-
URL_START_GOOD
private static final java.util.regex.Pattern URL_START_GOOD
Check for the beginning of a "good" url
-
SUPPORTED_FILE_TYPES
public static final java.util.List<java.lang.String> SUPPORTED_FILE_TYPES
The supported image file types on the current system
-
FILE_FILTER
public static final ExtensionFileFilter FILE_FILTER
The default file filter
-
FILE_FILTER_WITH_FOLDERS
public static final ExtensionFileFilter FILE_FILTER_WITH_FOLDERS
An alternate file filter that also includes folders.
-
-
Constructor Detail
-
ImageImporter
public ImageImporter()
Constructs a newImageImporter.
-
ImageImporter
public ImageImporter(boolean includeFolders)
Constructs a newImageImporterwith folders selection, if wanted.- Parameters:
includeFolders- If true, includes folders in the file filter
-
ImageImporter
public ImageImporter(GpxLayer gpx)
Constructs a newImageImporterfor the given GPX layer. Folders selection is allowed.- Parameters:
gpx- The GPX layer
-
-
Method Detail
-
getFileFilters
private static ExtensionFileFilter getFileFilters(boolean folder)
-
acceptFile
public boolean acceptFile(java.io.File pathname)
Description copied from class:FileImporterDetermines if this file importer accepts the given file.- Overrides:
acceptFilein classFileImporter- Parameters:
pathname- The file to test- Returns:
trueif this file importer accepts the given file,falseotherwise
-
importData
public void importData(java.util.List<java.io.File> sel, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
Description copied from class:FileImporterNeeds to be implemented if isBatchImporter() returns true.- Overrides:
importDatain classFileImporter- Parameters:
sel- files to importprogressMonitor- progress monitor- Throws:
java.io.IOException- if any I/O error occursIllegalDataException- if invalid data is read
-
addRecursiveFiles
static void addRecursiveFiles(java.util.List<java.io.File> files, java.util.Set<java.lang.String> visitedDirs, java.util.List<java.io.File> sel, ProgressMonitor progressMonitor) throws java.io.IOException
- Throws:
java.io.IOException
-
addRecursiveFiles
static void addRecursiveFiles(java.util.Set<Options> options, java.util.List<java.io.File> files, java.util.Set<java.lang.String> visitedDirs, java.util.List<java.io.File> sel, ProgressMonitor progressMonitor) throws java.io.IOException
- Throws:
java.io.IOException
-
isBatchImporter
public boolean isBatchImporter()
Description copied from class:FileImporterA batch importer is a file importer that prefers to read multiple files at the same time.- Overrides:
isBatchImporterin classFileImporter- Returns:
trueif this importer is a batch importer
-
getPriority
public double getPriority()
Needs to be the last, to avoid problems.- Overrides:
getPriorityin classFileImporter- Returns:
- priority
-
-