source: josm/trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmUrlTask.java@ 13632

Last change on this file since 13632 was 11329, checked in by simon04, 7 years ago

see #13201 - OsmUrlToBounds: also take Geo URLs into account

This adds Geo URL support to various actions, such as:

  • Download dialog
  • Jump to Position
  • Commandline parameters (OSM or GPS download)
  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.downloadtasks;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.util.concurrent.Future;
7
8import org.openstreetmap.josm.gui.progress.ProgressMonitor;
9import org.openstreetmap.josm.tools.GeoUrlToBounds;
10import org.openstreetmap.josm.tools.OsmUrlToBounds;
11
12/**
13 * Task allowing to download an OSM url containing coordinates
14 * @since 4996
15 */
16public class DownloadOsmUrlTask extends DownloadOsmTask {
17
18 @Override
19 public Future<?> loadUrl(boolean newLayer, String url, ProgressMonitor progressMonitor) {
20 return download(newLayer, OsmUrlToBounds.parse(url), null);
21 }
22
23 @Override
24 public String[] getPatterns() {
25 return new String[]{
26 "https?://www\\.(osm|openstreetmap)\\.org/\\?lat=.*&lon=.*",
27 "https?://www\\.(osm|openstreetmap)\\.org/(.*)?#map=\\p{Digit}+/.*/.*",
28 GeoUrlToBounds.PATTERN.toString(),
29 };
30 }
31
32 @Override
33 public String getTitle() {
34 return tr("Download OSM URL");
35 }
36}
Note: See TracBrowser for help on using the repository browser.