Ticket #18122: 18122-quick-and-dirty.patch
File 18122-quick-and-dirty.patch, 4.0 KB (added by , 6 years ago) |
---|
-
src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
467 467 if (remark != null && !remark.isEmpty()) { 468 468 rememberErrorMessage(remark); 469 469 } 470 // need to synthesize a download bounds lest the visual indication of downloaded area doesn't work 471 dataSet.addDataSource(new DataSource(currentBounds != null ? currentBounds : 472 new Bounds(LatLon.ZERO), "OpenStreetMap server")); 470 if (!(reader instanceof OverpassDownloadReader)) { 471 // need to synthesize a download bounds lest the visual indication of downloaded area doesn't work 472 dataSet.addDataSource(new DataSource(currentBounds != null ? currentBounds : 473 new Bounds(LatLon.ZERO), "OpenStreetMap server")); 474 } 473 475 } 474 476 475 477 rememberDownloadedData(dataSet); -
src/org/openstreetmap/josm/io/OverpassDownloadReader.java
30 30 import org.openstreetmap.josm.data.coor.LatLon; 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; 35 36 import org.openstreetmap.josm.data.preferences.BooleanProperty; … … 384 385 public DataSet parseOsm(ProgressMonitor progressMonitor) throws OsmTransferException { 385 386 386 387 DataSet ds = super.parseOsm(progressMonitor); 388 boolean ignoreBounds = !overpassQuery.contains("node({{bbox}})"); // quick & dirty solution 389 if (ignoreBounds) { 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); 387 401 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 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 } 402 410 } 411 return ds; 403 412 } 404 405 return ds;406 413 } 407 414 408 415 /**