Defaults for the Layer, Source and Feature generics
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user