Class GpxExporter
- java.lang.Object
-
- org.openstreetmap.josm.gui.io.importexport.FileExporter
-
- org.openstreetmap.josm.gui.io.importexport.GpxExporter
-
- All Implemented Interfaces:
GpxConstants,MainLayerManager.ActiveLayerChangeListener
public class GpxExporter extends FileExporter implements GpxConstants
Exports data to a .gpx file. Data may be native GPX or OSM data which will be converted.- Since:
- 1949
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
GpxConstants.ColorFormat
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringGPL_WARNINGprivate static java.lang.String[]LICENSESprivate static java.lang.StringPUBLIC_DOMAINprivate static java.util.List<java.lang.Class<? extends Layer>>SUPPORTED_LAYERSprivate static java.lang.String[]URLS-
Fields inherited from class org.openstreetmap.josm.gui.io.importexport.FileExporter
filter
-
Fields inherited from interface org.openstreetmap.josm.data.gpx.GpxConstants
EXTENSION_ABBREVIATIONS, FIX_VALUES, GARMIN_COLORS, GPX_CMT, GPX_DESC, GPX_NAME, GPX_PREFIX, GPX_SRC, JOSM_CREATOR_NAME, META_AUTHOR_EMAIL, META_AUTHOR_LINK, META_AUTHOR_NAME, META_BOUNDS, META_COPYRIGHT_AUTHOR, META_COPYRIGHT_LICENSE, META_COPYRIGHT_YEAR, META_DESC, META_KEYWORDS, META_LINKS, META_NAME, META_PREFIX, META_TIME, PT_AGEOFDGPSDATA, PT_COURSE, PT_DGPSID, PT_ELE, PT_FIX, PT_GEOIDHEIGHT, PT_HDOP, PT_MAGVAR, PT_PDOP, PT_SAT, PT_STD_HDEV, PT_STD_VDEV, PT_SYM, PT_TIME, PT_TYPE, PT_VDOP, RTE_TRK_KEYS, RTKLIB_AGE, RTKLIB_Q, RTKLIB_RATIO, RTKLIB_SDE, RTKLIB_SDEU, RTKLIB_SDN, RTKLIB_SDNE, RTKLIB_SDU, RTKLIB_SDUN, WPT_KEYS, XML_URI_EXTENSIONS_DRAWING, XML_URI_EXTENSIONS_GARMIN, XML_URI_EXTENSIONS_JOSM, XML_URI_XSD, XML_XSD_EXTENSIONS_DRAWING, XML_XSD_EXTENSIONS_GARMIN, XML_XSD_EXTENSIONS_JOSM
-
-
Constructor Summary
Constructors Constructor Description GpxExporter()Constructs a newGpxExporter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptFile(java.io.File pathname, Layer layer)Check if this exporter can export a certain layer to a certain file.private static voidaddDependencies(GpxData data, javax.swing.JCheckBox author, JosmTextField authorName, JosmTextField email, JosmTextField copyright, javax.swing.JButton predefined, JosmTextField copyrightYear, javax.swing.JLabel nameLabel, javax.swing.JLabel emailLabel, javax.swing.JLabel copyrightLabel, javax.swing.JLabel copyrightYearLabel, javax.swing.JLabel warning)Add all those listeners to handle the enable state of the fields.private static voidenableCopyright(GpxData data, JosmTextField copyright, javax.swing.JButton predefined, JosmTextField copyrightYear, javax.swing.JLabel copyrightLabel, javax.swing.JLabel copyrightYearLabel, javax.swing.JLabel warning, boolean enable)voidexportData(java.io.File file, Layer layer)Execute the data export.private voidexportData(java.io.File file, Layer layer, boolean quiet)voidexportDataQuiet(java.io.File file, Layer layer)Execute the data export without prompting the user.private static GpxDatagetGpxData(Layer layer, java.io.File file)static java.util.List<java.lang.Class<? extends Layer>>getSupportedLayers()Returns the list of supported layers.static booleanisSupportedLayer(Layer layer)Determines if the given layer is supported by this action.-
Methods inherited from class org.openstreetmap.josm.gui.io.importexport.FileExporter
activeOrEditLayerChanged, isCanceled, isEnabled, setCanceled, setEnabled
-
-
-
-
Field Detail
-
SUPPORTED_LAYERS
private static final java.util.List<java.lang.Class<? extends Layer>> SUPPORTED_LAYERS
-
GPL_WARNING
private static final java.lang.String GPL_WARNING
-
PUBLIC_DOMAIN
private static final java.lang.String PUBLIC_DOMAIN
- See Also:
- Constant Field Values
-
LICENSES
private static final java.lang.String[] LICENSES
-
URLS
private static final java.lang.String[] URLS
-
-
Constructor Detail
-
GpxExporter
public GpxExporter()
Constructs a newGpxExporter.
-
-
Method Detail
-
acceptFile
public boolean acceptFile(java.io.File pathname, Layer layer)
Description copied from class:FileExporterCheck if this exporter can export a certain layer to a certain file. Most exporters support just a single layer type.- Overrides:
acceptFilein classFileExporter- Parameters:
pathname- the target file name (check file extension using theFileExporter.filterlayer- the layer requested for export- Returns:
- true, if the exporter can handle the layer and filename is okay
-
exportData
public void exportData(java.io.File file, Layer layer) throws java.io.IOException
Description copied from class:FileExporterExecute the data export. (To be overridden by subclasses.)- Overrides:
exportDatain classFileExporter- Parameters:
file- target filelayer- the layer to export- Throws:
java.io.IOException- in case of an IO error
-
exportDataQuiet
public void exportDataQuiet(java.io.File file, Layer layer) throws java.io.IOException
Description copied from class:FileExporterExecute the data export without prompting the user. (To be overridden by subclasses.)- Overrides:
exportDataQuietin classFileExporter- Parameters:
file- target filelayer- the layer to export- Throws:
java.io.IOException- in case of an IO error
-
exportData
private void exportData(java.io.File file, Layer layer, boolean quiet) throws java.io.IOException
- Throws:
java.io.IOException
-
getSupportedLayers
public static java.util.List<java.lang.Class<? extends Layer>> getSupportedLayers()
Returns the list of supported layers.- Returns:
- the list of supported layers
- Since:
- 18068
-
isSupportedLayer
public static boolean isSupportedLayer(Layer layer)
Determines if the given layer is supported by this action.- Parameters:
layer- layer to test- Returns:
trueif the given layer is supported by this action- Since:
- 18068
-
getGpxData
private static GpxData getGpxData(Layer layer, java.io.File file)
-
enableCopyright
private static void enableCopyright(GpxData data, JosmTextField copyright, javax.swing.JButton predefined, JosmTextField copyrightYear, javax.swing.JLabel copyrightLabel, javax.swing.JLabel copyrightYearLabel, javax.swing.JLabel warning, boolean enable)
-
addDependencies
private static void addDependencies(GpxData data, javax.swing.JCheckBox author, JosmTextField authorName, JosmTextField email, JosmTextField copyright, javax.swing.JButton predefined, JosmTextField copyrightYear, javax.swing.JLabel nameLabel, javax.swing.JLabel emailLabel, javax.swing.JLabel copyrightLabel, javax.swing.JLabel copyrightYearLabel, javax.swing.JLabel warning)
Add all those listeners to handle the enable state of the fields.- Parameters:
data- GPX dataauthor- Author checkboxauthorName- Author name textfieldemail- E-mail textfieldcopyright- Copyright textfieldpredefined- Predefined buttoncopyrightYear- Copyright year textfieldnameLabel- Name labelemailLabel- E-mail labelcopyrightLabel- Copyright labelcopyrightYearLabel- Copyright year labelwarning- Warning label
-
-