Changeset 30162 in osm for applications/editors
- Timestamp:
- 2014-01-01T14:26:21+01:00 (11 years ago)
- Location:
- applications/editors/josm/plugins/mirrored_download
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mirrored_download/build.xml
r29854 r30162 5 5 <property name="commit.message" value=""/> 6 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 7 <property name="plugin.main.version" value="6 162"/>7 <property name="plugin.main.version" value="6589"/> 8 8 9 9 <!-- Configure these properties (replace "..." accordingly). -
applications/editors/josm/plugins/mirrored_download/src/mirrored_download/MirroredDownloadAction.java
r30106 r30162 56 56 dialog.rememberSettings(); 57 57 Bounds area = dialog.getSelectedDownloadArea(); 58 DownloadOsmTask task = new DownloadOsmTask(); 58 DownloadOsmTask task = new DownloadOsmTask() { 59 60 protected final String encodePartialUrl(String url, String safePart) { 61 if (url != null && safePart != null) { 62 int pos = url.indexOf(safePart); 63 if (pos > -1) { 64 pos += safePart.length(); 65 try { 66 return url.substring(0, pos) + URLEncoder.encode(url.substring(pos), "UTF-8").replaceAll("\\+", "%20"); 67 } catch (UnsupportedEncodingException e) { 68 e.printStackTrace(); 69 } 70 } 71 } 72 return url; 73 } 74 75 @Override 76 protected String modifyUrlBeforeLoad(String url) { 77 if (url.matches(PATTERN_OVERPASS_API_URL)) { 78 return encodePartialUrl(url, "/interpreter?data="); // encode only the part after the = sign 79 } else if (url.matches(PATTERN_OVERPASS_API_XAPI_URL)) { 80 return encodePartialUrl(url, "/xapi?"); // encode only the part after the ? sign 81 } else { 82 return url; 83 } 84 } 85 86 }; 59 87 Future<?> future = task.download( 60 88 new MirroredDownloadReader(area, dialog.getOverpassType(), dialog.getOverpassQuery()),
Note:
See TracChangeset
for help on using the changeset viewer.