Ignore:
Timestamp:
2015-08-08T18:32:10+02:00 (9 years ago)
Author:
wiktorn
Message:
  • performance improvements - move all cache accesses to worker thread, as now, mostly we will have accesses to disks
  • follow HTTP 302 redirection when downloading tiles. Addresses: #11770
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSource.java

    r8647 r8649  
    3737 */
    3838public class TemplatedWMSTileSource extends TMSTileSource implements TemplatedTileSource {
    39     private Map<String, String> headers = new ConcurrentHashMap<>();
     39    private final Map<String, String> headers = new ConcurrentHashMap<>();
    4040    private final Set<String> serverProjections;
    4141    private EastNorth topLeftCorner;
    4242    private Bounds worldBounds;
     43    private int[] tileXMax;
     44    private int[] tileYMax;
    4345
    4446    private static final Pattern PATTERN_HEADER  = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}");
     
    8991        EastNorth max = proj.latlon2eastNorth(worldBounds.getMax());
    9092        this.topLeftCorner = new EastNorth(min.east(), max.north());
     93
     94        LatLon bottomRight = new LatLon(worldBounds.getMinLat(), worldBounds.getMaxLon());
     95        tileXMax = new int[getMaxZoom() + 1];
     96        tileYMax = new int[getMaxZoom() + 1];
     97        for(int zoom = getMinZoom(); zoom <= getMaxZoom(); zoom++) {
     98            TileXY maxTileIndex = latLonToTileXY(bottomRight.toCoordinate(), zoom);
     99            tileXMax[zoom] = maxTileIndex.getXIndex();
     100            tileYMax[zoom] = maxTileIndex.getYIndex();
     101        }
    91102    }
    92103
     
    229240    @Override
    230241    public int getTileXMax(int zoom) {
    231         LatLon bottomRight = new LatLon(worldBounds.getMinLat(), worldBounds.getMaxLon());
    232         return latLonToTileXY(bottomRight.toCoordinate(), zoom).getXIndex();
     242        return tileXMax[zoom];
    233243    }
    234244
     
    240250    @Override
    241251    public int getTileYMax(int zoom) {
    242         LatLon bottomRight = new LatLon(worldBounds.getMinLat(), worldBounds.getMaxLon());
    243         return latLonToTileXY(bottomRight.toCoordinate(), zoom).getYIndex();
     252        return tileYMax[zoom];
    244253    }
    245254
Note: See TracChangeset for help on using the changeset viewer.