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


Ignore:
Timestamp:
2021-08-31T23:17:15+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21260 - fix reprojection of MVT tiles (patch by taylor.smock)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

    r17975 r18187  
    889889        if (tile == null) {
    890890            if (coordinateConverter.requiresReprojection()) {
    891                 tile = new ReprojectionTile(tileSource, x, y, zoom);
     891                tile = new ReprojectionTile(createTile(tileSource, x, y, zoom));
    892892            } else {
    893893                tile = createTile(tileSource, x, y, zoom);
  • trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java

    r17165 r18187  
    55import java.awt.geom.Point2D;
    66import java.awt.image.BufferedImage;
     7import java.io.IOException;
     8import java.io.InputStream;
    79
    810import org.openstreetmap.gui.jmapviewer.Tile;
     
    1113import org.openstreetmap.josm.data.coor.EastNorth;
    1214import org.openstreetmap.josm.data.imagery.CoordinateConversion;
     15import org.openstreetmap.josm.data.imagery.vectortile.VectorTile;
    1316import org.openstreetmap.josm.data.projection.Projection;
    1417import org.openstreetmap.josm.data.projection.ProjectionRegistry;
     
    2629public class ReprojectionTile extends Tile {
    2730
     31    private final Tile tile;
    2832    protected TileAnchor anchor;
    2933    private double nativeScale;
     
    3236    /**
    3337     * Constructs a new {@code ReprojectionTile}.
    34      * @param source sourec tile
     38     * @param source source tile
    3539     * @param xtile X coordinate
    3640     * @param ytile Y coordinate
     
    3943    public ReprojectionTile(TileSource source, int xtile, int ytile, int zoom) {
    4044        super(source, xtile, ytile, zoom);
     45        this.tile = null;
     46    }
     47
     48    /**
     49     * Create a reprojection tile for a specific tile
     50     * @param tile The tile to use
     51     */
     52    public ReprojectionTile(Tile tile) {
     53        super(tile.getTileSource(), tile.getXtile(), tile.getYtile(), tile.getZoom());
     54        this.tile = tile;
    4155    }
    4256
     
    7387            return false;
    7488        return !maxZoomReached || currentScale >= nativeScale;
     89    }
     90
     91    @Override
     92    public void loadImage(InputStream inputStream) throws IOException {
     93        if (this.tile instanceof VectorTile) {
     94            this.tile.loadImage(inputStream);
     95        } else {
     96            super.loadImage(inputStream);
     97        }
    7598    }
    7699
Note: See TracChangeset for help on using the changeset viewer.