Changeset 19289 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2025-01-24T14:05:46+01:00 (3 months ago)
Author:
taylor.smock
Message:

Fix #24097: Zoom to imagery layer

This fixes two issues:

  1. Adds implementation for visitBoundingBox used by the Zoom to layer action
  2. Uses addLayer(Layer, boolean) to avoid zooming to the bounds of the layer on layer add

Also, clean up some deprecation warnings.

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r19050 r19289  
    169169            if (infoToAdd != null) {
    170170                layer = ImageryLayer.create(infoToAdd);
    171                 getLayerManager().addLayer(layer);
     171                getLayerManager().addLayer(layer, false);
    172172                AlignImageryPanel.addNagPanelIfNeeded(infoToAdd);
    173173            }
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r19280 r19289  
    2727import java.io.IOException;
    2828import java.net.MalformedURLException;
    29 import java.net.URL;
     29import java.net.URI;
     30import java.net.URISyntaxException;
    3031import java.time.Instant;
    3132import java.util.ArrayList;
     
    292293
    293294        try {
    294             if ("file".equalsIgnoreCase(new URL(tileSource.getBaseUrl()).getProtocol())) {
     295            if ("file".equalsIgnoreCase(new URI(tileSource.getBaseUrl()).toURL().getProtocol())) {
    295296                tileLoader = new OsmTileLoader(this);
    296297            }
    297         } catch (MalformedURLException e) {
     298        } catch (URISyntaxException | MalformedURLException e) {
    298299            // ignore, assume that this is not a file
    299300            Logging.log(Logging.LEVEL_DEBUG, e);
     
    515516        if (tile != null) {
    516517            try {
    517                 new Notification(HttpClient.create(new URL(tile.getUrl() + '/' + request))
     518                new Notification(HttpClient.create(new URI(tile.getUrl() + '/' + request).toURL())
    518519                        .connect().fetchContent()).setIcon(JOptionPane.INFORMATION_MESSAGE).show();
    519             } catch (IOException ex) {
     520            } catch (URISyntaxException | IOException ex) {
    520521                Logging.error(ex);
    521522            }
     
    18741875    @Override
    18751876    public void visitBoundingBox(BoundingXYVisitor v) {
     1877        if (this.getInfo() != null) {
     1878            v.visit(this.getInfo().getBounds());
     1879        }
    18761880    }
    18771881
Note: See TracChangeset for help on using the changeset viewer.