Ignore:
Timestamp:
2017-09-29T20:13:22+02:00 (7 years ago)
Author:
donvip
Message:

Edigeo: allow to download cadastre files from URL

Location:
applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/CadastrePlugin.java

    r33658 r33680  
    4848import org.openstreetmap.josm.plugins.fr.cadastre.actions.mapmode.WMSAdjustAction;
    4949import org.openstreetmap.josm.plugins.fr.cadastre.actions.upload.CheckSourceUploadHook;
     50import org.openstreetmap.josm.plugins.fr.cadastre.download.CadastreDownloadTask;
    5051import org.openstreetmap.josm.plugins.fr.cadastre.edigeo.pci.EdigeoPciImporter;
    5152import org.openstreetmap.josm.plugins.fr.cadastre.preferences.CadastrePreferenceSetting;
     
    229230        registerSessionLayerExporter(WMSLayer.class, CadastreSessionExporter.class);
    230231        registerSessionLayerImporter("cadastre-fr", CadastreSessionImporter.class);
     232
     233        MainApplication.getMenu().openLocation.addDownloadTaskClass(CadastreDownloadTask.class);
     234        //DownloadDialog.addDownloadSource(new CadastreDownloadSource());
    231235    }
    232236
  • applications/editors/josm/plugins/cadastre-fr/src/org/openstreetmap/josm/plugins/fr/cadastre/edigeo/pci/EdigeoPciImporter.java

    r33671 r33680  
    1313import org.openstreetmap.josm.data.osm.DataSet;
    1414import org.openstreetmap.josm.gui.io.importexport.OsmImporter;
     15import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    1516import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     17import org.openstreetmap.josm.io.CachedFile;
    1618import org.openstreetmap.josm.io.IllegalDataException;
    1719import org.openstreetmap.josm.tools.Logging;
     
    5557        }
    5658    }
     59
     60    /**
     61     * Import data from an URL.
     62     * @param source source URL
     63     * @return imported data set
     64     * @throws IOException if any I/O error occurs
     65     * @throws IllegalDataException if an error was found while parsing the data
     66     */
     67    public DataSet parseDataSet(final String source) throws IOException, IllegalDataException {
     68        try (CachedFile cf = new CachedFile(source)) {
     69            this.file = cf.getFile();
     70            return parseDataSet(cf.getInputStream(), NullProgressMonitor.INSTANCE);
     71        }
     72    }
    5773}
Note: See TracChangeset for help on using the changeset viewer.