Ignore:
Timestamp:
2015-05-10T13:27:54+02:00 (9 years ago)
Author:
bastiK
Message:

applied #10454 - Mapbox "empty" tile (imagery with zoom level > 17) (patch by wiktorn)

File:
1 edited

Legend:

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

    r8093 r8344  
    1010import java.util.Collections;
    1111import java.util.List;
     12import java.util.Map;
    1213import java.util.Objects;
    1314import java.util.TreeSet;
     
    2122import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource;
    2223import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource.Mapnik;
     24import org.openstreetmap.gui.jmapviewer.tilesources.TileSourceInfo;
    2325import org.openstreetmap.josm.Main;
    2426import org.openstreetmap.josm.data.Bounds;
     
    3537 * @author Frederik Ramm
    3638 */
    37 public class ImageryInfo implements Comparable<ImageryInfo>, Attributed {
     39public class ImageryInfo extends TileSourceInfo implements Comparable<ImageryInfo>, Attributed {
    3840
    3941    /**
     
    5355        /** A WMS endpoint entry only stores the WMS server info, without layer, which are chosen later by the user. **/
    5456        WMS_ENDPOINT("wms_endpoint");
     57
    5558
    5659        private final String typeString;
     
    151154    }
    152155
    153     /** name of the imagery entry (gets translated by josm usually) */
    154     private String name;
     156
    155157    /** original name of the imagery entry in case of translation call, for multiple languages English when possible */
    156158    private String origName;
    157159    /** (original) language of the translated name entry */
    158160    private String langName;
    159     /** id for this imagery entry, optional at the moment */
    160     private String id;
    161     /** URL of the imagery service */
    162     private String url = null;
    163161    /** whether this is a entry activated by default or not */
    164162    private boolean defaultEntry = false;
     
    199197    private String icon;
    200198    // when adding a field, also adapt the ImageryInfo(ImageryInfo) constructor
     199    private Map<String, String> noTileHeaders;
    201200
    202201    /**
     
    225224        @pref String icon;
    226225        @pref String description;
     226        @pref Map<String, String> noTileHeaders;
    227227
    228228        /**
     
    278278                projections = val.toString();
    279279            }
     280            if (i.noTileHeaders != null && !i.noTileHeaders.isEmpty()) {
     281                noTileHeaders = i.noTileHeaders;
     282            }
    280283        }
    281284
     
    295298     */
    296299    public ImageryInfo() {
     300        super();
    297301    }
    298302
     
    302306     */
    303307    public ImageryInfo(String name) {
    304         this.name=name;
     308        super(name);
    305309    }
    306310
     
    311315     */
    312316    public ImageryInfo(String name, String url) {
    313         this.name=name;
     317        this(name);
    314318        setExtendedUrl(url);
    315319    }
     
    322326     */
    323327    public ImageryInfo(String name, String url, String eulaAcceptanceRequired) {
    324         this.name=name;
     328        this(name);
    325329        setExtendedUrl(url);
    326330        this.eulaAcceptanceRequired = eulaAcceptanceRequired;
     
    337341     */
    338342    public ImageryInfo(String name, String url, String type, String eulaAcceptanceRequired, String cookies) {
    339         this.name=name;
     343        this(name);
    340344        setExtendedUrl(url);
    341345        ImageryType t = ImageryType.fromString(type);
     
    347351            throw new IllegalArgumentException("unknown type: "+type);
    348352        }
     353    }
     354
     355    public ImageryInfo(String name, String url, String type, String eulaAcceptanceRequired, String cookies, String id) {
     356        this(name, url, type, eulaAcceptanceRequired, cookies);
     357        setId(id);
    349358    }
    350359
     
    390399        countryCode = e.country_code;
    391400        icon = e.icon;
     401        if (e.noTileHeaders != null) {
     402            noTileHeaders = e.noTileHeaders;
     403        }
    392404    }
    393405
     
    688700     * @return The entry name
    689701     */
     702    @Override
    690703    public String getName() {
    691704        return this.name;
     
    759772     * @return The entry URL
    760773     */
     774    @Override
    761775    public String getUrl() {
    762776        return this.url;
     
    791805     * @return the cookie data part
    792806     */
     807    @Override
    793808    public String getCookies() {
    794809        return this.cookies;
     
    803818     * @return The maximum zoom level
    804819     */
     820    @Override
    805821    public int getMaxZoom() {
    806822        return this.defaultMaxZoom;
     
    811827     * @return The minimum zoom level
    812828     */
     829    @Override
    813830    public int getMinZoom() {
    814831        return this.defaultMinZoom;
     
    10261043        return capabilities != null && capabilities.isOnImageryBlacklist(this.url);
    10271044    }
     1045
     1046    public void setNoTileHeaders(Map<String, String> noTileHeaders) {
     1047       this.noTileHeaders = noTileHeaders;
     1048    }
     1049
     1050    @Override
     1051    public Map<String, String> getNoTileHeaders() {
     1052        return noTileHeaders;
     1053    }
    10281054}
Note: See TracChangeset for help on using the changeset viewer.