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 * @param id unique id for the tile source; contains only characters that 023 * are safe for file names; can be null 024 */ 025 public AbstractOsmTileSource(String name, String base_url, String id) { 026 super(name, base_url, id); 027 } 028 029 public int getMaxZoom() { 030 return 19; 031 } 032 033 @Override 034 public boolean requiresAttribution() { 035 return true; 036 } 037 038 @Override 039 public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { 040 return DEFAULT_OSM_ATTRIBUTION; 041 } 042 043 @Override 044 public String getAttributionLinkURL() { 045 return "https://openstreetmap.org/"; 046 } 047 048 @Override 049 public Image getAttributionImage() { 050 return null; 051 } 052 053 @Override 054 public String getAttributionImageURL() { 055 return null; 056 } 057 058 @Override 059 public String getTermsOfUseText() { 060 return null; 061 } 062 063 @Override 064 public String getTermsOfUseURL() { 065 return "https://www.openstreetmap.org/copyright"; 066 } 067}