Changeset 6118 in josm
- Timestamp:
- 2013-08-08T19:08:38+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r6085 r6118 28 28 return b; 29 29 int i = url.indexOf('?'); 30 if (i == -1) 31 return null; 30 if (i == -1) { 31 //probably it's a URL following the new scheme? 32 if (url.indexOf('#') >= 0) 33 return parseHashURLs(url); 34 else 35 return null; 36 } 32 37 String[] args = url.substring(i+1).split("&"); 33 38 HashMap<String, String> map = new HashMap<String, String>(); … … 71 76 } 72 77 78 /** 79 * Openstreetmap.org changed it's URL scheme in August 2013, which breaks the URL parsing. 80 * The following function, called by the old parse function if necessary, provides parsing new URLs 81 * the new URLs follow the scheme http://www.openstreetmap.org/#map=18/51.71873/8.76164&layers=CN 82 * @param url 83 * @return 84 */ 85 private static Bounds parseHashURLs(String url) { 86 int startIndex = url.indexOf("="); 87 int endIndex = url.indexOf("&"); 88 String coordPart = url.substring(startIndex+1, endIndex); 89 System.out.println(coordPart); 90 91 String[] parts = coordPart.split("/"); 92 Bounds b = positionToBounds(Double.parseDouble(parts[1]), 93 Double.parseDouble(parts[2]), 94 Integer.parseInt(parts[0])); 95 return b; 96 } 97 73 98 private static double parseDouble(HashMap<String, String> map, String key) { 74 99 if (map.containsKey(key))
Note:
See TracChangeset
for help on using the changeset viewer.