diff --git a/src/org/openstreetmap/josm/Main.java b/src/org/openstreetmap/josm/Main.java
index f3f0ec3..a7a982b 100644
|
a
|
b
|
public abstract class Main {
|
| 569 | 569 | getLayerManager().addLayerChangeListener(new LayerChangeListener() { |
| 570 | 570 | @Override |
| 571 | 571 | public void layerAdded(LayerAddEvent e) { |
| | 572 | Layer layer = e.getAddedLayer(); |
| 572 | 573 | if (map == null) { |
| 573 | | Layer layer = e.getAddedLayer(); |
| 574 | | ProjectionBounds viewProjectionBounds = layer.getViewProjectionBounds(); |
| 575 | | Main.main.createMapFrame(layer, viewProjectionBounds == null ? null : new ViewportData(viewProjectionBounds)); |
| | 574 | Main.main.createMapFrame(layer, null); |
| | 575 | Main.map.setVisible(true); |
| | 576 | } |
| | 577 | ProjectionBounds viewProjectionBounds = layer.getViewProjectionBounds(); |
| | 578 | if (viewProjectionBounds != null) { |
| | 579 | Main.map.mapView.scheduleZoomTo(new ViewportData(viewProjectionBounds)); |
| 576 | 580 | } |
| 577 | 581 | } |
| 578 | 582 | |
| … |
… |
public abstract class Main {
|
| 819 | 823 | */ |
| 820 | 824 | public final synchronized void addLayer(final Layer layer, ViewportData viewport) { |
| 821 | 825 | getLayerManager().addLayer(layer); |
| 822 | | if (map != null) { |
| 823 | | Main.map.setVisible(true); |
| 824 | | } else if (viewport != null) { |
| 825 | | Main.map.mapView.zoomTo(viewport); |
| | 826 | if (viewport != null) { |
| | 827 | Main.map.mapView.scheduleZoomTo(viewport); |
| 826 | 828 | } |
| 827 | 829 | } |
| 828 | 830 | |
diff --git a/src/org/openstreetmap/josm/gui/MapView.java b/src/org/openstreetmap/josm/gui/MapView.java
index ea5f1ba..dface55 100644
|
a
|
b
|
LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener {
|
| 1290 | 1290 | public final MainLayerManager getLayerManager() { |
| 1291 | 1291 | return layerManager; |
| 1292 | 1292 | } |
| | 1293 | |
| | 1294 | /** |
| | 1295 | * Schedule a zoom to the given position on the next redraw. |
| | 1296 | * Temporary, may be removed without warning. |
| | 1297 | * @param viewportData |
| | 1298 | * @since xxx |
| | 1299 | */ |
| | 1300 | public void scheduleZoomTo(ViewportData viewportData) { |
| | 1301 | initialViewport = viewportData; |
| | 1302 | } |
| 1293 | 1303 | } |