Changeset 14374 in josm for trunk/src/org


Ignore:
Timestamp:
2018-10-27T16:31:51+02:00 (6 years ago)
Author:
simon04
Message:

fix #16879, see #14831 - Fix zoom to downloaded data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r14357 r14374  
    200200    @Override
    201201    public ProjectionBounds getDownloadProjectionBounds() {
    202         return downloadTask != null ? downloadTask.computeBbox(currentBounds) : null;
     202        return downloadTask != null ? downloadTask.computeBbox(currentBounds).orElse(null) : null;
    203203    }
    204204
     
    346346        }
    347347
    348         protected ProjectionBounds computeBbox(Bounds bounds) {
     348        protected Optional<ProjectionBounds> computeBbox(Bounds bounds) {
    349349            BoundingXYVisitor v = new BoundingXYVisitor();
    350350            if (bounds != null) {
     
    353353                v.computeBoundingBox(dataSet.getNodes());
    354354            }
    355             return v.getBounds();
     355            return Optional.ofNullable(v.getBounds());
    356356        }
    357357
     
    378378                layer.mergeFrom(dataSet);
    379379                MapFrame map = MainApplication.getMap();
    380                 if (map != null && zoomAfterDownload && bounds != null) {
    381                     map.mapView.zoomTo(new ViewportData(computeBbox(bounds)));
     380                if (map != null && zoomAfterDownload) {
     381                    computeBbox(bounds).map(ViewportData::new).ifPresent(map.mapView::zoomTo);
    382382                }
    383383                if (!primitivesToUpdate.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.