Ignore:
Timestamp:
2023-08-28T22:14:59+02:00 (15 months ago)
Author:
taylor.smock
Message:

Improve Zoom to layer action for PMTiles layers

Location:
applications/editors/josm/plugins/pmtiles/src/main/java/org/openstreetmap/josm/plugins/pmtiles/gui/layers
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pmtiles/src/main/java/org/openstreetmap/josm/plugins/pmtiles/gui/layers/PMTilesImageLayer.java

    r36115 r36125  
    77import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
    88import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTFile;
     9import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    910import org.openstreetmap.josm.gui.layer.AbstractCachedTileSourceLayer;
    1011import org.openstreetmap.josm.plugins.pmtiles.data.imagery.PMTilesImageryInfo;
     
    6970        return PMTilesLayer.super.getChangesetSourceTag();
    7071    }
     72
     73    @Override
     74    public void visitBoundingBox(BoundingXYVisitor v) {
     75        super.visitBoundingBox(v);
     76        PMTilesLayer.super.visitBoundingBox(v);
     77    }
    7178}
  • applications/editors/josm/plugins/pmtiles/src/main/java/org/openstreetmap/josm/plugins/pmtiles/gui/layers/PMTilesLayer.java

    r36115 r36125  
    44import static org.openstreetmap.josm.tools.Utils.getSystemProperty;
    55
     6import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    67import org.openstreetmap.josm.plugins.pmtiles.data.imagery.PMTilesImageryInfo;
    78import org.openstreetmap.josm.tools.TextUtils;
     
    4950        return sb.toString();
    5051    }
     52
     53    /**
     54     * Visits the content bounds of this layer. The behavior of this method depends on the layer,
     55     * but each implementation should attempt to cover the relevant content of the layer in this method.
     56     * @param v The visitor that gets notified about the contents of this layer.
     57     * @see org.openstreetmap.josm.gui.layer.Layer#visitBoundingBox
     58     */
     59    default void visitBoundingBox(BoundingXYVisitor v) {
     60        v.visit(this.getInfo().getBounds());
     61    }
    5162}
  • applications/editors/josm/plugins/pmtiles/src/main/java/org/openstreetmap/josm/plugins/pmtiles/gui/layers/PMTilesMVTLayer.java

    r36115 r36125  
    88import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MVTFile;
    99import org.openstreetmap.josm.data.imagery.vectortile.mapbox.MapboxVectorTileSource;
     10import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    1011import org.openstreetmap.josm.gui.layer.imagery.MVTLayer;
    1112import org.openstreetmap.josm.plugins.pmtiles.data.imagery.PMTilesImageryInfo;
     
    7071        return PMTilesLayer.super.getChangesetSourceTag();
    7172    }
     73
     74    @Override
     75    public void visitBoundingBox(BoundingXYVisitor v) {
     76        super.visitBoundingBox(v);
     77        PMTilesLayer.super.visitBoundingBox(v);
     78    }
    7279}
Note: See TracChangeset for help on using the changeset viewer.