Conflicts: src/objectliterals.jsdoc src/ol/attribution.js src/ol/geom/geometry.js src/ol/geom/geometrycollection.js src/ol/geom/linestring.js src/ol/layer/vectorlayer.exports src/ol/layer/vectorlayer.js src/ol/map.js src/ol/proj/proj.js src/ol/renderer/canvas/canvasvectorlayerrenderer.js src/ol/source/imagewmssource.js src/ol/source/tilewmssource.js src/ol/source/vectorsource.exports src/ol/source/vectorsource.js src/ol/source/wmssource.js src/ol/style/style.js src/ol/tilegrid/tilegrid.js src/ol/tilegrid/wmtstilegrid.js src/ol/tilegrid/xyztilegrid.js
75 lines
1.5 KiB
JavaScript
75 lines
1.5 KiB
JavaScript
goog.provide('ol.Attribution');
|
|
|
|
goog.require('ol.TileRange');
|
|
|
|
|
|
|
|
/**
|
|
* Create a new attribution to be associated with a layer source.
|
|
*
|
|
* Example:
|
|
*
|
|
* source: new ol.source.OSM({
|
|
* attributions: [
|
|
* new ol.Attribution({
|
|
* html: 'All maps © ' +
|
|
* '<a href="http://www.opencyclemap.org/">OpenCycleMap</a>'
|
|
* }),
|
|
* ol.source.OSM.DATA_ATTRIBUTION
|
|
* ],
|
|
* ..
|
|
*
|
|
* @constructor
|
|
* @param {olx.AttributionOptions} options Attribution options.
|
|
* @struct
|
|
* @todo stability experimental
|
|
*/
|
|
ol.Attribution = function(options) {
|
|
|
|
/**
|
|
* @private
|
|
* @type {string}
|
|
*/
|
|
this.html_ = options.html;
|
|
|
|
/**
|
|
* @private
|
|
* @type {Object.<string, Array.<ol.TileRange>>}
|
|
*/
|
|
this.tileRanges_ = goog.isDef(options.tileRanges) ?
|
|
options.tileRanges : null;
|
|
|
|
};
|
|
|
|
|
|
/**
|
|
* @return {string} HTML.
|
|
*/
|
|
ol.Attribution.prototype.getHTML = function() {
|
|
return this.html_;
|
|
};
|
|
|
|
|
|
/**
|
|
* @param {Object.<string, ol.TileRange>} tileRanges Tile ranges.
|
|
* @return {boolean} Intersects any tile range.
|
|
*/
|
|
ol.Attribution.prototype.intersectsAnyTileRange = function(tileRanges) {
|
|
if (goog.isNull(this.tileRanges_)) {
|
|
return true;
|
|
}
|
|
var i, ii, tileRange, z;
|
|
for (z in tileRanges) {
|
|
if (!(z in this.tileRanges_)) {
|
|
continue;
|
|
}
|
|
tileRange = tileRanges[z];
|
|
for (i = 0, ii = this.tileRanges_[z].length; i < ii; ++i) {
|
|
if (this.tileRanges_[z][i].intersects(tileRange)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
};
|