- Timestamp:
- 2010-02-18T08:46:30+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r2842 r3010 155 155 OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null); 156 156 Main.main.addLayer(layer); 157 BoundingXYVisitor v = new BoundingXYVisitor(); 158 v.visit(currentBounds); 159 Main.map.mapView.recalculateCenterScale(v); 157 160 } else { 158 161 OsmDataLayer target; -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r2860 r3010 179 179 scaler.setLocation(10,30); 180 180 181 if (!zoomToEditLayerBoundingBox()) { 182 new AutoScaleAction("data").actionPerformed(null); 181 OsmDataLayer layer = getEditLayer(); 182 if (layer != null) { 183 if (!zoomToDataSetBoundingBox(layer.data)) { 184 // no bounding box defined 185 new AutoScaleAction("data").actionPerformed(null); 186 } 187 } else { 188 new AutoScaleAction("layer").actionPerformed(null); 183 189 } 184 190 … … 682 688 * (aka {@link OsmDataLayer}). If the edit layer has multiple download bounding 683 689 * boxes it zooms to a large virtual bounding box containing all smaller ones. 684 * This implementation can be used for resolving ticket #1461.685 690 * 686 691 * @return <code>true</code> if a zoom operation has been performed 687 692 */ 688 public boolean zoomToEditLayerBoundingBox() { 689 // workaround for #1461 (zoom to download bounding box instead of all data) 693 public boolean zoomToDataSetBoundingBox(DataSet ds) { 690 694 // In case we already have an existing data layer ... 691 695 OsmDataLayer layer= getEditLayer(); 692 696 if (layer == null) 693 697 return false; 694 Collection<DataSource> dataSources = layer.data.dataSources;698 Collection<DataSource> dataSources = ds.dataSources; 695 699 // ... with bounding box[es] of data loaded from OSM or a file... 696 700 BoundingXYVisitor bbox = new BoundingXYVisitor(); 697 for (DataSource ds: dataSources) {698 bbox.visit( ds.bounds);699 if (bbox.hasExtend()) {700 // ... we zoom to it's bounding box701 recalculateCenterScale(bbox);702 return true;703 }701 for (DataSource source : dataSources) { 702 bbox.visit(source.bounds); 703 } 704 if (bbox.hasExtend()) { 705 // ... we zoom to it's bounding box 706 recalculateCenterScale(bbox); 707 return true; 704 708 } 705 709 return false;
Note:
See TracChangeset
for help on using the changeset viewer.