Merge pull request #13291 from ahocevar/generics
Defaults for generic types
This commit is contained in:
33
package-lock.json
generated
33
package-lock.json
generated
@@ -23,6 +23,7 @@
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@types/arcgis-rest-api": "^10.4.4",
|
||||
"@types/geojson": "^7946.0.7",
|
||||
"@types/offscreencanvas": "^2019.6.4",
|
||||
"@types/pbf": "^3.0.2",
|
||||
"@types/topojson-specification": "^1.0.1",
|
||||
"babel-loader": "^8.2.2",
|
||||
@@ -62,6 +63,7 @@
|
||||
"shx": "^0.3.2",
|
||||
"sinon": "^12.0.1",
|
||||
"threads": "^1.6.5",
|
||||
"typescript": "^4.6.0-beta",
|
||||
"walk": "^2.3.9",
|
||||
"webpack": "^5.27.2",
|
||||
"webpack-cli": "^4.5.0",
|
||||
@@ -2132,6 +2134,12 @@
|
||||
"integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/offscreencanvas": {
|
||||
"version": "2019.6.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.6.4.tgz",
|
||||
"integrity": "sha512-u8SAgdZ8ROtkTF+mfZGOscl0or6BSj9A4g37e6nvxDc+YB/oDut0wHkK2PBBiC2bNR8TS0CPV+1gAk4fNisr1Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/pbf": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.2.tgz",
|
||||
@@ -9463,6 +9471,19 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.6.0-beta",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.0-beta.tgz",
|
||||
"integrity": "sha512-xg5avH08DioTdxex568HFLHvnHWxGzpu9FK0ehLNwlqzx/kjy5/qEkBmkbPlvC9xs45bc7gbAbEhNqtczJsHAg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ua-parser-js": {
|
||||
"version": "0.7.31",
|
||||
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz",
|
||||
@@ -11915,6 +11936,12 @@
|
||||
"integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/offscreencanvas": {
|
||||
"version": "2019.6.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.6.4.tgz",
|
||||
"integrity": "sha512-u8SAgdZ8ROtkTF+mfZGOscl0or6BSj9A4g37e6nvxDc+YB/oDut0wHkK2PBBiC2bNR8TS0CPV+1gAk4fNisr1Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/pbf": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.2.tgz",
|
||||
@@ -17561,6 +17588,12 @@
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.6.0-beta",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.0-beta.tgz",
|
||||
"integrity": "sha512-xg5avH08DioTdxex568HFLHvnHWxGzpu9FK0ehLNwlqzx/kjy5/qEkBmkbPlvC9xs45bc7gbAbEhNqtczJsHAg==",
|
||||
"dev": true
|
||||
},
|
||||
"ua-parser-js": {
|
||||
"version": "0.7.31",
|
||||
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz",
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
"build-legacy": "shx rm -rf build/legacy && npm run build-index && webpack --config config/webpack-config-legacy-build.mjs && cleancss --source-map src/ol/ol.css -o build/legacy/ol.css",
|
||||
"build-site": "shx rm -rf build/site && npm run build-examples && npm run apidoc && npm run build-legacy && shx mkdir -p build/site && shx cp site/index.html build/site/ && shx mv build/apidoc build/examples build/legacy build/site/",
|
||||
"copy-css": "shx cp src/ol/ol.css build/ol/ol.css",
|
||||
"generate-types": "npx --package=typescript@3.8.3 -y -- tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol",
|
||||
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers.cjs && npx --package=typescript@4.3.5 -y -- tsc --project config/tsconfig-build.json",
|
||||
"typecheck": "npx --package=typescript@4.3.5 -y -- tsc --pretty",
|
||||
"generate-types": "tsc --project config/tsconfig-build.json --declaration --declarationMap --emitDeclarationOnly --outdir build/ol",
|
||||
"transpile": "shx rm -rf build/ol && shx mkdir -p build/ol && shx cp -rf src/ol build/ol/src && node tasks/serialize-workers.cjs && tsc --project config/tsconfig-build.json",
|
||||
"typecheck": "tsc --pretty",
|
||||
"apidoc-debug": "shx rm -rf build/apidoc && node --inspect-brk=9229 ./node_modules/jsdoc/jsdoc.js -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc",
|
||||
"apidoc": "shx rm -rf build/apidoc && jsdoc -R config/jsdoc/api/index.md -c config/jsdoc/api/conf.json -P package.json -d build/apidoc"
|
||||
},
|
||||
@@ -59,6 +59,7 @@
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"@types/arcgis-rest-api": "^10.4.4",
|
||||
"@types/geojson": "^7946.0.7",
|
||||
"@types/offscreencanvas": "^2019.6.4",
|
||||
"@types/pbf": "^3.0.2",
|
||||
"@types/topojson-specification": "^1.0.1",
|
||||
"babel-loader": "^8.2.2",
|
||||
@@ -98,6 +99,7 @@
|
||||
"shx": "^0.3.2",
|
||||
"sinon": "^12.0.1",
|
||||
"threads": "^1.6.5",
|
||||
"typescript": "^4.6.0-beta",
|
||||
"walk": "^2.3.9",
|
||||
"webpack": "^5.27.2",
|
||||
"webpack-cli": "^4.5.0",
|
||||
|
||||
@@ -11,7 +11,7 @@ import {listen, unlistenByKey} from './events.js';
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Feature<import("./geom/Geometry.js").default>|import("./render/Feature.js").default} FeatureLike
|
||||
* @typedef {Feature|import("./render/Feature.js").default} FeatureLike
|
||||
*/
|
||||
|
||||
/***
|
||||
@@ -70,7 +70,7 @@ import {listen, unlistenByKey} from './events.js';
|
||||
* ```
|
||||
*
|
||||
* @api
|
||||
* @template {import("./geom/Geometry.js").default} Geometry
|
||||
* @template {import("./geom/Geometry.js").default} [Geometry=import("./geom/Geometry.js").default]
|
||||
*/
|
||||
class Feature extends BaseObject {
|
||||
/**
|
||||
|
||||
@@ -393,7 +393,7 @@ class GML2 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/LineString.js").default} line LineString geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
* @private
|
||||
@@ -455,7 +455,7 @@ class GML2 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/Polygon.js").default} polygon Polygon geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
* @private
|
||||
@@ -467,7 +467,7 @@ class GML2 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/LinearRing.js").default} ring LinearRing geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
@@ -546,7 +546,7 @@ class GML2 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/Point.js").default} point Point geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
|
||||
@@ -720,7 +720,7 @@ class GML3 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/LinearRing.js").default} ring LinearRing geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
@@ -744,7 +744,7 @@ class GML3 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/Point.js").default} point Point geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
@@ -768,7 +768,7 @@ class GML3 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Polygon} polygon Polygon geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
* @private
|
||||
@@ -780,7 +780,7 @@ class GML3 extends GMLBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {LineString} line LineString geometry.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
* @private
|
||||
|
||||
@@ -166,7 +166,7 @@ class GMLBase extends XMLFeature {
|
||||
if (!featureType && node.childNodes) {
|
||||
(featureType = []), (featureNS = {});
|
||||
for (let i = 0, ii = node.childNodes.length; i < ii; ++i) {
|
||||
const child = node.childNodes[i];
|
||||
const child = /** @type {Element} */ (node.childNodes[i]);
|
||||
if (child.nodeType === 1) {
|
||||
const ft = child.nodeName.split(':').pop();
|
||||
if (featureType.indexOf(ft) === -1) {
|
||||
|
||||
@@ -869,7 +869,7 @@ function writeRte(node, feature, objectStack) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Feature} feature Feature.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -902,7 +902,7 @@ function writeTrk(node, feature, objectStack) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {LineString} lineString LineString.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
|
||||
@@ -1007,8 +1007,7 @@ function createFeatureStyleFunction(
|
||||
if (drawName) {
|
||||
const geometry = feature.getGeometry();
|
||||
if (geometry) {
|
||||
const type = geometry.getType();
|
||||
if (type === GeometryType.GEOMETRY_COLLECTION) {
|
||||
if (geometry instanceof GeometryCollection) {
|
||||
multiGeometryPoints = geometry
|
||||
.getGeometriesArrayRecursive()
|
||||
.filter(function (geometry) {
|
||||
@@ -1020,6 +1019,7 @@ function createFeatureStyleFunction(
|
||||
});
|
||||
drawName = multiGeometryPoints.length > 0;
|
||||
} else {
|
||||
const type = geometry.getType();
|
||||
drawName =
|
||||
type === GeometryType.POINT || type === GeometryType.MULTI_POINT;
|
||||
}
|
||||
@@ -2473,7 +2473,7 @@ const DOCUMENT_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Array<Feature>} features Features.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
* @this {KML}
|
||||
@@ -2499,7 +2499,7 @@ function writeDocument(node, features, objectStack) {
|
||||
const DATA_NODE_FACTORY = makeSimpleNodeFactory('Data');
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {{names: Array<string>, values: (Array<*>)}} namesAndValues Names and values.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -2561,7 +2561,7 @@ const GX_NODE_FACTORY = function (value, objectStack, opt_nodeName) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Object} icon Icon object.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -2617,7 +2617,7 @@ const ICON_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../style/Icon.js").default} style Icon style.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -2712,7 +2712,7 @@ const LABEL_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Text} style style.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -2758,7 +2758,7 @@ const LINE_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Stroke} style style.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -2856,7 +2856,7 @@ const MULTI_GEOMETRY_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/Geometry.js").default} geometry Geometry.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -2927,7 +2927,7 @@ const BOUNDARY_IS_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/LinearRing.js").default} linearRing Linear ring.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -3180,7 +3180,7 @@ const PRIMITIVE_GEOMETRY_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("../geom/SimpleGeometry.js").default} geometry Geometry.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -3243,7 +3243,7 @@ const INNER_BOUNDARY_NODE_FACTORY = makeSimpleNodeFactory('innerBoundaryIs');
|
||||
const OUTER_BOUNDARY_NODE_FACTORY = makeSimpleNodeFactory('outerBoundaryIs');
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Polygon} polygon Polygon.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -3281,7 +3281,7 @@ const POLY_STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Style} style Style.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
@@ -3341,7 +3341,7 @@ const STYLE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Object<string, Array<Style>>} styles Styles.
|
||||
* @param {Array<*>} objectStack Object stack.
|
||||
*/
|
||||
|
||||
@@ -110,7 +110,7 @@ class Polyline extends TextFeature {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import("../Feature.js").default} feature Features.
|
||||
* @param {import("../Feature.js").default<LineString>} feature Features.
|
||||
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
|
||||
* @protected
|
||||
* @return {string} Text.
|
||||
@@ -126,7 +126,7 @@ class Polyline extends TextFeature {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<import("../Feature.js").default>} features Features.
|
||||
* @param {Array<import("../Feature.js").default<LineString>>} features Features.
|
||||
* @param {import("./Feature.js").WriteOptions} [opt_options] Write options.
|
||||
* @protected
|
||||
* @return {string} Text.
|
||||
|
||||
@@ -1054,7 +1054,7 @@ function writeQuery(node, featureType, objectStack) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("./filter/Filter.js").default} filter Filter.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
@@ -1158,7 +1158,7 @@ function writeDuringFilter(node, filter, objectStack) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("./filter/LogicalNary.js").default} filter Filter.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
@@ -1182,7 +1182,7 @@ function writeLogicalFilter(node, filter, objectStack) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {import("./filter/Not.js").default} filter Filter.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
@@ -1341,7 +1341,7 @@ export function writeFilter(filter, opt_version) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Element} node Node.
|
||||
* @param {Array<string>} featureTypes Feature types.
|
||||
* @param {Array<*>} objectStack Node stack.
|
||||
*/
|
||||
|
||||
@@ -421,7 +421,7 @@ class Draw extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Sketch feature.
|
||||
* @type {Feature}
|
||||
* @type {Feature<import('../geom/SimpleGeometry.js').default>}
|
||||
* @private
|
||||
*/
|
||||
this.sketchFeature_ = null;
|
||||
@@ -1022,7 +1022,7 @@ class Draw extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Stop drawing without adding the sketch feature to the target layer.
|
||||
* @return {Feature} The sketch feature (or null if none).
|
||||
* @return {Feature<import("../geom/SimpleGeometry.js").default>} The sketch feature (or null if none).
|
||||
* @private
|
||||
*/
|
||||
abortDrawing_() {
|
||||
|
||||
@@ -253,7 +253,7 @@ class Modify extends PointerInteraction {
|
||||
|
||||
/**
|
||||
* Editing vertex.
|
||||
* @type {Feature}
|
||||
* @type {Feature<Point>}
|
||||
* @private
|
||||
*/
|
||||
this.vertexFeature_ = null;
|
||||
|
||||
@@ -25,7 +25,7 @@ import {listen, unlistenByKey} from '../events.js';
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {import("../source/Source.js").default} SourceType
|
||||
* @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default]
|
||||
* @typedef {Object} Options
|
||||
* @property {string} [className='ol-layer'] A CSS class name to set to the layer element.
|
||||
* @property {number} [opacity=1] Opacity (0, 1).
|
||||
@@ -93,8 +93,8 @@ import {listen, unlistenByKey} from '../events.js';
|
||||
* @fires import("../render/Event.js").RenderEvent#prerender
|
||||
* @fires import("../render/Event.js").RenderEvent#postrender
|
||||
*
|
||||
* @template {import("../source/Source.js").default} SourceType
|
||||
* @template {import("../renderer/Layer.js").default} RendererType
|
||||
* @template {import("../source/Source.js").default} [SourceType=import("../source/Source.js").default]
|
||||
* @template {import("../renderer/Layer.js").default} [RendererType=import("../renderer/Layer.js").default]
|
||||
* @api
|
||||
*/
|
||||
class Layer extends BaseLayer {
|
||||
|
||||
@@ -96,8 +96,9 @@ function getRenderExtent(frameState, extent) {
|
||||
fromUserExtent(layerState.extent, frameState.viewState.projection)
|
||||
);
|
||||
}
|
||||
const source =
|
||||
/** {import("../../source/Tile.js").default} */ layerState.layer.getRenderSource();
|
||||
const source = /** @type {import("../../source/Tile.js").default} */ (
|
||||
layerState.layer.getRenderSource()
|
||||
);
|
||||
if (!source.getWrapX()) {
|
||||
const gridExtent = source
|
||||
.getTileGridForProjection(frameState.viewState.projection)
|
||||
|
||||
@@ -115,7 +115,7 @@ class Cluster extends VectorSource {
|
||||
this.geometryFunction =
|
||||
options.geometryFunction ||
|
||||
function (feature) {
|
||||
const geometry = feature.getGeometry();
|
||||
const geometry = /** @type {Point} */ (feature.getGeometry());
|
||||
assert(geometry.getType() == GeometryType.POINT, 10); // The default `geometryFunction` can only handle `Point` geometries
|
||||
return geometry;
|
||||
};
|
||||
|
||||
@@ -139,7 +139,7 @@ class TileJSON extends TileImage {
|
||||
if (!client.status || (client.status >= 200 && client.status < 300)) {
|
||||
let response;
|
||||
try {
|
||||
response = /** @type {TileJSON} */ (JSON.parse(client.responseText));
|
||||
response = /** @type {Config} */ (JSON.parse(client.responseText));
|
||||
} catch (err) {
|
||||
this.handleTileJSONError();
|
||||
return;
|
||||
|
||||
@@ -34,7 +34,7 @@ import {xhr} from '../featureloader.js';
|
||||
* @classdesc
|
||||
* Events emitted by {@link module:ol/source/Vector} instances are instances of this
|
||||
* type.
|
||||
* @template {import("../geom/Geometry.js").default} Geometry
|
||||
* @template {import("../geom/Geometry.js").default} [Geometry=import("../geom/Geometry.js").default]
|
||||
*/
|
||||
export class VectorSourceEvent extends Event {
|
||||
/**
|
||||
@@ -170,7 +170,7 @@ export class VectorSourceEvent extends Event {
|
||||
*
|
||||
* @fires VectorSourceEvent
|
||||
* @api
|
||||
* @template {import("../geom/Geometry.js").default} Geometry
|
||||
* @template {import("../geom/Geometry.js").default} [Geometry=import("../geom/Geometry.js").default]
|
||||
*/
|
||||
class VectorSource extends Source {
|
||||
/**
|
||||
@@ -299,9 +299,15 @@ class VectorSource extends Source {
|
||||
|
||||
let collection, features;
|
||||
if (Array.isArray(options.features)) {
|
||||
features = options.features;
|
||||
features =
|
||||
/** @type {Array<import("../Feature.js").default<Geometry>>} */ (
|
||||
options.features
|
||||
);
|
||||
} else if (options.features) {
|
||||
collection = options.features;
|
||||
collection =
|
||||
/** @type {Collection<import("../Feature.js").default<Geometry>>} */ (
|
||||
options.features
|
||||
);
|
||||
features = collection.getArray();
|
||||
}
|
||||
if (!useSpatialIndex && collection === undefined) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import {extend} from './array.js';
|
||||
* {@link module:ol/xml.makeSimpleNodeFactory}, the top `objectStack` item needs
|
||||
* to have this structure.
|
||||
* @typedef {Object} NodeStackItem
|
||||
* @property {Node} node Node.
|
||||
* @property {Element} node Node.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user