Ticket #21886: josm_21886.patch
| File josm_21886.patch, 2.9 KB (added by , 3 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/download/OSMDownloadSource.java
211 211 setLayout(new GridBagLayout()); 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)); 218 220 add(downloadSourcesPanel, GBC.eol().fill(GBC.HORIZONTAL)); … … 324 326 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")); 338 331 sizeCheck.setForeground(Color.darkGray); … … 340 333 } 341 334 342 335 displaySizeCheckResult(DOWNLOAD_SOURCES.stream() 336 .filter(IDownloadSourceType::isEnabled) 343 337 .anyMatch(type -> type.isDownloadAreaTooLarge(bbox))); 344 338 } 345 339 340 @Override 341 public String getSimpleName() { 342 return SIMPLE_NAME; 343 } 344 346 345 private void displaySizeCheckResult(boolean isAreaTooLarge) { 347 346 if (isAreaTooLarge) { 348 347 sizeCheck.setText(tr("Download area too large; will probably be rejected by server")); … … 414 413 @Override 415 414 public boolean isDownloadAreaTooLarge(Bounds bound) { 416 415 // see max_request_area in 417 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/ example.application.yml416 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml 418 417 return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area", 0.25); 419 418 } 420 419 } … … 492 491 @Override 493 492 public boolean isDownloadAreaTooLarge(Bounds bound) { 494 493 // see max_note_request_area in 495 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/ example.application.yml494 // https://github.com/openstreetmap/openstreetmap-website/blob/master/config/settings.yml 496 495 return bound.getArea() > Config.getPref().getDouble("osm-server.max-request-area-notes", 25); 497 496 } 498 497 }
