diff --git a/src/org/openstreetmap/josm/Main.java b/src/org/openstreetmap/josm/Main.java
index b57ec52..22c867e 100644
|
a
|
b
|
import org.openstreetmap.josm.data.coor.LatLon;
|
| 74 | 74 | import org.openstreetmap.josm.data.osm.DataSet; |
| 75 | 75 | import org.openstreetmap.josm.data.osm.OsmPrimitive; |
| 76 | 76 | import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy; |
| 77 | | import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; |
| 78 | 77 | import org.openstreetmap.josm.data.projection.Projection; |
| 79 | 78 | import org.openstreetmap.josm.data.projection.ProjectionChangeListener; |
| 80 | 79 | import org.openstreetmap.josm.data.validation.OsmValidator; |
| … |
… |
public abstract class Main {
|
| 768 | 767 | * @see #addLayer(Layer, ViewportData) |
| 769 | 768 | */ |
| 770 | 769 | public final void addLayer(final Layer layer) { |
| 771 | | BoundingXYVisitor v = new BoundingXYVisitor(); |
| 772 | | layer.visitBoundingBox(v); |
| 773 | | addLayer(layer, v.getBounds()); |
| | 770 | addLayer(layer, layer.getViewProjectionBounds()); |
| 774 | 771 | } |
| 775 | 772 | |
| 776 | 773 | /** |
diff --git a/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java b/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
index 2fbbd13..324ca12 100644
|
a
|
b
|
public class DownloadOsmTask extends AbstractDownloadTask<DataSet> {
|
| 258 | 258 | // |
| 259 | 259 | final OsmDataLayer layer = createNewLayer(newLayerName); |
| 260 | 260 | if (Main.main != null) |
| 261 | | Main.main.addLayer(layer, computeBbox(bounds)); |
| | 261 | Main.main.addLayer(layer); |
| 262 | 262 | return layer; |
| 263 | 263 | } |
| 264 | 264 | return null; |
diff --git a/src/org/openstreetmap/josm/gui/layer/Layer.java b/src/org/openstreetmap/josm/gui/layer/Layer.java
index 45f505c..4f4253f 100644
|
a
|
b
|
import org.openstreetmap.josm.actions.GpxExportAction;
|
| 22 | 22 | import org.openstreetmap.josm.actions.SaveAction; |
| 23 | 23 | import org.openstreetmap.josm.actions.SaveActionBase; |
| 24 | 24 | import org.openstreetmap.josm.actions.SaveAsAction; |
| | 25 | import org.openstreetmap.josm.data.ProjectionBounds; |
| 25 | 26 | import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; |
| 26 | 27 | import org.openstreetmap.josm.data.projection.Projection; |
| 27 | 28 | import org.openstreetmap.josm.data.projection.ProjectionChangeListener; |
| … |
… |
public abstract class Layer extends AbstractMapViewPaintable implements Destroya
|
| 592 | 593 | return LayerPositionStrategy.AFTER_LAST_VALIDATION_LAYER; |
| 593 | 594 | } |
| 594 | 595 | } |
| | 596 | |
| | 597 | /** |
| | 598 | * Gets the {@link ProjectionBounds} for this layer to be visible to the user. This can be the exact bounds, the UI handles padding. Return |
| | 599 | * <code>null</code> if you cannot provide this information. The default implementation uses the bounds from |
| | 600 | * {@link #visitBoundingBox(BoundingXYVisitor)}. |
| | 601 | * @return The bounds for this layer. |
| | 602 | * @since xxx |
| | 603 | */ |
| | 604 | public ProjectionBounds getViewProjectionBounds() { |
| | 605 | BoundingXYVisitor v = new BoundingXYVisitor(); |
| | 606 | visitBoundingBox(v); |
| | 607 | return v.getBounds(); |
| | 608 | } |
| 595 | 609 | } |
diff --git a/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java b/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
index 0f60228..142e410 100644
|
a
|
b
|
import org.openstreetmap.josm.actions.ToggleUploadDiscouragedLayerAction;
|
| 48 | 48 | import org.openstreetmap.josm.data.APIDataSet; |
| 49 | 49 | import org.openstreetmap.josm.data.Bounds; |
| 50 | 50 | import org.openstreetmap.josm.data.DataSource; |
| | 51 | import org.openstreetmap.josm.data.ProjectionBounds; |
| 51 | 52 | import org.openstreetmap.josm.data.SelectionChangedListener; |
| 52 | 53 | import org.openstreetmap.josm.data.conflict.Conflict; |
| 53 | 54 | import org.openstreetmap.josm.data.conflict.ConflictCollection; |
| … |
… |
public class OsmDataLayer extends AbstractModifiableLayer implements Listener, S
|
| 1078 | 1079 | dialog.setUploadedPrimitives(new APIDataSet(data)); |
| 1079 | 1080 | return dialog; |
| 1080 | 1081 | } |
| | 1082 | |
| | 1083 | @Override |
| | 1084 | public ProjectionBounds getViewProjectionBounds() { |
| | 1085 | BoundingXYVisitor v = new BoundingXYVisitor(); |
| | 1086 | v.visit(data.getDataSourceBoundingBox()); |
| | 1087 | if (!v.hasExtend()) { |
| | 1088 | v.computeBoundingBox(data.getNodes()); |
| | 1089 | } |
| | 1090 | return v.getBounds(); |
| | 1091 | } |
| 1081 | 1092 | } |
diff --git a/src/org/openstreetmap/josm/io/OsmImporter.java b/src/org/openstreetmap/josm/io/OsmImporter.java
index 92857ba..68c9e8b 100644
|
a
|
b
|
import javax.swing.JOptionPane;
|
| 14 | 14 | import org.openstreetmap.josm.Main; |
| 15 | 15 | import org.openstreetmap.josm.actions.ExtensionFileFilter; |
| 16 | 16 | import org.openstreetmap.josm.data.osm.DataSet; |
| 17 | | import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; |
| 18 | 17 | import org.openstreetmap.josm.gui.layer.OsmDataLayer; |
| 19 | 18 | import org.openstreetmap.josm.gui.progress.ProgressMonitor; |
| 20 | 19 | import org.openstreetmap.josm.gui.util.GuiHelper; |
| … |
… |
public class OsmImporter extends FileImporter {
|
| 96 | 95 | @Override |
| 97 | 96 | public void run() { |
| 98 | 97 | OsmDataLayer layer = data.getLayer(); |
| 99 | | BoundingXYVisitor v = new BoundingXYVisitor(); |
| 100 | | v.visit(layer.data.getDataSourceBoundingBox()); |
| 101 | | if (!v.hasExtend()) { |
| 102 | | v.computeBoundingBox(layer.data.getNodes()); |
| 103 | | } |
| 104 | | Main.main.addLayer(layer, v.getBounds()); |
| | 98 | Main.main.addLayer(layer); |
| 105 | 99 | data.getPostLayerTask().run(); |
| 106 | 100 | data.getLayer().onPostLoadFromFile(); |
| 107 | 101 | } |