Changeset 32181 in osm for applications/viewer/jmapviewer/src/org/openstreetmap
- Timestamp:
- 2016-05-15T17:45:55+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/tilesources/BingAerialTileSource.java
r32180 r32181 37 37 import org.xml.sax.SAXException; 38 38 39 /** 40 * Tile source for the Bing Maps REST Imagery API. 41 * @see <a href="https://msdn.microsoft.com/en-us/library/ff701724.aspx">MSDN</a> 42 */ 39 43 public class BingAerialTileSource extends TMSTileSource { 40 44 … … 66 70 67 71 protected static class Attribution { 68 private String attribution ;72 private String attributionText; 69 73 private int minZoom; 70 74 private int maxZoom; … … 102 106 XPathFactory xPathFactory = XPathFactory.newInstance(); 103 107 XPath xpath = xPathFactory.newXPath(); 104 imageUrlTemplate = xpath.compile("//ImageryMetadata/ImageUrl/text()").evaluate(document); 105 imageUrlTemplate = imageUrlTemplate.replace( 108 imageUrlTemplate = xpath.compile("//ImageryMetadata/ImageUrl/text()").evaluate(document).replace( 106 109 "http://ecn.{subdomain}.tiles.virtualearth.net/", 107 110 "https://ecn.{subdomain}.tiles.virtualearth.net/"); … … 129 132 NodeList imageryProviderNodes = (NodeList) xpath.compile("//ImageryMetadata/ImageryProvider") 130 133 .evaluate(document, XPathConstants.NODESET); 131 List<Attribution> attributions = new ArrayList<>(imageryProviderNodes.getLength());134 List<Attribution> attributionsList = new ArrayList<>(imageryProviderNodes.getLength()); 132 135 for (int i = 0; i < imageryProviderNodes.getLength(); i++) { 133 136 Node providerNode = imageryProviderNodes.item(i); … … 139 142 Node areaNode = coverageAreaNodes.item(j); 140 143 Attribution attr = new Attribution(); 141 attr.attribution = attribution;144 attr.attributionText = attribution; 142 145 143 146 attr.maxZoom = Integer.parseInt(zoomMaxXpath.evaluate(areaNode)); … … 151 154 attr.max = new Coordinate(northLat, eastLon); 152 155 153 attributions .add(attr);154 } 155 } 156 157 return attributions ;156 attributionsList.add(attr); 157 } 158 } 159 160 return attributionsList; 158 161 } catch (SAXException e) { 159 162 System.err.println("Could not parse Bing aerials attribution metadata."); … … 182 185 @Override 183 186 public String getAttributionLinkURL() { 184 //return "http://bing.com/maps" 185 // FIXME: I've set attributionLinkURL temporarily to ToU URL to comply with bing ToU 187 // Terms of Use URL to comply with Bing Terms of Use 186 188 // (the requirement is that we have such a link at the bottom of the window) 187 return "http ://go.microsoft.com/?linkid=9710837";189 return "https://www.microsoft.com/maps/assets/docs/terms.aspx"; 188 190 } 189 191 … … 284 286 if (topLeft.getLon() < attr.max.getLon() && botRight.getLon() > attr.min.getLon() 285 287 && topLeft.getLat() > attr.min.getLat() && botRight.getLat() < attr.max.getLat()) { 286 a.append(attr.attribution );288 a.append(attr.attributionText); 287 289 a.append(' '); 288 290 }
Note:
See TracChangeset
for help on using the changeset viewer.