Merge pull request #8697 from fredj/fix-typecheck-cluster

Remove unused properties from Cluster and Image options
This commit is contained in:
Frédéric Junod
2018-09-24 13:14:06 +02:00
committed by GitHub
2 changed files with 12 additions and 15 deletions

View File

@@ -16,8 +16,7 @@ import VectorSource from '../source/Vector.js';
* @typedef {Object} Options
* @property {import("./Source.js").AttributionLike} [attributions] Attributions.
* @property {number} [distance=20] Minimum distance in pixels between clusters.
* @property {import("../extent.js").Extent} [extent] Extent.
* @property {function(import("../Feature.js").default):import("../geom/Point.js").default} [geometryFunction]
* @property {function(Feature):Point} [geometryFunction]
* Function that takes an {@link module:ol/Feature} as argument and returns an
* {@link module:ol/geom/Point} as cluster calculation point for the feature. When a
* feature should not be considered for clustering, the function should return
@@ -30,8 +29,7 @@ import VectorSource from '../source/Vector.js';
* ```
* See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster
* calculation point for polygons.
* @property {import("../proj.js").ProjectionLike} projection Projection.
* @property {import("./Vector.js").default} source Source.
* @property {VectorSource} source Source.
* @property {boolean} [wrapX=true] Whether to wrap the world horizontally.
*/
@@ -45,7 +43,7 @@ import VectorSource from '../source/Vector.js';
*/
class Cluster extends VectorSource {
/**
* @param {Options=} options Cluster options.
* @param {Options} options Cluster options.
*/
constructor(options) {
super({
@@ -66,25 +64,25 @@ class Cluster extends VectorSource {
this.distance = options.distance !== undefined ? options.distance : 20;
/**
* @type {Array<import("../Feature.js").default>}
* @type {Array<Feature>}
* @protected
*/
this.features = [];
/**
* @param {import("../Feature.js").default} feature Feature.
* @return {import("../geom/Point.js").default} Cluster calculation point.
* @param {Feature} feature Feature.
* @return {Point} Cluster calculation point.
* @protected
*/
this.geometryFunction = options.geometryFunction || function(feature) {
const geometry = /** @type {import("../geom/Point.js").default} */ (feature.getGeometry());
const geometry = /** @type {Point} */ (feature.getGeometry());
assert(geometry instanceof Point,
10); // The default `geometryFunction` can only handle `import("../geom/Point.js").Point` geometries
10); // The default `geometryFunction` can only handle `Point` geometries
return geometry;
};
/**
* @type {import("./Vector.js").default}
* @type {VectorSource}
* @protected
*/
this.source = options.source;
@@ -103,7 +101,7 @@ class Cluster extends VectorSource {
/**
* Get a reference to the wrapped source.
* @return {import("./Vector.js").default} Source.
* @return {VectorSource} Source.
* @api
*/
getSource() {
@@ -187,8 +185,8 @@ class Cluster extends VectorSource {
}
/**
* @param {Array<import("../Feature.js").default>} features Features
* @return {import("../Feature.js").default} The cluster feature.
* @param {Array<Feature>} features Features
* @return {Feature} The cluster feature.
* @protected
*/
createCluster(features) {

View File

@@ -70,7 +70,6 @@ class ImageSourceEvent extends Event {
/**
* @typedef {Object} Options
* @property {import("./Source.js").AttributionLike} [attributions]
* @property {import("../extent.js").Extent} [extent]
* @property {import("../proj.js").ProjectionLike} projection
* @property {Array<number>} [resolutions]
* @property {import("./State.js").default} [state]