Merge pull request #10840 from fredj/remove_inheritDoc

Remove inherit doc
This commit is contained in:
Frédéric Junod
2020-04-04 14:06:43 +02:00
committed by GitHub
120 changed files with 891 additions and 573 deletions

View File

@@ -17,7 +17,6 @@
"config/jsdoc/api/plugins/markdown", "config/jsdoc/api/plugins/markdown",
"jsdoc-plugin-typescript", "jsdoc-plugin-typescript",
"config/jsdoc/api/plugins/inline-options", "config/jsdoc/api/plugins/inline-options",
"config/jsdoc/api/plugins/inheritdoc",
"config/jsdoc/api/plugins/events", "config/jsdoc/api/plugins/events",
"config/jsdoc/api/plugins/observable", "config/jsdoc/api/plugins/observable",
"config/jsdoc/api/plugins/api" "config/jsdoc/api/plugins/api"

View File

@@ -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;
}
}
}
}
}
}
}
}
};

View File

@@ -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 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 ### Events

View File

@@ -129,7 +129,7 @@ class Geolocation extends BaseObject {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.setTracking(false); this.setTracking(false);

View File

@@ -78,7 +78,7 @@ class ImageWrapper extends ImageBase {
} }
/** /**
* @inheritDoc * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
* @api * @api
*/ */
getImage() { getImage() {
@@ -114,7 +114,6 @@ class ImageWrapper extends ImageBase {
* Load the image or retry if loading previously failed. * Load the image or retry if loading previously failed.
* Loading is taken care of by the tile queue, and calling this method is * 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. * only needed for preloading or for reloading in case of an error.
* @override
* @api * @api
*/ */
load() { load() {

View File

@@ -76,7 +76,7 @@ class ImageCanvas extends ImageBase {
} }
/** /**
* @inheritDoc * Load not yet loaded URI.
*/ */
load() { load() {
if (this.state == ImageState.IDLE) { if (this.state == ImageState.IDLE) {

View File

@@ -68,7 +68,7 @@ class ImageTile extends Tile {
} }
/** /**
* @inheritDoc * @return {string} Key.
*/ */
getKey() { getKey() {
return this.src_; return this.src_;
@@ -103,7 +103,7 @@ class ImageTile extends Tile {
} }
/** /**
* @inheritDoc * Load not yet loaded URI.
* @api * @api
*/ */
load() { load() {

View File

@@ -86,7 +86,6 @@ class MapBrowserEvent extends MapEvent {
/** /**
* Prevents the default browser action. * Prevents the default browser action.
* See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault. * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.
* @override
* @api * @api
*/ */
preventDefault() { preventDefault() {
@@ -97,7 +96,6 @@ class MapBrowserEvent extends MapEvent {
/** /**
* Prevents further propagation of the current event. * Prevents further propagation of the current event.
* See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation. * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.
* @override
* @api * @api
*/ */
stopPropagation() { stopPropagation() {

View File

@@ -295,7 +295,7 @@ class MapBrowserEventHandler extends EventTarget {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
if (this.relayedListenerKey_) { if (this.relayedListenerKey_) {

View File

@@ -498,7 +498,7 @@ class PluggableMap extends BaseObject {
/** /**
* *
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.mapBrowserEventHandler_.dispose(); this.mapBrowserEventHandler_.dispose();

View File

@@ -59,7 +59,8 @@ class TileQueue extends PriorityQueue {
} }
/** /**
* @inheritDoc * @param {Array} element Element.
* @return {boolean} The element was added to the queue.
*/ */
enqueue(element) { enqueue(element) {
const added = super.enqueue(element); const added = super.enqueue(element);

View File

@@ -155,14 +155,14 @@ class VectorRenderTile extends Tile {
} }
/** /**
* @inheritDoc * Load the tile.
*/ */
load() { load() {
this.getSourceTiles(); this.getSourceTiles();
} }
/** /**
* @inheritDoc * Remove from the cache due to expiry
*/ */
release() { release() {
for (const key in this.context_) { for (const key in this.context_) {

View File

@@ -87,14 +87,14 @@ class VectorTile extends Tile {
} }
/** /**
* @inheritDoc * @return {string} Key.
*/ */
getKey() { getKey() {
return this.url_; return this.url_;
} }
/** /**
* @inheritDoc * Load not yet loaded URI.
*/ */
load() { load() {
if (this.state == TileState.IDLE) { if (this.state == TileState.IDLE) {

View File

@@ -91,7 +91,7 @@ class Control extends BaseObject {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
removeNode(this.element); removeNode(this.element);

View File

@@ -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 * @api
*/ */
setMap(map) { setMap(map) {

View File

@@ -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 * @api
*/ */
setMap(map) { setMap(map) {

View File

@@ -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 * @api
*/ */
setMap(map) { setMap(map) {

View File

@@ -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) { setMap(map) {
super.setMap(map); super.setMap(map);

View File

@@ -130,7 +130,7 @@ class Target extends Disposable {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
clear(this.listeners_); clear(this.listeners_);

View File

@@ -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 esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
const geometry = readGeometry(esriJSONFeature.geometry, opt_options); const geometry = readGeometry(esriJSONFeature.geometry, opt_options);
const feature = new Feature(); const feature = new Feature();
@@ -112,18 +116,21 @@ class EsriJSON extends JSONFeature {
feature.setGeometryName(this.geometryName_); feature.setGeometryName(this.geometryName_);
} }
feature.setGeometry(geometry); 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) { if (esriJSONFeature.attributes) {
feature.setProperties(esriJSONFeature.attributes, true); feature.setProperties(esriJSONFeature.attributes, true);
const id = esriJSONFeature.attributes[opt_idField];
if (id !== undefined) {
feature.setId(/** @type {number} */(id));
}
} }
return feature; return feature;
} }
/** /**
* @inheritDoc * @param {Object} object Object.
* @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @protected
* @return {Array<Feature>} Features.
*/ */
readFeaturesFromObject(object, opt_options) { readFeaturesFromObject(object, opt_options) {
const options = opt_options ? opt_options : {}; const options = opt_options ? opt_options : {};
@@ -132,9 +139,8 @@ class EsriJSON extends JSONFeature {
/** @type {Array<import("../Feature.js").default>} */ /** @type {Array<import("../Feature.js").default>} */
const features = []; const features = [];
const esriJSONFeatures = esriJSONFeatureSet.features; const esriJSONFeatures = esriJSONFeatureSet.features;
options.idField = object.objectIdFieldName;
for (let i = 0, ii = esriJSONFeatures.length; i < ii; ++i) { 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; return features;
} else { } 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) { 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) { readProjectionFromObject(object) {
if (object['spatialReference'] && object['spatialReference']['wkid'] !== undefined) { 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("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {EsriJSONGeometry} Object. * @return {EsriJSONGeometry} Object.
* @override
* @api * @api
*/ */
writeGeometryObject(geometry, opt_options) { writeGeometryObject(geometry, opt_options) {
@@ -181,7 +191,6 @@ class EsriJSON extends JSONFeature {
* @param {import("../Feature.js").default} feature Feature. * @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {Object} Object. * @return {Object} Object.
* @override
* @api * @api
*/ */
writeFeatureObject(feature, opt_options) { writeFeatureObject(feature, opt_options) {
@@ -212,7 +221,6 @@ class EsriJSON extends JSONFeature {
* @param {Array<import("../Feature.js").default>} features Features. * @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {EsriJSONFeatureSet} EsriJSON Object. * @return {EsriJSONFeatureSet} EsriJSON Object.
* @override
* @api * @api
*/ */
writeFeaturesObject(features, opt_options) { writeFeaturesObject(features, opt_options) {

View File

@@ -81,7 +81,7 @@ class FeatureFormat {
/** /**
* Adds the data projection to the read options. * 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. * @param {ReadOptions=} opt_options Options.
* @return {ReadOptions|undefined} Options. * @return {ReadOptions|undefined} Options.
* @protected * @protected
@@ -132,7 +132,7 @@ class FeatureFormat {
* Read a single feature from a source. * Read a single feature from a source.
* *
* @abstract * @abstract
* @param {Document|Node|Object|string} source Source. * @param {Document|Element|Object|string} source Source.
* @param {ReadOptions=} opt_options Read options. * @param {ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").FeatureLike} Feature. * @return {import("../Feature.js").FeatureLike} Feature.
*/ */
@@ -144,7 +144,7 @@ class FeatureFormat {
* Read all features from a source. * Read all features from a source.
* *
* @abstract * @abstract
* @param {Document|Node|ArrayBuffer|Object|string} source Source. * @param {Document|Element|ArrayBuffer|Object|string} source Source.
* @param {ReadOptions=} opt_options Read options. * @param {ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").FeatureLike>} Features. * @return {Array<import("../Feature.js").FeatureLike>} Features.
*/ */
@@ -156,7 +156,7 @@ class FeatureFormat {
* Read a single geometry from a source. * Read a single geometry from a source.
* *
* @abstract * @abstract
* @param {Document|Node|Object|string} source Source. * @param {Document|Element|Object|string} source Source.
* @param {ReadOptions=} opt_options Read options. * @param {ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry. * @return {import("../geom/Geometry.js").default} Geometry.
*/ */
@@ -168,7 +168,7 @@ class FeatureFormat {
* Read the projection from a source. * Read the projection from a source.
* *
* @abstract * @abstract
* @param {Document|Node|Object|string} source Source. * @param {Document|Element|Object|string} source Source.
* @return {import("../proj/Projection.js").default} Projection. * @return {import("../proj/Projection.js").default} Projection.
*/ */
readProjection(source) { readProjection(source) {

View File

@@ -53,7 +53,7 @@ class GML2 extends GMLBase {
makeArrayPusher(this.readFeaturesInternal); makeArrayPusher(this.readFeaturesInternal);
/** /**
* @inheritDoc * @type {string}
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : schemaLocation; options.schemaLocation : schemaLocation;

View File

@@ -86,7 +86,7 @@ class GML3 extends GMLBase {
options.multiSurface : true; options.multiSurface : true;
/** /**
* @inheritDoc * @type {string}
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : schemaLocation; options.schemaLocation : schemaLocation;
@@ -866,7 +866,6 @@ class GML3 extends GMLBase {
* @param {import("../geom/Geometry.js").default} geometry Geometry. * @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Options. * @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override
* @api * @api
*/ */
writeGeometryNode(geometry, opt_options) { writeGeometryNode(geometry, opt_options) {
@@ -888,7 +887,6 @@ class GML3 extends GMLBase {
* @param {Array<import("../Feature.js").default>} features Features. * @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Options. * @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Element} Node. * @return {Element} Node.
* @override
* @api * @api
*/ */
writeFeaturesNode(features, opt_options) { writeFeaturesNode(features, opt_options) {

View File

@@ -22,7 +22,7 @@ class GML32 extends GML3 {
super(options); super(options);
/** /**
* @inheritDoc * @type {string}
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd'; options.schemaLocation : this.namespace + ' http://schemas.opengis.net/gml/3.2.1/gml.xsd';

View File

@@ -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 //@ts-ignore
readGeometryFromNode(node, opt_options) { 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<import("../Feature.js").default>} Features.
*/ */
readFeaturesFromNode(node, opt_options) { readFeaturesFromNode(node, opt_options) {
const 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) { readProjectionFromNode(node) {
return getProjection(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName')); return getProjection(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName'));

View File

@@ -130,7 +130,7 @@ class GPX extends XMLFeature {
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection('EPSG:4326'); 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) { readFeatureFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) { 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<import("../Feature.js").default>} Features.
*/ */
readFeaturesFromNode(node, opt_options) { readFeaturesFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) { if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
@@ -207,7 +211,6 @@ class GPX extends XMLFeature {
* @param {Array<Feature>} features Features. * @param {Array<Feature>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Options. * @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override
* @api * @api
*/ */
writeFeaturesNode(features, opt_options) { writeFeaturesNode(features, opt_options) {

View File

@@ -63,7 +63,7 @@ class GeoJSON extends JSONFeature {
super(); super();
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection( this.dataProjection = getProjection(
options.dataProjection ? 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) { 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<Feature>} Features.
*/ */
readFeaturesFromObject(object, opt_options) { readFeaturesFromObject(object, opt_options) {
const geoJSONObject = /** @type {GeoJSONObject} */ (object); 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) { 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) { readProjectionFromObject(object) {
const crs = object['crs']; const crs = object['crs'];
@@ -181,7 +192,6 @@ class GeoJSON extends JSONFeature {
* @param {import("../Feature.js").default} feature Feature. * @param {import("../Feature.js").default} feature Feature.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {GeoJSONFeature} Object. * @return {GeoJSONFeature} Object.
* @override
* @api * @api
*/ */
writeFeatureObject(feature, opt_options) { writeFeatureObject(feature, opt_options) {
@@ -218,7 +228,6 @@ class GeoJSON extends JSONFeature {
* @param {Array<import("../Feature.js").default>} features Features. * @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {GeoJSONFeatureCollection} GeoJSON Object. * @return {GeoJSONFeatureCollection} GeoJSON Object.
* @override
* @api * @api
*/ */
writeFeaturesObject(features, opt_options) { writeFeaturesObject(features, opt_options) {
@@ -239,7 +248,6 @@ class GeoJSON extends JSONFeature {
* @param {import("../geom/Geometry.js").default} geometry Geometry. * @param {import("../geom/Geometry.js").default} geometry Geometry.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options. * @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
* @override
* @api * @api
*/ */
writeGeometryObject(geometry, opt_options) { writeGeometryObject(geometry, opt_options) {

View File

@@ -77,7 +77,7 @@ class IGC extends TextFeature {
const options = opt_options ? opt_options : {}; const options = opt_options ? opt_options : {};
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection('EPSG:4326'); 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) { readFeatureFromText(text, opt_options) {
const altitudeMode = this.altitudeMode_; 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<Feature>} Features.
*/ */
readFeaturesFromText(text, opt_options) { readFeaturesFromText(text, opt_options) {
const feature = this.readFeatureFromText(text, opt_options); const feature = this.readFeatureFromText(text, opt_options);

View File

@@ -19,7 +19,7 @@ class JSONFeature extends FeatureFormat {
} }
/** /**
* @inheritDoc * @return {import("./FormatType.js").default} Format.
*/ */
getType() { getType() {
return FormatType.JSON; 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. Only works for a single feature. Use `readFeatures` to
* read a feature collection. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature. * @return {import("../Feature.js").default} Feature.
* @api * @api
@@ -43,7 +43,7 @@ class JSONFeature extends FeatureFormat {
* Read all features. Works with both a single feature and a feature * Read all features. Works with both a single feature and a feature
* collection. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").default>} Features. * @return {Array<import("../Feature.js").default>} Features.
* @api * @api
@@ -78,7 +78,7 @@ class JSONFeature extends FeatureFormat {
/** /**
* Read a geometry. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry. * @return {import("../geom/Geometry.js").default} Geometry.
* @api * @api
@@ -102,7 +102,7 @@ class JSONFeature extends FeatureFormat {
/** /**
* Read the projection. * 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. * @return {import("../proj/Projection.js").default} Projection.
* @api * @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. * @return {Object} Object.
*/ */
function getObject(source) { function getObject(source) {

View File

@@ -427,7 +427,7 @@ class KML extends XMLFeature {
} }
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection('EPSG:4326'); 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) { readFeatureFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) { 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<import("../Feature.js").default>} Features.
*/ */
readFeaturesFromNode(node, opt_options) { readFeaturesFromNode(node, opt_options) {
if (!includes(NAMESPACE_URIS, node.namespaceURI)) { if (!includes(NAMESPACE_URIS, node.namespaceURI)) {
@@ -847,7 +852,6 @@ class KML extends XMLFeature {
* @param {Array<Feature>} features Features. * @param {Array<Feature>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Options. * @param {import("./Feature.js").WriteOptions=} opt_options Options.
* @return {Node} Node. * @return {Node} Node.
* @override
* @api * @api
*/ */
writeFeaturesNode(features, opt_options) { writeFeaturesNode(features, opt_options) {

View File

@@ -234,7 +234,7 @@ class MVT extends FeatureFormat {
} }
/** /**
* @inheritDoc * @return {import("./FormatType.js").default} Format.
*/ */
getType() { getType() {
return FormatType.ARRAY_BUFFER; 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 * @api
*/ */
readProjection(source) { readProjection(source) {

View File

@@ -58,13 +58,16 @@ class OSMXML extends XMLFeature {
super(); super();
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection('EPSG:4326'); this.dataProjection = getProjection('EPSG:4326');
} }
/** /**
* @inheritDoc * @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/ */
readFeaturesFromNode(node, opt_options) { readFeaturesFromNode(node, opt_options) {
const options = this.getReadOptions(node, opt_options); const options = this.getReadOptions(node, opt_options);

View File

@@ -33,19 +33,21 @@ class OWS extends XML {
} }
/** /**
* @inheritDoc * @param {Document} doc Document.
* @return {Object} Object
*/ */
readFromDocument(doc) { readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) { for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n); return this.readFromNode(/** @type {Element} */ (n));
} }
} }
return null; return null;
} }
/** /**
* @inheritDoc * @param {Element} node Node.
* @return {Object} Object
*/ */
readFromNode(node) { readFromNode(node) {
const owsObject = pushParseAndPop({}, const owsObject = pushParseAndPop({},

View File

@@ -47,7 +47,7 @@ class Polyline extends TextFeature {
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection('EPSG:4326'); 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) { readFeatureFromText(text, opt_options) {
const geometry = this.readGeometryFromText(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<Feature>} Features.
*/ */
readFeaturesFromText(text, opt_options) { readFeaturesFromText(text, opt_options) {
const feature = this.readFeatureFromText(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) { readGeometryFromText(text, opt_options) {
const stride = getStrideForLayout(this.geometryLayout_); 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) { writeFeatureText(feature, opt_options) {
const geometry = feature.getGeometry(); const geometry = feature.getGeometry();
@@ -108,14 +120,20 @@ class Polyline extends TextFeature {
} }
/** /**
* @inheritDoc * @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/ */
writeFeaturesText(features, opt_options) { writeFeaturesText(features, opt_options) {
return this.writeFeatureText(features[0], 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) { writeGeometryText(geometry, opt_options) {
geometry = /** @type {LineString} */ geometry = /** @type {LineString} */

View File

@@ -19,7 +19,7 @@ class TextFeature extends FeatureFormat {
} }
/** /**
* @inheritDoc * @return {import("./FormatType.js").default} Format.
*/ */
getType() { getType() {
return FormatType.TEXT; return FormatType.TEXT;
@@ -28,7 +28,7 @@ class TextFeature extends FeatureFormat {
/** /**
* Read the feature from the source. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature. * @return {import("../Feature.js").default} Feature.
* @api * @api
@@ -51,7 +51,7 @@ class TextFeature extends FeatureFormat {
/** /**
* Read the features from the source. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {Array<import("../Feature.js").default>} Features. * @return {Array<import("../Feature.js").default>} Features.
* @api * @api
@@ -74,7 +74,7 @@ class TextFeature extends FeatureFormat {
/** /**
* Read the geometry from the source. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../geom/Geometry.js").default} Geometry. * @return {import("../geom/Geometry.js").default} Geometry.
* @api * @api
@@ -97,7 +97,7 @@ class TextFeature extends FeatureFormat {
/** /**
* Read the projection from the source. * 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. * @return {import("../proj/Projection.js").default} Projection.
* @api * @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. * @return {string} Text.
*/ */
function getText(source) { function getText(source) {

View File

@@ -78,7 +78,7 @@ class TopoJSON extends JSONFeature {
this.layers_ = options.layers ? options.layers : null; this.layers_ = options.layers ? options.layers : null;
/** /**
* @inheritDoc * @type {import("../proj/Projection.js").default}
*/ */
this.dataProjection = getProjection( this.dataProjection = getProjection(
options.dataProjection ? 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<Feature>} Features.
*/ */
readFeaturesFromObject(object, opt_options) { readFeaturesFromObject(object, opt_options) {
if (object.type == 'Topology') { 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) { readProjectionFromObject(object) {
return this.dataProjection; return this.dataProjection;

View File

@@ -254,7 +254,10 @@ class WFS extends XMLFeature {
} }
/** /**
* @inheritDoc * @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/ */
readFeaturesFromNode(node, opt_options) { readFeaturesFromNode(node, opt_options) {
/** @type {import("../xml.js").NodeStackItem} */ /** @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) { 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) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readProjectionFromNode(n); return this.readProjectionFromNode(/** @type {Element} */ (n));
} }
} }
return null; return null;
} }
/** /**
* @inheritDoc * @param {Element} node Node.
* @return {import("../proj/Projection.js").default} Projection.
*/ */
readProjectionFromNode(node) { readProjectionFromNode(node) {
if (node.firstElementChild && if (node.firstElementChild &&

View File

@@ -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) { readFeatureFromText(text, opt_options) {
const geom = this.readGeometryFromText(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<Feature>} Features.
*/ */
readFeaturesFromText(text, opt_options) { readFeaturesFromText(text, opt_options) {
let geometries = []; 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) { readGeometryFromText(text, opt_options) {
const geometry = this.parse_(text); 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) { writeFeatureText(feature, opt_options) {
const geometry = feature.getGeometry(); const geometry = feature.getGeometry();
@@ -700,7 +712,10 @@ class WKT extends TextFeature {
} }
/** /**
* @inheritDoc * @param {Array<import("../Feature.js").default>} features Features.
* @param {import("./Feature.js").WriteOptions=} opt_options Write options.
* @protected
* @return {string} Text.
*/ */
writeFeaturesText(features, opt_options) { writeFeaturesText(features, opt_options) {
if (features.length == 1) { 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) { writeGeometryText(geometry, opt_options) {
return encode(transformGeometryWithOptions(geometry, true, opt_options)); return encode(transformGeometryWithOptions(geometry, true, opt_options));

View File

@@ -60,19 +60,21 @@ class WMSCapabilities extends XML {
} }
/** /**
* @inheritDoc * @param {Document} doc Document.
* @return {Object} Object
*/ */
readFromDocument(doc) { readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) { for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n); return this.readFromNode(/** @type {Element} */ (n));
} }
} }
return null; return null;
} }
/** /**
* @inheritDoc * @param {Element} node Node.
* @return {Object} Object
*/ */
readFromNode(node) { readFromNode(node) {
this.version = node.getAttribute('version').trim(); this.version = node.getAttribute('version').trim();

View File

@@ -144,7 +144,10 @@ class WMSGetFeatureInfo extends XMLFeature {
} }
/** /**
* @inheritDoc * @protected
* @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features.
*/ */
readFeaturesFromNode(node, opt_options) { readFeaturesFromNode(node, opt_options) {
const options = {}; const options = {};

View File

@@ -59,19 +59,21 @@ class WMTSCapabilities extends XML {
} }
/** /**
* @inheritDoc * @param {Document} doc Document.
* @return {Object} Object
*/ */
readFromDocument(doc) { readFromDocument(doc) {
for (let n = doc.firstChild; n; n = n.nextSibling) { for (let n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) { if (n.nodeType == Node.ELEMENT_NODE) {
return this.readFromNode(n); return this.readFromNode(/** @type {Element} */ (n));
} }
} }
return null; return null;
} }
/** /**
* @inheritDoc * @param {Element} node Node.
* @return {Object} Object
*/ */
readFromNode(node) { readFromNode(node) {
let version = node.getAttribute('version'); let version = node.getAttribute('version');

View File

@@ -27,7 +27,7 @@ class XMLFeature extends FeatureFormat {
} }
/** /**
* @inheritDoc * @return {import("./FormatType.js").default} Format.
*/ */
getType() { getType() {
return FormatType.XML; return FormatType.XML;
@@ -36,7 +36,7 @@ class XMLFeature extends FeatureFormat {
/** /**
* Read a single feature. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Read options.
* @return {import("../Feature.js").default} Feature. * @return {import("../Feature.js").default} Feature.
* @api * @api
@@ -50,7 +50,7 @@ class XMLFeature extends FeatureFormat {
} else if (isDocument(source)) { } else if (isDocument(source)) {
return this.readFeatureFromDocument(/** @type {Document} */ (source), opt_options); return this.readFeatureFromDocument(/** @type {Document} */ (source), opt_options);
} else { } 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. * @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {import("../Feature.js").default} Feature. * @return {import("../Feature.js").default} Feature.
*/ */
@@ -80,7 +80,7 @@ class XMLFeature extends FeatureFormat {
/** /**
* Read all features from a feature collection. * 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. * @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @return {Array<import("../Feature.js").default>} Features. * @return {Array<import("../Feature.js").default>} Features.
* @api * @api
@@ -95,7 +95,7 @@ class XMLFeature extends FeatureFormat {
return this.readFeaturesFromDocument( return this.readFeaturesFromDocument(
/** @type {Document} */ (source), opt_options); /** @type {Document} */ (source), opt_options);
} else { } 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) { readFeaturesFromDocument(doc, opt_options) {
/** @type {Array<import("../Feature.js").default>} */ /** @type {Array<import("../Feature.js").default>} */
const features = []; 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) { if (n.nodeType == Node.ELEMENT_NODE) {
extend(features, this.readFeaturesFromNode(n, opt_options)); extend(features, this.readFeaturesFromNode(/** @type {Element} */ (n), opt_options));
} }
} }
return features; return features;
@@ -118,7 +118,7 @@ class XMLFeature extends FeatureFormat {
/** /**
* @abstract * @abstract
* @param {Node} node Node. * @param {Element} node Node.
* @param {import("./Feature.js").ReadOptions=} opt_options Options. * @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @protected * @protected
* @return {Array<import("../Feature.js").default>} Features. * @return {Array<import("../Feature.js").default>} 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) { readGeometry(source, opt_options) {
if (!source) { if (!source) {
@@ -140,7 +144,7 @@ class XMLFeature extends FeatureFormat {
return this.readGeometryFromDocument( return this.readGeometryFromDocument(
/** @type {Document} */ (source), opt_options); /** @type {Document} */ (source), opt_options);
} else { } 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. * @param {import("./Feature.js").ReadOptions=} opt_options Options.
* @protected * @protected
* @return {import("../geom/Geometry.js").default} Geometry. * @return {import("../geom/Geometry.js").default} Geometry.
@@ -167,7 +171,7 @@ class XMLFeature extends FeatureFormat {
/** /**
* Read the projection from the source. * 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. * @return {import("../proj/Projection.js").default} Projection.
* @api * @api
*/ */
@@ -180,7 +184,7 @@ class XMLFeature extends FeatureFormat {
} else if (isDocument(source)) { } else if (isDocument(source)) {
return this.readProjectionFromDocument(/** @type {Document} */ (source)); return this.readProjectionFromDocument(/** @type {Document} */ (source));
} else { } 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 * @protected
* @return {import("../proj/Projection.js").default} Projection. * @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) { writeFeature(feature, opt_options) {
const node = this.writeFeatureNode(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) { writeGeometry(geometry, opt_options) {
const node = this.writeGeometryNode(geometry, opt_options); const node = this.writeGeometryNode(geometry, opt_options);

View File

@@ -36,7 +36,6 @@ class Circle extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!Circle} Clone. * @return {!Circle} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
const flatCoordinates = this.flatCoordinates; 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) { containsXY(x, y) {
const flatCoordinates = this.flatCoordinates; 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) { computeExtent(extent) {
const flatCoordinates = this.flatCoordinates; 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 * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -193,16 +203,10 @@ class Circle extends SimpleGeometry {
this.changed(); this.changed();
} }
/**
* @inheritDoc
*/
getCoordinates() { getCoordinates() {
return null; return null;
} }
/**
* @inheritDoc
*/
setCoordinates(coordinates, opt_layout) {} 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 * @api
*/ */
rotate(angle, anchor) { 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 * @api
*/ */
translate(deltaX, deltaY) { translate(deltaX, deltaY) {

View File

@@ -184,8 +184,7 @@ class Geometry extends BaseObject {
* coordinates in place. * coordinates in place.
* @abstract * @abstract
* @param {number} sx The scaling factor in the x-direction. * @param {number} sx The scaling factor in the x-direction.
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).
* sx).
* @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
* of the geometry extent). * of the geometry extent).
* @api * @api

View File

@@ -61,7 +61,6 @@ class GeometryCollection extends Geometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!GeometryCollection} Clone. * @return {!GeometryCollection} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { 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) { containsXY(x, y) {
const geometries = this.geometries_; 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) { computeExtent(extent) {
createOrUpdateEmpty(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) { getSimplifiedGeometry(squaredTolerance) {
if (this.simplifiedGeometryRevision !== this.getRevision()) { 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 * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { 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 * @api
*/ */
rotate(angle, anchor) { 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 * @api
*/ */
scale(sx, opt_sy, opt_anchor) { 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 * @api
*/ */
applyTransform(transformFn) { 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 * @api
*/ */
translate(deltaX, deltaY) { translate(deltaX, deltaY) {
@@ -279,7 +308,7 @@ class GeometryCollection extends Geometry {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.unlistenGeometriesChange_(); this.unlistenGeometriesChange_();

View File

@@ -81,7 +81,6 @@ class LineString extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!LineString} Clone. * @return {!LineString} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
@@ -147,7 +150,6 @@ class LineString extends SimpleGeometry {
/** /**
* Return the coordinates of the linestring. * Return the coordinates of the linestring.
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates. * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates() { getCoordinates() {
@@ -193,7 +195,9 @@ class LineString extends SimpleGeometry {
} }
/** /**
* @inheritDoc * @param {number} squaredTolerance Squared tolerance.
* @return {LineString} Simplified LineString.
* @protected
*/ */
getSimplifiedGeometryInternal(squaredTolerance) { getSimplifiedGeometryInternal(squaredTolerance) {
const simplifiedFlatCoordinates = []; 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 * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -225,7 +232,6 @@ class LineString extends SimpleGeometry {
* Set the coordinates of the linestring. * Set the coordinates of the linestring.
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates. * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
* @param {GeometryLayout=} opt_layout Layout. * @param {GeometryLayout=} opt_layout Layout.
* @override
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -52,7 +52,6 @@ class LinearRing extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!LinearRing} Clone. * @return {!LinearRing} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
@@ -88,7 +91,6 @@ class LinearRing extends SimpleGeometry {
/** /**
* Return the coordinates of the linear ring. * Return the coordinates of the linear ring.
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates. * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates() { getCoordinates() {
@@ -97,7 +99,9 @@ class LinearRing extends SimpleGeometry {
} }
/** /**
* @inheritDoc * @param {number} squaredTolerance Squared tolerance.
* @return {LinearRing} Simplified LinearRing.
* @protected
*/ */
getSimplifiedGeometryInternal(squaredTolerance) { getSimplifiedGeometryInternal(squaredTolerance) {
const simplifiedFlatCoordinates = []; 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 * @api
*/ */
getType() { 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) { intersectsExtent(extent) {
return false; return false;
@@ -126,7 +134,6 @@ class LinearRing extends SimpleGeometry {
* Set the coordinates of the linear ring. * Set the coordinates of the linear ring.
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates. * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
* @param {GeometryLayout=} opt_layout Layout. * @param {GeometryLayout=} opt_layout Layout.
* @override
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -93,7 +93,6 @@ class MultiLineString extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!MultiLineString} Clone. * @return {!MultiLineString} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
@@ -154,7 +157,6 @@ class MultiLineString extends SimpleGeometry {
/** /**
* Return the coordinates of the multilinestring. * Return the coordinates of the multilinestring.
* @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates. * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates() { getCoordinates() {
@@ -224,7 +226,9 @@ class MultiLineString extends SimpleGeometry {
} }
/** /**
* @inheritDoc * @param {number} squaredTolerance Squared tolerance.
* @return {MultiLineString} Simplified MultiLineString.
* @protected
*/ */
getSimplifiedGeometryInternal(squaredTolerance) { getSimplifiedGeometryInternal(squaredTolerance) {
const simplifiedFlatCoordinates = []; 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 * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -256,7 +263,6 @@ class MultiLineString extends SimpleGeometry {
* Set the coordinates of the multilinestring. * Set the coordinates of the multilinestring.
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates. * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
* @param {GeometryLayout=} opt_layout Layout. * @param {GeometryLayout=} opt_layout Layout.
* @override
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -49,7 +49,6 @@ class MultiPoint extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!MultiPoint} Clone. * @return {!MultiPoint} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) {
@@ -83,7 +86,6 @@ class MultiPoint extends SimpleGeometry {
/** /**
* Return the coordinates of the multipoint. * Return the coordinates of the multipoint.
* @return {Array<import("../coordinate.js").Coordinate>} Coordinates. * @return {Array<import("../coordinate.js").Coordinate>} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates() { getCoordinates() {
@@ -125,7 +127,8 @@ class MultiPoint extends SimpleGeometry {
} }
/** /**
* @inheritDoc * Get the type of this geometry.
* @return {import("./GeometryType.js").default} Geometry type.
* @api * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -153,7 +158,6 @@ class MultiPoint extends SimpleGeometry {
* Set the coordinates of the multipoint. * Set the coordinates of the multipoint.
* @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates. * @param {!Array<import("../coordinate.js").Coordinate>} coordinates Coordinates.
* @param {import("./GeometryLayout.js").default=} opt_layout Layout. * @param {import("./GeometryLayout.js").default=} opt_layout Layout.
* @override
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -138,7 +138,6 @@ class MultiPolygon extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!MultiPolygon} Clone. * @return {!MultiPolygon} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { 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) { containsXY(x, y) {
return linearRingssContainsXY(this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride, 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 * By default, coordinate orientation will depend on how the geometry was
* constructed. * constructed.
* @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates. * @return {Array<Array<Array<import("../coordinate.js").Coordinate>>>} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates(opt_right) { getCoordinates(opt_right) {
@@ -266,7 +270,9 @@ class MultiPolygon extends SimpleGeometry {
} }
/** /**
* @inheritDoc * @param {number} squaredTolerance Squared tolerance.
* @return {MultiPolygon} Simplified MultiPolygon.
* @protected
*/ */
getSimplifiedGeometryInternal(squaredTolerance) { getSimplifiedGeometryInternal(squaredTolerance) {
const simplifiedFlatCoordinates = []; 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 * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -352,7 +361,6 @@ class MultiPolygon extends SimpleGeometry {
* Set the coordinates of the multipolygon. * Set the coordinates of the multipolygon.
* @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates. * @param {!Array<Array<Array<import("../coordinate.js").Coordinate>>>} coordinates Coordinates.
* @param {GeometryLayout=} opt_layout Layout. * @param {GeometryLayout=} opt_layout Layout.
* @override
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -27,7 +27,6 @@ class Point extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!Point} Clone. * @return {!Point} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
const flatCoordinates = this.flatCoordinates; const flatCoordinates = this.flatCoordinates;
@@ -56,7 +59,6 @@ class Point extends SimpleGeometry {
/** /**
* Return the coordinate of the point. * Return the coordinate of the point.
* @return {import("../coordinate.js").Coordinate} Coordinates. * @return {import("../coordinate.js").Coordinate} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates() { 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) { computeExtent(extent) {
return createOrUpdateFromCoordinate(this.flatCoordinates, extent); return createOrUpdateFromCoordinate(this.flatCoordinates, extent);
} }
/** /**
* @inheritDoc * Get the type of this geometry.
* @return {import("./GeometryType.js").default} Geometry type.
* @api * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -87,7 +94,8 @@ class Point extends SimpleGeometry {
} }
/** /**
* @inheritDoc * @param {!Array<*>} coordinates Coordinates.
* @param {import("./GeometryLayout.js").default=} opt_layout Layout.
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -112,7 +112,6 @@ class Polygon extends SimpleGeometry {
/** /**
* Make a complete copy of the geometry. * Make a complete copy of the geometry.
* @return {!Polygon} Clone. * @return {!Polygon} Clone.
* @override
* @api * @api
*/ */
clone() { 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) { closestPointXY(x, y, closestPoint, minSquaredDistance) {
if (minSquaredDistance < closestSquaredDistanceXY(this.getExtent(), x, y)) { 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) { containsXY(x, y) {
return linearRingsContainsXY(this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride, 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 * By default, coordinate orientation will depend on how the geometry was
* constructed. * constructed.
* @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates. * @return {Array<Array<import("../coordinate.js").Coordinate>>} Coordinates.
* @override
* @api * @api
*/ */
getCoordinates(opt_right) { getCoordinates(opt_right) {
@@ -281,7 +285,9 @@ class Polygon extends SimpleGeometry {
} }
/** /**
* @inheritDoc * @param {number} squaredTolerance Squared tolerance.
* @return {Polygon} Simplified Polygon.
* @protected
*/ */
getSimplifiedGeometryInternal(squaredTolerance) { getSimplifiedGeometryInternal(squaredTolerance) {
const simplifiedFlatCoordinates = []; 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 * @api
*/ */
getType() { 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 * @api
*/ */
intersectsExtent(extent) { intersectsExtent(extent) {
@@ -314,7 +323,6 @@ class Polygon extends SimpleGeometry {
* Set the coordinates of the polygon. * Set the coordinates of the polygon.
* @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates. * @param {!Array<Array<import("../coordinate.js").Coordinate>>} coordinates Coordinates.
* @param {GeometryLayout=} opt_layout Layout. * @param {GeometryLayout=} opt_layout Layout.
* @override
* @api * @api
*/ */
setCoordinates(coordinates, opt_layout) { setCoordinates(coordinates, opt_layout) {

View File

@@ -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) { computeExtent(extent) {
return createOrUpdateFromFlatCoordinates(this.flatCoordinates, 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) { getSimplifiedGeometry(squaredTolerance) {
if (this.simplifiedGeometryRevision !== this.getRevision()) { if (this.simplifiedGeometryRevision !== this.getRevision()) {
@@ -224,8 +228,7 @@ class SimpleGeometry extends Geometry {
* Scale the geometry (with an optional origin). This modifies the geometry * Scale the geometry (with an optional origin). This modifies the geometry
* coordinates in place. * coordinates in place.
* @param {number} sx The scaling factor in the x-direction. * @param {number} sx The scaling factor in the x-direction.
* @param {number=} opt_sy The scaling factor in the y-direction (defaults to * @param {number=} opt_sy The scaling factor in the y-direction (defaults to sx).
* sx).
* @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center * @param {import("../coordinate.js").Coordinate=} opt_anchor The scale origin (defaults to the center
* of the geometry extent). * of the geometry extent).
* @api * @api

View File

@@ -185,7 +185,10 @@ class DragAndDrop extends Interaction {
} }
/** /**
* @inheritDoc * Activate or deactivate the interaction.
* @param {boolean} active Active.
* @observable
* @api
*/ */
setActive(active) { setActive(active) {
if (!this.getActive() && 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) { setMap(map) {
this.unregisterListeners_(); this.unregisterListeners_();

View File

@@ -181,7 +181,8 @@ class DragBox extends PointerInteraction {
} }
/** /**
* @inheritDoc * Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
*/ */
handleDragEvent(mapBrowserEvent) { handleDragEvent(mapBrowserEvent) {
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); 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) { handleUpEvent(mapBrowserEvent) {
this.box_.setMap(null); 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) { handleDownEvent(mapBrowserEvent) {
if (this.condition_(mapBrowserEvent)) { if (this.condition_(mapBrowserEvent)) {

View File

@@ -86,7 +86,8 @@ class DragPan extends PointerInteraction {
/** /**
* @inheritDoc * Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
*/ */
handleDragEvent(mapBrowserEvent) { handleDragEvent(mapBrowserEvent) {
if (!this.panning_) { 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) { handleUpEvent(mapBrowserEvent) {
const map = mapBrowserEvent.map; 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) { handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length > 0 && this.conditionInternal_(mapBrowserEvent)) { if (this.targetPointers.length > 0 && this.conditionInternal_(mapBrowserEvent)) {

View File

@@ -60,7 +60,8 @@ class DragRotate extends PointerInteraction {
} }
/** /**
* @inheritDoc * Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
*/ */
handleDragEvent(mapBrowserEvent) { handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(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) { handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(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) { handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) { if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -70,7 +70,8 @@ class DragRotateAndZoom extends PointerInteraction {
} }
/** /**
* @inheritDoc * Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
*/ */
handleDragEvent(mapBrowserEvent) { handleDragEvent(mapBrowserEvent) {
if (!mouseOnly(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) { handleUpEvent(mapBrowserEvent) {
if (!mouseOnly(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) { handleDownEvent(mapBrowserEvent) {
if (!mouseOnly(mapBrowserEvent)) { if (!mouseOnly(mapBrowserEvent)) {

View File

@@ -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) { setMap(map) {
super.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. * 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 * @api
*/ */
handleEvent(event) { handleEvent(event) {
@@ -520,7 +524,7 @@ class Draw extends PointerInteraction {
pass = event.type === MapBrowserEventType.POINTERMOVE; pass = event.type === MapBrowserEventType.POINTERMOVE;
if (pass && this.freehand_) { if (pass && this.freehand_) {
pass = this.handlePointerMove_(event); 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)) { (event.type === MapBrowserEventType.POINTERDRAG && this.downTimeout_ === undefined)) {
this.handlePointerMove_(event); 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) { handleDownEvent(event) {
this.shouldHandle_ = !this.freehand_; 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) { handleUpEvent(event) {
let pass = true; let pass = true;

View File

@@ -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) { handleEvent(mapBrowserEvent) {
if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) { if (!mapBrowserEvent.pointerEvent) {
return true; return true;
} }
//display pointer (if not dragging) //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) { handleDownEvent(mapBrowserEvent) {
const pixel = mapBrowserEvent.pixel; 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) { handleDragEvent(mapBrowserEvent) {
if (this.pointerHandler_) { if (this.pointerHandler_) {
@@ -355,11 +359,12 @@ class Extent extends PointerInteraction {
this.setExtent(this.pointerHandler_(pixelCoordinate)); this.setExtent(this.pointerHandler_(pixelCoordinate));
this.createOrUpdatePointerFeature_(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) { handleUpEvent(mapBrowserEvent) {
this.pointerHandler_ = null; 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) { setMap(map) {
this.extentOverlay_.setMap(map); this.extentOverlay_.setMap(map);

View File

@@ -404,7 +404,10 @@ class Modify extends PointerInteraction {
} }
/** /**
* @inheritDoc * Activate or deactivate the interaction.
* @param {boolean} active Active.
* @observable
* @api
*/ */
setActive(active) { setActive(active) {
if (this.vertexFeature_ && !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) { setMap(map) {
this.overlay_.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. * 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) { handleEvent(mapBrowserEvent) {
if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) { if (!mapBrowserEvent.pointerEvent) {
return true; return true;
} }
this.lastPointerEvent_ = mapBrowserEvent; 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) { handleDragEvent(evt) {
this.ignoreNextSingleClick_ = false; 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) { handleDownEvent(evt) {
if (!this.condition_(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) { handleUpEvent(evt) {
for (let i = this.dragSegments_.length - 1; i >= 0; --i) { for (let i = this.dragSegments_.length - 1; i >= 0; --i) {

View File

@@ -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 * Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a mousewheel-event) and eventually
* zooms the map. * zooms the map.
* @override * @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
*/ */
handleEvent(mapBrowserEvent) { handleEvent(mapBrowserEvent) {
if (!this.conditionInternal_(mapBrowserEvent)) { if (!this.conditionInternal_(mapBrowserEvent)) {

View File

@@ -75,7 +75,8 @@ class PinchRotate extends PointerInteraction {
} }
/** /**
* @inheritDoc * Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
*/ */
handleDragEvent(mapBrowserEvent) { handleDragEvent(mapBrowserEvent) {
let rotationDelta = 0.0; 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) { handleUpEvent(mapBrowserEvent) {
if (this.targetPointers.length < 2) { 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) { handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length >= 2) { if (this.targetPointers.length >= 2) {

View File

@@ -60,7 +60,8 @@ class PinchZoom extends PointerInteraction {
} }
/** /**
* @inheritDoc * Handle pointer drag events.
* @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Event.
*/ */
handleDragEvent(mapBrowserEvent) { handleDragEvent(mapBrowserEvent) {
let scaleDelta = 1.0; 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) { handleUpEvent(mapBrowserEvent) {
if (this.targetPointers.length < 2) { 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) { handleDownEvent(mapBrowserEvent) {
if (this.targetPointers.length >= 2) { if (this.targetPointers.length >= 2) {

View File

@@ -126,11 +126,12 @@ class PointerInteraction extends Interaction {
* Handles the {@link module:ol/MapBrowserEvent map browser event} and may call into * 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 * other functions, if event sequences like e.g. 'drag' or 'down-up' etc. are
* detected. * detected.
* @override * @param {import("../MapBrowserPointerEvent.js").default} mapBrowserEvent Map browser event.
* @return {boolean} `false` to stop event propagation.
* @api * @api
*/ */
handleEvent(mapBrowserEvent) { handleEvent(mapBrowserEvent) {
if (!(/** @type {import("../MapBrowserPointerEvent.js").default} */ (mapBrowserEvent).pointerEvent)) { if (!mapBrowserEvent.pointerEvent) {
return true; return true;
} }

View File

@@ -317,7 +317,6 @@ class Select extends Interaction {
* Remove the interaction from its current map, if any, and attach it to a new * 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. * map, if any. Pass `null` to just remove the interaction from the current map.
* @param {import("../PluggableMap.js").default} map Map. * @param {import("../PluggableMap.js").default} map Map.
* @override
* @api * @api
*/ */
setMap(map) { setMap(map) {

View File

@@ -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) { handleEvent(evt) {
const result = this.snapTo(evt.pixel, evt.coordinate, evt.map); 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) { handleUpEvent(evt) {
const featuresToUpdate = getValues(this.pendingFeatures_); 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) { setMap(map) {
const currentMap = this.getMap(); const currentMap = this.getMap();

View File

@@ -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) { handleDownEvent(event) {
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map); 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) { handleUpEvent(event) {
if (this.lastCoordinate_) { 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) { handleDragEvent(event) {
if (this.lastCoordinate_) { 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) { handleMoveEvent(event) {
const elem = event.map.getViewport(); 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) { setMap(map) {
const oldMap = this.getMap(); const oldMap = this.getMap();

View File

@@ -322,7 +322,7 @@ class BaseLayer extends BaseObject {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
if (this.state_) { if (this.state_) {

View File

@@ -190,7 +190,8 @@ class LayerGroup extends BaseLayer {
} }
/** /**
* @inheritDoc * @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be modified in place).
* @return {Array<import("./Layer.js").default>} Array of layers.
*/ */
getLayersArray(opt_array) { getLayersArray(opt_array) {
const array = opt_array !== undefined ? opt_array : []; const array = opt_array !== undefined ? opt_array : [];
@@ -201,7 +202,8 @@ class LayerGroup extends BaseLayer {
} }
/** /**
* @inheritDoc * @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer states (to be modified in place).
* @return {Array<import("./Layer.js").State>} List of layer states.
*/ */
getLayerStatesArray(opt_states) { getLayerStatesArray(opt_states) {
const states = opt_states !== undefined ? 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() { getSourceState() {
return SourceState.READY; return SourceState.READY;

View File

@@ -178,7 +178,8 @@ class Heatmap extends VectorLayer {
} }
/** /**
* @inheritDoc * Create a renderer for this layer.
* @return {WebGLPointsLayerRenderer} A layer renderer.
*/ */
createRenderer() { createRenderer() {
return new WebGLPointsLayerRenderer(this, { return new WebGLPointsLayerRenderer(this, {

View File

@@ -46,7 +46,7 @@ import {assert} from '../asserts.js';
/** /**
* @typedef {Object} State * @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 {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.
* @property {SourceState} sourceState * @property {SourceState} sourceState
* @property {boolean} visible * @property {boolean} visible
@@ -138,7 +138,8 @@ class Layer extends BaseLayer {
} }
/** /**
* @inheritDoc * @param {Array<import("./Layer.js").default>=} opt_array Array of layers (to be modified in place).
* @return {Array<import("./Layer.js").default>} Array of layers.
*/ */
getLayersArray(opt_array) { getLayersArray(opt_array) {
const array = opt_array ? opt_array : []; const array = opt_array ? opt_array : [];
@@ -147,7 +148,8 @@ class Layer extends BaseLayer {
} }
/** /**
* @inheritDoc * @param {Array<import("./Layer.js").State>=} opt_states Optional list of layer states (to be modified in place).
* @return {Array<import("./Layer.js").State>} List of layer states.
*/ */
getLayerStatesArray(opt_states) { getLayerStatesArray(opt_states) {
const states = opt_states ? opt_states : []; const states = opt_states ? opt_states : [];
@@ -166,7 +168,7 @@ class Layer extends BaseLayer {
} }
/** /**
* @inheritDoc * @return {import("../source/State.js").default} Source state.
*/ */
getSourceState() { getSourceState() {
const source = this.getSource(); const source = this.getSource();
@@ -299,7 +301,7 @@ class Layer extends BaseLayer {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.setSource(null); this.setSource(null);

View File

@@ -93,7 +93,8 @@ class WebGLPointsLayer extends Layer {
} }
/** /**
* @inheritDoc * Create a renderer for this layer.
* @return {WebGLPointsLayerRenderer} A layer renderer.
*/ */
createRenderer() { createRenderer() {
return new WebGLPointsLayerRenderer(this, { return new WebGLPointsLayerRenderer(this, {
@@ -109,8 +110,7 @@ class WebGLPointsLayer extends Layer {
} }
/** /**
* * Clean up.
* @inheritDoc
*/ */
disposeInternal() { disposeInternal() {
this.renderer_.dispose(); this.renderer_.dispose();

View File

@@ -47,7 +47,7 @@ class RenderBox extends Disposable {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.setMap(null); this.setMap(null);

View File

@@ -87,7 +87,7 @@ class VectorContext {
drawPolygon(polygonGeometry, feature) {} 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. * @param {import("../Feature.js").FeatureLike} feature Feature.
*/ */
drawText(geometry, feature) {} drawText(geometry, feature) {}

View File

@@ -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) { drawCustom(geometry, feature, renderer) {
this.beginGeometry(geometry, feature); this.beginGeometry(geometry, feature);
@@ -213,10 +215,9 @@ class CanvasBuilder extends VectorContext {
let flatCoordinates, builderEnd, builderEnds, builderEndss; let flatCoordinates, builderEnd, builderEnds, builderEndss;
let offset; let offset;
if (type == GeometryType.MULTI_POLYGON) { if (type == GeometryType.MULTI_POLYGON) {
geometry = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry); flatCoordinates = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getOrientedFlatCoordinates();
flatCoordinates = geometry.getOrientedFlatCoordinates();
builderEndss = []; builderEndss = [];
const endss = geometry.getEndss(); const endss = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
offset = 0; offset = 0;
for (let i = 0, ii = endss.length; i < ii; ++i) { for (let i = 0, ii = endss.length; i < ii; ++i) {
const myEnds = []; 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) { setFillStrokeStyle(fillStyle, strokeStyle) {
const state = this.state; const state = this.state;

View File

@@ -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) { drawPoint(pointGeometry, feature) {
if (!this.image_) { 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) { drawMultiPoint(multiPointGeometry, feature) {
if (!this.image_) { if (!this.image_) {
@@ -166,7 +168,7 @@ class CanvasImageBuilder extends CanvasBuilder {
} }
/** /**
* @inheritDoc * @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
*/ */
finish() { finish() {
this.reverseHitDetectionInstructions(); 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) { setImageStyle(imageStyle, declutterGroups) {
const anchor = imageStyle.getAnchor(); const anchor = imageStyle.getAnchor();
@@ -197,7 +200,7 @@ class CanvasImageBuilder extends CanvasBuilder {
const origin = imageStyle.getOrigin(); const origin = imageStyle.getOrigin();
this.anchorX_ = anchor[0]; this.anchorX_ = anchor[0];
this.anchorY_ = anchor[1]; this.anchorY_ = anchor[1];
this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups); this.declutterGroups_ = declutterGroups;
this.hitDetectionImage_ = hitDetectionImage; this.hitDetectionImage_ = hitDetectionImage;
this.image_ = image; this.image_ = image;
this.height_ = size[1]; this.height_ = size[1];

View File

@@ -390,7 +390,6 @@ class CanvasImmediateRenderer extends VectorContext {
* the current fill and stroke styles. * the current fill and stroke styles.
* *
* @param {import("../../geom/Circle.js").default} geometry Circle geometry. * @param {import("../../geom/Circle.js").default} geometry Circle geometry.
* @override
* @api * @api
*/ */
drawCircle(geometry) { drawCircle(geometry) {
@@ -430,7 +429,6 @@ class CanvasImmediateRenderer extends VectorContext {
* any `zIndex` on the provided style will be ignored. * any `zIndex` on the provided style will be ignored.
* *
* @param {import("../../style/Style.js").default} style The rendering style. * @param {import("../../style/Style.js").default} style The rendering style.
* @override
* @api * @api
*/ */
setStyle(style) { setStyle(style) {
@@ -451,7 +449,6 @@ class CanvasImmediateRenderer extends VectorContext {
* {@link module:ol/render/canvas/Immediate#setStyle} first to set the rendering style. * {@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. * @param {import("../../geom/Geometry.js").default|import("../Feature.js").default} geometry The geometry to render.
* @override
* @api * @api
*/ */
drawGeometry(geometry) { drawGeometry(geometry) {
@@ -493,7 +490,6 @@ class CanvasImmediateRenderer extends VectorContext {
* *
* @param {import("../../Feature.js").default} feature Feature. * @param {import("../../Feature.js").default} feature Feature.
* @param {import("../../style/Style.js").default} style Style. * @param {import("../../style/Style.js").default} style Style.
* @override
* @api * @api
*/ */
drawFeature(feature, style) { drawFeature(feature, style) {
@@ -510,7 +506,6 @@ class CanvasImmediateRenderer extends VectorContext {
* uses the current styles appropriate for each geometry in the collection. * uses the current styles appropriate for each geometry in the collection.
* *
* @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection. * @param {import("../../geom/GeometryCollection.js").default} geometry Geometry collection.
* @override
*/ */
drawGeometryCollection(geometry) { drawGeometryCollection(geometry) {
const geometries = geometry.getGeometriesArray(); const geometries = geometry.getGeometriesArray();
@@ -524,7 +519,6 @@ class CanvasImmediateRenderer extends VectorContext {
* the current style. * the current style.
* *
* @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry. * @param {import("../../geom/Point.js").default|import("../Feature.js").default} geometry Point geometry.
* @override
*/ */
drawPoint(geometry) { drawPoint(geometry) {
if (this.squaredTolerance_) { if (this.squaredTolerance_) {
@@ -545,7 +539,6 @@ class CanvasImmediateRenderer extends VectorContext {
* uses the current style. * uses the current style.
* *
* @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry. * @param {import("../../geom/MultiPoint.js").default|import("../Feature.js").default} geometry MultiPoint geometry.
* @override
*/ */
drawMultiPoint(geometry) { drawMultiPoint(geometry) {
if (this.squaredTolerance_) { if (this.squaredTolerance_) {
@@ -566,7 +559,6 @@ class CanvasImmediateRenderer extends VectorContext {
* the current style. * the current style.
* *
* @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry. * @param {import("../../geom/LineString.js").default|import("../Feature.js").default} geometry LineString geometry.
* @override
*/ */
drawLineString(geometry) { drawLineString(geometry) {
if (this.squaredTolerance_) { if (this.squaredTolerance_) {
@@ -595,7 +587,6 @@ class CanvasImmediateRenderer extends VectorContext {
* and uses the current style. * and uses the current style.
* *
* @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry. * @param {import("../../geom/MultiLineString.js").default|import("../Feature.js").default} geometry MultiLineString geometry.
* @override
*/ */
drawMultiLineString(geometry) { drawMultiLineString(geometry) {
if (this.squaredTolerance_) { if (this.squaredTolerance_) {
@@ -629,7 +620,6 @@ class CanvasImmediateRenderer extends VectorContext {
* the current style. * the current style.
* *
* @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry. * @param {import("../../geom/Polygon.js").default|import("../Feature.js").default} geometry Polygon geometry.
* @override
*/ */
drawPolygon(geometry) { drawPolygon(geometry) {
if (this.squaredTolerance_) { if (this.squaredTolerance_) {
@@ -666,7 +656,6 @@ class CanvasImmediateRenderer extends VectorContext {
* Render MultiPolygon geometry into the canvas. Rendering is immediate and * Render MultiPolygon geometry into the canvas. Rendering is immediate and
* uses the current style. * uses the current style.
* @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry. * @param {import("../../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
* @override
*/ */
drawMultiPolygon(geometry) { drawMultiPolygon(geometry) {
if (this.squaredTolerance_) { if (this.squaredTolerance_) {
@@ -824,7 +813,6 @@ class CanvasImmediateRenderer extends VectorContext {
* *
* @param {import("../../style/Fill.js").default} fillStyle Fill style. * @param {import("../../style/Fill.js").default} fillStyle Fill style.
* @param {import("../../style/Stroke.js").default} strokeStyle Stroke style. * @param {import("../../style/Stroke.js").default} strokeStyle Stroke style.
* @override
*/ */
setFillStrokeStyle(fillStyle, strokeStyle) { setFillStrokeStyle(fillStyle, strokeStyle) {
if (!fillStyle) { if (!fillStyle) {
@@ -870,7 +858,6 @@ class CanvasImmediateRenderer extends VectorContext {
* the image style. * the image style.
* *
* @param {import("../../style/Image.js").default} imageStyle Image style. * @param {import("../../style/Image.js").default} imageStyle Image style.
* @override
*/ */
setImageStyle(imageStyle) { setImageStyle(imageStyle) {
if (!imageStyle) { if (!imageStyle) {
@@ -900,7 +887,6 @@ class CanvasImmediateRenderer extends VectorContext {
* remove the text style. * remove the text style.
* *
* @param {import("../../style/Text.js").default} textStyle Text style. * @param {import("../../style/Text.js").default} textStyle Text style.
* @override
*/ */
setTextStyle(textStyle) { setTextStyle(textStyle) {
if (!textStyle) { if (!textStyle) {

View File

@@ -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) { drawLineString(lineStringGeometry, feature) {
const state = this.state; 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) { drawMultiLineString(multiLineStringGeometry, feature) {
const state = this.state; const state = this.state;
@@ -79,14 +81,14 @@ class CanvasLineStringBuilder extends CanvasBuilder {
const stride = multiLineStringGeometry.getStride(); const stride = multiLineStringGeometry.getStride();
let offset = 0; let offset = 0;
for (let i = 0, ii = ends.length; i < ii; ++i) { 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.hitDetectionInstructions.push(strokeInstruction);
this.endGeometry(feature); this.endGeometry(feature);
} }
/** /**
* @inheritDoc * @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
*/ */
finish() { finish() {
const state = this.state; const state = this.state;
@@ -99,7 +101,7 @@ class CanvasLineStringBuilder extends CanvasBuilder {
} }
/** /**
* @inheritDoc. * @param {import("../canvas.js").FillStrokeState} state State.
*/ */
applyStroke(state) { applyStroke(state) {
if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) { if (state.lastStroke != undefined && state.lastStroke != this.coordinates.length) {

View File

@@ -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) { drawCircle(circleGeometry, feature) {
const state = this.state; 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) { drawPolygon(polygonGeometry, feature) {
const state = this.state; const state = this.state;
@@ -133,12 +135,13 @@ class CanvasPolygonBuilder extends CanvasBuilder {
const ends = polygonGeometry.getEnds(); const ends = polygonGeometry.getEnds();
const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates(); const flatCoordinates = polygonGeometry.getOrientedFlatCoordinates();
const stride = polygonGeometry.getStride(); const stride = polygonGeometry.getStride();
this.drawFlatCoordinatess_(flatCoordinates, 0, ends, stride); this.drawFlatCoordinatess_(flatCoordinates, 0, /** @type {Array<number>} */ (ends), stride);
this.endGeometry(feature); this.endGeometry(feature);
} }
/** /**
* @inheritDoc * @param {import("../../geom/MultiPolygon.js").default} multiPolygonGeometry MultiPolygon geometry.
* @param {import("../../Feature.js").FeatureLike} feature Feature.
*/ */
drawMultiPolygon(multiPolygonGeometry, feature) { drawMultiPolygon(multiPolygonGeometry, feature) {
const state = this.state; const state = this.state;
@@ -173,7 +176,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
} }
/** /**
* @inheritDoc * @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
*/ */
finish() { finish() {
this.reverseHitDetectionInstructions(); this.reverseHitDetectionInstructions();

View File

@@ -134,7 +134,7 @@ class CanvasTextBuilder extends CanvasBuilder {
} }
/** /**
* @inheritDoc * @return {import("./Builder.js").SerializableInstructions} the serializable instructions.
*/ */
finish() { finish() {
const instructions = super.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) { drawText(geometry, feature) {
const fillState = this.textFillState_; const fillState = this.textFillState_;
@@ -173,11 +174,11 @@ class CanvasTextBuilder extends CanvasBuilder {
if (geometryType == GeometryType.LINE_STRING) { if (geometryType == GeometryType.LINE_STRING) {
ends = [flatCoordinates.length]; ends = [flatCoordinates.length];
} else if (geometryType == GeometryType.MULTI_LINE_STRING) { } else if (geometryType == GeometryType.MULTI_LINE_STRING) {
ends = geometry.getEnds(); ends = /** @type {import("../../geom/MultiLineString.js").default} */ (geometry).getEnds();
} else if (geometryType == GeometryType.POLYGON) { } 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) { } else if (geometryType == GeometryType.MULTI_POLYGON) {
const endss = geometry.getEndss(); const endss = /** @type {import("../../geom/MultiPolygon.js").default} */ (geometry).getEndss();
ends = []; ends = [];
for (i = 0, ii = endss.length; i < ii; ++i) { for (i = 0, ii = endss.length; i < ii; ++i) {
ends.push(endss[i][0]); ends.push(endss[i][0]);
@@ -217,7 +218,7 @@ class CanvasTextBuilder extends CanvasBuilder {
switch (geometryType) { switch (geometryType) {
case GeometryType.POINT: case GeometryType.POINT:
case GeometryType.MULTI_POINT: case GeometryType.MULTI_POINT:
flatCoordinates = geometry.getFlatCoordinates(); flatCoordinates = /** @type {import("../../geom/MultiPoint.js").default} */ (geometry).getFlatCoordinates();
end = flatCoordinates.length; end = flatCoordinates.length;
break; break;
case GeometryType.LINE_STRING: 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) { setTextStyle(textStyle, declutterGroups) {
let textState, fillState, strokeState; let textState, fillState, strokeState;
if (!textStyle) { if (!textStyle) {
this.text_ = ''; this.text_ = '';
} else { } else {
this.declutterGroups_ = /** @type {import("../canvas.js").DeclutterGroups} */ (declutterGroups); this.declutterGroups_ = declutterGroups;
const textFillStyle = textStyle.getFill(); const textFillStyle = textStyle.getFill();
if (!textFillStyle) { if (!textFillStyle) {

View File

@@ -79,7 +79,8 @@ class CompositeMapRenderer extends MapRenderer {
} }
/** /**
* @inheritDoc * Render.
* @param {?import("../PluggableMap.js").FrameState} frameState Frame state.
*/ */
renderFrame(frameState) { renderFrame(frameState) {
if (!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) { forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) {
const viewState = frameState.viewState; const viewState = frameState.viewState;

View File

@@ -23,7 +23,7 @@ class LayerRenderer extends Observable {
this.boundHandleImageChange_ = this.handleImageChange_.bind(this); this.boundHandleImageChange_ = this.handleImageChange_.bind(this);
/** /**
* @private * @protected
* @type {LayerType} * @type {LayerType}
*/ */
this.layer_ = layer; this.layer_ = layer;
@@ -65,12 +65,14 @@ class LayerRenderer extends Observable {
* @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level. * @param {Object<number, Object<string, import("../Tile.js").default>>} tiles Lookup of loaded tiles by zoom level.
* @param {number} zoom Zoom level. * @param {number} zoom Zoom level.
* @param {import("../Tile.js").default} tile Tile. * @param {import("../Tile.js").default} tile Tile.
* @return {boolean|void} If `false`, the tile will not be considered loaded.
*/ */
loadedTileCallback(tiles, zoom, tile) { loadedTileCallback(tiles, zoom, tile) {
if (!tiles[zoom]) { if (!tiles[zoom]) {
tiles[zoom] = {}; tiles[zoom] = {};
} }
tiles[zoom][tile.tileCoord.toString()] = tile; tiles[zoom][tile.tileCoord.toString()] = tile;
return undefined;
} }
/** /**

View File

@@ -151,14 +151,14 @@ class MapRenderer extends Disposable {
* @param {import("../pixel.js").Pixel} pixel Pixel. * @param {import("../pixel.js").Pixel} pixel Pixel.
* @param {import("../PluggableMap.js").FrameState} frameState FrameState. * @param {import("../PluggableMap.js").FrameState} frameState FrameState.
* @param {number} hitTolerance Hit tolerance in pixels. * @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. * 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 * function, only layers which are visible and for which this function
* returns `true` will be tested for features. By default, all visible * returns `true` will be tested for features. By default, all visible
* layers will be tested. * layers will be tested.
* @return {T|undefined} Callback result. * @return {T|undefined} Callback result.
* @template S,T,U * @template T
*/ */
forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) { forEachLayerAtPixel(pixel, frameState, hitTolerance, callback, layerFilter) {
return abstract(); return abstract();

View File

@@ -31,14 +31,16 @@ class CanvasImageLayerRenderer extends CanvasLayerRenderer {
} }
/** /**
* @inheritDoc * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
*/ */
getImage() { getImage() {
return !this.image_ ? null : this.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) { prepareFrame(frameState) {
const layerState = frameState.layerStatesArray[frameState.layerIndex]; 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) { renderFrame(frameState, target) {
const image = this.image_; const image = this.image_;

View File

@@ -123,7 +123,10 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
} }
/** /**
* @inheritDoc * @param {Object<number, Object<string, import("../../Tile.js").default>>} 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) { loadedTileCallback(tiles, zoom, tile) {
if (this.isDrawableTile(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) { prepareFrame(frameState) {
return !!this.getLayer().getSource(); return !!this.getLayer().getSource();
} }
/** /**
* TODO: File a TypeScript issue about inheritDoc not being followed * Render the layer.
* all the way. Without this explicit return type, the VectorTileLayer * @param {import("../../PluggableMap.js").FrameState} frameState Frame state.
* renderFrame function does not pass. * @param {HTMLElement} target Target that may be used to render content to.
* * @return {HTMLElement} The rendered element.
* @inheritDoc
* @returns {HTMLElement} The rendered element.
*/ */
renderFrame(frameState, target) { renderFrame(frameState, target) {
const layerState = frameState.layerStatesArray[frameState.layerIndex]; const layerState = frameState.layerStatesArray[frameState.layerIndex];
@@ -418,7 +421,7 @@ class CanvasTileLayerRenderer extends CanvasLayerRenderer {
} }
/** /**
* @inheritDoc * @return {HTMLCanvasElement} Image
*/ */
getImage() { getImage() {
const context = this.context; const context = this.context;

View File

@@ -52,7 +52,7 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.vectorRenderer_.dispose(); 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<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
*/ */
getFeatures(pixel) { getFeatures(pixel) {
if (this.vectorRenderer_) { 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() { handleFontsChanged() {
this.vectorRenderer_.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) { prepareFrame(frameState) {
const pixelRatio = frameState.pixelRatio; const pixelRatio = frameState.pixelRatio;
@@ -145,17 +149,21 @@ class CanvasVectorImageLayerRenderer extends CanvasImageLayerRenderer {
} }
/** /**
* @override
*/ */
preRender() {} preRender() {}
/** /**
* @override
*/ */
postRender() {} 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<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
* @return {T|void} Callback result.
* @template T
*/ */
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
if (this.vectorRenderer_) { if (this.vectorRenderer_) {

View File

@@ -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) { useContainer(target, transform, opacity) {
if (opacity < 1) { 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) { renderFrame(frameState, target) {
@@ -221,14 +227,16 @@ class CanvasVectorLayerRenderer extends CanvasLayerRenderer {
const opacity = layerState.opacity; const opacity = layerState.opacity;
const container = this.container; const container = this.container;
if (opacity !== parseFloat(container.style.opacity)) { if (opacity !== parseFloat(container.style.opacity)) {
container.style.opacity = opacity === 1 ? '' : opacity; container.style.opacity = opacity === 1 ? '' : String(opacity);
} }
return this.container; return this.container;
} }
/** /**
* @inheritDoc * Asynchronous layer level hit detection.
* @param {import("../../pixel.js").Pixel} pixel Pixel.
* @return {Promise<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
*/ */
getFeatures(pixel) { getFeatures(pixel) {
return new Promise(function(resolve, reject) { 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<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
* @return {T|void} Callback result.
* @template T
*/ */
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
if (!this.replayGroup_) { 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() { handleFontsChanged() {
const layer = this.getLayer(); 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) { prepareFrame(frameState) {
const vectorLayer = this.getLayer(); const vectorLayer = this.getLayer();

View File

@@ -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) { getTile(z, x, y, frameState) {
const pixelRatio = frameState.pixelRatio; 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) { isDrawableTile(tile) {
const layer = this.getLayer(); 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) { prepareFrame(frameState) {
const layerRevision = this.getLayer().getRevision(); 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<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
* @return {T|void} Callback result.
* @template T
*/ */
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
const resolution = frameState.viewState.resolution; const resolution = frameState.viewState.resolution;
const rotation = frameState.viewState.rotation; const rotation = frameState.viewState.rotation;
hitTolerance = hitTolerance == undefined ? 0 : hitTolerance; hitTolerance = hitTolerance == undefined ? 0 : hitTolerance;
const layer = /** @type {import("../../layer/VectorTile.js").default} */ (this.getLayer()); const layer = this.getLayer();
const declutter = layer.getDeclutter(); const declutter = layer.getDeclutter();
const source = layer.getSource(); const source = layer.getSource();
const tileGrid = source.getTileGridForProjection(frameState.viewState.projection); 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<Array<import("../../Feature").default>>} Promise that resolves with an array of features.
*/ */
getFeatures(pixel) { getFeatures(pixel) {
return new Promise(function(resolve, reject) { 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() { handleFontsChanged() {
clear(this.renderTileImageQueue_); 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) { renderFrame(frameState, target) {
const viewHints = frameState.viewHints; const viewHints = frameState.viewHints;

View File

@@ -68,7 +68,7 @@ class WebGLLayerRenderer extends LayerRenderer {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.helper.dispose(); this.helper.dispose();

View File

@@ -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) { renderFrame(frameState) {
const renderCount = this.indicesBuffer_.getSize(); const renderCount = this.indicesBuffer_.getSize();
@@ -360,7 +362,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
const layerState = frameState.layerStatesArray[frameState.layerIndex]; const layerState = frameState.layerStatesArray[frameState.layerIndex];
const opacity = layerState.opacity; const opacity = layerState.opacity;
if (opacity !== parseFloat(canvas.style.opacity)) { if (opacity !== parseFloat(canvas.style.opacity)) {
canvas.style.opacity = opacity; canvas.style.opacity = String(opacity);
} }
if (this.hitDetectionEnabled_) { 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) { prepareFrame(frameState) {
const layer = this.getLayer(); 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<import("../../Feature.js").FeatureLike>} declutteredFeatures Decluttered features.
* @return {T|void} Callback result.
* @template T
*/ */
forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) { forEachFeatureAtCoordinate(coordinate, frameState, hitTolerance, callback, declutteredFeatures) {
assert(this.hitDetectionEnabled_, 66); assert(this.hitDetectionEnabled_, 66);
@@ -567,7 +577,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
this.worker_.terminate(); this.worker_.terminate();

View File

@@ -112,7 +112,7 @@ class ReprojImage extends ImageBase {
} }
/** /**
* @inheritDoc * Clean up.
*/ */
disposeInternal() { disposeInternal() {
if (this.state == ImageState.LOADING) { if (this.state == ImageState.LOADING) {
@@ -122,7 +122,7 @@ class ReprojImage extends ImageBase {
} }
/** /**
* @inheritDoc * @return {HTMLCanvasElement} Image.
*/ */
getImage() { getImage() {
return this.canvas_; return this.canvas_;
@@ -156,7 +156,7 @@ class ReprojImage extends ImageBase {
} }
/** /**
* @inheritDoc * Load not yet loaded URI.
*/ */
load() { load() {
if (this.state == ImageState.IDLE) { if (this.state == ImageState.IDLE) {

View File

@@ -256,7 +256,7 @@ class ReprojTile extends Tile {
} }
/** /**
* @inheritDoc * Load not yet loaded URI.
*/ */
load() { load() {
if (this.state == TileState.IDLE) { if (this.state == TileState.IDLE) {

View File

@@ -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) { clear(opt_fast) {
this.features.length = 0; 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) { loadFeatures(extent, resolution, projection) {
this.source.loadFeatures(extent, resolution, projection); this.source.loadFeatures(extent, resolution, projection);
@@ -157,7 +161,6 @@ class Cluster extends VectorSource {
/** /**
* Handle the source changing. * Handle the source changing.
* @override
*/ */
refresh() { refresh() {
this.clear(); this.clear();

View File

@@ -288,7 +288,7 @@ class IIIF extends TileImage {
}); });
/** /**
* @inheritDoc * @type {number}
*/ */
this.zDirection = options.zDirection; this.zDirection = options.zDirection;

View File

@@ -120,7 +120,6 @@ class ImageSource extends Source {
/** /**
* @return {Array<number>} Resolutions. * @return {Array<number>} Resolutions.
* @override
*/ */
getResolutions() { getResolutions() {
return this.resolutions_; return this.resolutions_;

View File

@@ -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) { getImageInternal(extent, resolution, pixelRatio, projection) {

View File

@@ -90,7 +90,11 @@ 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) { getImageInternal(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution); resolution = this.findNearestResolution(resolution);

View File

@@ -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) { getImageInternal(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution); resolution = this.findNearestResolution(resolution);

View File

@@ -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) { getImageInternal(extent, resolution, pixelRatio, projection) {
if (intersects(extent, this.image_.getExtent())) { 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) { handleImageChange(evt) {
if (this.image_.getState() == ImageState.LOADED) { if (this.image_.getState() == ImageState.LOADED) {

Some files were not shown because too many files have changed in this diff Show More