diff --git a/examples/localized-openstreetmap.js b/examples/localized-openstreetmap.js
index e8053c83d1..21571eb09a 100644
--- a/examples/localized-openstreetmap.js
+++ b/examples/localized-openstreetmap.js
@@ -11,9 +11,10 @@ var map = new ol.Map({
new ol.layer.TileLayer({
source: new ol.source.OSM({
attributions: [
- new ol.Attribution(
- 'All maps © ' +
- 'OpenCycleMap'),
+ new ol.Attribution({
+ html: 'All maps © ' +
+ 'OpenCycleMap'
+ }),
ol.source.OSM.DATA_ATTRIBUTION
],
url: 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'
diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js
index 2d71383205..7926d4ec7e 100644
--- a/examples/wms-custom-proj.js
+++ b/examples/wms-custom-proj.js
@@ -21,10 +21,12 @@ var layers = [
source: new ol.source.TiledWMS({
url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
- attributions: [new ol.Attribution(
- '© ' +
- '' +
- 'Pixelmap 1:1000000 / geo.admin.ch')],
+ attributions: [new ol.Attribution({
+ html: '© ' +
+ '' +
+ 'Pixelmap 1:1000000 / geo.admin.ch'
+ })],
params: {
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'FORMAT': 'image/jpeg'
@@ -36,10 +38,12 @@ var layers = [
source: new ol.source.TiledWMS({
url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
- attributions: [new ol.Attribution(
- '© ' +
- '' +
- 'National parks / geo.admin.ch')],
+ attributions: [new ol.Attribution({
+ html: '© ' +
+ '' +
+ 'National parks / geo.admin.ch'
+ })],
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
extent: extent
})
diff --git a/examples/wms-no-proj.js b/examples/wms-no-proj.js
index 1bb50d5454..4d5db23199 100644
--- a/examples/wms-no-proj.js
+++ b/examples/wms-no-proj.js
@@ -13,10 +13,12 @@ goog.require('ol.source.TiledWMS');
var layers = [
new ol.layer.TileLayer({
source: new ol.source.TiledWMS({
- attributions: [new ol.Attribution(
- '© ' +
- '' +
- 'Pixelmap 1:1000000 / geo.admin.ch')],
+ attributions: [new ol.Attribution({
+ html: '© ' +
+ '' +
+ 'Pixelmap 1:1000000 / geo.admin.ch'
+ })],
crossOrigin: 'anonymous',
params: {
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
@@ -27,10 +29,12 @@ var layers = [
}),
new ol.layer.ImageLayer({
source: new ol.source.SingleImageWMS({
- attributions: [new ol.Attribution(
- '© ' +
- '' +
- 'National parks / geo.admin.ch')],
+ attributions: [new ol.Attribution({
+ html: '© ' +
+ '' +
+ 'National parks / geo.admin.ch'
+ })],
crossOrigin: 'anonymous',
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
url: 'http://wms.geo.admin.ch/'
diff --git a/examples/wms-single-image-custom-proj.js b/examples/wms-single-image-custom-proj.js
index 8e4ed4ce4f..6e97b8cab3 100644
--- a/examples/wms-single-image-custom-proj.js
+++ b/examples/wms-single-image-custom-proj.js
@@ -18,10 +18,12 @@ var layers = [
source: new ol.source.SingleImageWMS({
url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
- attributions: [new ol.Attribution(
- '© ' +
- '' +
- 'Pixelmap 1:1000000 / geo.admin.ch')],
+ attributions: [new ol.Attribution({
+ html: '© ' +
+ '' +
+ 'Pixelmap 1:1000000 / geo.admin.ch'
+ })],
params: {
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'FORMAT': 'image/jpeg'
@@ -33,10 +35,12 @@ var layers = [
source: new ol.source.SingleImageWMS({
url: 'http://wms.geo.admin.ch/',
crossOrigin: 'anonymous',
- attributions: [new ol.Attribution(
- '© ' +
- '' +
- 'National parks / geo.admin.ch')],
+ attributions: [new ol.Attribution({
+ html: '© ' +
+ '' +
+ 'National parks / geo.admin.ch'
+ })],
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
extent: extent
})
diff --git a/examples/wmts-ign.js b/examples/wmts-ign.js
index 7a0f17c43e..d54d2730bb 100644
--- a/examples/wmts-ign.js
+++ b/examples/wmts-ign.js
@@ -51,10 +51,11 @@ xhr.onload = function() {
'http://gpp3-wxs.ign.fr/static/logos/IGN/IGN.gif'
];
- var attribution = new ol.Attribution(
- '' +
- '
');
+ var attribution = new ol.Attribution({
+ html: '' +
+ '
'
+ });
var sourceOptions;
var source;
diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc
index 74faeefaf4..c004df2eee 100644
--- a/src/objectliterals.jsdoc
+++ b/src/objectliterals.jsdoc
@@ -1,3 +1,10 @@
+/**
+ * @typedef {Object} ol.AttributionOptions
+ * @property {string} html HTML markup for this attribution.
+ * @property {Object.>|undefined} tileRanges
+ * Tile ranges (FOR INTERNAL USE ONLY).
+ */
+
/**
* @typedef {Object} ol.DeviceOrientationOptions
* @property {boolean|undefined} tracking Tracking.
diff --git a/src/ol/attribution.exports b/src/ol/attribution.exports
index 053c0abeae..27673d4985 100644
--- a/src/ol/attribution.exports
+++ b/src/ol/attribution.exports
@@ -1 +1 @@
-@exportSymbol ol.Attribution
+@exportClass ol.Attribution ol.AttributionOptions
diff --git a/src/ol/attribution.js b/src/ol/attribution.js
index 81a88007be..95bc352e60 100644
--- a/src/ol/attribution.js
+++ b/src/ol/attribution.js
@@ -11,31 +11,31 @@ goog.require('ol.TileRange');
*
* source: new ol.source.OSM({
* attributions: [
- * new ol.Attribution(
- * 'All maps © ' +
- * 'OpenCycleMap'),
+ * new ol.Attribution({
+ * html: 'All maps © ' +
+ * 'OpenCycleMap'
+ * }),
* ol.source.OSM.DATA_ATTRIBUTION
* ],
* ..
*
* @constructor
- * @param {string} html The markup to use for display of the attribution.
- * @param {Object.>=} opt_tileRanges Tile ranges
- * (FOR INTERNAL USE ONLY).
+ * @param {ol.AttributionOptions} options Attribution options.
*/
-ol.Attribution = function(html, opt_tileRanges) {
+ol.Attribution = function(options) {
/**
* @private
* @type {string}
*/
- this.html_ = html;
+ this.html_ = options.html;
/**
* @private
* @type {Object.>}
*/
- this.tileRanges_ = opt_tileRanges || null;
+ this.tileRanges_ = goog.isDef(options.tileRanges) ?
+ options.tileRanges : null;
};
diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js
index 9882130e9c..226138140f 100644
--- a/src/ol/source/bingmapssource.js
+++ b/src/ol/source/bingmapssource.js
@@ -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);
diff --git a/src/ol/source/mapquestsource.js b/src/ol/source/mapquestsource.js
index 2263523fc6..c7b2bce931 100644
--- a/src/ol/source/mapquestsource.js
+++ b/src/ol/source/mapquestsource.js
@@ -14,9 +14,10 @@ goog.require('ol.source.XYZ');
ol.source.MapQuestOSM = function() {
var attributions = [
- new ol.Attribution(
- 'Tiles Courtesy of ' +
- 'MapQuest'),
+ new ol.Attribution({
+ html: 'Tiles Courtesy of ' +
+ 'MapQuest'
+ }),
ol.source.OSM.DATA_ATTRIBUTION
];
@@ -41,12 +42,14 @@ goog.inherits(ol.source.MapQuestOSM, ol.source.XYZ);
ol.source.MapQuestOpenAerial = function() {
var attributions = [
- new ol.Attribution(
- 'Tiles Courtesy of ' +
- 'MapQuest'),
- new ol.Attribution(
- 'Portions Courtesy NASA/JPL-Caltech and ' +
- 'U.S. Depart. of Agriculture, Farm Service Agency')
+ new ol.Attribution({
+ html: 'Tiles Courtesy of ' +
+ 'MapQuest'
+ }),
+ new ol.Attribution({
+ html: 'Portions Courtesy NASA/JPL-Caltech and ' +
+ 'U.S. Depart. of Agriculture, Farm Service Agency'
+ })
];
goog.base(this, {
diff --git a/src/ol/source/osmsource.js b/src/ol/source/osmsource.js
index 4f3e88dd19..cc759a3653 100644
--- a/src/ol/source/osmsource.js
+++ b/src/ol/source/osmsource.js
@@ -44,21 +44,24 @@ goog.inherits(ol.source.OSM, ol.source.XYZ);
* @const
* @type {ol.Attribution}
*/
-ol.source.OSM.DATA_ATTRIBUTION = new ol.Attribution(
- 'Data © OpenStreetMap ' +
- 'contributors, ' +
- 'ODbL');
+ol.source.OSM.DATA_ATTRIBUTION = new ol.Attribution({
+ html: 'Data © ' +
+ 'OpenStreetMap ' +
+ 'contributors, ' +
+ 'ODbL'
+});
/**
* @const
* @type {ol.Attribution}
*/
-ol.source.OSM.TILE_ATTRIBUTION = new ol.Attribution(
- 'Tiles © ' +
- 'OpenStreetMap ' +
- 'contributors, ' +
- 'CC BY-SA');
+ol.source.OSM.TILE_ATTRIBUTION = new ol.Attribution({
+ html: 'Tiles © ' +
+ 'OpenStreetMap ' +
+ 'contributors, ' +
+ 'CC BY-SA'
+});
/**
diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js
index 01a856201d..1486aa0d98 100644
--- a/src/ol/source/stamensource.js
+++ b/src/ol/source/stamensource.js
@@ -114,8 +114,10 @@ goog.inherits(ol.source.Stamen, ol.source.XYZ);
* @const {Array.}
*/
ol.source.Stamen.ATTRIBUTIONS = [
- new ol.Attribution(
- 'Map tiles by Stamen Design, under ' +
- 'CC BY 3.0.'),
+ new ol.Attribution({
+ html: 'Map tiles by Stamen Design, ' +
+ 'under CC BY' +
+ ' 3.0.'
+ }),
ol.source.OSM.DATA_ATTRIBUTION
];
diff --git a/src/ol/source/tilejsonsource.js b/src/ol/source/tilejsonsource.js
index 42c1e97a4e..9d01f57acb 100644
--- a/src/ol/source/tilejsonsource.js
+++ b/src/ol/source/tilejsonsource.js
@@ -113,7 +113,10 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function() {
[tileGrid.getTileRangeForExtentAndZ(attributionExtent, z)];
}
this.setAttributions([
- new ol.Attribution(tileJSON.attribution, tileRanges)
+ new ol.Attribution({
+ html: tileJSON.attribution,
+ tileRanges: tileRanges
+ })
]);
}