Changeset 24485 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
 - 2010-12-01T03:38:09+01:00 (15 years ago)
 - Location:
 - applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
 - Files:
 - 
      
- 2 edited
 
- 
          
  OsmTileSource.java (modified) (3 diffs)
 - 
          
  interfaces/TileSource.java (modified) (2 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileSource.java
r22697 r24485 1 1 package org.openstreetmap.gui.jmapviewer; 2 2 3 import java.awt.Image; 4 5 import javax.swing.ImageIcon; 6 3 7 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 8 import org.openstreetmap.josm.data.coor.LatLon; 4 9 5 10 public class OsmTileSource { … … 11 16 protected String NAME; 12 17 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) 14 26 { 15 27 NAME = name; 16 28 BASE_URL = base_url; 29 ATTR_IMG_URL = attr_img_url; 30 if(ATTR_IMG_URL == null) { 31 REQUIRES_ATTRIBUTION = false; 32 } 17 33 } 18 34 … … 56 72 public int getTileSize() { 57 73 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"; 58 89 } 59 90 }  - 
      
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/interfaces/TileSource.java
r22281 r24485 1 1 package org.openstreetmap.gui.jmapviewer.interfaces; 2 2 3 import java.awt.Image; 4 3 5 import org.openstreetmap.gui.jmapviewer.JMapViewer; 6 import org.openstreetmap.josm.data.coor.LatLon; 4 7 5 8 //License: GPL. Copyright 2008 by Jan Peter Stotz … … 92 95 */ 93 96 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(); 94 115 }  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  