Changeset 25314 in osm
- Timestamp:
- 2011-02-15T11:40:10+01:00 (14 years ago)
- Location:
- applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/BingAerialTileSource.java
r25217 r25314 161 161 public Image getAttributionImage() { 162 162 try { 163 return ImageIO.read(getClass().getResourceAsStream(" /images/bing_maps.png"));163 return ImageIO.read(getClass().getResourceAsStream("images/bing_maps.png")); 164 164 } catch (IOException e) { 165 165 return null; -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/Demo.java
r24989 r25314 56 56 }); 57 57 JComboBox tileSourceSelector = new JComboBox(new TileSource[] { new OsmTileSource.Mapnik(), 58 new OsmTileSource.TilesAtHome(), new OsmTileSource.CycleMap() }); 58 new OsmTileSource.TilesAtHome(), new OsmTileSource.CycleMap(), new BingAerialTileSource() }); 59 59 tileSourceSelector.addItemListener(new ItemListener() { 60 60 public void itemStateChanged(ItemEvent e) { -
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmTileSource.java
r25265 r25314 23 23 } 24 24 25 public AbstractOsmTileSource(String name, String base_url, String attr_img_url) 26 { 25 public AbstractOsmTileSource(String name, String base_url, String attr_img_url) { 27 26 NAME = name; 28 27 BASE_URL = base_url; 29 28 ATTR_IMG_URL = attr_img_url; 30 if(ATTR_IMG_URL == null) {31 REQUIRES_ATTRIBUTION = false;32 }33 29 } 34 30 … … 78 74 79 75 public Image getAttributionImage() { 80 if(ATTR_IMG_URL != null) 76 if (ATTR_IMG_URL != null) 81 77 return new ImageIcon(ATTR_IMG_URL).getImage(); 82 78 else … … 89 85 90 86 public String getAttributionText(int zoom, Coordinate topLeft, Coordinate botRight) { 91 return " CC-BY-SAOpenStreetMapand Contributors";87 return "© OpenStreetMap contributors, CC-BY-SA "; 92 88 } 93 89 … … 97 93 98 94 public String getTermsOfUseURL() { 99 return "http://openstreetmap.org/"; 95 return "http://www.openstreetmap.org/copyright"; 100 96 } 101 97 102 98 public double latToTileY(double lat, int zoom) { 103 104 105 99 double l = lat / 180 * Math.PI; 100 double pf = Math.log(Math.tan(l) + (1 / Math.cos(l))); 101 return Math.pow(2.0, zoom - 1) * (Math.PI - pf) / Math.PI; 106 102 } 107 103 108 104 public double lonToTileX(double lon, int zoom) { 109 105 return Math.pow(2.0, zoom - 3) * (lon + 180.0) / 45.0; 110 106 } 111 107 112 108 public double tileYToLat(int y, int zoom) { 113 return Math.atan(Math.sinh(Math.PI 114 - (Math.PI * y / Math.pow(2.0, zoom - 1)))) 115 * 180 / Math.PI; 109 return Math.atan(Math.sinh(Math.PI - (Math.PI * y / Math.pow(2.0, zoom - 1)))) * 180 / Math.PI; 116 110 } 117 111 118 112 public double tileXToLon(int x, int zoom) { 119 113 return x * 45.0 / Math.pow(2.0, zoom - 3) - 180.0; 120 114 } 121 115 } … … 164 158 public static abstract class OsmaSource extends AbstractOsmTileSource { 165 159 String osmaSuffix; 160 166 161 public OsmaSource(String name, String osmaSuffix) { 167 162 super(name, MAP_OSMA); … … 183 178 } 184 179 } 180 185 181 public static class TilesAtHome extends OsmaSource { 186 182 public TilesAtHome() { … … 188 184 } 189 185 } 186 190 187 public static class Maplint extends OsmaSource { 191 188 public Maplint() {
Note:
See TracChangeset
for help on using the changeset viewer.