Ignore:
Timestamp:
2014-02-25T00:21:39+01:00 (10 years ago)
Author:
Don-vip
Message:

enable loading of .osm.zip files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmCompressedTask.java

    r6798 r6882  
    1919public class DownloadOsmCompressedTask extends DownloadOsmTask {
    2020
    21     static final String PATTERN_GZ =  "https?://.*/.*\\.osm.(gz|bz2?)";
     21    static final String PATTERN_COMPRESS =  "https?://.*/.*\\.osm.(gz|bz2?|zip)";
    2222
    2323    @Override
    2424    public String[] getPatterns() {
    25         return new String[]{PATTERN_GZ};
     25        return new String[]{PATTERN_COMPRESS};
    2626    }
    2727
     
    3131    }
    3232   
    33     /* (non-Javadoc)
    34      * @see org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask#download(boolean, org.openstreetmap.josm.data.Bounds, org.openstreetmap.josm.gui.progress.ProgressMonitor)
    35      */
    3633    @Override
    3734    public Future<?> download(boolean newLayer, Bounds downloadArea,
     
    5451                if (url.matches("https?://.*/.*\\.osm.bz2?")) {
    5552                    return reader.parseOsmBzip2(subTaskMonitor);
     53                } else if (url.matches("https?://.*/.*\\.osm.gz")) {
     54                    return reader.parseOsmGzip(subTaskMonitor);
    5655                } else {
    57                     return reader.parseOsmGzip(subTaskMonitor);
     56                    return reader.parseOsmZip(subTaskMonitor);
    5857                }
    5958            }
    6059        };
    6160        currentBounds = null;
    62         // Extract .osm.gz/bz/bz2 filename from URL to set the new layer name
    63         extractOsmFilename("https?://.*/(.*\\.osm.(gz|bz2?))", url);
     61        // Extract .osm.gz/bz/bz2/zip filename from URL to set the new layer name
     62        extractOsmFilename("https?://.*/(.*\\.osm.(gz|bz2?|zip))", url);
    6463        return Main.worker.submit(downloadTask);
    6564    }
Note: See TracChangeset for help on using the changeset viewer.