Ignore:
Timestamp:
2014-12-17T01:49:45+01:00 (9 years ago)
Author:
bastiK
Message:

fixed #10860 - set initial viewport correctly when mapview is opened

File:
1 edited

Legend:

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

    r7749 r7816  
    1515import org.openstreetmap.josm.data.Bounds;
    1616import org.openstreetmap.josm.data.DataSource;
     17import org.openstreetmap.josm.data.ProjectionBounds;
    1718import org.openstreetmap.josm.data.coor.LatLon;
    1819import org.openstreetmap.josm.data.osm.DataSet;
     
    250251        }
    251252
    252         protected void computeBboxAndCenterScale(Bounds bounds) {
     253        protected ProjectionBounds computeBbox(Bounds bounds) {
    253254            BoundingXYVisitor v = new BoundingXYVisitor();
    254255            if (bounds != null) {
     
    257258                v.computeBoundingBox(dataSet.getNodes());
    258259            }
     260            return v.getBounds();
     261        }
     262
     263        protected void computeBboxAndCenterScale(Bounds bounds) {
     264            ProjectionBounds pb = computeBbox(bounds);
     265            BoundingXYVisitor v = new BoundingXYVisitor();
     266            v.visit(pb);
    259267            Main.map.mapView.recalculateCenterScale(v);
    260268        }
     
    267275                //
    268276                final OsmDataLayer layer = createNewLayer(newLayerName);
    269                 final boolean isDisplayingMapView = Main.isDisplayingMapView();
    270 
    271                 Main.main.addLayer(layer);
    272 
    273                 // If the mapView is not there yet, we cannot calculate the bounds (see constructor of MapView).
    274                 // Otherwise jump to the current download.
    275                 if (isDisplayingMapView) {
    276                     computeBboxAndCenterScale(bounds);
    277                 }
     277                Main.main.addLayer(layer, computeBbox(bounds));
    278278                return layer;
    279279            }
Note: See TracChangeset for help on using the changeset viewer.