Adapt sources to new signature for ol.Attribution

This commit is contained in:
Éric Lemoine
2013-08-30 16:47:42 +02:00
parent 818894bb56
commit 38ab64c3c3
5 changed files with 34 additions and 23 deletions

View File

@@ -131,7 +131,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
} }
} }
}); });
return new ol.Attribution(html, tileRanges); return new ol.Attribution({html: html, tileRanges: tileRanges});
}); });
this.setAttributions(attributions); this.setAttributions(attributions);

View File

@@ -14,9 +14,10 @@ goog.require('ol.source.XYZ');
ol.source.MapQuestOSM = function() { ol.source.MapQuestOSM = function() {
var attributions = [ var attributions = [
new ol.Attribution( new ol.Attribution({
'Tiles Courtesy of ' + html: 'Tiles Courtesy of ' +
'<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'), '<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'
}),
ol.source.OSM.DATA_ATTRIBUTION ol.source.OSM.DATA_ATTRIBUTION
]; ];
@@ -41,12 +42,14 @@ goog.inherits(ol.source.MapQuestOSM, ol.source.XYZ);
ol.source.MapQuestOpenAerial = function() { ol.source.MapQuestOpenAerial = function() {
var attributions = [ var attributions = [
new ol.Attribution( new ol.Attribution({
'Tiles Courtesy of ' + html: 'Tiles Courtesy of ' +
'<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'), '<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'
new ol.Attribution( }),
'Portions Courtesy NASA/JPL-Caltech and ' + new ol.Attribution({
'U.S. Depart. of Agriculture, Farm Service Agency') html: 'Portions Courtesy NASA/JPL-Caltech and ' +
'U.S. Depart. of Agriculture, Farm Service Agency'
})
]; ];
goog.base(this, { goog.base(this, {

View File

@@ -44,21 +44,24 @@ goog.inherits(ol.source.OSM, ol.source.XYZ);
* @const * @const
* @type {ol.Attribution} * @type {ol.Attribution}
*/ */
ol.source.OSM.DATA_ATTRIBUTION = new ol.Attribution( ol.source.OSM.DATA_ATTRIBUTION = new ol.Attribution({
'Data &copy; <a href="http://www.openstreetmap.org/">OpenStreetMap</a> ' + html: 'Data &copy; ' +
'contributors, ' + '<a href="http://www.openstreetmap.org/">OpenStreetMap</a> ' +
'<a href="http://www.openstreetmap.org/copyright">ODbL</a>'); 'contributors, ' +
'<a href="http://www.openstreetmap.org/copyright">ODbL</a>'
});
/** /**
* @const * @const
* @type {ol.Attribution} * @type {ol.Attribution}
*/ */
ol.source.OSM.TILE_ATTRIBUTION = new ol.Attribution( ol.source.OSM.TILE_ATTRIBUTION = new ol.Attribution({
'Tiles &copy; ' + html: 'Tiles &copy; ' +
'<a href="http://www.openstreetmap.org/">OpenStreetMap</a> ' + '<a href="http://www.openstreetmap.org/">OpenStreetMap</a> ' +
'contributors, ' + 'contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA</a>'); '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC BY-SA</a>'
});
/** /**

View File

@@ -114,8 +114,10 @@ goog.inherits(ol.source.Stamen, ol.source.XYZ);
* @const {Array.<ol.Attribution>} * @const {Array.<ol.Attribution>}
*/ */
ol.source.Stamen.ATTRIBUTIONS = [ ol.source.Stamen.ATTRIBUTIONS = [
new ol.Attribution( new ol.Attribution({
'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, under ' + html: 'Map tiles by <a href="http://stamen.com/">Stamen Design</a>, ' +
'<a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.'), 'under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY' +
' 3.0</a>.'
}),
ol.source.OSM.DATA_ATTRIBUTION ol.source.OSM.DATA_ATTRIBUTION
]; ];

View File

@@ -113,7 +113,10 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function() {
[tileGrid.getTileRangeForExtentAndZ(attributionExtent, z)]; [tileGrid.getTileRangeForExtentAndZ(attributionExtent, z)];
} }
this.setAttributions([ this.setAttributions([
new ol.Attribution(tileJSON.attribution, tileRanges) new ol.Attribution({
html: tileJSON.attribution,
tileRanges: tileRanges
})
]); ]);
} }