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.TileSource; 007import org.openstreetmap.gui.jmapviewer.Coordinate; 008 009abstract public class AbstractTileSource implements TileSource { 010 011 protected String attributionText; 012 protected String attributionLinkURL; 013 protected Image attributionImage; 014 protected String attributionImageURL; 015 protected String termsOfUseText; 016 protected String termsOfUseURL; 017 018 @Override 019 public boolean requiresAttribution() { 020 return attributionText != null || attributionImage != null || termsOfUseText != null || termsOfUseURL != null; 021 } 022 023 @Override 024 public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { 025 return attributionText; 026 } 027 028 @Override 029 public String getAttributionLinkURL() { 030 return attributionLinkURL; 031 } 032 033 @Override 034 public Image getAttributionImage() { 035 return attributionImage; 036 } 037 038 @Override 039 public String getAttributionImageURL() { 040 return attributionImageURL; 041 } 042 043 @Override 044 public String getTermsOfUseText() { 045 return termsOfUseText; 046 } 047 048 @Override 049 public String getTermsOfUseURL() { 050 return termsOfUseURL; 051 } 052 053 public void setAttributionText(String attributionText) { 054 this.attributionText = attributionText; 055 } 056 057 public void setAttributionLinkURL(String attributionLinkURL) { 058 this.attributionLinkURL = attributionLinkURL; 059 } 060 061 public void setAttributionImage(Image attributionImage) { 062 this.attributionImage = attributionImage; 063 } 064 065 public void setAttributionImageURL(String attributionImageURL) { 066 this.attributionImageURL = attributionImageURL; 067 } 068 069 public void setTermsOfUseText(String termsOfUseText) { 070 this.termsOfUseText = termsOfUseText; 071 } 072 073 public void setTermsOfUseURL(String termsOfUseURL) { 074 this.termsOfUseURL = termsOfUseURL; 075 } 076 077}