Changeset 32022 in osm for applications


Ignore:
Timestamp:
2016-01-24T15:12:38+01:00 (9 years ago)
Author:
stoecker
Message:

see #josm12425 - fix handling of equal no tile headers with different values

Location:
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/AbstractTMSTileSource.java

    r32021 r32022  
    2828    protected String baseUrl;
    2929    protected String id;
    30     private final Map<String, String> noTileHeaders;
    31     private final Map<String, String> noTileChecksums;
     30    private final Map<String, List<String> > noTileHeaders;
     31    private final Map<String, List<String> > noTileChecksums;
    3232    private final Map<String, String> metadataHeaders;
    3333    protected int tileSize;
     
    212212    public boolean isNoTileAtZoom(Map<String, List<String>> headers, int statusCode, byte[] content) {
    213213        if (noTileHeaders != null && headers != null) {
    214             for (Entry<String, String> searchEntry: noTileHeaders.entrySet()) {
     214            for (Entry<String, List<String>> searchEntry: noTileHeaders.entrySet()) {
    215215                List<String> headerVals = headers.get(searchEntry.getKey());
    216216                if (headerVals != null) {
    217217                    for (String headerValue: headerVals) {
    218                         if (headerValue.matches(searchEntry.getValue())) {
    219                             return true;
     218                        for (String val: searchEntry.getValue()) {
     219                            if (headerValue.matches(val)) {
     220                                return true;
     221                            }
    220222                        }
    221223                    }
     
    224226        }
    225227        if (noTileChecksums != null) {
    226             for (Entry<String, String> searchEntry: noTileChecksums.entrySet()) {
     228            for (Entry<String, List<String>> searchEntry: noTileChecksums.entrySet()) {
    227229                MessageDigest md = null;
    228230                try {
     
    242244                    hexChars[j++] = (char)(vn + (vn >= 10 ? 'a'-10 : '0'));
    243245                }
    244                 if (new String(hexChars).equalsIgnoreCase(searchEntry.getValue())) {
    245                     return true;
     246                for (String val: searchEntry.getValue()) {
     247                    if (new String(hexChars).equalsIgnoreCase(val)) {
     248                        return true;
     249                    }
    246250                }
    247251            }
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/TileSourceInfo.java

    r32021 r32022  
    22package org.openstreetmap.gui.jmapviewer.tilesources;
    33
     4import java.util.List;
    45import java.util.Map;
    56
     
    2223
    2324    /** headers meaning, that there is no tile at this zoom level */
    24     protected Map<String, String> noTileHeaders;
     25    protected Map<String, List<String>> noTileHeaders;
    2526
    2627    /** checksum of empty tiles */
    27     protected Map<String, String> noTileChecksums;
     28    protected Map<String, List<String>> noTileChecksums;
    2829
    2930    /** minimum zoom level supported by the tile source */
     
    99100     * Request header information for empty tiles for servers delivering such tile types
    100101     * @return map of headers, that when set, means that this is "no tile at this zoom level" situation
     102     * @since 32022
    101103     */
    102     public Map<String, String> getNoTileHeaders() {
     104    public Map<String, List<String>> getNoTileHeaders() {
    103105        return noTileHeaders;
    104106    }
     
    107109     * Checkusm for empty tiles for servers delivering such tile types
    108110     * @return map of checksums, that when detected, means that this is "no tile at this zoom level" situation
    109      * @since 32021
     111     * @since 32022
    110112     */
    111     public Map<String, String> getNoTileChecksums() {
     113    public Map<String, List<String>> getNoTileChecksums() {
    112114        return noTileChecksums;
    113115    }
Note: See TracChangeset for help on using the changeset viewer.