Changeset 12608 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-08-16T21:56:01+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/OverpassDownloadAction.java
r12578 r12608 32 32 import org.openstreetmap.josm.data.Bounds; 33 33 import org.openstreetmap.josm.data.preferences.BooleanProperty; 34 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 34 35 import org.openstreetmap.josm.gui.download.DownloadDialog; 35 36 import org.openstreetmap.josm.gui.download.OverpassQueryList; … … 72 73 dialog.rememberSettings(); 73 74 Optional<Bounds> selectedArea = dialog.getSelectedDownloadArea(); 74 String overpassQuery = dialog.get OverpassQuery();75 String overpassQuery = dialog.getRepairedOverpassQuery(); 75 76 76 77 /* … … 99 100 100 101 if (errors.isEmpty() || onlyNoDataError) { 101 dialog.saveHistoricItemOnSuccess( );102 dialog.saveHistoricItemOnSuccess(overpassQuery); 102 103 } 103 104 }; … … 111 112 task.setZoomAfterDownload(dialog.isZoomToDownloadedDataRequired()); 112 113 Future<?> future = task.download( 113 new OverpassDownloadReader(area, OverpassServerPreference.getOverpassServer(), dialog.getOverpassQuery()),114 new OverpassDownloadReader(area, OverpassServerPreference.getOverpassServer(), overpassQuery), 114 115 dialog.isNewLayerRequired(), area, null); 115 116 Main.worker.submit(new PostDownloadHandler(task, future, errorReporter)); … … 253 254 } 254 255 256 String getRepairedOverpassQuery() { 257 String query = getOverpassQuery(); 258 if (query.matches("(/\\*(\\*[^/]|[^\\*/])*\\*/|\\s)*")) { 259 // Empty query. User might want to download everything 260 boolean doFix = ConditionalOptionPaneUtil.showConfirmationDialog( 261 "download.overpass.fix.emptytoall", 262 this, 263 tr("You entered an empty query. Do you want to download all data in this area instead?"), 264 tr("Download all data?"), 265 JOptionPane.YES_NO_OPTION, 266 JOptionPane.QUESTION_MESSAGE, 267 JOptionPane.YES_OPTION); 268 if (doFix) { 269 return "[out:xml]; \n" 270 + query + "\n" 271 + "(\n" 272 + " node({{bbox}});\n" 273 + "<;\n" 274 + ");\n" 275 + "(._;>;);" 276 + "out meta;"; 277 } 278 } 279 // Note: We can add more repairs here. We might e.g. want to intercept missing 'out meta'. 280 return query; 281 } 282 255 283 /** 256 284 * Sets the query that is displayed … … 264 292 /** 265 293 * Adds the current query to {@link OverpassQueryList}. 266 */ 267 void saveHistoricItemOnSuccess() { 268 overpassQueryList.saveHistoricItem(overpassQuery.getText()); 294 * @param overpassQueryToSave The query to save 295 */ 296 void saveHistoricItemOnSuccess(String overpassQueryToSave) { 297 overpassQueryList.saveHistoricItem(overpassQueryToSave); 269 298 } 270 299
Note:
See TracChangeset
for help on using the changeset viewer.