001// License: GPL. For details, see Readme.txt file.
002package org.openstreetmap.gui.jmapviewer.tilesources;
003
004import java.awt.Image;
005
006import org.openstreetmap.gui.jmapviewer.Coordinate;
007
008/**
009 * Abstract clas for OSM Tile sources
010 */
011public abstract class AbstractOsmTileSource extends AbstractTMSTileSource {
012    
013    /**
014     * The OSM attribution. Must be always in line with <a href="https://www.openstreetmap.org/copyright/en">https://www.openstreetmap.org/copyright/en</a>
015     */
016    public static final String DEFAULT_OSM_ATTRIBUTION = "\u00a9 OpenStreetMap contributors";
017    
018    /**
019     * Constructs a new OSM tile source
020     * @param name Source name as displayed in GUI
021     * @param base_url Source URL
022     */
023    public AbstractOsmTileSource(String name, String base_url) {
024        super(name, base_url);
025    }
026
027    public int getMaxZoom() {
028        return 19;
029    }
030
031    @Override
032    public boolean requiresAttribution() {
033        return true;
034    }
035
036    @Override
037    public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) {
038        return DEFAULT_OSM_ATTRIBUTION;
039    }
040
041    @Override
042    public String getAttributionLinkURL() {
043        return "https://openstreetmap.org/";
044    }
045
046    @Override
047    public Image getAttributionImage() {
048        return null;
049    }
050
051    @Override
052    public String getAttributionImageURL() {
053        return null;
054    }
055
056    @Override
057    public String getTermsOfUseText() {
058        return null;
059    }
060
061    @Override
062    public String getTermsOfUseURL() {
063        return "https://www.openstreetmap.org/copyright";
064    }
065}