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.interfaces.ICoordinate; 007 008/** 009 * Abstract class for OSM Tile sources 010 */ 011public abstract class AbstractOsmTileSource extends TMSTileSource { 012 013 /** 014 * The OSM attribution. Must be always in line with 015 * <a href="https://www.openstreetmap.org/copyright/en">https://www.openstreetmap.org/copyright/en</a> 016 */ 017 public static final String DEFAULT_OSM_ATTRIBUTION = "\u00a9 OpenStreetMap contributors"; 018 019 /** 020 * Constructs a new OSM tile source 021 * @param name Source name as displayed in GUI 022 * @param baseUrl Source URL 023 * @param id unique id for the tile source; contains only characters that 024 * are safe for file names; can be null 025 */ 026 public AbstractOsmTileSource(String name, String baseUrl, String id) { 027 super(new TileSourceInfo(name, baseUrl, id)); 028 } 029 030 @Override 031 public int getMaxZoom() { 032 return 19; 033 } 034 035 @Override 036 public boolean requiresAttribution() { 037 return true; 038 } 039 040 @Override 041 public String getAttributionText(int zoom, ICoordinate topLeft, ICoordinate botRight) { 042 return DEFAULT_OSM_ATTRIBUTION; 043 } 044 045 @Override 046 public String getAttributionLinkURL() { 047 return "https://openstreetmap.org/"; 048 } 049 050 @Override 051 public Image getAttributionImage() { 052 return null; 053 } 054 055 @Override 056 public String getAttributionImageURL() { 057 return null; 058 } 059 060 @Override 061 public String getTermsOfUseText() { 062 return null; 063 } 064 065 @Override 066 public String getTermsOfUseURL() { 067 return "https://www.openstreetmap.org/copyright"; 068 } 069}