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