Changeset 18728 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2023-05-12T14:55:43+02:00 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java
r18014 r18728 88 88 MainApplication.worker.submit(new PostDownloadHandler(task, future)); 89 89 if (zoom) { 90 tasks.add(new Pair< AbstractDownloadTask<?>, Future<?>>(task, future));90 tasks.add(new Pair<>(task, future)); 91 91 } 92 92 } catch (InstantiationException | IllegalAccessException | IllegalArgumentException … … 212 212 213 213 // size check depends on selected data source 214 checkboxChangeListener = e -> 215 dialog.getSelectedDownloadArea().ifPresent(this::updateSizeCheck); 214 checkboxChangeListener = e -> { 215 rememberSettings(); 216 dialog.getSelectedDownloadArea().ifPresent(OSMDownloadSourcePanel.this::boundingBoxChanged); 217 }; 216 218 217 219 downloadSourcesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); … … 281 283 } 282 284 283 final Boolean slippyMapShowsDownloadBounds = settings.getSlippyMapBounds()285 final boolean slippyMapShowsDownloadBounds = settings.getSlippyMapBounds() 284 286 .map(b -> b.intersects(settings.getDownloadBounds().get())) 285 287 .orElse(true); … … 325 327 @Override 326 328 public void boundingBoxChanged(Bounds bbox) { 327 updateSizeCheck(bbox);328 }329 330 @Override331 public String getSimpleName() {332 return SIMPLE_NAME;333 }334 335 private void updateSizeCheck(Bounds bbox) {336 329 if (bbox == null) { 337 330 sizeCheck.setText(tr("No area selected yet")); … … 341 334 342 335 displaySizeCheckResult(DOWNLOAD_SOURCES.stream() 336 .filter(IDownloadSourceType::isEnabled) 343 337 .anyMatch(type -> type.isDownloadAreaTooLarge(bbox))); 338 } 339 340 @Override 341 public String getSimpleName() { 342 return SIMPLE_NAME; 344 343 } 345 344 … … 355 354 } 356 355 357 /**358 * Encapsulates data that is required to download from the OSM server.359 */360 static class OSMDownloadData {361 362 private final List<IDownloadSourceType> downloadPossibilities;363 364 /**365 * Constructs a new {@code OSMDownloadData}.366 * @param downloadPossibilities A list of DataDownloadTypes (instantiated, with367 * options set)368 */369 OSMDownloadData(List<IDownloadSourceType> downloadPossibilities) {370 this.downloadPossibilities = downloadPossibilities;371 }372 373 /**374 * Returns the download possibilities.375 * @return A list of DataDownloadTypes (instantiated, with options set)376 */377 public List<IDownloadSourceType> getDownloadPossibilities() {378 return downloadPossibilities;379 }380 }381 382 356 private static class OsmDataDownloadType implements IDownloadSourceType { 383 357 static final BooleanProperty IS_ENABLED = new BooleanProperty("download.osm.data", true); … … 415 389 public boolean isDownloadAreaTooLarge(Bounds bound) { 416 390 // see max_request_area in 417 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/ example.application.yml391 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml 418 392 return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area", 0.25); 419 393 } … … 493 467 public boolean isDownloadAreaTooLarge(Bounds bound) { 494 468 // see max_note_request_area in 495 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/ example.application.yml469 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml 496 470 return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area-notes", 25); 497 471 }
Note:
See TracChangeset
for help on using the changeset viewer.