diff --git a/src/ol/layer/BaseImage.js b/src/ol/layer/BaseImage.js index 10a3ad09ec..9183382986 100644 --- a/src/ol/layer/BaseImage.js +++ b/src/ol/layer/BaseImage.js @@ -34,6 +34,7 @@ import Layer from './Layer.js'; * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * + * @extends {Layer} * @api */ class BaseImageLayer extends Layer { @@ -48,12 +49,4 @@ class BaseImageLayer extends Layer { } - -/** - * Return the associated {@link module:ol/source/Image source} of the image layer. - * @function - * @return {import("../source/Image.js").default} Source. - * @api - */ -BaseImageLayer.prototype.getSource; export default BaseImageLayer; diff --git a/src/ol/layer/BaseTile.js b/src/ol/layer/BaseTile.js index efeea306a6..0bbfe1c346 100644 --- a/src/ol/layer/BaseTile.js +++ b/src/ol/layer/BaseTile.js @@ -39,6 +39,7 @@ import {assign} from '../obj.js'; * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * + * @extends {Layer} * @api */ class BaseTileLayer extends Layer { @@ -102,13 +103,4 @@ class BaseTileLayer extends Layer { } -/** - * Return the associated {@link module:ol/source/Tile tilesource} of the layer. - * @function - * @return {import("../source/Tile.js").default} Source. - * @api - */ -BaseTileLayer.prototype.getSource; - - export default BaseTileLayer; diff --git a/src/ol/layer/BaseVector.js b/src/ol/layer/BaseVector.js index 6498e00e92..7df1fe9bf3 100644 --- a/src/ol/layer/BaseVector.js +++ b/src/ol/layer/BaseVector.js @@ -61,6 +61,8 @@ const Property = { * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * + * @template {import("../source/Vector.js").default|import("../source/VectorTile.js").default} VectorSourceType + * @extends {Layer} * @api */ class BaseVectorLayer extends Layer { @@ -219,13 +221,4 @@ class BaseVectorLayer extends Layer { } -/** - * Return the associated {@link module:ol/source/Vector vectorsource} of the layer. - * @function - * @return {import("../source/Vector.js").default} Source. - * @api - */ -BaseVectorLayer.prototype.getSource; - - export default BaseVectorLayer; diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index c3fb6a772c..7981a0f288 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -62,6 +62,8 @@ import SourceState from '../source/State.js'; * * @fires import("../render/Event.js").RenderEvent#prerender * @fires import("../render/Event.js").RenderEvent#postrender + * + * @template {import("../source/Source.js").default} SourceType */ class Layer extends BaseLayer { /** @@ -106,7 +108,7 @@ class Layer extends BaseLayer { getChangeEventType(LayerProperty.SOURCE), this.handleSourcePropertyChange_, this); - const source = options.source ? options.source : null; + const source = options.source ? /** @type {SourceType} */ (options.source) : null; this.setSource(source); } @@ -130,15 +132,12 @@ class Layer extends BaseLayer { /** * Get the layer source. - * @return {import("../source/Source.js").default} The layer source (or `null` if not yet set). + * @return {SourceType} The layer source (or `null` if not yet set). * @observable * @api */ getSource() { - const source = this.get(LayerProperty.SOURCE); - return ( - /** @type {import("../source/Source.js").default} */ (source) || null - ); + return /** @type {SourceType} */ (this.get(LayerProperty.SOURCE)) || null; } /** @@ -227,7 +226,7 @@ class Layer extends BaseLayer { /** * Set the layer source. - * @param {import("../source/Source.js").default} source The layer source. + * @param {SourceType} source The layer source. * @observable * @api */ diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 0456b04ea0..46086a490b 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -17,6 +17,7 @@ import CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js'; * property on the layer object; for example, setting `title: 'My Title'` in the * options means that `title` is observable, and has get/set accessors. * + * @extends {BaseVectorLayer} * @api */ class VectorLayer extends BaseVectorLayer { diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 5ebf976173..900fb4fb20 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -70,6 +70,7 @@ import {assign} from '../obj.js'; * options means that `title` is observable, and has get/set accessors. * * @param {Options=} opt_options Options. + * @extends {BaseVectorLayer} * @api */ class VectorTileLayer extends BaseVectorLayer { @@ -165,11 +166,4 @@ class VectorTileLayer extends BaseVectorLayer { } -/** - * Return the associated {@link module:ol/source/VectorTile vectortilesource} of the layer. - * @function - * @return {import("../source/VectorTile.js").default} Source. - * @api - */ -VectorTileLayer.prototype.getSource; export default VectorTileLayer;