Changeset 33241 in osm


Ignore:
Timestamp:
2017-04-15T16:47:18+02:00 (8 years ago)
Author:
donvip
Message:

fix #josm14653 - Overpass Download - PBF format

Location:
applications/editors/josm/plugins/pbf
Files:
3 edited

Legend:

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

    r33165 r33241  
    33
    44    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    5     <property name="plugin.main.version" value="11626"/>
     5    <property name="plugin.main.version" value="11919"/>
    66
    77    <property name="plugin.author" value="Don-vip"/>
  • applications/editors/josm/plugins/pbf/src/org/openstreetmap/josm/plugins/pbf/PbfPlugin.java

    r32290 r33241  
    44import org.openstreetmap.josm.Main;
    55import org.openstreetmap.josm.actions.ExtensionFileFilter;
     6import org.openstreetmap.josm.io.OverpassDownloadReader;
     7import org.openstreetmap.josm.io.OverpassDownloadReader.OverpassOutpoutFormat;
    68import org.openstreetmap.josm.plugins.Plugin;
    79import org.openstreetmap.josm.plugins.PluginInformation;
     
    911import org.openstreetmap.josm.plugins.pbf.io.PbfExporter;
    1012import org.openstreetmap.josm.plugins.pbf.io.PbfImporter;
     13import org.openstreetmap.josm.plugins.pbf.io.PbfReader;
    1114
    1215/**
     
    2831        // Allow JOSM to download remote *.osm.pbf files
    2932        Main.main.menu.openLocation.addDownloadTaskClass(DownloadPbfTask.class);
     33        // Alow JOSM to download PBF data from Overpass API
     34        OverpassDownloadReader.registerOverpassOutpoutFormatReader(OverpassOutpoutFormat.PBF, PbfReader.class);
    3035    }
    3136}
  • applications/editors/josm/plugins/pbf/src/org/openstreetmap/josm/plugins/pbf/io/PbfReader.java

    r33165 r33241  
    1818import org.openstreetmap.josm.data.coor.LatLon;
    1919import org.openstreetmap.josm.data.osm.DataSet;
     20import org.openstreetmap.josm.data.osm.DataSet.UploadPolicy;
    2021import org.openstreetmap.josm.data.osm.Node;
    2122import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    276277            }
    277278            if (discourageUpload)
    278                 ds.setUploadDiscouraged(true);
     279                ds.setUploadPolicy(UploadPolicy.DISCOURAGED);
    279280        }
    280281
     
    295296        public void complete() {
    296297            if (discourageUpload)
    297                 ds.setUploadDiscouraged(true);
     298                ds.setUploadPolicy(UploadPolicy.DISCOURAGED);
    298299        }
    299300    }
     
    314315        ProgressMonitor monitor = progressMonitor == null ? NullProgressMonitor.INSTANCE : progressMonitor;
    315316        CheckParameterUtil.ensureParameterNotNull(source, "source");
    316 
    317         PbfReader reader = new PbfReader();
    318 
     317        return new PbfReader().doParseDataSet(source, monitor);
     318    }
     319
     320    @Override
     321    protected DataSet doParseDataSet(InputStream source, ProgressMonitor monitor)
     322            throws IllegalDataException {
    319323        try {
    320324            monitor.beginTask(tr("Prepare OSM data...", 2));
    321325            monitor.indeterminateSubTask(tr("Reading OSM data..."));
    322326
    323             reader.parse(source);
     327            parse(source);
    324328            monitor.worked(1);
    325329
    326330            monitor.indeterminateSubTask(tr("Preparing data set..."));
    327             reader.prepareDataSet();
     331            prepareDataSet();
    328332            monitor.worked(1);
    329             return reader.getDataSet();
     333            return getDataSet();
    330334        } catch (IllegalDataException e) {
    331335            throw e;
Note: See TracChangeset for help on using the changeset viewer.