Changeset 7817 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-12-17T13:46:53+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r7816 r7817 700 700 * @param layer the layer 701 701 * 702 * @see #addLayer( org.openstreetmap.josm.gui.layer.Layer, org.openstreetmap.josm.data.ProjectionBounds)703 * @see #addLayer( org.openstreetmap.josm.gui.layer.Layer, org.openstreetmap.josm.data.ViewportData)702 * @see #addLayer(Layer, ProjectionBounds) 703 * @see #addLayer(Layer, ViewportData) 704 704 */ 705 705 public final void addLayer(final Layer layer) { … … 715 715 * 716 716 * @param layer the layer 717 * @param bounds the bounds of the layer (target zoom area) 717 * @param bounds the bounds of the layer (target zoom area); can be null, then 718 * the viewport isn't changed 718 719 */ 719 720 public final synchronized void addLayer(final Layer layer, ProjectionBounds bounds) { 720 addLayer(layer, new ViewportData(bounds));721 addLayer(layer, bounds == null ? null : new ViewportData(bounds)); 721 722 } 722 723 … … 727 728 * 728 729 * @param layer the layer 729 * @param viewport the viewport to zoom to 730 * @param viewport the viewport to zoom to; can be null, then the viewport 731 * isn't changed 730 732 */ 731 733 public final synchronized void addLayer(final Layer layer, ViewportData viewport) { … … 738 740 if (noMap) { 739 741 Main.map.setVisible(true); 742 } else if (viewport != null) { 743 Main.map.mapView.zoomTo(viewport); 740 744 } 741 745 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r7668 r7817 85 85 bboxCalculator.enlargeBoundingBox(); 86 86 if (bboxCalculator.getBounds() != null) { 87 Main.map.mapView. recalculateCenterScale(bboxCalculator);87 Main.map.mapView.zoomTo(bboxCalculator); 88 88 } 89 89 } … … 174 174 BoundingXYVisitor bbox = getBoundingBox(); 175 175 if (bbox != null && bbox.getBounds() != null) { 176 Main.map.mapView. recalculateCenterScale(bbox);176 Main.map.mapView.zoomTo(bbox); 177 177 } 178 178 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r7816 r7817 265 265 BoundingXYVisitor v = new BoundingXYVisitor(); 266 266 v.visit(pb); 267 Main.map.mapView. recalculateCenterScale(v);267 Main.map.mapView.zoomTo(v); 268 268 } 269 269 -
trunk/src/org/openstreetmap/josm/data/ViewportData.java
r7816 r7817 3 3 4 4 import org.openstreetmap.josm.data.coor.EastNorth; 5 import org.openstreetmap.josm.tools.CheckParameterUtil; 5 6 6 7 /** … … 28 29 */ 29 30 public ViewportData(EastNorth center, Double scale) { 31 CheckParameterUtil.ensureParameterNotNull(center); 32 CheckParameterUtil.ensureParameterNotNull(scale); 30 33 this.center = center; 31 34 this.scale = scale; … … 34 37 35 38 public ViewportData(ProjectionBounds bounds) { 39 CheckParameterUtil.ensureParameterNotNull(bounds); 36 40 this.center = null; 37 41 this.scale = null; -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r7816 r7817 529 529 @Override public void paint(Graphics g) { 530 530 if (initialViewport != null) { 531 if (initialViewport.getBounds() != null) { 532 BoundingXYVisitor box = new BoundingXYVisitor(); 533 box.visit(initialViewport.getBounds()); 534 recalculateCenterScale(box); 535 } else { 536 zoomTo(initialViewport.getCenter(), initialViewport.getScale(), true); 537 } 531 zoomTo(initialViewport); 538 532 initialViewport = null; 539 533 } … … 693 687 /** 694 688 * Set the new dimension to the view. 695 */ 689 * 690 * @deprecated use #zoomTo(BoundingXYVisitor) 691 */ 692 @Deprecated 696 693 public void recalculateCenterScale(BoundingXYVisitor box) { 697 if (box == null) { 698 box = new BoundingXYVisitor(); 699 } 700 if (box.getBounds() == null) { 701 box.visit(getProjection().getWorldBoundsLatLon()); 702 } 703 if (!box.hasExtend()) { 704 box.enlargeBoundingBox(); 705 } 706 707 zoomTo(box.getBounds()); 694 zoomTo(box); 708 695 } 709 696 -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r7816 r7817 43 43 import org.openstreetmap.josm.data.osm.Way; 44 44 import org.openstreetmap.josm.data.osm.WaySegment; 45 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 45 46 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 46 47 import org.openstreetmap.josm.data.preferences.IntegerProperty; … … 580 581 zoomTo(new ProjectionBounds(getProjection().latlon2eastNorth(box.getMin()), 581 582 getProjection().latlon2eastNorth(box.getMax()))); 583 } 584 585 public void zoomTo(ViewportData viewport) { 586 if (viewport == null) return; 587 if (viewport.getBounds() != null) { 588 BoundingXYVisitor box = new BoundingXYVisitor(); 589 box.visit(viewport.getBounds()); 590 zoomTo(box); 591 } else { 592 zoomTo(viewport.getCenter(), viewport.getScale(), true); 593 } 594 } 595 596 /** 597 * Set the new dimension to the view. 598 */ 599 public void zoomTo(BoundingXYVisitor box) { 600 if (box == null) { 601 box = new BoundingXYVisitor(); 602 } 603 if (box.getBounds() == null) { 604 box.visit(getProjection().getWorldBoundsLatLon()); 605 } 606 if (!box.hasExtend()) { 607 box.enlargeBoundingBox(); 608 } 609 610 zoomTo(box.getBounds()); 582 611 } 583 612 -
trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
r7781 r7817 451 451 return; 452 452 box.enlargeBoundingBox(); 453 Main.map.mapView. recalculateCenterScale(box);453 Main.map.mapView.zoomTo(box); 454 454 } 455 455 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r7578 r7817 746 746 BoundingXYVisitor bbox = new BoundingXYVisitor(); 747 747 yLayer.visitBoundingBox(bbox); 748 Main.map.mapView. recalculateCenterScale(bbox);748 Main.map.mapView.zoomTo(bbox); 749 749 } 750 750 -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r7521 r7817 244 244 BoundingXYVisitor bbox1 = new BoundingXYVisitor(); 245 245 bbox1.visit(bbox); 246 Main.map.mapView. recalculateCenterScale(bbox1);246 Main.map.mapView.zoomTo(bbox1); 247 247 } 248 248 });
Note:
See TracChangeset
for help on using the changeset viewer.