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