Changeset 24485 in osm


Ignore:
Timestamp:
2010-12-01T03:38:09+01:00 (14 years ago)
Author:
yellowbkpk
Message:

Checkpoint for Bing attribution requirements.

Location:
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileSource.java

    r22697 r24485  
    11package org.openstreetmap.gui.jmapviewer;
    22
     3import java.awt.Image;
     4
     5import javax.swing.ImageIcon;
     6
    37import org.openstreetmap.gui.jmapviewer.interfaces.TileSource;
     8import org.openstreetmap.josm.data.coor.LatLon;
    49
    510public class OsmTileSource {
     
    1116        protected String NAME;
    1217        protected String BASE_URL;
    13         public AbstractOsmTileSource(String name, String base_url)
     18        protected String ATTR_IMG_URL;
     19        protected boolean REQUIRES_ATTRIBUTION = true;
     20
     21        public AbstractOsmTileSource(String name, String base_url) {
     22            this(name, base_url, null);
     23        }
     24
     25        public AbstractOsmTileSource(String name, String base_url, String attr_img_url)
    1426        {
    1527            NAME = name;
    1628            BASE_URL = base_url;
     29            ATTR_IMG_URL = attr_img_url;
     30            if(ATTR_IMG_URL == null) {
     31                REQUIRES_ATTRIBUTION = false;
     32            }
    1733        }
    1834
     
    5672        public int getTileSize() {
    5773            return 256;
     74        }
     75
     76        public Image getAttributionImage() {
     77            if(ATTR_IMG_URL != null)
     78                return new ImageIcon(ATTR_IMG_URL).getImage();
     79            else
     80                return null;
     81        }
     82
     83        public boolean requiresAttribution() {
     84            return REQUIRES_ATTRIBUTION;
     85        }
     86
     87        public String getAttributionText(int zoom, LatLon topLeft, LatLon botRight) {
     88            return "CC-BY-SA OpenStreetMap and Contributors";
    5889        }
    5990    }
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java

    r22281 r24485  
    11package org.openstreetmap.gui.jmapviewer.interfaces;
    22
     3import java.awt.Image;
     4
    35import org.openstreetmap.gui.jmapviewer.JMapViewer;
     6import org.openstreetmap.josm.data.coor.LatLon;
    47
    58//License: GPL. Copyright 2008 by Jan Peter Stotz
     
    9295     */
    9396    public int getTileSize();
     97
     98    /**
     99     * @return True if the tile source requires attribution.
     100     */
     101    public boolean requiresAttribution();
     102
     103    /**
     104     * @param zoom The optional zoom level for the view.
     105     * @param botRight The bottom right of the bounding box for attribution.
     106     * @param topLeft The top left of the bounding box for attribution.
     107     * @return Attribution text for the image source.
     108     */
     109    public String getAttributionText(int zoom, LatLon topLeft, LatLon botRight);
     110
     111    /**
     112     * @return The URL for the attribution image. Null if no image should be displayed.
     113     */
     114    public Image getAttributionImage();
    94115}
Note: See TracChangeset for help on using the changeset viewer.