Move ol.Attribution to ol/source/Source
This commit is contained in:
committed by
Frederic Junod
parent
71bb2ce019
commit
2b41a3930b
+14
-6
@@ -8,15 +8,23 @@ import {get as getProjection} from '../proj.js';
|
|||||||
import SourceState from '../source/State.js';
|
import SourceState from '../source/State.js';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A function that returns a string or an array of strings representing source
|
||||||
|
* attributions.
|
||||||
|
*
|
||||||
|
* @typedef {function(module:ol/PluggableMap~FrameState): (string|Array.<string>)} Attribution
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A type that can be used to provide attribution information for data sources.
|
* A type that can be used to provide attribution information for data sources.
|
||||||
*
|
*
|
||||||
* It represents either
|
* It represents either
|
||||||
* * a simple string (e.g. `'© Acme Inc.'`)
|
* * a simple string (e.g. `'© Acme Inc.'`)
|
||||||
* * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)
|
* * an array of simple strings (e.g. `['© Acme Inc.', '© Bacme Inc.']`)
|
||||||
* * a function that returns a string or array of strings (`{@link ol.Attribution}`)
|
* * a function that returns a string or array of strings (`{@link module:ol/source/Source~Attribution}`)
|
||||||
*
|
*
|
||||||
* @typedef {string|Array.<string>|ol.Attribution} AttributionLike
|
* @typedef {string|Array.<string>|module:ol/source/Source~Attribution} AttributionLike
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +63,7 @@ const Source = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {?ol.Attribution}
|
* @type {?module:ol/source/Source~Attribution}
|
||||||
*/
|
*/
|
||||||
this.attributions_ = this.adaptAttributions_(options.attributions);
|
this.attributions_ = this.adaptAttributions_(options.attributions);
|
||||||
|
|
||||||
@@ -79,7 +87,7 @@ inherits(Source, BaseObject);
|
|||||||
/**
|
/**
|
||||||
* Turns the attributions option into an attributions function.
|
* Turns the attributions option into an attributions function.
|
||||||
* @param {module:ol/source/Source~AttributionLike|undefined} attributionLike The attribution option.
|
* @param {module:ol/source/Source~AttributionLike|undefined} attributionLike The attribution option.
|
||||||
* @return {?ol.Attribution} An attribution function (or null).
|
* @return {?module:ol/source/Source~Attribution} An attribution function (or null).
|
||||||
*/
|
*/
|
||||||
Source.prototype.adaptAttributions_ = function(attributionLike) {
|
Source.prototype.adaptAttributions_ = function(attributionLike) {
|
||||||
if (!attributionLike) {
|
if (!attributionLike) {
|
||||||
@@ -116,7 +124,7 @@ Source.prototype.forEachFeatureAtCoordinate = UNDEFINED;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the attribution function for the source.
|
* Get the attribution function for the source.
|
||||||
* @return {?ol.Attribution} Attribution function.
|
* @return {?module:ol/source/Source~Attribution} Attribution function.
|
||||||
*/
|
*/
|
||||||
Source.prototype.getAttributions = function() {
|
Source.prototype.getAttributions = function() {
|
||||||
return this.attributions_;
|
return this.attributions_;
|
||||||
@@ -170,7 +178,7 @@ Source.prototype.refresh = function() {
|
|||||||
/**
|
/**
|
||||||
* Set the attributions of the source.
|
* Set the attributions of the source.
|
||||||
* @param {module:ol/source/Source~AttributionLike|undefined} attributions Attributions.
|
* @param {module:ol/source/Source~AttributionLike|undefined} attributions Attributions.
|
||||||
* Can be passed as `string`, `Array<string>`, `{@link ol.Attribution}`,
|
* Can be passed as `string`, `Array<string>`, `{@link module:ol/source/Source~Attribution}`,
|
||||||
* or `undefined`.
|
* or `undefined`.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,15 +21,6 @@ const ol = {};
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A function that returns a string or an array of strings representing source
|
|
||||||
* attributions.
|
|
||||||
*
|
|
||||||
* @typedef {function(olx.FrameState): (string|Array.<string>)}
|
|
||||||
*/
|
|
||||||
ol.Attribution;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{fillStyle: module:ol/colorlike~ColorLike}}
|
* @typedef {{fillStyle: module:ol/colorlike~ColorLike}}
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user