Changeset 35139 in osm for applications/editors/josm


Ignore:
Timestamp:
2019-09-26T20:51:07+02:00 (5 years ago)
Author:
donvip
Message:

fix #josm13679 - add session support

Location:
applications/editors/josm/plugins/opendata
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/build.xml

    r34972 r35139  
    11<?xml version="1.0" encoding="utf-8"?>
    22<project name="opendata" default="dist" basedir=".">
    3     <property name="plugin.main.version" value="14977"/>
     3    <property name="plugin.main.version" value="15377"/>
    44    <property name="plugin.author" value="Don-vip"/>
    55    <property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/OdPlugin.java

    r34452 r35139  
    2222import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    2323import org.openstreetmap.josm.gui.util.GuiHelper;
     24import org.openstreetmap.josm.io.session.SessionReader;
     25import org.openstreetmap.josm.io.session.SessionWriter;
    2426import org.openstreetmap.josm.plugins.Plugin;
    2527import org.openstreetmap.josm.plugins.PluginInformation;
     
    3941import org.openstreetmap.josm.plugins.opendata.core.io.geographic.MifTabImporter;
    4042import org.openstreetmap.josm.plugins.opendata.core.io.geographic.ShpImporter;
     43import org.openstreetmap.josm.plugins.opendata.core.io.session.OpenDataSessionExporter;
     44import org.openstreetmap.josm.plugins.opendata.core.io.session.OpenDataSessionImporter;
    4145import org.openstreetmap.josm.plugins.opendata.core.io.tabular.CsvImporter;
    4246import org.openstreetmap.josm.plugins.opendata.core.io.tabular.OdsImporter;
    4347import org.openstreetmap.josm.plugins.opendata.core.io.tabular.XlsImporter;
     48import org.openstreetmap.josm.plugins.opendata.core.layers.OdDataLayer;
    4449import org.openstreetmap.josm.plugins.opendata.core.modules.Module;
    4550import org.openstreetmap.josm.plugins.opendata.core.modules.ModuleHandler;
     
    5863
    5964    private OdDialog dialog;
     65
     66    public final List<AbstractImporter> importers =  Arrays.asList(new AbstractImporter[]{
     67            new CsvImporter(), new OdsImporter(), new XlsImporter(), // Tabular file formats
     68            new KmlKmzImporter(), new ShpImporter(), new MifTabImporter(), new GmlImporter(), // Geographic file formats
     69            new ZipImporter(), // Zip archive containing any of the others
     70            new SevenZipImporter(), // 7Zip archive containing any of the others
     71            xmlImporter // Generic importer for XML files (currently used for Neptune files)
     72    });
    6073
    6174    public OdPlugin(PluginInformation info) {
     
    6881        }
    6982        // Allow JOSM to import more files
    70         for (AbstractImporter importer : Arrays.asList(new AbstractImporter[]{
    71                 new CsvImporter(), new OdsImporter(), new XlsImporter(), // Tabular file formats
    72                 new KmlKmzImporter(), new ShpImporter(), new MifTabImporter(), new GmlImporter(), // Geographic file formats
    73                 new ZipImporter(), // Zip archive containing any of the others
    74                 new SevenZipImporter(), // 7Zip archive containing any of the others
    75                 xmlImporter // Generic importer for XML files (currently used for Neptune files)
    76         })) {
    77             ExtensionFileFilter.addImporterFirst(importer);
    78         }
     83        importers.forEach(ExtensionFileFilter::addImporterFirst);
     84        // Session support
     85        SessionReader.registerSessionLayerImporter("open-data", OpenDataSessionImporter.class);
     86        SessionWriter.registerSessionLayerExporter(OdDataLayer.class, OpenDataSessionExporter.class);
    7987
    8088        menu = MainApplication.getMenu().dataMenu;
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/AbstractImporter.java

    r33553 r35139  
    4444    }
    4545
     46    public final void setFile(File file) {
     47        this.file = file;
     48    }
     49
    4650    @Override
    4751    public void importData(File file, ProgressMonitor progressMonitor)
Note: See TracChangeset for help on using the changeset viewer.