Changeset 15447 in josm
- Timestamp:
- 2019-10-10T12:05:16+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r15358 r15447 477 477 rememberErrorMessage(remark); 478 478 } 479 // need to synthesize a download bounds lest the visual indication of downloaded area doesn't work 480 dataSet.addDataSource(new DataSource(currentBounds != null ? currentBounds : 481 new Bounds(LatLon.ZERO), "OpenStreetMap server")); 479 if (!(reader instanceof BoundingBoxDownloader) 480 || ((BoundingBoxDownloader) reader).considerAsFullDownload()) { 481 // need to synthesize a download bounds lest the visual indication of downloaded area doesn't work 482 dataSet.addDataSource(new DataSource( 483 currentBounds != null ? currentBounds : new Bounds(LatLon.ZERO), "OpenStreetMap server")); 484 } 482 485 } 483 486 -
trunk/src/org/openstreetmap/josm/gui/download/OverpassDownloadSource.java
r14418 r15447 52 52 */ 53 53 public class OverpassDownloadSource implements DownloadSource<OverpassDownloadSource.OverpassDownloadData> { 54 /** Overpass query to retrieve all nodes and related parent objects, */ 55 public static final String FULL_DOWNLOAD_QUERY = "[out:xml]; \n" 56 + "(\n" 57 + " node({{bbox}});\n" 58 + "<;\n" 59 + ");\n" 60 + "(._;>;);" 61 + "out meta;"; 54 62 55 63 @Override … … 249 257 JOptionPane.YES_OPTION); 250 258 if (doFix) { 251 String repairedQuery = "[out:xml]; \n" 252 + query + "\n" 253 + "(\n" 254 + " node({{bbox}});\n" 255 + "<;\n" 256 + ");\n" 257 + "(._;>;);" 258 + "out meta;"; 259 this.overpassQuery.setText(repairedQuery); 259 this.overpassQuery.setText(FULL_DOWNLOAD_QUERY); 260 260 } else { 261 261 return false; -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r14762 r15447 256 256 } 257 257 } 258 259 /** 260 * @return true if download is complete for the given bounding box (not filtered) 261 */ 262 public boolean considerAsFullDownload() { 263 return true; 264 } 265 258 266 } -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r14439 r15447 31 31 import org.openstreetmap.josm.data.osm.BBox; 32 32 import org.openstreetmap.josm.data.osm.DataSet; 33 import org.openstreetmap.josm.data.osm.DataSetMerger; 33 34 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 34 35 import org.openstreetmap.josm.data.osm.PrimitiveId; … … 36 37 import org.openstreetmap.josm.data.preferences.ListProperty; 37 38 import org.openstreetmap.josm.data.preferences.StringProperty; 39 import org.openstreetmap.josm.gui.download.OverpassDownloadSource; 38 40 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 39 41 import org.openstreetmap.josm.io.NameFinder.SearchResult; … … 385 387 386 388 DataSet ds = super.parseOsm(progressMonitor); 387 388 // add bounds if necessary (note that Overpass API does not return bounds in the response XML) 389 if (ds != null && ds.getDataSources().isEmpty() && overpassQuery.contains("{{bbox}}")) { 390 if (crosses180th) { 391 Bounds bounds = new Bounds(lat1, lon1, lat2, 180.0); 392 DataSource src = new DataSource(bounds, getBaseUrl()); 393 ds.addDataSource(src); 394 395 bounds = new Bounds(lat1, -180.0, lat2, lon2); 396 src = new DataSource(bounds, getBaseUrl()); 397 ds.addDataSource(src); 398 } else { 399 Bounds bounds = new Bounds(lat1, lon1, lat2, lon2); 400 DataSource src = new DataSource(bounds, getBaseUrl()); 401 ds.addDataSource(src); 402 } 403 } 404 405 return ds; 389 if (!considerAsFullDownload()) { 390 DataSet noBounds = new DataSet(); 391 DataSetMerger dsm = new DataSetMerger(noBounds, ds); 392 dsm.merge(null, false); 393 return dsm.getTargetDataSet(); 394 } else { 395 // add bounds if necessary (note that Overpass API does not return bounds in the response XML) 396 if (ds != null && ds.getDataSources().isEmpty() && overpassQuery.contains("{{bbox}}")) { 397 if (crosses180th) { 398 Bounds bounds = new Bounds(lat1, lon1, lat2, 180.0); 399 DataSource src = new DataSource(bounds, getBaseUrl()); 400 ds.addDataSource(src); 401 402 bounds = new Bounds(lat1, -180.0, lat2, lon2); 403 src = new DataSource(bounds, getBaseUrl()); 404 ds.addDataSource(src); 405 } else { 406 Bounds bounds = new Bounds(lat1, lon1, lat2, lon2); 407 DataSource src = new DataSource(bounds, getBaseUrl()); 408 ds.addDataSource(src); 409 } 410 } 411 return ds; 412 } 406 413 } 407 414 … … 417 424 .replaceAll("(?s)\\[out:(csv)[^\\]]*\\]", "[out:xml]"); 418 425 } 426 427 @Override 428 public boolean considerAsFullDownload() { 429 return overpassQuery.equals(OverpassDownloadSource.FULL_DOWNLOAD_QUERY); 430 } 419 431 }
Note:
See TracChangeset
for help on using the changeset viewer.