diff --git a/config/jsdoc/api/conf.json b/config/jsdoc/api/conf.json index 63badc07eb..2a2f328b2b 100644 --- a/config/jsdoc/api/conf.json +++ b/config/jsdoc/api/conf.json @@ -17,7 +17,6 @@ "config/jsdoc/api/plugins/markdown", "jsdoc-plugin-typescript", "config/jsdoc/api/plugins/inline-options", - "config/jsdoc/api/plugins/inheritdoc", "config/jsdoc/api/plugins/events", "config/jsdoc/api/plugins/observable", "config/jsdoc/api/plugins/api" diff --git a/config/jsdoc/api/plugins/inheritdoc.js b/config/jsdoc/api/plugins/inheritdoc.js deleted file mode 100755 index 6284a731ee..0000000000 --- a/config/jsdoc/api/plugins/inheritdoc.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This is a hack to prevent inheritDoc tags from entirely removing - * documentation of the method that inherits the documentation. - */ - -exports.defineTags = function(dictionary) { - dictionary.defineTag('inheritDoc', { - mustNotHaveValue: true, - canHaveType: false, - canHaveName: false, - onTagged: function(doclet, tag) { - doclet.inheritdoc = true; - } - }); -}; - - -const lookup = {}; -const incompleteByClass = {}; -const keepKeys = ['comment', 'meta', 'name', 'memberof', 'longname', 'augment', - 'stability']; - -exports.handlers = { - - newDoclet: function(e) { - const doclet = e.doclet; - let incompletes; - if (!(doclet.longname in lookup)) { - lookup[doclet.longname] = []; - } - lookup[doclet.longname].push(doclet); - if (doclet.inheritdoc) { - if (!(doclet.memberof in incompleteByClass)) { - incompleteByClass[doclet.memberof] = []; - } - incompletes = incompleteByClass[doclet.memberof]; - if (incompletes.indexOf(doclet.name) == -1) { - incompletes.push(doclet.name); - } - } - }, - - parseComplete: function(e) { - let ancestors, candidate, candidates, doclet, i, j, k, l, key; - let stability, incomplete, incompletes; - const doclets = e.doclets; - for (i = doclets.length - 1; i >= 0; --i) { - doclet = doclets[i]; - incompletes = incompleteByClass[doclet.longname]; - if (!doclet.augments || !incompletes) { - continue; - } - ancestors = doclet.augments.slice(); - // collect ancestors from the whole hierarchy - for (j = 0; j < ancestors.length; ++j) { - candidates = lookup[ancestors[j]]; - if (candidates) { - for (k = candidates.length - 1; k >= 0; --k) { - candidate = candidates[k]; - if (candidate.augments) { - Array.prototype.push.apply(ancestors, candidate.augments); - } - } - } - } - // walk through all inheritDoc members - let incompleteDoclet; - for (j = incompletes.length - 1; j >= 0; --j) { - incomplete = incompletes[j]; - candidates = lookup[doclet.longname + '#' + incomplete]; - if (candidates) { - // get the incomplete doclet that needs to be augmented - for (k = candidates.length - 1; k >= 0; --k) { - incompleteDoclet = candidates[k]; - if (incompleteDoclet.inheritdoc) { - break; - } - } - } - // find the documented ancestor - for (k = ancestors.length - 1; k >= 0; --k) { - candidates = lookup[ancestors[k] + '#' + incomplete]; - if (candidates) { - for (l = candidates.length - 1; l >= 0; --l) { - candidate = candidates[l]; - if (candidate && !candidate.inheritdoc) { - stability = candidate.stability || incompleteDoclet.stability; - if (stability) { - incompleteDoclet.stability = stability; - for (key in candidate) { - if (candidate.hasOwnProperty(key) && - keepKeys.indexOf(key) == -1) { - incompleteDoclet[key] = candidate[key]; - } - } - // We have found a matching parent doc and applied it so we - // don't want to ignore this doclet anymore. - incompleteDoclet.ignore = false; - // We found a match so we can stop break - break; - } - } - } - } - } - } - } - } - -}; diff --git a/config/jsdoc/api/readme.md b/config/jsdoc/api/readme.md index db290d473d..5179e075e5 100644 --- a/config/jsdoc/api/readme.md +++ b/config/jsdoc/api/readme.md @@ -24,7 +24,7 @@ The second line tells the Closure compiler the type of the argument. The third line (`@api`) marks the method as part of the api and thus exportable. Without such an api annotation, the method will not be documented in the generated API documentation. Symbols without an api annotation will also not be exportable. -The `@api` annotation can be used in conjunction with the `@inheritDoc` annotation to export a symbol that is documented on a parent class (where the method may be abstract). In general, `@api` annotations should never be used on abstract methods (only on their implementations). +In general, `@api` annotations should never be used on abstract methods (only on their implementations). ### Events diff --git a/src/ol/Geolocation.js b/src/ol/Geolocation.js index fa1f61f03b..094148bb94 100644 --- a/src/ol/Geolocation.js +++ b/src/ol/Geolocation.js @@ -129,7 +129,7 @@ class Geolocation extends BaseObject { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.setTracking(false); diff --git a/src/ol/Image.js b/src/ol/Image.js index a7f0797b0e..d8f9cbb09c 100644 --- a/src/ol/Image.js +++ b/src/ol/Image.js @@ -78,7 +78,7 @@ class ImageWrapper extends ImageBase { } /** - * @inheritDoc + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. * @api */ getImage() { @@ -114,7 +114,6 @@ class ImageWrapper extends ImageBase { * Load the image or retry if loading previously failed. * Loading is taken care of by the tile queue, and calling this method is * only needed for preloading or for reloading in case of an error. - * @override * @api */ load() { diff --git a/src/ol/ImageCanvas.js b/src/ol/ImageCanvas.js index dde34ad47c..599beac831 100644 --- a/src/ol/ImageCanvas.js +++ b/src/ol/ImageCanvas.js @@ -76,7 +76,7 @@ class ImageCanvas extends ImageBase { } /** - * @inheritDoc + * Load not yet loaded URI. */ load() { if (this.state == ImageState.IDLE) { diff --git a/src/ol/ImageTile.js b/src/ol/ImageTile.js index 3e0b95253a..de3ad74440 100644 --- a/src/ol/ImageTile.js +++ b/src/ol/ImageTile.js @@ -68,7 +68,7 @@ class ImageTile extends Tile { } /** - * @inheritDoc + * @return {string} Key. */ getKey() { return this.src_; @@ -103,7 +103,7 @@ class ImageTile extends Tile { } /** - * @inheritDoc + * Load not yet loaded URI. * @api */ load() { diff --git a/src/ol/MapBrowserEvent.js b/src/ol/MapBrowserEvent.js index dc301946b7..fe5f426052 100644 --- a/src/ol/MapBrowserEvent.js +++ b/src/ol/MapBrowserEvent.js @@ -86,7 +86,6 @@ class MapBrowserEvent extends MapEvent { /** * Prevents the default browser action. * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault. - * @override * @api */ preventDefault() { @@ -97,7 +96,6 @@ class MapBrowserEvent extends MapEvent { /** * Prevents further propagation of the current event. * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation. - * @override * @api */ stopPropagation() { diff --git a/src/ol/MapBrowserEventHandler.js b/src/ol/MapBrowserEventHandler.js index 1c70416eb7..a1d2b67157 100644 --- a/src/ol/MapBrowserEventHandler.js +++ b/src/ol/MapBrowserEventHandler.js @@ -295,7 +295,7 @@ class MapBrowserEventHandler extends EventTarget { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { if (this.relayedListenerKey_) { diff --git a/src/ol/PluggableMap.js b/src/ol/PluggableMap.js index 5cd3ad7f22..51b1b5648d 100644 --- a/src/ol/PluggableMap.js +++ b/src/ol/PluggableMap.js @@ -498,7 +498,7 @@ class PluggableMap extends BaseObject { /** * - * @inheritDoc + * Clean up. */ disposeInternal() { this.mapBrowserEventHandler_.dispose(); diff --git a/src/ol/TileQueue.js b/src/ol/TileQueue.js index eb39b119d8..400cd56f74 100644 --- a/src/ol/TileQueue.js +++ b/src/ol/TileQueue.js @@ -59,7 +59,8 @@ class TileQueue extends PriorityQueue { } /** - * @inheritDoc + * @param {Array} element Element. + * @return {boolean} The element was added to the queue. */ enqueue(element) { const added = super.enqueue(element); diff --git a/src/ol/VectorRenderTile.js b/src/ol/VectorRenderTile.js index 372fc8a3a0..db9a6ec07f 100644 --- a/src/ol/VectorRenderTile.js +++ b/src/ol/VectorRenderTile.js @@ -155,14 +155,14 @@ class VectorRenderTile extends Tile { } /** - * @inheritDoc + * Load the tile. */ load() { this.getSourceTiles(); } /** - * @inheritDoc + * Remove from the cache due to expiry */ release() { for (const key in this.context_) { diff --git a/src/ol/VectorTile.js b/src/ol/VectorTile.js index ecf13ed8ea..f957a452df 100644 --- a/src/ol/VectorTile.js +++ b/src/ol/VectorTile.js @@ -87,14 +87,14 @@ class VectorTile extends Tile { } /** - * @inheritDoc + * @return {string} Key. */ getKey() { return this.url_; } /** - * @inheritDoc + * Load not yet loaded URI. */ load() { if (this.state == TileState.IDLE) { diff --git a/src/ol/control/Control.js b/src/ol/control/Control.js index 2f03317507..1f54f28ce7 100644 --- a/src/ol/control/Control.js +++ b/src/ol/control/Control.js @@ -91,7 +91,7 @@ class Control extends BaseObject { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { removeNode(this.element); diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index d3741fb8e6..d2f82a3268 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -213,7 +213,10 @@ class FullScreen extends Control { } /** - * @inheritDoc + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. * @api */ setMap(map) { diff --git a/src/ol/control/MousePosition.js b/src/ol/control/MousePosition.js index 3a2c017999..b55796638e 100644 --- a/src/ol/control/MousePosition.js +++ b/src/ol/control/MousePosition.js @@ -162,7 +162,10 @@ class MousePosition extends Control { } /** - * @inheritDoc + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. * @api */ setMap(map) { diff --git a/src/ol/control/OverviewMap.js b/src/ol/control/OverviewMap.js index a77f8ae698..a64b15979d 100644 --- a/src/ol/control/OverviewMap.js +++ b/src/ol/control/OverviewMap.js @@ -255,7 +255,10 @@ class OverviewMap extends Control { } /** - * @inheritDoc + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. * @api */ setMap(map) { diff --git a/src/ol/control/ZoomSlider.js b/src/ol/control/ZoomSlider.js index 58f2229d40..b65ec01808 100644 --- a/src/ol/control/ZoomSlider.js +++ b/src/ol/control/ZoomSlider.js @@ -148,7 +148,11 @@ class ZoomSlider extends Control { } /** - * @inheritDoc + * Remove the control from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. + * @api */ setMap(map) { super.setMap(map); diff --git a/src/ol/events/Target.js b/src/ol/events/Target.js index 7ea0ccf929..475d2d570e 100644 --- a/src/ol/events/Target.js +++ b/src/ol/events/Target.js @@ -130,7 +130,7 @@ class Target extends Disposable { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { clear(this.listeners_); diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 2a15c14368..37d4dcee8e 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -102,9 +102,13 @@ class EsriJSON extends JSONFeature { } /** - * @inheritDoc + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @param {string=} opt_idField Name of the field where to get the id from. + * @protected + * @return {import("../Feature.js").default} Feature. */ - readFeatureFromObject(object, opt_options) { + readFeatureFromObject(object, opt_options, opt_idField) { const esriJSONFeature = /** @type {EsriJSONFeature} */ (object); const geometry = readGeometry(esriJSONFeature.geometry, opt_options); const feature = new Feature(); @@ -112,18 +116,21 @@ class EsriJSON extends JSONFeature { feature.setGeometryName(this.geometryName_); } feature.setGeometry(geometry); - if (opt_options && opt_options.idField && - esriJSONFeature.attributes[opt_options.idField]) { - feature.setId(/** @type {number} */(esriJSONFeature.attributes[opt_options.idField])); - } if (esriJSONFeature.attributes) { feature.setProperties(esriJSONFeature.attributes, true); + const id = esriJSONFeature.attributes[opt_idField]; + if (id !== undefined) { + feature.setId(/** @type {number} */(id)); + } } return feature; } /** - * @inheritDoc + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {Array} Features. */ readFeaturesFromObject(object, opt_options) { const options = opt_options ? opt_options : {}; @@ -132,9 +139,8 @@ class EsriJSON extends JSONFeature { /** @type {Array} */ const features = []; const esriJSONFeatures = esriJSONFeatureSet.features; - options.idField = object.objectIdFieldName; for (let i = 0, ii = esriJSONFeatures.length; i < ii; ++i) { - features.push(this.readFeatureFromObject(esriJSONFeatures[i], options)); + features.push(this.readFeatureFromObject(esriJSONFeatures[i], options, object.objectIdFieldName)); } return features; } else { @@ -143,14 +149,19 @@ class EsriJSON extends JSONFeature { } /** - * @inheritDoc + * @param {EsriJSONGeometry} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. */ readGeometryFromObject(object, opt_options) { - return readGeometry(/** @type {EsriJSONGeometry} */(object), opt_options); + return readGeometry(object, opt_options); } /** - * @inheritDoc + * @param {Object} object Object. + * @protected + * @return {import("../proj/Projection.js").default} Projection. */ readProjectionFromObject(object) { if (object['spatialReference'] && object['spatialReference']['wkid'] !== undefined) { @@ -168,7 +179,6 @@ class EsriJSON extends JSONFeature { * @param {import("../geom/Geometry.js").default} geometry Geometry. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {EsriJSONGeometry} Object. - * @override * @api */ writeGeometryObject(geometry, opt_options) { @@ -181,7 +191,6 @@ class EsriJSON extends JSONFeature { * @param {import("../Feature.js").default} feature Feature. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {Object} Object. - * @override * @api */ writeFeatureObject(feature, opt_options) { @@ -212,7 +221,6 @@ class EsriJSON extends JSONFeature { * @param {Array} features Features. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {EsriJSONFeatureSet} EsriJSON Object. - * @override * @api */ writeFeaturesObject(features, opt_options) { diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index afc8aab5a1..f6d4ec1a13 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -81,7 +81,7 @@ class FeatureFormat { /** * Adds the data projection to the read options. - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {ReadOptions=} opt_options Options. * @return {ReadOptions|undefined} Options. * @protected @@ -132,7 +132,7 @@ class FeatureFormat { * Read a single feature from a source. * * @abstract - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {ReadOptions=} opt_options Read options. * @return {import("../Feature.js").FeatureLike} Feature. */ @@ -144,7 +144,7 @@ class FeatureFormat { * Read all features from a source. * * @abstract - * @param {Document|Node|ArrayBuffer|Object|string} source Source. + * @param {Document|Element|ArrayBuffer|Object|string} source Source. * @param {ReadOptions=} opt_options Read options. * @return {Array} Features. */ @@ -156,7 +156,7 @@ class FeatureFormat { * Read a single geometry from a source. * * @abstract - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {ReadOptions=} opt_options Read options. * @return {import("../geom/Geometry.js").default} Geometry. */ @@ -168,7 +168,7 @@ class FeatureFormat { * Read the projection from a source. * * @abstract - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @return {import("../proj/Projection.js").default} Projection. */ readProjection(source) { diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 596ff706bd..0842d2ac07 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -53,7 +53,7 @@ class GML2 extends GMLBase { makeArrayPusher(this.readFeaturesInternal); /** - * @inheritDoc + * @type {string} */ this.schemaLocation = options.schemaLocation ? options.schemaLocation : schemaLocation; diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index e6fd12d07d..b2929794f5 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -86,7 +86,7 @@ class GML3 extends GMLBase { options.multiSurface : true; /** - * @inheritDoc + * @type {string} */ this.schemaLocation = options.schemaLocation ? options.schemaLocation : schemaLocation; @@ -866,7 +866,6 @@ class GML3 extends GMLBase { * @param {import("../geom/Geometry.js").default} geometry Geometry. * @param {import("./Feature.js").WriteOptions=} opt_options Options. * @return {Node} Node. - * @override * @api */ writeGeometryNode(geometry, opt_options) { @@ -888,7 +887,6 @@ class GML3 extends GMLBase { * @param {Array} features Features. * @param {import("./Feature.js").WriteOptions=} opt_options Options. * @return {Element} Node. - * @override * @api */ writeFeaturesNode(features, opt_options) { diff --git a/src/ol/format/GML32.js b/src/ol/format/GML32.js index 1cae5f8dd7..777829cecf 100644 --- a/src/ol/format/GML32.js +++ b/src/ol/format/GML32.js @@ -22,7 +22,7 @@ class GML32 extends GML3 { super(options); /** - * @inheritDoc + * @type {string} */ this.schemaLocation = options.schemaLocation ? options.schemaLocation : this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd'; diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index d0f5c7b05a..c3a726a484 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -470,7 +470,10 @@ class GMLBase extends XMLFeature { } /** - * @inheritDoc + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @protected + * @return {import("../geom/Geometry.js").default|import("../extent.js").Extent} Geometry. */ //@ts-ignore readGeometryFromNode(node, opt_options) { @@ -480,7 +483,9 @@ class GMLBase extends XMLFeature { } /** - * @inheritDoc + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {Array} Features. */ readFeaturesFromNode(node, opt_options) { const options = { @@ -495,7 +500,8 @@ class GMLBase extends XMLFeature { } /** - * @inheritDoc + * @param {Element} node Node. + * @return {import("../proj/Projection.js").default} Projection. */ readProjectionFromNode(node) { return getProjection(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName')); diff --git a/src/ol/format/GPX.js b/src/ol/format/GPX.js index ec56119232..d1be09df7b 100644 --- a/src/ol/format/GPX.js +++ b/src/ol/format/GPX.js @@ -130,7 +130,7 @@ class GPX extends XMLFeature { /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection('EPSG:4326'); @@ -160,7 +160,9 @@ class GPX extends XMLFeature { } /** - * @inheritDoc + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {import("../Feature.js").default} Feature. */ readFeatureFromNode(node, opt_options) { if (!includes(NAMESPACE_URIS, node.namespaceURI)) { @@ -179,7 +181,9 @@ class GPX extends XMLFeature { } /** - * @inheritDoc + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {Array} Features. */ readFeaturesFromNode(node, opt_options) { if (!includes(NAMESPACE_URIS, node.namespaceURI)) { @@ -207,7 +211,6 @@ class GPX extends XMLFeature { * @param {Array} features Features. * @param {import("./Feature.js").WriteOptions=} opt_options Options. * @return {Node} Node. - * @override * @api */ writeFeaturesNode(features, opt_options) { diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 2e3f30dee2..0ea2a67ee9 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -63,7 +63,7 @@ class GeoJSON extends JSONFeature { super(); /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection( options.dataProjection ? @@ -90,7 +90,10 @@ class GeoJSON extends JSONFeature { } /** - * @inheritDoc + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {import("../Feature.js").default} Feature. */ readFeatureFromObject(object, opt_options) { /** @@ -127,7 +130,10 @@ class GeoJSON extends JSONFeature { } /** - * @inheritDoc + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {Array} Features. */ readFeaturesFromObject(object, opt_options) { const geoJSONObject = /** @type {GeoJSONObject} */ (object); @@ -147,14 +153,19 @@ class GeoJSON extends JSONFeature { } /** - * @inheritDoc + * @param {GeoJSONGeometry} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. */ readGeometryFromObject(object, opt_options) { - return readGeometry(/** @type {GeoJSONGeometry} */ (object), opt_options); + return readGeometry(object, opt_options); } /** - * @inheritDoc + * @param {Object} object Object. + * @protected + * @return {import("../proj/Projection.js").default} Projection. */ readProjectionFromObject(object) { const crs = object['crs']; @@ -181,7 +192,6 @@ class GeoJSON extends JSONFeature { * @param {import("../Feature.js").default} feature Feature. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {GeoJSONFeature} Object. - * @override * @api */ writeFeatureObject(feature, opt_options) { @@ -218,7 +228,6 @@ class GeoJSON extends JSONFeature { * @param {Array} features Features. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {GeoJSONFeatureCollection} GeoJSON Object. - * @override * @api */ writeFeaturesObject(features, opt_options) { @@ -239,7 +248,6 @@ class GeoJSON extends JSONFeature { * @param {import("../geom/Geometry.js").default} geometry Geometry. * @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object. - * @override * @api */ writeGeometryObject(geometry, opt_options) { diff --git a/src/ol/format/IGC.js b/src/ol/format/IGC.js index fb2d71f306..3c46e8af47 100644 --- a/src/ol/format/IGC.js +++ b/src/ol/format/IGC.js @@ -77,7 +77,7 @@ class IGC extends TextFeature { const options = opt_options ? opt_options : {}; /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection('EPSG:4326'); @@ -89,7 +89,10 @@ class IGC extends TextFeature { } /** - * @inheritDoc + * @protected + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @return {import("../Feature.js").default} Feature. */ readFeatureFromText(text, opt_options) { const altitudeMode = this.altitudeMode_; @@ -164,7 +167,10 @@ class IGC extends TextFeature { } /** - * @inheritDoc + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {Array} Features. */ readFeaturesFromText(text, opt_options) { const feature = this.readFeatureFromText(text, opt_options); diff --git a/src/ol/format/JSONFeature.js b/src/ol/format/JSONFeature.js index 2186befc84..483c192752 100644 --- a/src/ol/format/JSONFeature.js +++ b/src/ol/format/JSONFeature.js @@ -19,7 +19,7 @@ class JSONFeature extends FeatureFormat { } /** - * @inheritDoc + * @return {import("./FormatType.js").default} Format. */ getType() { return FormatType.JSON; @@ -29,7 +29,7 @@ class JSONFeature extends FeatureFormat { * Read a feature. Only works for a single feature. Use `readFeatures` to * read a feature collection. * - * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @param {ArrayBuffer|Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {import("../Feature.js").default} Feature. * @api @@ -43,7 +43,7 @@ class JSONFeature extends FeatureFormat { * Read all features. Works with both a single feature and a feature * collection. * - * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @param {ArrayBuffer|Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {Array} Features. * @api @@ -78,7 +78,7 @@ class JSONFeature extends FeatureFormat { /** * Read a geometry. * - * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @param {ArrayBuffer|Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {import("../geom/Geometry.js").default} Geometry. * @api @@ -102,7 +102,7 @@ class JSONFeature extends FeatureFormat { /** * Read the projection. * - * @param {ArrayBuffer|Document|Node|Object|string} source Source. + * @param {ArrayBuffer|Document|Element|Object|string} source Source. * @return {import("../proj/Projection.js").default} Projection. * @api */ @@ -189,7 +189,7 @@ class JSONFeature extends FeatureFormat { /** - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @return {Object} Object. */ function getObject(source) { diff --git a/src/ol/format/KML.js b/src/ol/format/KML.js index 7cbe238247..1c1608d935 100644 --- a/src/ol/format/KML.js +++ b/src/ol/format/KML.js @@ -427,7 +427,7 @@ class KML extends XMLFeature { } /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection('EPSG:4326'); @@ -598,7 +598,9 @@ class KML extends XMLFeature { } /** - * @inheritDoc + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {import("../Feature.js").default} Feature. */ readFeatureFromNode(node, opt_options) { if (!includes(NAMESPACE_URIS, node.namespaceURI)) { @@ -614,7 +616,10 @@ class KML extends XMLFeature { } /** - * @inheritDoc + * @protected + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {Array} Features. */ readFeaturesFromNode(node, opt_options) { if (!includes(NAMESPACE_URIS, node.namespaceURI)) { @@ -847,7 +852,6 @@ class KML extends XMLFeature { * @param {Array} features Features. * @param {import("./Feature.js").WriteOptions=} opt_options Options. * @return {Node} Node. - * @override * @api */ writeFeaturesNode(features, opt_options) { diff --git a/src/ol/format/MVT.js b/src/ol/format/MVT.js index c8c8e2c77e..40c80480e7 100644 --- a/src/ol/format/MVT.js +++ b/src/ol/format/MVT.js @@ -234,7 +234,7 @@ class MVT extends FeatureFormat { } /** - * @inheritDoc + * @return {import("./FormatType.js").default} Format. */ getType() { return FormatType.ARRAY_BUFFER; @@ -277,7 +277,10 @@ class MVT extends FeatureFormat { } /** - * @inheritDoc + * Read the projection from the source. + * + * @param {Document|Element|Object|string} source Source. + * @return {import("../proj/Projection.js").default} Projection. * @api */ readProjection(source) { diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index d74ddd2aa2..cef247f8a6 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -58,13 +58,16 @@ class OSMXML extends XMLFeature { super(); /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection('EPSG:4326'); } /** - * @inheritDoc + * @protected + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {Array} Features. */ readFeaturesFromNode(node, opt_options) { const options = this.getReadOptions(node, opt_options); diff --git a/src/ol/format/OWS.js b/src/ol/format/OWS.js index 1c4578afa9..e9dd976dd8 100644 --- a/src/ol/format/OWS.js +++ b/src/ol/format/OWS.js @@ -33,19 +33,21 @@ class OWS extends XML { } /** - * @inheritDoc + * @param {Document} doc Document. + * @return {Object} Object */ readFromDocument(doc) { for (let n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { - return this.readFromNode(n); + return this.readFromNode(/** @type {Element} */ (n)); } } return null; } /** - * @inheritDoc + * @param {Element} node Node. + * @return {Object} Object */ readFromNode(node) { const owsObject = pushParseAndPop({}, diff --git a/src/ol/format/Polyline.js b/src/ol/format/Polyline.js index d28f2c4e2f..8900422cd5 100644 --- a/src/ol/format/Polyline.js +++ b/src/ol/format/Polyline.js @@ -47,7 +47,7 @@ class Polyline extends TextFeature { /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection('EPSG:4326'); @@ -66,7 +66,10 @@ class Polyline extends TextFeature { } /** - * @inheritDoc + * @protected + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @return {import("../Feature.js").default} Feature. */ readFeatureFromText(text, opt_options) { const geometry = this.readGeometryFromText(text, opt_options); @@ -74,7 +77,10 @@ class Polyline extends TextFeature { } /** - * @inheritDoc + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {Array} Features. */ readFeaturesFromText(text, opt_options) { const feature = this.readFeatureFromText(text, opt_options); @@ -82,7 +88,10 @@ class Polyline extends TextFeature { } /** - * @inheritDoc + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. */ readGeometryFromText(text, opt_options) { const stride = getStrideForLayout(this.geometryLayout_); @@ -95,7 +104,10 @@ class Polyline extends TextFeature { } /** - * @inheritDoc + * @param {import("../Feature.js").default} feature Features. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @protected + * @return {string} Text. */ writeFeatureText(feature, opt_options) { const geometry = feature.getGeometry(); @@ -108,14 +120,20 @@ class Polyline extends TextFeature { } /** - * @inheritDoc + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @protected + * @return {string} Text. */ writeFeaturesText(features, opt_options) { return this.writeFeatureText(features[0], opt_options); } /** - * @inheritDoc + * @param {LineString} geometry Geometry. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @protected + * @return {string} Text. */ writeGeometryText(geometry, opt_options) { geometry = /** @type {LineString} */ diff --git a/src/ol/format/TextFeature.js b/src/ol/format/TextFeature.js index 926ae832e4..c1f40290d7 100644 --- a/src/ol/format/TextFeature.js +++ b/src/ol/format/TextFeature.js @@ -19,7 +19,7 @@ class TextFeature extends FeatureFormat { } /** - * @inheritDoc + * @return {import("./FormatType.js").default} Format. */ getType() { return FormatType.TEXT; @@ -28,7 +28,7 @@ class TextFeature extends FeatureFormat { /** * Read the feature from the source. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {import("../Feature.js").default} Feature. * @api @@ -51,7 +51,7 @@ class TextFeature extends FeatureFormat { /** * Read the features from the source. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {Array} Features. * @api @@ -74,7 +74,7 @@ class TextFeature extends FeatureFormat { /** * Read the geometry from the source. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {import("../geom/Geometry.js").default} Geometry. * @api @@ -97,7 +97,7 @@ class TextFeature extends FeatureFormat { /** * Read the projection from the source. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @return {import("../proj/Projection.js").default} Projection. * @api */ @@ -186,7 +186,7 @@ class TextFeature extends FeatureFormat { /** - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @return {string} Text. */ function getText(source) { diff --git a/src/ol/format/TopoJSON.js b/src/ol/format/TopoJSON.js index c8cc330cf7..37d3d7bcb9 100644 --- a/src/ol/format/TopoJSON.js +++ b/src/ol/format/TopoJSON.js @@ -78,7 +78,7 @@ class TopoJSON extends JSONFeature { this.layers_ = options.layers ? options.layers : null; /** - * @inheritDoc + * @type {import("../proj/Projection.js").default} */ this.dataProjection = getProjection( options.dataProjection ? @@ -87,7 +87,10 @@ class TopoJSON extends JSONFeature { } /** - * @inheritDoc + * @param {Object} object Object. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {Array} Features. */ readFeaturesFromObject(object, opt_options) { if (object.type == 'Topology') { @@ -128,7 +131,9 @@ class TopoJSON extends JSONFeature { } /** - * @inheritDoc + * @param {Object} object Object. + * @protected + * @return {import("../proj/Projection.js").default} Projection. */ readProjectionFromObject(object) { return this.dataProjection; diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index e3cd863db2..435dc870e9 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -254,7 +254,10 @@ class WFS extends XMLFeature { } /** - * @inheritDoc + * @protected + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {Array} Features. */ readFeaturesFromNode(node, opt_options) { /** @type {import("../xml.js").NodeStackItem} */ @@ -513,19 +516,21 @@ class WFS extends XMLFeature { } /** - * @inheritDoc + * @param {Document} doc Document. + * @return {import("../proj/Projection.js").default} Projection. */ readProjectionFromDocument(doc) { - for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) { + for (let n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { - return this.readProjectionFromNode(n); + return this.readProjectionFromNode(/** @type {Element} */ (n)); } } return null; } /** - * @inheritDoc + * @param {Element} node Node. + * @return {import("../proj/Projection.js").default} Projection. */ readProjectionFromNode(node) { if (node.firstElementChild && diff --git a/src/ol/format/WKT.js b/src/ol/format/WKT.js index c4c6ad2eb2..20660e484f 100644 --- a/src/ol/format/WKT.js +++ b/src/ol/format/WKT.js @@ -642,7 +642,10 @@ class WKT extends TextFeature { } /** - * @inheritDoc + * @protected + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @return {import("../Feature.js").default} Feature. */ readFeatureFromText(text, opt_options) { const geom = this.readGeometryFromText(text, opt_options); @@ -655,7 +658,10 @@ class WKT extends TextFeature { } /** - * @inheritDoc + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {Array} Features. */ readFeaturesFromText(text, opt_options) { let geometries = []; @@ -677,7 +683,10 @@ class WKT extends TextFeature { } /** - * @inheritDoc + * @param {string} text Text. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @protected + * @return {import("../geom/Geometry.js").default} Geometry. */ readGeometryFromText(text, opt_options) { const geometry = this.parse_(text); @@ -689,7 +698,10 @@ class WKT extends TextFeature { } /** - * @inheritDoc + * @param {import("../Feature.js").default} feature Features. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @protected + * @return {string} Text. */ writeFeatureText(feature, opt_options) { const geometry = feature.getGeometry(); @@ -700,7 +712,10 @@ class WKT extends TextFeature { } /** - * @inheritDoc + * @param {Array} features Features. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @protected + * @return {string} Text. */ writeFeaturesText(features, opt_options) { if (features.length == 1) { @@ -715,7 +730,10 @@ class WKT extends TextFeature { } /** - * @inheritDoc + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @protected + * @return {string} Text. */ writeGeometryText(geometry, opt_options) { return encode(transformGeometryWithOptions(geometry, true, opt_options)); diff --git a/src/ol/format/WMSCapabilities.js b/src/ol/format/WMSCapabilities.js index 7dda2be9de..82b5874383 100644 --- a/src/ol/format/WMSCapabilities.js +++ b/src/ol/format/WMSCapabilities.js @@ -60,19 +60,21 @@ class WMSCapabilities extends XML { } /** - * @inheritDoc + * @param {Document} doc Document. + * @return {Object} Object */ readFromDocument(doc) { for (let n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { - return this.readFromNode(n); + return this.readFromNode(/** @type {Element} */ (n)); } } return null; } /** - * @inheritDoc + * @param {Element} node Node. + * @return {Object} Object */ readFromNode(node) { this.version = node.getAttribute('version').trim(); diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index f63f88cb54..ccc8e2a136 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -144,7 +144,10 @@ class WMSGetFeatureInfo extends XMLFeature { } /** - * @inheritDoc + * @protected + * @param {Element} node Node. + * @param {import("./Feature.js").ReadOptions=} opt_options Options. + * @return {Array} Features. */ readFeaturesFromNode(node, opt_options) { const options = {}; diff --git a/src/ol/format/WMTSCapabilities.js b/src/ol/format/WMTSCapabilities.js index bd1629f1d7..cfdcdd8cb4 100644 --- a/src/ol/format/WMTSCapabilities.js +++ b/src/ol/format/WMTSCapabilities.js @@ -59,19 +59,21 @@ class WMTSCapabilities extends XML { } /** - * @inheritDoc + * @param {Document} doc Document. + * @return {Object} Object */ readFromDocument(doc) { for (let n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { - return this.readFromNode(n); + return this.readFromNode(/** @type {Element} */ (n)); } } return null; } /** - * @inheritDoc + * @param {Element} node Node. + * @return {Object} Object */ readFromNode(node) { let version = node.getAttribute('version'); diff --git a/src/ol/format/XMLFeature.js b/src/ol/format/XMLFeature.js index 0f413e21c3..550b78dca7 100644 --- a/src/ol/format/XMLFeature.js +++ b/src/ol/format/XMLFeature.js @@ -27,7 +27,7 @@ class XMLFeature extends FeatureFormat { } /** - * @inheritDoc + * @return {import("./FormatType.js").default} Format. */ getType() { return FormatType.XML; @@ -36,7 +36,7 @@ class XMLFeature extends FeatureFormat { /** * Read a single feature. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Read options. * @return {import("../Feature.js").default} Feature. * @api @@ -50,7 +50,7 @@ class XMLFeature extends FeatureFormat { } else if (isDocument(source)) { return this.readFeatureFromDocument(/** @type {Document} */ (source), opt_options); } else { - return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options); + return this.readFeatureFromNode(/** @type {Element} */ (source), opt_options); } } @@ -69,7 +69,7 @@ class XMLFeature extends FeatureFormat { } /** - * @param {Node} node Node. + * @param {Element} node Node. * @param {import("./Feature.js").ReadOptions=} opt_options Options. * @return {import("../Feature.js").default} Feature. */ @@ -80,7 +80,7 @@ class XMLFeature extends FeatureFormat { /** * Read all features from a feature collection. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @param {import("./Feature.js").ReadOptions=} opt_options Options. * @return {Array} Features. * @api @@ -95,7 +95,7 @@ class XMLFeature extends FeatureFormat { return this.readFeaturesFromDocument( /** @type {Document} */ (source), opt_options); } else { - return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options); + return this.readFeaturesFromNode(/** @type {Element} */ (source), opt_options); } } @@ -108,9 +108,9 @@ class XMLFeature extends FeatureFormat { readFeaturesFromDocument(doc, opt_options) { /** @type {Array} */ const features = []; - for (let n = /** @type {Node} */ (doc.firstChild); n; n = n.nextSibling) { + for (let n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { - extend(features, this.readFeaturesFromNode(n, opt_options)); + extend(features, this.readFeaturesFromNode(/** @type {Element} */ (n), opt_options)); } } return features; @@ -118,7 +118,7 @@ class XMLFeature extends FeatureFormat { /** * @abstract - * @param {Node} node Node. + * @param {Element} node Node. * @param {import("./Feature.js").ReadOptions=} opt_options Options. * @protected * @return {Array} Features. @@ -128,7 +128,11 @@ class XMLFeature extends FeatureFormat { } /** - * @inheritDoc + * Read a single geometry from a source. + * + * @param {Document|Element|Object|string} source Source. + * @param {import("./Feature.js").ReadOptions=} opt_options Read options. + * @return {import("../geom/Geometry.js").default} Geometry. */ readGeometry(source, opt_options) { if (!source) { @@ -140,7 +144,7 @@ class XMLFeature extends FeatureFormat { return this.readGeometryFromDocument( /** @type {Document} */ (source), opt_options); } else { - return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options); + return this.readGeometryFromNode(/** @type {Element} */ (source), opt_options); } } @@ -155,7 +159,7 @@ class XMLFeature extends FeatureFormat { } /** - * @param {Node} node Node. + * @param {Element} node Node. * @param {import("./Feature.js").ReadOptions=} opt_options Options. * @protected * @return {import("../geom/Geometry.js").default} Geometry. @@ -167,7 +171,7 @@ class XMLFeature extends FeatureFormat { /** * Read the projection from the source. * - * @param {Document|Node|Object|string} source Source. + * @param {Document|Element|Object|string} source Source. * @return {import("../proj/Projection.js").default} Projection. * @api */ @@ -180,7 +184,7 @@ class XMLFeature extends FeatureFormat { } else if (isDocument(source)) { return this.readProjectionFromDocument(/** @type {Document} */ (source)); } else { - return this.readProjectionFromNode(/** @type {Node} */ (source)); + return this.readProjectionFromNode(/** @type {Element} */ (source)); } } @@ -194,7 +198,7 @@ class XMLFeature extends FeatureFormat { } /** - * @param {Node} node Node. + * @param {Element} node Node. * @protected * @return {import("../proj/Projection.js").default} Projection. */ @@ -203,7 +207,11 @@ class XMLFeature extends FeatureFormat { } /** - * @inheritDoc + * Encode a feature as string. + * + * @param {import("../Feature.js").default} feature Feature. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @return {string} Encoded feature. */ writeFeature(feature, opt_options) { const node = this.writeFeatureNode(feature, opt_options); @@ -243,7 +251,11 @@ class XMLFeature extends FeatureFormat { } /** - * @inheritDoc + * Encode a geometry as string. + * + * @param {import("../geom/Geometry.js").default} geometry Geometry. + * @param {import("./Feature.js").WriteOptions=} opt_options Write options. + * @return {string} Encoded geometry. */ writeGeometry(geometry, opt_options) { const node = this.writeGeometryNode(geometry, opt_options); diff --git a/src/ol/geom/Circle.js b/src/ol/geom/Circle.js index 25010f9ed3..e5bdf14397 100644 --- a/src/ol/geom/Circle.js +++ b/src/ol/geom/Circle.js @@ -36,7 +36,6 @@ class Circle extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!Circle} Clone. - * @override * @api */ clone() { @@ -44,7 +43,11 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { const flatCoordinates = this.flatCoordinates; @@ -72,7 +75,9 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). */ containsXY(x, y) { const flatCoordinates = this.flatCoordinates; @@ -91,7 +96,9 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. */ computeExtent(extent) { const flatCoordinates = this.flatCoordinates; @@ -122,7 +129,8 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -130,7 +138,9 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -193,16 +203,10 @@ class Circle extends SimpleGeometry { this.changed(); } - /** - * @inheritDoc - */ getCoordinates() { return null; } - /** - * @inheritDoc - */ setCoordinates(coordinates, opt_layout) {} /** @@ -216,7 +220,10 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @param {number} angle Rotation angle in radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. * @api */ rotate(angle, anchor) { @@ -227,7 +234,10 @@ class Circle extends SimpleGeometry { } /** - * @inheritDoc + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. * @api */ translate(deltaX, deltaY) { diff --git a/src/ol/geom/Geometry.js b/src/ol/geom/Geometry.js index bc6092d06b..f63e6a9779 100644 --- a/src/ol/geom/Geometry.js +++ b/src/ol/geom/Geometry.js @@ -184,8 +184,7 @@ class Geometry extends BaseObject { * coordinates in place. * @abstract * @param {number} sx The scaling factor in the x-direction. - * @param {number=} opt_sy The scaling factor in the y-direction (defaults to - * sx). + * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx). * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center * of the geometry extent). * @api diff --git a/src/ol/geom/GeometryCollection.js b/src/ol/geom/GeometryCollection.js index 1d407f2fdc..981140a949 100644 --- a/src/ol/geom/GeometryCollection.js +++ b/src/ol/geom/GeometryCollection.js @@ -61,7 +61,6 @@ class GeometryCollection extends Geometry { /** * Make a complete copy of the geometry. * @return {!GeometryCollection} Clone. - * @override * @api */ clone() { @@ -71,7 +70,11 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -86,7 +89,9 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). */ containsXY(x, y) { const geometries = this.geometries_; @@ -99,7 +104,9 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. */ computeExtent(extent) { createOrUpdateEmpty(extent); @@ -144,7 +151,9 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Create a simplified version of this geometry using the Douglas Peucker algorithm. + * @param {number} squaredTolerance Squared tolerance. + * @return {GeometryCollection} Simplified GeometryCollection. */ getSimplifiedGeometry(squaredTolerance) { if (this.simplifiedGeometryRevision !== this.getRevision()) { @@ -179,7 +188,8 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -187,7 +197,9 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -208,7 +220,10 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Rotate the geometry around a given coordinate. This modifies the geometry + * coordinates in place. + * @param {number} angle Rotation angle in radians. + * @param {import("../coordinate.js").Coordinate} anchor The rotation center. * @api */ rotate(angle, anchor) { @@ -220,7 +235,13 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Scale the geometry (with an optional origin). This modifies the geometry + * coordinates in place. + * @abstract + * @param {number} sx The scaling factor in the x-direction. + * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx). + * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center + * of the geometry extent). * @api */ scale(sx, opt_sy, opt_anchor) { @@ -255,7 +276,12 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Apply a transform function to the coordinates of the geometry. + * The geometry is modified in place. + * If you do not want the geometry modified in place, first `clone()` it and + * then use this function on the clone. + * @param {import("../proj.js").TransformFunction} transformFn Transform function. + * Called with a flat array of geometry coordinates. * @api */ applyTransform(transformFn) { @@ -267,7 +293,10 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Translate the geometry. This modifies the geometry coordinates in place. If + * instead you want a new geometry, first `clone()` this geometry. + * @param {number} deltaX Delta X. + * @param {number} deltaY Delta Y. * @api */ translate(deltaX, deltaY) { @@ -279,7 +308,7 @@ class GeometryCollection extends Geometry { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.unlistenGeometriesChange_(); diff --git a/src/ol/geom/LineString.js b/src/ol/geom/LineString.js index e8928c7d22..6334708e51 100644 --- a/src/ol/geom/LineString.js +++ b/src/ol/geom/LineString.js @@ -81,7 +81,6 @@ class LineString extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!LineString} Clone. - * @override * @api */ clone() { @@ -89,7 +88,11 @@ class LineString extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -147,7 +150,6 @@ class LineString extends SimpleGeometry { /** * Return the coordinates of the linestring. * @return {Array} Coordinates. - * @override * @api */ getCoordinates() { @@ -193,7 +195,9 @@ class LineString extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} squaredTolerance Squared tolerance. + * @return {LineString} Simplified LineString. + * @protected */ getSimplifiedGeometryInternal(squaredTolerance) { const simplifiedFlatCoordinates = []; @@ -204,7 +208,8 @@ class LineString extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -212,7 +217,9 @@ class LineString extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -225,7 +232,6 @@ class LineString extends SimpleGeometry { * Set the coordinates of the linestring. * @param {!Array} coordinates Coordinates. * @param {GeometryLayout=} opt_layout Layout. - * @override * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/LinearRing.js b/src/ol/geom/LinearRing.js index 40f99071a9..e85ab25969 100644 --- a/src/ol/geom/LinearRing.js +++ b/src/ol/geom/LinearRing.js @@ -52,7 +52,6 @@ class LinearRing extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!LinearRing} Clone. - * @override * @api */ clone() { @@ -60,7 +59,11 @@ class LinearRing extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -88,7 +91,6 @@ class LinearRing extends SimpleGeometry { /** * Return the coordinates of the linear ring. * @return {Array} Coordinates. - * @override * @api */ getCoordinates() { @@ -97,7 +99,9 @@ class LinearRing extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} squaredTolerance Squared tolerance. + * @return {LinearRing} Simplified LinearRing. + * @protected */ getSimplifiedGeometryInternal(squaredTolerance) { const simplifiedFlatCoordinates = []; @@ -108,7 +112,8 @@ class LinearRing extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -116,7 +121,10 @@ class LinearRing extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. + * @api */ intersectsExtent(extent) { return false; @@ -126,7 +134,6 @@ class LinearRing extends SimpleGeometry { * Set the coordinates of the linear ring. * @param {!Array} coordinates Coordinates. * @param {GeometryLayout=} opt_layout Layout. - * @override * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/MultiLineString.js b/src/ol/geom/MultiLineString.js index 449338bf1b..1e483b11e2 100644 --- a/src/ol/geom/MultiLineString.js +++ b/src/ol/geom/MultiLineString.js @@ -93,7 +93,6 @@ class MultiLineString extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!MultiLineString} Clone. - * @override * @api */ clone() { @@ -101,7 +100,11 @@ class MultiLineString extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -154,7 +157,6 @@ class MultiLineString extends SimpleGeometry { /** * Return the coordinates of the multilinestring. * @return {Array>} Coordinates. - * @override * @api */ getCoordinates() { @@ -224,7 +226,9 @@ class MultiLineString extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} squaredTolerance Squared tolerance. + * @return {MultiLineString} Simplified MultiLineString. + * @protected */ getSimplifiedGeometryInternal(squaredTolerance) { const simplifiedFlatCoordinates = []; @@ -236,7 +240,8 @@ class MultiLineString extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -244,7 +249,9 @@ class MultiLineString extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -256,7 +263,6 @@ class MultiLineString extends SimpleGeometry { * Set the coordinates of the multilinestring. * @param {!Array>} coordinates Coordinates. * @param {GeometryLayout=} opt_layout Layout. - * @override * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/MultiPoint.js b/src/ol/geom/MultiPoint.js index e433e51bf3..a487828c93 100644 --- a/src/ol/geom/MultiPoint.js +++ b/src/ol/geom/MultiPoint.js @@ -49,7 +49,6 @@ class MultiPoint extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!MultiPoint} Clone. - * @override * @api */ clone() { @@ -58,7 +57,11 @@ class MultiPoint extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -83,7 +86,6 @@ class MultiPoint extends SimpleGeometry { /** * Return the coordinates of the multipoint. * @return {Array} Coordinates. - * @override * @api */ getCoordinates() { @@ -125,7 +127,8 @@ class MultiPoint extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -133,7 +136,9 @@ class MultiPoint extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -153,7 +158,6 @@ class MultiPoint extends SimpleGeometry { * Set the coordinates of the multipoint. * @param {!Array} coordinates Coordinates. * @param {import("./GeometryLayout.js").default=} opt_layout Layout. - * @override * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/MultiPolygon.js b/src/ol/geom/MultiPolygon.js index ca9eb29b73..c3098284fa 100644 --- a/src/ol/geom/MultiPolygon.js +++ b/src/ol/geom/MultiPolygon.js @@ -138,7 +138,6 @@ class MultiPolygon extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!MultiPolygon} Clone. - * @override * @api */ clone() { @@ -153,7 +152,11 @@ class MultiPolygon extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -170,7 +173,9 @@ class MultiPolygon extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). */ containsXY(x, y) { return linearRingssContainsXY(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, x, y); @@ -196,7 +201,6 @@ class MultiPolygon extends SimpleGeometry { * By default, coordinate orientation will depend on how the geometry was * constructed. * @return {Array>>} Coordinates. - * @override * @api */ getCoordinates(opt_right) { @@ -266,7 +270,9 @@ class MultiPolygon extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} squaredTolerance Squared tolerance. + * @return {MultiPolygon} Simplified MultiPolygon. + * @protected */ getSimplifiedGeometryInternal(squaredTolerance) { const simplifiedFlatCoordinates = []; @@ -332,7 +338,8 @@ class MultiPolygon extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -340,7 +347,9 @@ class MultiPolygon extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -352,7 +361,6 @@ class MultiPolygon extends SimpleGeometry { * Set the coordinates of the multipolygon. * @param {!Array>>} coordinates Coordinates. * @param {GeometryLayout=} opt_layout Layout. - * @override * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/Point.js b/src/ol/geom/Point.js index 92b27d6a0e..0c3b7fc0d9 100644 --- a/src/ol/geom/Point.js +++ b/src/ol/geom/Point.js @@ -27,7 +27,6 @@ class Point extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!Point} Clone. - * @override * @api */ clone() { @@ -36,7 +35,11 @@ class Point extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { const flatCoordinates = this.flatCoordinates; @@ -56,7 +59,6 @@ class Point extends SimpleGeometry { /** * Return the coordinate of the point. * @return {import("../coordinate.js").Coordinate} Coordinates. - * @override * @api */ getCoordinates() { @@ -64,14 +66,17 @@ class Point extends SimpleGeometry { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. */ computeExtent(extent) { return createOrUpdateFromCoordinate(this.flatCoordinates, extent); } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -79,7 +84,9 @@ class Point extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -87,7 +94,8 @@ class Point extends SimpleGeometry { } /** - * @inheritDoc + * @param {!Array<*>} coordinates Coordinates. + * @param {import("./GeometryLayout.js").default=} opt_layout Layout. * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/Polygon.js b/src/ol/geom/Polygon.js index 24d0f17d82..4280671787 100644 --- a/src/ol/geom/Polygon.js +++ b/src/ol/geom/Polygon.js @@ -112,7 +112,6 @@ class Polygon extends SimpleGeometry { /** * Make a complete copy of the geometry. * @return {!Polygon} Clone. - * @override * @api */ clone() { @@ -120,7 +119,11 @@ class Polygon extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @param {import("../coordinate.js").Coordinate} closestPoint Closest point. + * @param {number} minSquaredDistance Minimum squared distance. + * @return {number} Minimum squared distance. */ closestPointXY(x, y, closestPoint, minSquaredDistance) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { @@ -137,7 +140,9 @@ class Polygon extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} x X. + * @param {number} y Y. + * @return {boolean} Contains (x, y). */ containsXY(x, y) { return linearRingsContainsXY(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, x, y); @@ -163,7 +168,6 @@ class Polygon extends SimpleGeometry { * By default, coordinate orientation will depend on how the geometry was * constructed. * @return {Array>} Coordinates. - * @override * @api */ getCoordinates(opt_right) { @@ -281,7 +285,9 @@ class Polygon extends SimpleGeometry { } /** - * @inheritDoc + * @param {number} squaredTolerance Squared tolerance. + * @return {Polygon} Simplified Polygon. + * @protected */ getSimplifiedGeometryInternal(squaredTolerance) { const simplifiedFlatCoordinates = []; @@ -294,7 +300,8 @@ class Polygon extends SimpleGeometry { } /** - * @inheritDoc + * Get the type of this geometry. + * @return {import("./GeometryType.js").default} Geometry type. * @api */ getType() { @@ -302,7 +309,9 @@ class Polygon extends SimpleGeometry { } /** - * @inheritDoc + * Test if the geometry and the passed extent intersect. + * @param {import("../extent.js").Extent} extent Extent. + * @return {boolean} `true` if the geometry and the extent intersect. * @api */ intersectsExtent(extent) { @@ -314,7 +323,6 @@ class Polygon extends SimpleGeometry { * Set the coordinates of the polygon. * @param {!Array>} coordinates Coordinates. * @param {GeometryLayout=} opt_layout Layout. - * @override * @api */ setCoordinates(coordinates, opt_layout) { diff --git a/src/ol/geom/SimpleGeometry.js b/src/ol/geom/SimpleGeometry.js index 5a8e697ad5..c70e5ea753 100644 --- a/src/ol/geom/SimpleGeometry.js +++ b/src/ol/geom/SimpleGeometry.js @@ -41,7 +41,9 @@ class SimpleGeometry extends Geometry { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @protected + * @return {import("../extent.js").Extent} extent Extent. */ computeExtent(extent) { return createOrUpdateFromFlatCoordinates(this.flatCoordinates, @@ -91,7 +93,9 @@ class SimpleGeometry extends Geometry { } /** - * @inheritDoc + * Create a simplified version of this geometry using the Douglas Peucker algorithm. + * @param {number} squaredTolerance Squared tolerance. + * @return {SimpleGeometry} Simplified geometry. */ getSimplifiedGeometry(squaredTolerance) { if (this.simplifiedGeometryRevision !== this.getRevision()) { @@ -224,8 +228,7 @@ class SimpleGeometry extends Geometry { * Scale the geometry (with an optional origin). This modifies the geometry * coordinates in place. * @param {number} sx The scaling factor in the x-direction. - * @param {number=} opt_sy The scaling factor in the y-direction (defaults to - * sx). + * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx). * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center * of the geometry extent). * @api diff --git a/src/ol/interaction/DragAndDrop.js b/src/ol/interaction/DragAndDrop.js index 5cb69e3b08..fe6c9c1ba8 100644 --- a/src/ol/interaction/DragAndDrop.js +++ b/src/ol/interaction/DragAndDrop.js @@ -185,7 +185,10 @@ class DragAndDrop extends Interaction { } /** - * @inheritDoc + * Activate or deactivate the interaction. + * @param {boolean} active Active. + * @observable + * @api */ setActive(active) { if (!this.getActive() && active) { @@ -198,7 +201,10 @@ class DragAndDrop extends Interaction { } /** - * @inheritDoc + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. */ setMap(map) { this.unregisterListeners_(); diff --git a/src/ol/interaction/DragBox.js b/src/ol/interaction/DragBox.js index 28ae6ecbe0..5d9f93658e 100644 --- a/src/ol/interaction/DragBox.js +++ b/src/ol/interaction/DragBox.js @@ -181,7 +181,8 @@ class DragBox extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); @@ -191,7 +192,9 @@ class DragBox extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { this.box_.setMap(null); @@ -205,7 +208,9 @@ class DragBox extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { if (this.condition_(mapBrowserEvent)) { diff --git a/src/ol/interaction/DragPan.js b/src/ol/interaction/DragPan.js index 2b3f6ba755..38dd51e1a0 100644 --- a/src/ol/interaction/DragPan.js +++ b/src/ol/interaction/DragPan.js @@ -86,7 +86,8 @@ class DragPan extends PointerInteraction { /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { if (!this.panning_) { @@ -121,7 +122,9 @@ class DragPan extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { const map = mapBrowserEvent.map; @@ -159,7 +162,9 @@ class DragPan extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { if (this.targetPointers.length > 0 && this.conditionInternal_(mapBrowserEvent)) { diff --git a/src/ol/interaction/DragRotate.js b/src/ol/interaction/DragRotate.js index 2749785fd6..2a705601b7 100644 --- a/src/ol/interaction/DragRotate.js +++ b/src/ol/interaction/DragRotate.js @@ -60,7 +60,8 @@ class DragRotate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { if (!mouseOnly(mapBrowserEvent)) { @@ -85,7 +86,9 @@ class DragRotate extends PointerInteraction { /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { if (!mouseOnly(mapBrowserEvent)) { @@ -100,7 +103,9 @@ class DragRotate extends PointerInteraction { /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { if (!mouseOnly(mapBrowserEvent)) { diff --git a/src/ol/interaction/DragRotateAndZoom.js b/src/ol/interaction/DragRotateAndZoom.js index 593bc9e4ee..4dd5188461 100644 --- a/src/ol/interaction/DragRotateAndZoom.js +++ b/src/ol/interaction/DragRotateAndZoom.js @@ -70,7 +70,8 @@ class DragRotateAndZoom extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { if (!mouseOnly(mapBrowserEvent)) { @@ -100,7 +101,9 @@ class DragRotateAndZoom extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { if (!mouseOnly(mapBrowserEvent)) { @@ -116,7 +119,9 @@ class DragRotateAndZoom extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { if (!mouseOnly(mapBrowserEvent)) { diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index b00c73f25c..a1b76655a1 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -465,7 +465,10 @@ class Draw extends PointerInteraction { } /** - * @inheritDoc + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. */ setMap(map) { super.setMap(map); @@ -483,7 +486,8 @@ class Draw extends PointerInteraction { /** * Handles the {@link module:ol/MapBrowserEvent map browser event} and may actually draw or finish the drawing. - * @override + * @param {import("../MapBrowserPointerEvent.js").default} event Map browser event. + * @return {boolean} `false` to stop event propagation. * @api */ handleEvent(event) { @@ -520,7 +524,7 @@ class Draw extends PointerInteraction { pass = event.type === MapBrowserEventType.POINTERMOVE; if (pass && this.freehand_) { pass = this.handlePointerMove_(event); - } else if (/** @type {MapBrowserPointerEvent} */ (event).pointerEvent.pointerType == 'mouse' || + } else if (event.pointerEvent.pointerType == 'mouse' || (event.type === MapBrowserEventType.POINTERDRAG && this.downTimeout_ === undefined)) { this.handlePointerMove_(event); } @@ -532,7 +536,9 @@ class Draw extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} event Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(event) { this.shouldHandle_ = !this.freehand_; @@ -559,7 +565,9 @@ class Draw extends PointerInteraction { /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} event Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(event) { let pass = true; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 5ca737e2bb..2f3a5b32fb 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -273,10 +273,11 @@ class Extent extends PointerInteraction { } /** - * @inheritDoc + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. */ handleEvent(mapBrowserEvent) { - if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) { + if (!mapBrowserEvent.pointerEvent) { return true; } //display pointer (if not dragging) @@ -290,7 +291,9 @@ class Extent extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { const pixel = mapBrowserEvent.pixel; @@ -347,7 +350,8 @@ class Extent extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { if (this.pointerHandler_) { @@ -355,11 +359,12 @@ class Extent extends PointerInteraction { this.setExtent(this.pointerHandler_(pixelCoordinate)); this.createOrUpdatePointerFeature_(pixelCoordinate); } - return true; } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { this.pointerHandler_ = null; @@ -372,7 +377,10 @@ class Extent extends PointerInteraction { } /** - * @inheritDoc + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. */ setMap(map) { this.extentOverlay_.setMap(map); diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index dffdf8e707..61ee477232 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -404,7 +404,10 @@ class Modify extends PointerInteraction { } /** - * @inheritDoc + * Activate or deactivate the interaction. + * @param {boolean} active Active. + * @observable + * @api */ setActive(active) { if (this.vertexFeature_ && !active) { @@ -415,7 +418,10 @@ class Modify extends PointerInteraction { } /** - * @inheritDoc + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. */ setMap(map) { this.overlay_.setMap(map); @@ -702,10 +708,11 @@ class Modify extends PointerInteraction { /** * Handles the {@link module:ol/MapBrowserEvent map browser event} and may modify the geometry. - * @override + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. */ handleEvent(mapBrowserEvent) { - if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) { + if (!mapBrowserEvent.pointerEvent) { return true; } this.lastPointerEvent_ = mapBrowserEvent; @@ -732,7 +739,8 @@ class Modify extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} evt Event. */ handleDragEvent(evt) { this.ignoreNextSingleClick_ = false; @@ -818,7 +826,9 @@ class Modify extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} evt Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(evt) { if (!this.condition_(evt)) { @@ -899,7 +909,9 @@ class Modify extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} evt Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(evt) { for (let i = this.dragSegments_.length - 1; i >= 0; --i) { diff --git a/src/ol/interaction/MouseWheelZoom.js b/src/ol/interaction/MouseWheelZoom.js index 9eb6027c4d..519ea34fe8 100644 --- a/src/ol/interaction/MouseWheelZoom.js +++ b/src/ol/interaction/MouseWheelZoom.js @@ -162,7 +162,8 @@ class MouseWheelZoom extends Interaction { /** * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually * zooms the map. - * @override + * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. */ handleEvent(mapBrowserEvent) { if (!this.conditionInternal_(mapBrowserEvent)) { diff --git a/src/ol/interaction/PinchRotate.js b/src/ol/interaction/PinchRotate.js index f3ad9b23e0..ab126f1fff 100644 --- a/src/ol/interaction/PinchRotate.js +++ b/src/ol/interaction/PinchRotate.js @@ -75,7 +75,8 @@ class PinchRotate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { let rotationDelta = 0.0; @@ -122,7 +123,9 @@ class PinchRotate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { if (this.targetPointers.length < 2) { @@ -136,7 +139,9 @@ class PinchRotate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { if (this.targetPointers.length >= 2) { diff --git a/src/ol/interaction/PinchZoom.js b/src/ol/interaction/PinchZoom.js index 31aa44dd16..775edc6adb 100644 --- a/src/ol/interaction/PinchZoom.js +++ b/src/ol/interaction/PinchZoom.js @@ -60,7 +60,8 @@ class PinchZoom extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. */ handleDragEvent(mapBrowserEvent) { let scaleDelta = 1.0; @@ -99,7 +100,9 @@ class PinchZoom extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(mapBrowserEvent) { if (this.targetPointers.length < 2) { @@ -114,7 +117,9 @@ class PinchZoom extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(mapBrowserEvent) { if (this.targetPointers.length >= 2) { diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index 2a3fa574d2..6c45375f20 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -126,11 +126,12 @@ class PointerInteraction extends Interaction { * Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are * detected. - * @override + * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event. + * @return {boolean} `false` to stop event propagation. * @api */ handleEvent(mapBrowserEvent) { - if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) { + if (!mapBrowserEvent.pointerEvent) { return true; } diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index 9fde58ccbb..b24a6352fb 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -317,7 +317,6 @@ class Select extends Interaction { * Remove the interaction from its current map, if any, and attach it to a new * map, if any. Pass `null` to just remove the interaction from the current map. * @param {import("../PluggableMap.js").default} map Map. - * @override * @api */ setMap(map) { diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index 61a5a1c6de..af66ec06c9 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -243,7 +243,8 @@ class Snap extends PointerInteraction { } /** - * @inheritDoc + * @param {import("../MapBrowserPointerEvent.js").default} evt Map browser event. + * @return {boolean} `false` to stop event propagation. */ handleEvent(evt) { const result = this.snapTo(evt.pixel, evt.coordinate, evt.map); @@ -289,7 +290,9 @@ class Snap extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} evt Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(evt) { const featuresToUpdate = getValues(this.pendingFeatures_); @@ -331,7 +334,10 @@ class Snap extends PointerInteraction { } /** - * @inheritDoc + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. */ setMap(map) { const currentMap = this.getMap(); diff --git a/src/ol/interaction/Translate.js b/src/ol/interaction/Translate.js index 293fb457c1..f8334d3362 100644 --- a/src/ol/interaction/Translate.js +++ b/src/ol/interaction/Translate.js @@ -193,7 +193,9 @@ class Translate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer down events. + * @param {import("../MapBrowserPointerEvent.js").default} event Event. + * @return {boolean} If the event was consumed. */ handleDownEvent(event) { this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map); @@ -214,7 +216,9 @@ class Translate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer up events. + * @param {import("../MapBrowserPointerEvent.js").default} event Event. + * @return {boolean} If the event was consumed. */ handleUpEvent(event) { if (this.lastCoordinate_) { @@ -235,7 +239,8 @@ class Translate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer drag events. + * @param {import("../MapBrowserPointerEvent.js").default} event Event. */ handleDragEvent(event) { if (this.lastCoordinate_) { @@ -260,7 +265,8 @@ class Translate extends PointerInteraction { } /** - * @inheritDoc + * Handle pointer move events. + * @param {import("../MapBrowserPointerEvent.js").default} event Event. */ handleMoveEvent(event) { const elem = event.map.getViewport(); @@ -318,7 +324,10 @@ class Translate extends PointerInteraction { } /** - * @inheritDoc + * Remove the interaction from its current map and attach it to the new map. + * Subclasses may set up event handlers to get notified about changes to + * the map here. + * @param {import("../PluggableMap.js").default} map Map. */ setMap(map) { const oldMap = this.getMap(); diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 21a44fdc36..7f39118e4b 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -322,7 +322,7 @@ class BaseLayer extends BaseObject { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { if (this.state_) { diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 12dff00af2..c7dd443100 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -190,7 +190,8 @@ class LayerGroup extends BaseLayer { } /** - * @inheritDoc + * @param {Array=} opt_array Array of layers (to be modified in place). + * @return {Array} Array of layers. */ getLayersArray(opt_array) { const array = opt_array !== undefined ? opt_array : []; @@ -201,7 +202,8 @@ class LayerGroup extends BaseLayer { } /** - * @inheritDoc + * @param {Array=} opt_states Optional list of layer states (to be modified in place). + * @return {Array} List of layer states. */ getLayerStatesArray(opt_states) { const states = opt_states !== undefined ? opt_states : []; @@ -238,7 +240,7 @@ class LayerGroup extends BaseLayer { } /** - * @inheritDoc + * @return {import("../source/State.js").default} Source state. */ getSourceState() { return SourceState.READY; diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index 0d015bf985..961c144418 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -178,7 +178,8 @@ class Heatmap extends VectorLayer { } /** - * @inheritDoc + * Create a renderer for this layer. + * @return {WebGLPointsLayerRenderer} A layer renderer. */ createRenderer() { return new WebGLPointsLayerRenderer(this, { diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index 2f6b2fb0b7..a96ee841c5 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -46,7 +46,7 @@ import {assert} from '../asserts.js'; /** * @typedef {Object} State - * @property {import("./Base.js").default} layer + * @property {import("./Layer.js").default} layer * @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point. * @property {SourceState} sourceState * @property {boolean} visible @@ -138,7 +138,8 @@ class Layer extends BaseLayer { } /** - * @inheritDoc + * @param {Array=} opt_array Array of layers (to be modified in place). + * @return {Array} Array of layers. */ getLayersArray(opt_array) { const array = opt_array ? opt_array : []; @@ -147,7 +148,8 @@ class Layer extends BaseLayer { } /** - * @inheritDoc + * @param {Array=} opt_states Optional list of layer states (to be modified in place). + * @return {Array} List of layer states. */ getLayerStatesArray(opt_states) { const states = opt_states ? opt_states : []; @@ -166,8 +168,8 @@ class Layer extends BaseLayer { } /** - * @inheritDoc - */ + * @return {import("../source/State.js").default} Source state. + */ getSourceState() { const source = this.getSource(); return !source ? SourceState.UNDEFINED : source.getState(); @@ -299,7 +301,7 @@ class Layer extends BaseLayer { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.setSource(null); diff --git a/src/ol/layer/WebGLPoints.js b/src/ol/layer/WebGLPoints.js index cdcea572b4..fb9428a7ff 100644 --- a/src/ol/layer/WebGLPoints.js +++ b/src/ol/layer/WebGLPoints.js @@ -93,7 +93,8 @@ class WebGLPointsLayer extends Layer { } /** - * @inheritDoc + * Create a renderer for this layer. + * @return {WebGLPointsLayerRenderer} A layer renderer. */ createRenderer() { return new WebGLPointsLayerRenderer(this, { @@ -109,8 +110,7 @@ class WebGLPointsLayer extends Layer { } /** - * - * @inheritDoc + * Clean up. */ disposeInternal() { this.renderer_.dispose(); diff --git a/src/ol/render/Box.js b/src/ol/render/Box.js index 6b1f8c323e..3402b35857 100644 --- a/src/ol/render/Box.js +++ b/src/ol/render/Box.js @@ -47,7 +47,7 @@ class RenderBox extends Disposable { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.setMap(null); diff --git a/src/ol/render/VectorContext.js b/src/ol/render/VectorContext.js index 838996200d..e00d586363 100644 --- a/src/ol/render/VectorContext.js +++ b/src/ol/render/VectorContext.js @@ -87,7 +87,7 @@ class VectorContext { drawPolygon(polygonGeometry, feature) {} /** - * @param {import("../geom/Geometry.js").default|import("./Feature.js").default} geometry Geometry. + * @param {import("../geom/SimpleGeometry.js").default|import("./Feature.js").default} geometry Geometry. * @param {import("../Feature.js").FeatureLike} feature Feature. */ drawText(geometry, feature) {} diff --git a/src/ol/render/canvas/Builder.js b/src/ol/render/canvas/Builder.js index ade18f1e61..f56abfe483 100644 --- a/src/ol/render/canvas/Builder.js +++ b/src/ol/render/canvas/Builder.js @@ -203,7 +203,9 @@ class CanvasBuilder extends VectorContext { } /** - * @inheritDoc. + * @param {import("../../geom/SimpleGeometry.js").default} geometry Geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. + * @param {Function} renderer Renderer. */ drawCustom(geometry, feature, renderer) { this.beginGeometry(geometry, feature); @@ -213,10 +215,9 @@ class CanvasBuilder extends VectorContext { let flatCoordinates, builderEnd, builderEnds, builderEndss; let offset; if (type == GeometryType.MULTI_POLYGON) { - geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry); - flatCoordinates = geometry.getOrientedFlatCoordinates(); + flatCoordinates = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getOrientedFlatCoordinates(); builderEndss = []; - const endss = geometry.getEndss(); + const endss = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss(); offset = 0; for (let i = 0, ii = endss.length; i < ii; ++i) { const myEnds = []; @@ -302,7 +303,8 @@ class CanvasBuilder extends VectorContext { } /** - * @inheritDoc + * @param {import("../../style/Fill.js").default} fillStyle Fill style. + * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style. */ setFillStrokeStyle(fillStyle, strokeStyle) { const state = this.state; diff --git a/src/ol/render/canvas/ImageBuilder.js b/src/ol/render/canvas/ImageBuilder.js index f60304d577..dc217fd0b7 100644 --- a/src/ol/render/canvas/ImageBuilder.js +++ b/src/ol/render/canvas/ImageBuilder.js @@ -107,7 +107,8 @@ class CanvasImageBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/Point.js").default|import("../Feature.js").default} pointGeometry Point geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawPoint(pointGeometry, feature) { if (!this.image_) { @@ -136,7 +137,8 @@ class CanvasImageBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} multiPointGeometry MultiPoint geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawMultiPoint(multiPointGeometry, feature) { if (!this.image_) { @@ -166,7 +168,7 @@ class CanvasImageBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. */ finish() { this.reverseHitDetectionInstructions(); @@ -187,7 +189,8 @@ class CanvasImageBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../style/Image.js").default} imageStyle Image style. + * @param {import("../canvas.js").DeclutterGroup} declutterGroups Declutter. */ setImageStyle(imageStyle, declutterGroups) { const anchor = imageStyle.getAnchor(); @@ -197,7 +200,7 @@ class CanvasImageBuilder extends CanvasBuilder { const origin = imageStyle.getOrigin(); this.anchorX_ = anchor[0]; this.anchorY_ = anchor[1]; - this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups); + this.declutterGroups_ = declutterGroups; this.hitDetectionImage_ = hitDetectionImage; this.image_ = image; this.height_ = size[1]; diff --git a/src/ol/render/canvas/Immediate.js b/src/ol/render/canvas/Immediate.js index 4f16188299..13a2923115 100644 --- a/src/ol/render/canvas/Immediate.js +++ b/src/ol/render/canvas/Immediate.js @@ -390,7 +390,6 @@ class CanvasImmediateRenderer extends VectorContext { * the current fill and stroke styles. * * @param {import("../../geom/Circle.js").default} geometry Circle geometry. - * @override * @api */ drawCircle(geometry) { @@ -430,7 +429,6 @@ class CanvasImmediateRenderer extends VectorContext { * any `zIndex` on the provided style will be ignored. * * @param {import("../../style/Style.js").default} style The rendering style. - * @override * @api */ setStyle(style) { @@ -451,7 +449,6 @@ class CanvasImmediateRenderer extends VectorContext { * {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style. * * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render. - * @override * @api */ drawGeometry(geometry) { @@ -493,7 +490,6 @@ class CanvasImmediateRenderer extends VectorContext { * * @param {import("../../Feature.js").default} feature Feature. * @param {import("../../style/Style.js").default} style Style. - * @override * @api */ drawFeature(feature, style) { @@ -510,7 +506,6 @@ class CanvasImmediateRenderer extends VectorContext { * uses the current styles appropriate for each geometry in the collection. * * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection. - * @override */ drawGeometryCollection(geometry) { const geometries = geometry.getGeometriesArray(); @@ -524,7 +519,6 @@ class CanvasImmediateRenderer extends VectorContext { * the current style. * * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry. - * @override */ drawPoint(geometry) { if (this.squaredTolerance_) { @@ -545,7 +539,6 @@ class CanvasImmediateRenderer extends VectorContext { * uses the current style. * * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry. - * @override */ drawMultiPoint(geometry) { if (this.squaredTolerance_) { @@ -566,7 +559,6 @@ class CanvasImmediateRenderer extends VectorContext { * the current style. * * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry. - * @override */ drawLineString(geometry) { if (this.squaredTolerance_) { @@ -595,7 +587,6 @@ class CanvasImmediateRenderer extends VectorContext { * and uses the current style. * * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry. - * @override */ drawMultiLineString(geometry) { if (this.squaredTolerance_) { @@ -629,7 +620,6 @@ class CanvasImmediateRenderer extends VectorContext { * the current style. * * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry. - * @override */ drawPolygon(geometry) { if (this.squaredTolerance_) { @@ -666,7 +656,6 @@ class CanvasImmediateRenderer extends VectorContext { * Render MultiPolygon geometry into the canvas. Rendering is immediate and * uses the current style. * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry. - * @override */ drawMultiPolygon(geometry) { if (this.squaredTolerance_) { @@ -824,7 +813,6 @@ class CanvasImmediateRenderer extends VectorContext { * * @param {import("../../style/Fill.js").default} fillStyle Fill style. * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style. - * @override */ setFillStrokeStyle(fillStyle, strokeStyle) { if (!fillStyle) { @@ -870,7 +858,6 @@ class CanvasImmediateRenderer extends VectorContext { * the image style. * * @param {import("../../style/Image.js").default} imageStyle Image style. - * @override */ setImageStyle(imageStyle) { if (!imageStyle) { @@ -900,7 +887,6 @@ class CanvasImmediateRenderer extends VectorContext { * remove the text style. * * @param {import("../../style/Text.js").default} textStyle Text style. - * @override */ setTextStyle(textStyle) { if (!textStyle) { diff --git a/src/ol/render/canvas/LineStringBuilder.js b/src/ol/render/canvas/LineStringBuilder.js index eedbc70b67..2d898ad9e1 100644 --- a/src/ol/render/canvas/LineStringBuilder.js +++ b/src/ol/render/canvas/LineStringBuilder.js @@ -34,7 +34,8 @@ class CanvasLineStringBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} lineStringGeometry Line string geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawLineString(lineStringGeometry, feature) { const state = this.state; @@ -58,7 +59,8 @@ class CanvasLineStringBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} multiLineStringGeometry MultiLineString geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawMultiLineString(multiLineStringGeometry, feature) { const state = this.state; @@ -79,14 +81,14 @@ class CanvasLineStringBuilder extends CanvasBuilder { const stride = multiLineStringGeometry.getStride(); let offset = 0; for (let i = 0, ii = ends.length; i < ii; ++i) { - offset = this.drawFlatCoordinates_(flatCoordinates, offset, ends[i], stride); + offset = this.drawFlatCoordinates_(flatCoordinates, offset, /** @type {number} */ (ends[i]), stride); } this.hitDetectionInstructions.push(strokeInstruction); this.endGeometry(feature); } /** - * @inheritDoc + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. */ finish() { const state = this.state; @@ -99,7 +101,7 @@ class CanvasLineStringBuilder extends CanvasBuilder { } /** - * @inheritDoc. + * @param {import("../canvas.js").FillStrokeState} state State. */ applyStroke(state) { if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { diff --git a/src/ol/render/canvas/PolygonBuilder.js b/src/ol/render/canvas/PolygonBuilder.js index 090ec6d1c7..6fa794fc55 100644 --- a/src/ol/render/canvas/PolygonBuilder.js +++ b/src/ol/render/canvas/PolygonBuilder.js @@ -62,7 +62,8 @@ class CanvasPolygonBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/Circle.js").default} circleGeometry Circle geometry. + * @param {import("../../Feature.js").default} feature Feature. */ drawCircle(circleGeometry, feature) { const state = this.state; @@ -106,7 +107,8 @@ class CanvasPolygonBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} polygonGeometry Polygon geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawPolygon(polygonGeometry, feature) { const state = this.state; @@ -133,12 +135,13 @@ class CanvasPolygonBuilder extends CanvasBuilder { const ends = polygonGeometry.getEnds(); const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates(); const stride = polygonGeometry.getStride(); - this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride); + this.drawFlatCoordinatess_(flatCoordinates, 0, /** @type {Array} */ (ends), stride); this.endGeometry(feature); } /** - * @inheritDoc + * @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawMultiPolygon(multiPolygonGeometry, feature) { const state = this.state; @@ -173,7 +176,7 @@ class CanvasPolygonBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. */ finish() { this.reverseHitDetectionInstructions(); diff --git a/src/ol/render/canvas/TextBuilder.js b/src/ol/render/canvas/TextBuilder.js index aec72113ad..942c31a73d 100644 --- a/src/ol/render/canvas/TextBuilder.js +++ b/src/ol/render/canvas/TextBuilder.js @@ -134,7 +134,7 @@ class CanvasTextBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @return {import("./Builder.js").SerializableInstructions} the serializable instructions. */ finish() { const instructions = super.finish(); @@ -145,7 +145,8 @@ class CanvasTextBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../geom/SimpleGeometry.js").default|import("../Feature.js").default} geometry Geometry. + * @param {import("../../Feature.js").FeatureLike} feature Feature. */ drawText(geometry, feature) { const fillState = this.textFillState_; @@ -173,11 +174,11 @@ class CanvasTextBuilder extends CanvasBuilder { if (geometryType == GeometryType.LINE_STRING) { ends = [flatCoordinates.length]; } else if (geometryType == GeometryType.MULTI_LINE_STRING) { - ends = geometry.getEnds(); + ends = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getEnds(); } else if (geometryType == GeometryType.POLYGON) { - ends = geometry.getEnds().slice(0, 1); + ends = /** @type {import("../../geom/Polygon.js").default} */ (geometry).getEnds().slice(0, 1); } else if (geometryType == GeometryType.MULTI_POLYGON) { - const endss = geometry.getEndss(); + const endss = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss(); ends = []; for (i = 0, ii = endss.length; i < ii; ++i) { ends.push(endss[i][0]); @@ -217,7 +218,7 @@ class CanvasTextBuilder extends CanvasBuilder { switch (geometryType) { case GeometryType.POINT: case GeometryType.MULTI_POINT: - flatCoordinates = geometry.getFlatCoordinates(); + flatCoordinates = /** @type {import("../../geom/MultiPoint.js").default} */ (geometry).getFlatCoordinates(); end = flatCoordinates.length; break; case GeometryType.LINE_STRING: @@ -379,14 +380,15 @@ class CanvasTextBuilder extends CanvasBuilder { } /** - * @inheritDoc + * @param {import("../../style/Text.js").default} textStyle Text style. + * @param {import("../canvas.js").DeclutterGroups} declutterGroups Declutter. */ setTextStyle(textStyle, declutterGroups) { let textState, fillState, strokeState; if (!textStyle) { this.text_ = ''; } else { - this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups); + this.declutterGroups_ = declutterGroups; const textFillStyle = textStyle.getFill(); if (!textFillStyle) { diff --git a/src/ol/renderer/Composite.js b/src/ol/renderer/Composite.js index 24ee0ef801..7cb44ee8ec 100644 --- a/src/ol/renderer/Composite.js +++ b/src/ol/renderer/Composite.js @@ -79,7 +79,8 @@ class CompositeMapRenderer extends MapRenderer { } /** - * @inheritDoc + * Render. + * @param {?import("../PluggableMap.js").FrameState} frameState Frame state. */ renderFrame(frameState) { if (!frameState) { @@ -133,7 +134,17 @@ class CompositeMapRenderer extends MapRenderer { } /** - * @inheritDoc + * @param {import("../pixel.js").Pixel} pixel Pixel. + * @param {import("../PluggableMap.js").FrameState} frameState FrameState. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer + * callback. + * @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter + * function, only layers which are visible and for which this function + * returns `true` will be tested for features. By default, all visible + * layers will be tested. + * @return {T|undefined} Callback result. + * @template T */ forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) { const viewState = frameState.viewState; diff --git a/src/ol/renderer/Layer.js b/src/ol/renderer/Layer.js index 072e043906..5ccef03487 100644 --- a/src/ol/renderer/Layer.js +++ b/src/ol/renderer/Layer.js @@ -23,7 +23,7 @@ class LayerRenderer extends Observable { this.boundHandleImageChange_ = this.handleImageChange_.bind(this); /** - * @private + * @protected * @type {LayerType} */ this.layer_ = layer; @@ -65,12 +65,14 @@ class LayerRenderer extends Observable { * @param {Object>} tiles Lookup of loaded tiles by zoom level. * @param {number} zoom Zoom level. * @param {import("../Tile.js").default} tile Tile. + * @return {boolean|void} If `false`, the tile will not be considered loaded. */ loadedTileCallback(tiles, zoom, tile) { if (!tiles[zoom]) { tiles[zoom] = {}; } tiles[zoom][tile.tileCoord.toString()] = tile; + return undefined; } /** diff --git a/src/ol/renderer/Map.js b/src/ol/renderer/Map.js index 86ee999a81..588904658b 100644 --- a/src/ol/renderer/Map.js +++ b/src/ol/renderer/Map.js @@ -151,14 +151,14 @@ class MapRenderer extends Disposable { * @param {import("../pixel.js").Pixel} pixel Pixel. * @param {import("../PluggableMap.js").FrameState} frameState FrameState. * @param {number} hitTolerance Hit tolerance in pixels. - * @param {function(this: S, import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer + * @param {function(import("../layer/Layer.js").default, (Uint8ClampedArray|Uint8Array)): T} callback Layer * callback. - * @param {function(this: U, import("../layer/Layer.js").default): boolean} layerFilter Layer filter + * @param {function(import("../layer/Layer.js").default): boolean} layerFilter Layer filter * function, only layers which are visible and for which this function * returns `true` will be tested for features. By default, all visible * layers will be tested. * @return {T|undefined} Callback result. - * @template S,T,U + * @template T */ forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) { return abstract(); diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index bd11ac74b3..c53510b041 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -31,14 +31,16 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. */ getImage() { return !this.image_ ? null : this.image_.getImage(); } /** - * @inheritDoc + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. */ prepareFrame(frameState) { const layerState = frameState.layerStatesArray[frameState.layerIndex]; @@ -77,7 +79,10 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. */ renderFrame(frameState, target) { const image = this.image_; diff --git a/src/ol/renderer/canvas/TileLayer.js b/src/ol/renderer/canvas/TileLayer.js index afdcdd9143..cb9a80a849 100644 --- a/src/ol/renderer/canvas/TileLayer.js +++ b/src/ol/renderer/canvas/TileLayer.js @@ -123,7 +123,10 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * @param {Object>} tiles Lookup of loaded tiles by zoom level. + * @param {number} zoom Zoom level. + * @param {import("../../Tile.js").default} tile Tile. + * @return {boolean|void} If `false`, the tile will not be considered loaded. */ loadedTileCallback(tiles, zoom, tile) { if (this.isDrawableTile(tile)) { @@ -133,19 +136,19 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. */ prepareFrame(frameState) { return !!this.getLayer().getSource(); } /** - * TODO: File a TypeScript issue about inheritDoc not being followed - * all the way. Without this explicit return type, the VectorTileLayer - * renderFrame function does not pass. - * - * @inheritDoc - * @returns {HTMLElement} The rendered element. + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. */ renderFrame(frameState, target) { const layerState = frameState.layerStatesArray[frameState.layerIndex]; @@ -418,7 +421,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * @return {HTMLCanvasElement} Image */ getImage() { const context = this.context; diff --git a/src/ol/renderer/canvas/VectorImageLayer.js b/src/ol/renderer/canvas/VectorImageLayer.js index 6f85052a20..79537a6d7a 100644 --- a/src/ol/renderer/canvas/VectorImageLayer.js +++ b/src/ol/renderer/canvas/VectorImageLayer.js @@ -52,7 +52,7 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.vectorRenderer_.dispose(); @@ -60,7 +60,9 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer { } /** - * @inheritDoc + * Asynchronous layer level hit detection. + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @return {Promise>} Promise that resolves with an array of features. */ getFeatures(pixel) { if (this.vectorRenderer_) { @@ -76,14 +78,16 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer { } /** - * @inheritDoc + * Perform action necessary to get the layer rendered after new fonts have loaded */ handleFontsChanged() { this.vectorRenderer_.handleFontsChanged(); } /** - * @inheritDoc + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. */ prepareFrame(frameState) { const pixelRatio = frameState.pixelRatio; @@ -145,17 +149,21 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer { } /** - * @override */ preRender() {} /** - * @override */ postRender() {} /** - * @inheritDoc + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback. + * @param {Array} declutteredFeatures Decluttered features. + * @return {T|void} Callback result. + * @template T */ forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { if (this.vectorRenderer_) { diff --git a/src/ol/renderer/canvas/VectorLayer.js b/src/ol/renderer/canvas/VectorLayer.js index 0d7af8e81b..4288ae872c 100644 --- a/src/ol/renderer/canvas/VectorLayer.js +++ b/src/ol/renderer/canvas/VectorLayer.js @@ -107,7 +107,10 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * Get a rendering container from an existing target, if compatible. + * @param {HTMLElement} target Potential render target. + * @param {string} transform CSS Transform. + * @param {number} opacity Opacity. */ useContainer(target, transform, opacity) { if (opacity < 1) { @@ -117,7 +120,10 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. */ renderFrame(frameState, target) { @@ -221,14 +227,16 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { const opacity = layerState.opacity; const container = this.container; if (opacity !== parseFloat(container.style.opacity)) { - container.style.opacity = opacity === 1 ? '' : opacity; + container.style.opacity = opacity === 1 ? '' : String(opacity); } return this.container; } /** - * @inheritDoc + * Asynchronous layer level hit detection. + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @return {Promise>} Promise that resolves with an array of features. */ getFeatures(pixel) { return new Promise(function(resolve, reject) { @@ -276,7 +284,13 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback. + * @param {Array} declutteredFeatures Decluttered features. + * @return {T|void} Callback result. + * @template T */ forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { if (!this.replayGroup_) { @@ -306,7 +320,7 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * Perform action necessary to get the layer rendered after new fonts have loaded */ handleFontsChanged() { const layer = this.getLayer(); @@ -325,7 +339,9 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer { } /** - * @inheritDoc + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. */ prepareFrame(frameState) { const vectorLayer = this.getLayer(); diff --git a/src/ol/renderer/canvas/VectorTileLayer.js b/src/ol/renderer/canvas/VectorTileLayer.js index a3520f9caa..b65d4f4a8f 100644 --- a/src/ol/renderer/canvas/VectorTileLayer.js +++ b/src/ol/renderer/canvas/VectorTileLayer.js @@ -136,7 +136,11 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritDoc + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {!import("../../Tile.js").default} Tile. */ getTile(z, x, y, frameState) { const pixelRatio = frameState.pixelRatio; @@ -167,7 +171,8 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritdoc + * @param {import("../../VectorRenderTile.js").default} tile Tile. + * @return {boolean} Tile is drawable. */ isDrawableTile(tile) { const layer = this.getLayer(); @@ -182,7 +187,9 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritDoc + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. */ prepareFrame(frameState) { const layerRevision = this.getLayer().getRevision(); @@ -279,13 +286,19 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritDoc + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback. + * @param {Array} declutteredFeatures Decluttered features. + * @return {T|void} Callback result. + * @template T */ forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { const resolution = frameState.viewState.resolution; const rotation = frameState.viewState.rotation; hitTolerance = hitTolerance == undefined ? 0 : hitTolerance; - const layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer()); + const layer = this.getLayer(); const declutter = layer.getDeclutter(); const source = layer.getSource(); const tileGrid = source.getTileGridForProjection(frameState.viewState.projection); @@ -334,7 +347,9 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritDoc + * Asynchronous layer level hit detection. + * @param {import("../../pixel.js").Pixel} pixel Pixel. + * @return {Promise>} Promise that resolves with an array of features. */ getFeatures(pixel) { return new Promise(function(resolve, reject) { @@ -394,7 +409,7 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritDoc + * Perform action necessary to get the layer rendered after new fonts have loaded */ handleFontsChanged() { clear(this.renderTileImageQueue_); @@ -414,7 +429,10 @@ class CanvasVectorTileLayerRenderer extends CanvasTileLayerRenderer { } /** - * @inheritDoc + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {HTMLElement} target Target that may be used to render content to. + * @return {HTMLElement} The rendered element. */ renderFrame(frameState, target) { const viewHints = frameState.viewHints; diff --git a/src/ol/renderer/webgl/Layer.js b/src/ol/renderer/webgl/Layer.js index b3f6072fec..ed1075d006 100644 --- a/src/ol/renderer/webgl/Layer.js +++ b/src/ol/renderer/webgl/Layer.js @@ -68,7 +68,7 @@ class WebGLLayerRenderer extends LayerRenderer { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.helper.dispose(); diff --git a/src/ol/renderer/webgl/PointsLayer.js b/src/ol/renderer/webgl/PointsLayer.js index b35e3831b7..a5e4a08867 100644 --- a/src/ol/renderer/webgl/PointsLayer.js +++ b/src/ol/renderer/webgl/PointsLayer.js @@ -349,7 +349,9 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer { } /** - * @inheritDoc + * Render the layer. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {HTMLElement} The rendered element. */ renderFrame(frameState) { const renderCount = this.indicesBuffer_.getSize(); @@ -360,7 +362,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer { const layerState = frameState.layerStatesArray[frameState.layerIndex]; const opacity = layerState.opacity; if (opacity !== parseFloat(canvas.style.opacity)) { - canvas.style.opacity = opacity; + canvas.style.opacity = String(opacity); } if (this.hitDetectionEnabled_) { @@ -372,7 +374,9 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer { } /** - * @inheritDoc + * Determine whether render should be called. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @return {boolean} Layer is ready to be rendered. */ prepareFrame(frameState) { const layer = this.getLayer(); @@ -511,7 +515,13 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer { } /** - * @inheritDoc + * @param {import("../../coordinate.js").Coordinate} coordinate Coordinate. + * @param {import("../../PluggableMap.js").FrameState} frameState Frame state. + * @param {number} hitTolerance Hit tolerance in pixels. + * @param {function(import("../../Feature.js").FeatureLike, import("../../layer/Layer.js").default): T} callback Feature callback. + * @param {Array} declutteredFeatures Decluttered features. + * @return {T|void} Callback result. + * @template T */ forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { assert(this.hitDetectionEnabled_, 66); @@ -567,7 +577,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.worker_.terminate(); diff --git a/src/ol/reproj/Image.js b/src/ol/reproj/Image.js index 7a5cfd7240..b52e439fd6 100644 --- a/src/ol/reproj/Image.js +++ b/src/ol/reproj/Image.js @@ -112,7 +112,7 @@ class ReprojImage extends ImageBase { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { if (this.state == ImageState.LOADING) { @@ -122,7 +122,7 @@ class ReprojImage extends ImageBase { } /** - * @inheritDoc + * @return {HTMLCanvasElement} Image. */ getImage() { return this.canvas_; @@ -156,7 +156,7 @@ class ReprojImage extends ImageBase { } /** - * @inheritDoc + * Load not yet loaded URI. */ load() { if (this.state == ImageState.IDLE) { diff --git a/src/ol/reproj/Tile.js b/src/ol/reproj/Tile.js index 8f42d63270..6117f8e7e4 100644 --- a/src/ol/reproj/Tile.js +++ b/src/ol/reproj/Tile.js @@ -256,7 +256,7 @@ class ReprojTile extends Tile { } /** - * @inheritDoc + * Load not yet loaded URI. */ load() { if (this.state == TileState.IDLE) { diff --git a/src/ol/source/Cluster.js b/src/ol/source/Cluster.js index 535956bc67..4ee85445e9 100644 --- a/src/ol/source/Cluster.js +++ b/src/ol/source/Cluster.js @@ -91,7 +91,9 @@ class Cluster extends VectorSource { } /** - * @override + * Remove all features from the source. + * @param {boolean=} opt_fast Skip dispatching of {@link module:ol/source/Vector.VectorSourceEvent#removefeature} events. + * @api */ clear(opt_fast) { this.features.length = 0; @@ -117,7 +119,9 @@ class Cluster extends VectorSource { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {import("../proj/Projection.js").default} projection Projection. */ loadFeatures(extent, resolution, projection) { this.source.loadFeatures(extent, resolution, projection); @@ -157,7 +161,6 @@ class Cluster extends VectorSource { /** * Handle the source changing. - * @override */ refresh() { this.clear(); diff --git a/src/ol/source/IIIF.js b/src/ol/source/IIIF.js index 5e0c365d9f..799abd470a 100644 --- a/src/ol/source/IIIF.js +++ b/src/ol/source/IIIF.js @@ -288,7 +288,7 @@ class IIIF extends TileImage { }); /** - * @inheritDoc + * @type {number} */ this.zDirection = options.zDirection; diff --git a/src/ol/source/Image.js b/src/ol/source/Image.js index cf93b63ebe..632595e6d8 100644 --- a/src/ol/source/Image.js +++ b/src/ol/source/Image.js @@ -120,7 +120,6 @@ class ImageSource extends Source { /** * @return {Array} Resolutions. - * @override */ getResolutions() { return this.resolutions_; diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index 7638353474..5c36d346aa 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -134,7 +134,11 @@ class ImageArcGISRest extends ImageSource { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../Image.js").default} Single image. */ getImageInternal(extent, resolution, pixelRatio, projection) { diff --git a/src/ol/source/ImageCanvas.js b/src/ol/source/ImageCanvas.js index b0988f5f28..ae3dc1afaa 100644 --- a/src/ol/source/ImageCanvas.js +++ b/src/ol/source/ImageCanvas.js @@ -90,8 +90,12 @@ class ImageCanvasSource extends ImageSource { } /** - * @inheritDoc - */ + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../ImageCanvas.js").default} Single image. + */ getImageInternal(extent, resolution, pixelRatio, projection) { resolution = this.findNearestResolution(resolution); diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index d39f82e111..964fb311b7 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -132,7 +132,11 @@ class ImageMapGuide extends ImageSource { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../Image.js").default} Single image. */ getImageInternal(extent, resolution, pixelRatio, projection) { resolution = this.findNearestResolution(resolution); diff --git a/src/ol/source/ImageStatic.js b/src/ol/source/ImageStatic.js index 146a0fb1d5..20112e3f96 100644 --- a/src/ol/source/ImageStatic.js +++ b/src/ol/source/ImageStatic.js @@ -86,7 +86,11 @@ class Static extends ImageSource { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../Image.js").default} Single image. */ getImageInternal(extent, resolution, pixelRatio, projection) { if (intersects(extent, this.image_.getExtent())) { @@ -105,7 +109,7 @@ class Static extends ImageSource { } /** - * @inheritDoc + * @param {import("../events/Event.js").default} evt Event. */ handleImageChange(evt) { if (this.image_.getState() == ImageState.LOADED) { diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index a32b9b061e..07134a5023 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -248,7 +248,11 @@ class ImageWMS extends ImageSource { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../Image.js").default} Single image. */ getImageInternal(extent, resolution, pixelRatio, projection) { diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 725e1d220c..4f976233d4 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -315,7 +315,11 @@ class RasterSource extends ImageSource { } /** - * @inheritDoc + * @param {import("../extent.js").Extent} extent Extent. + * @param {number} resolution Resolution. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../ImageCanvas.js").default} Single image. */ getImage(extent, resolution, pixelRatio, projection) { if (!this.allSourcesReady_()) { @@ -409,7 +413,7 @@ class RasterSource extends ImageSource { } /** - * @override + * @return {null} not implemented */ getImageInternal() { return null; // not implemented diff --git a/src/ol/source/Tile.js b/src/ol/source/Tile.js index 46a870770e..244c0772d5 100644 --- a/src/ol/source/Tile.js +++ b/src/ol/source/Tile.js @@ -212,7 +212,7 @@ class TileSource extends Source { } /** - * @inheritDoc + * @return {Array} Resolutions. */ getResolutions() { return this.tileGrid.getResolutions(); diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index 300572d67c..fcc0a1c7e0 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -172,10 +172,12 @@ class TileArcGISRest extends TileImage { } /** - * @inheritDoc + * Get the tile pixel ratio for this source. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Tile pixel ratio. */ getTilePixelRatio(pixelRatio) { - return this.hidpi_ ? /** @type {number} */ (pixelRatio) : 1; + return this.hidpi_ ? pixelRatio : 1; } /** diff --git a/src/ol/source/TileDebug.js b/src/ol/source/TileDebug.js index 127fb23f3f..3c4ac9f849 100644 --- a/src/ol/source/TileDebug.js +++ b/src/ol/source/TileDebug.js @@ -68,9 +68,6 @@ class LabeledTile extends Tile { } } - /** - * @override - */ load() {} } @@ -118,8 +115,11 @@ class TileDebug extends XYZ { } /** - * @inheritDoc - */ + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @return {!LabeledTile} Tile. + */ getTile(z, x, y) { const tileCoordKey = getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { diff --git a/src/ol/source/TileImage.js b/src/ol/source/TileImage.js index c96aa9638a..1a74acb885 100644 --- a/src/ol/source/TileImage.js +++ b/src/ol/source/TileImage.js @@ -140,7 +140,7 @@ class TileImage extends UrlTile { } /** - * @inheritDoc + * @return {boolean} Can expire cache. */ canExpireCache() { if (!ENABLE_RASTER_REPROJECTION) { @@ -159,7 +159,8 @@ class TileImage extends UrlTile { } /** - * @inheritDoc + * @param {import("../proj/Projection.js").default} projection Projection. + * @param {!Object} usedTiles Used tiles. */ expireCache(projection, usedTiles) { if (!ENABLE_RASTER_REPROJECTION) { @@ -176,7 +177,8 @@ class TileImage extends UrlTile { } /** - * @inheritDoc + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {number} Gutter. */ getContextOptions() { return this.contextOptions_; @@ -202,7 +204,8 @@ class TileImage extends UrlTile { } /** - * @inheritDoc + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {boolean} Opaque. */ getOpaque(projection) { if (ENABLE_RASTER_REPROJECTION && @@ -214,7 +217,8 @@ class TileImage extends UrlTile { } /** - * @inheritDoc + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../tilegrid/TileGrid.js").default} Tile grid. */ getTileGridForProjection(projection) { if (!ENABLE_RASTER_REPROJECTION) { @@ -228,14 +232,13 @@ class TileImage extends UrlTile { if (!(projKey in this.tileGridForProjection)) { this.tileGridForProjection[projKey] = getTileGridForProjection(projection); } - return ( - /** @type {!import("../tilegrid/TileGrid.js").default} */ (this.tileGridForProjection[projKey]) - ); + return this.tileGridForProjection[projKey]; } } /** - * @inheritDoc + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../TileCache.js").default} Tile cache. */ getTileCacheForProjection(projection) { if (!ENABLE_RASTER_REPROJECTION) { @@ -281,10 +284,15 @@ class TileImage extends UrlTile { } /** - * @inheritDoc + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../Tile.js").default} Tile. */ getTile(z, x, y, pixelRatio, projection) { - const sourceProjection = /** @type {!import("../proj/Projection.js").default} */ (this.getProjection()); + const sourceProjection = this.getProjection(); if (!ENABLE_RASTER_REPROJECTION || !sourceProjection || !projection || equivalent(sourceProjection, projection)) { return this.getTileInternal(z, x, y, pixelRatio, sourceProjection || projection); @@ -294,7 +302,7 @@ class TileImage extends UrlTile { let tile; const tileCoordKey = getKey(tileCoord); if (cache.containsKey(tileCoordKey)) { - tile = /** @type {!import("../Tile.js").default} */ (cache.get(tileCoordKey)); + tile = cache.get(tileCoordKey); } const key = this.getKey(); if (tile && tile.key == key) { diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index d716e78e44..e58e65eaad 100644 --- a/src/ol/source/TileWMS.js +++ b/src/ol/source/TileWMS.js @@ -262,7 +262,7 @@ class TileWMS extends TileImage { } /** - * @inheritDoc + * @return {number} Gutter. */ getGutter() { return this.gutter_; @@ -351,11 +351,12 @@ class TileWMS extends TileImage { } /** - * @inheritDoc + * Get the tile pixel ratio for this source. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Tile pixel ratio. */ getTilePixelRatio(pixelRatio) { - return (!this.hidpi_ || this.serverType_ === undefined) ? 1 : - /** @type {number} */ (pixelRatio); + return (!this.hidpi_ || this.serverType_ === undefined) ? 1 : pixelRatio; } /** diff --git a/src/ol/source/UTFGrid.js b/src/ol/source/UTFGrid.js index 8254fb70c4..7c0b30cf61 100644 --- a/src/ol/source/UTFGrid.js +++ b/src/ol/source/UTFGrid.js @@ -162,7 +162,8 @@ export class CustomTile extends Tile { /** - * @inheritDoc + * Return the key to be used for all tiles in the source. + * @return {string} The key for all tiles. */ getKey() { return this.src_; @@ -244,7 +245,6 @@ export class CustomTile extends Tile { /** - * @override */ load() { if (this.preemptive_) { @@ -467,14 +467,17 @@ class UTFGrid extends TileSource { /** - * @inheritDoc + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!CustomTile} Tile. */ getTile(z, x, y, pixelRatio, projection) { const tileCoordKey = getKeyZXY(z, x, y); if (this.tileCache.containsKey(tileCoordKey)) { - return ( - /** @type {!import("../Tile.js").default} */ (this.tileCache.get(tileCoordKey)) - ); + return this.tileCache.get(tileCoordKey); } else { const tileCoord = [z, x, y]; const urlTileCoord = @@ -494,7 +497,10 @@ class UTFGrid extends TileSource { /** - * @inheritDoc + * Marks a tile coord as being used, without triggering a load. + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. */ useTile(z, x, y) { const tileCoordKey = getKeyZXY(z, x, y); diff --git a/src/ol/source/UrlTile.js b/src/ol/source/UrlTile.js index ebc3f5a8ed..17bc269b66 100644 --- a/src/ol/source/UrlTile.js +++ b/src/ol/source/UrlTile.js @@ -201,7 +201,10 @@ class UrlTile extends TileSource { } /** - * @inheritDoc + * Marks a tile coord as being used, without triggering a load. + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. */ useTile(z, x, y) { const tileCoordKey = getKeyZXY(z, x, y); diff --git a/src/ol/source/VectorTile.js b/src/ol/source/VectorTile.js index 42e4a1f4b9..07cabf7ffe 100644 --- a/src/ol/source/VectorTile.js +++ b/src/ol/source/VectorTile.js @@ -341,14 +341,19 @@ class VectorTile extends UrlTile { } /** - * @inheritDoc + * @param {number} z Tile coordinate z. + * @param {number} x Tile coordinate x. + * @param {number} y Tile coordinate y. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!VectorRenderTile} Tile. */ getTile(z, x, y, pixelRatio, projection) { const coordKey = getKeyZXY(z, x, y); const key = this.getKey(); let tile; if (this.tileCache.containsKey(coordKey)) { - tile = /** @type {!import("../Tile.js").default} */ (this.tileCache.get(coordKey)); + tile = this.tileCache.get(coordKey); if (tile.key === key) { return tile; } @@ -395,7 +400,8 @@ class VectorTile extends UrlTile { } /** - * @inheritDoc + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {!import("../tilegrid/TileGrid.js").default} Tile grid. */ getTileGridForProjection(projection) { const code = projection.getCode(); @@ -412,14 +418,19 @@ class VectorTile extends UrlTile { } /** - * @inheritDoc + * Get the tile pixel ratio for this source. + * @param {number} pixelRatio Pixel ratio. + * @return {number} Tile pixel ratio. */ getTilePixelRatio(pixelRatio) { return pixelRatio; } /** - * @inheritDoc + * @param {number} z Z. + * @param {number} pixelRatio Pixel ratio. + * @param {import("../proj/Projection.js").default} projection Projection. + * @return {import("../size.js").Size} Tile size. */ getTilePixelSize(z, pixelRatio, projection) { const tileGrid = this.getTileGridForProjection(projection); diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index 5a6cdb2493..84ecfd0d52 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -154,7 +154,7 @@ class WMTS extends TileImage { /** * Set the URLs to use for requests. * URLs may contain OGC conform URL Template Variables: {TileMatrix}, {TileRow}, {TileCol}. - * @override + * @param {Array} urls URLs. */ setUrls(urls) { this.urls = urls; diff --git a/src/ol/source/Zoomify.js b/src/ol/source/Zoomify.js index 543dc954fe..cf7734c583 100644 --- a/src/ol/source/Zoomify.js +++ b/src/ol/source/Zoomify.js @@ -52,7 +52,8 @@ export class CustomTile extends ImageTile { } /** - * @inheritDoc + * Get the image element for this tile. + * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image. */ getImage() { if (this.zoomifyImage_) { @@ -258,7 +259,7 @@ class Zoomify extends TileImage { }); /** - * @inheritDoc + * @type {number} */ this.zDirection = options.zDirection; diff --git a/src/ol/style/Circle.js b/src/ol/style/Circle.js index 64dc96cd3a..190d8f5f20 100644 --- a/src/ol/style/Circle.js +++ b/src/ol/style/Circle.js @@ -38,11 +38,10 @@ class CircleStyle extends RegularShape { } /** - * Clones the style. - * @return {CircleStyle} The cloned style. - * @override - * @api - */ + * Clones the style. + * @return {CircleStyle} The cloned style. + * @api + */ clone() { const style = new CircleStyle({ fill: this.getFill() ? this.getFill().clone() : undefined, diff --git a/src/ol/style/Icon.js b/src/ol/style/Icon.js index 9882e4e274..60f6ddd7b7 100644 --- a/src/ol/style/Icon.js +++ b/src/ol/style/Icon.js @@ -225,7 +225,9 @@ class Icon extends ImageStyle { } /** - * @inheritDoc + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @return {Array} Anchor. * @api */ getAnchor() { @@ -293,7 +295,6 @@ class Icon extends ImageStyle { * Get the image icon. * @param {number} pixelRatio Pixel ratio. * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element. - * @override * @api */ getImage(pixelRatio) { @@ -301,35 +302,37 @@ class Icon extends ImageStyle { } /** - * @override + * @return {import("../size.js").Size} Image size. */ getImageSize() { return this.iconImage_.getSize(); } /** - * @override + * @return {import("../size.js").Size} Size of the hit-detection image. */ getHitDetectionImageSize() { return this.getImageSize(); } /** - * @override + * @return {import("../ImageState.js").default} Image state. */ getImageState() { return this.iconImage_.getImageState(); } /** - * @override + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLImageElement|HTMLCanvasElement} Image element. */ getHitDetectionImage(pixelRatio) { return this.iconImage_.getHitDetectionImage(pixelRatio); } /** - * @inheritDoc + * Get the origin of the symbolizer. + * @return {Array} Origin. * @api */ getOrigin() { @@ -371,7 +374,8 @@ class Icon extends ImageStyle { } /** - * @inheritDoc + * Get the size of the icon (in pixels). + * @return {import("../size.js").Size} Image size. * @api */ getSize() { @@ -379,7 +383,7 @@ class Icon extends ImageStyle { } /** - * @override + * @param {function(import("../events/Event.js").default): void} listener Listener function. */ listenImageChange(listener) { this.iconImage_.addEventListener(EventType.CHANGE, listener); @@ -390,7 +394,6 @@ class Icon extends ImageStyle { * When rendering a feature with an icon style, the vector renderer will * automatically call this method. However, you might want to call this * method yourself for preloading or other purposes. - * @override * @api */ load() { @@ -398,7 +401,7 @@ class Icon extends ImageStyle { } /** - * @override + * @param {function(import("../events/Event.js").default): void} listener Listener function. */ unlistenImageChange(listener) { this.iconImage_.removeEventListener(EventType.CHANGE, listener); diff --git a/src/ol/style/IconImage.js b/src/ol/style/IconImage.js index 38ca4cda5c..cde9a86523 100644 --- a/src/ol/style/IconImage.js +++ b/src/ol/style/IconImage.js @@ -170,6 +170,7 @@ class IconImage extends EventTarget { } /** + * Get the size of the icon (in pixels). * @return {import("../size.js").Size} Image size. */ getSize() { diff --git a/src/ol/style/Image.js b/src/ol/style/Image.js index 3e01ddc84f..700792b4a1 100644 --- a/src/ol/style/Image.js +++ b/src/ol/style/Image.js @@ -233,7 +233,6 @@ class ImageStyle { /** * @abstract * @param {function(import("../events/Event.js").default): void} listener Listener function. - * @template T */ listenImageChange(listener) { abstract(); @@ -250,7 +249,6 @@ class ImageStyle { /** * @abstract * @param {function(import("../events/Event.js").default): void} listener Listener function. - * @template T */ unlistenImageChange(listener) { abstract(); diff --git a/src/ol/style/RegularShape.js b/src/ol/style/RegularShape.js index 30f017ef91..463d99d353 100644 --- a/src/ol/style/RegularShape.js +++ b/src/ol/style/RegularShape.js @@ -171,7 +171,9 @@ class RegularShape extends ImageStyle { } /** - * @inheritDoc + * Get the anchor point in pixels. The anchor determines the center point for the + * symbolizer. + * @return {Array} Anchor. * @api */ getAnchor() { @@ -197,14 +199,17 @@ class RegularShape extends ImageStyle { } /** - * @inheritDoc + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLImageElement|HTMLCanvasElement} Image element. */ getHitDetectionImage(pixelRatio) { return this.hitDetectionCanvas_; } /** - * @inheritDoc + * Get the image icon. + * @param {number} pixelRatio Pixel ratio. + * @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element. * @api */ getImage(pixelRatio) { @@ -212,28 +217,29 @@ class RegularShape extends ImageStyle { } /** - * @inheritDoc + * @return {import("../size.js").Size} Image size. */ getImageSize() { return this.imageSize_; } /** - * @inheritDoc + * @return {import("../size.js").Size} Size of the hit-detection image. */ getHitDetectionImageSize() { return this.hitDetectionImageSize_; } /** - * @inheritDoc + * @return {import("../ImageState.js").default} Image state. */ getImageState() { return ImageState.LOADED; } /** - * @inheritDoc + * Get the origin of the symbolizer. + * @return {Array} Origin. * @api */ getOrigin() { @@ -268,7 +274,8 @@ class RegularShape extends ImageStyle { } /** - * @inheritDoc + * Get the size of the symbolizer (in pixels). + * @return {import("../size.js").Size} Size. * @api */ getSize() { @@ -285,17 +292,17 @@ class RegularShape extends ImageStyle { } /** - * @inheritDoc + * @param {function(import("../events/Event.js").default): void} listener Listener function. */ listenImageChange(listener) {} /** - * @inheritDoc + * Load not yet loaded URI. */ load() {} /** - * @inheritDoc + * @param {function(import("../events/Event.js").default): void} listener Listener function. */ unlistenImageChange(listener) {} diff --git a/src/ol/webgl/Helper.js b/src/ol/webgl/Helper.js index ce97b33a01..0f56ed066c 100644 --- a/src/ol/webgl/Helper.js +++ b/src/ol/webgl/Helper.js @@ -402,7 +402,7 @@ class WebGLHelper extends Disposable { } /** - * @inheritDoc + * Clean up. */ disposeInternal() { this.canvas_.removeEventListener(ContextEventType.LOST, this.boundHandleWebGLContextLost_); diff --git a/test/spec/ol/format/esrijson.test.js b/test/spec/ol/format/esrijson.test.js index 7513708d6d..c6490b3ba9 100644 --- a/test/spec/ol/format/esrijson.test.js +++ b/test/spec/ol/format/esrijson.test.js @@ -97,6 +97,7 @@ describe('ol.format.EsriJSON', function() { }; const featureCollectionEsriJSON = { + objectIdFieldName: 'prop0', features: [pointEsriJSON, lineStringEsriJSON, polygonEsriJSON] }; @@ -230,6 +231,10 @@ describe('ol.format.EsriJSON', function() { expect(features[0].getGeometry()).to.be.an(Point); expect(features[1].getGeometry()).to.be.an(LineString); expect(features[2].getGeometry()).to.be.an(Polygon); + + expect(features[0].getId()).to.eql('value0'); + expect(features[1].getId()).to.eql('value0'); + expect(features[2].getId()).to.eql('value0'); }); it('can read and transform a point', function() { diff --git a/test/spec/ol/source/tile.test.js b/test/spec/ol/source/tile.test.js index d9db390d97..e7b6edb9b3 100644 --- a/test/spec/ol/source/tile.test.js +++ b/test/spec/ol/source/tile.test.js @@ -35,9 +35,6 @@ class MockTile extends TileSource { } -/** - * @inheritDoc - */ MockTile.prototype.getTile = function(z, x, y) { const key = getKeyZXY(z, x, y); if (this.tileCache.containsKey(key)) {