add Terms of Service to the Bing attribution

make sure the epsg4326Extent is constructed with the correct arguments
This commit is contained in:
Bart van den Eijnden
2013-10-31 15:36:29 +01:00
parent d211f65203
commit 8b085514b1
3 changed files with 19 additions and 1 deletions

View File

@@ -26,6 +26,11 @@
.ol-attribution li:not(:last-child):after { .ol-attribution li:not(:last-child):after {
content: "\2003"; content: "\2003";
} }
.ol-attribution-bing-tos {
float:right;
padding-top: 2px;
white-space: nowrap;
}
.ol-dragbox { .ol-dragbox {
position: absolute; position: absolute;
border: 2px solid red; border: 2px solid red;

View File

@@ -1 +1,2 @@
@exportClass ol.source.BingMaps ol.source.BingMapsOptions @exportClass ol.source.BingMaps ol.source.BingMapsOptions
@exportProperty ol.source.BingMaps.TOS_ATTRIBUTION

View File

@@ -49,6 +49,17 @@ ol.source.BingMaps = function(options) {
goog.inherits(ol.source.BingMaps, ol.source.TileImage); goog.inherits(ol.source.BingMaps, ol.source.TileImage);
/**
* @const
* @type {ol.Attribution}
*/
ol.source.BingMaps.TOS_ATTRIBUTION = new ol.Attribution({
html: '<a class="ol-attribution-bing-tos" target="_blank" ' +
'href="http://www.microsoft.com/maps/product/terms.html">' +
'Terms of Use</a>'
});
/** /**
* @param {BingMapsImageryMetadataResponse} response Response. * @param {BingMapsImageryMetadataResponse} response Response.
*/ */
@@ -118,7 +129,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
var minZ = coverageArea.zoomMin; var minZ = coverageArea.zoomMin;
var maxZ = coverageArea.zoomMax; var maxZ = coverageArea.zoomMax;
var bbox = coverageArea.bbox; var bbox = coverageArea.bbox;
var epsg4326Extent = [bbox[1], bbox[3], bbox[0], bbox[2]]; var epsg4326Extent = [bbox[1], bbox[0], bbox[3], bbox[2]];
var extent = ol.extent.transform(epsg4326Extent, transform); var extent = ol.extent.transform(epsg4326Extent, transform);
var tileRange, z, zKey; var tileRange, z, zKey;
for (z = minZ; z <= maxZ; ++z) { for (z = minZ; z <= maxZ; ++z) {
@@ -133,6 +144,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
}); });
return new ol.Attribution({html: html, tileRanges: tileRanges}); return new ol.Attribution({html: html, tileRanges: tileRanges});
}); });
attributions.push(ol.source.BingMaps.TOS_ATTRIBUTION);
this.setAttributions(attributions); this.setAttributions(attributions);
this.setLogo(brandLogoUri); this.setLogo(brandLogoUri);