diff --git a/externs/olx.js b/externs/olx.js index a569214a05..9f972d224d 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -49,94 +49,6 @@ olx.render.State.prototype.resolution; olx.render.State.prototype.rotation; -/** - * @typedef {{attributions: (ol.AttributionLike|undefined), - * distance: (number|undefined), - * extent: (ol.Extent|undefined), - * format: (ol.format.Feature|undefined), - * geometryFunction: (undefined|function(module:ol/Feature~Feature):module:ol/geom/Point~Point), - * projection: ol.ProjectionLike, - * source: ol.source.Vector, - * wrapX: (boolean|undefined)}} - */ -olx.source.ClusterOptions; - - -/** - * Attributions. - * @type {ol.AttributionLike|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.attributions; - - -/** - * Minimum distance in pixels between clusters. Default is `20`. - * @type {number|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.distance; - - -/** - * Extent. - * @type {ol.Extent|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.extent; - - -/** - * Function that takes an {@link module:ol/Feature~Feature} as argument and returns an - * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a - * feature should not be considered for clustering, the function should return - * `null`. The default, which works when the underyling source contains point - * features only, is - * ```js - * function(feature) { - * return feature.getGeometry(); - * } - * ``` - * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster - * calculation point for polygons. - * @type {undefined|function(module:ol/Feature~Feature):module:ol/geom/Point~Point} - * @api - */ -olx.source.ClusterOptions.prototype.geometryFunction; - - -/** - * Format. - * @type {ol.format.Feature|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.format; - - -/** - * Projection. - * @type {ol.ProjectionLike} - * @api - */ -olx.source.ClusterOptions.prototype.projection; - - -/** - * Source. - * @type {ol.source.Vector} - * @api - */ -olx.source.ClusterOptions.prototype.source; - - -/** - * WrapX. Default is true - * @type {boolean|undefined} - * @api - */ -olx.source.ClusterOptions.prototype.wrapX; - - /** * @typedef {{preemptive: (boolean|undefined), * jsonp: (boolean|undefined), diff --git a/src/ol/source/Cluster.js b/src/ol/source/Cluster.js index d337275a83..0001a3c008 100644 --- a/src/ol/source/Cluster.js +++ b/src/ol/source/Cluster.js @@ -12,6 +12,31 @@ import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js'; import Point from '../geom/Point.js'; import VectorSource from '../source/Vector.js'; +/** + * @typedef {Object} Options + * @property {ol.AttributionLike} [attributions] Attributions. + * @property {number} [distance=20] Minimum distance in pixels between clusters. + * @property {ol.Extent} [extent] Extent. + * @property {ol.format.Feature} [format] Format. + * @property {function(module:ol/Feature~Feature):module:ol/geom/Point~Point} [geometryFunction] + * Function that takes an {@link module:ol/Feature~Feature} as argument and returns an + * {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a + * feature should not be considered for clustering, the function should return + * `null`. The default, which works when the underyling source contains point + * features only, is + * ```js + * function(feature) { + * return feature.getGeometry(); + * } + * ``` + * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster + * calculation point for polygons. + * @property {ol.ProjectionLike} projection Projection. + * @property {ol.source.Vector} source Source. + * @property {boolean} [wrapX=true] Whether to wrap the world horizontally. + */ + + /** * @classdesc * Layer source to cluster vector data. Works out of the box with point @@ -19,7 +44,7 @@ import VectorSource from '../source/Vector.js'; * considered for clustering, a custom `geometryFunction` can be defined. * * @constructor - * @param {olx.source.ClusterOptions} options Constructor options. + * @param {module:ol/source/Cluster~Options=} options Cluster options. * @extends {ol.source.Vector} * @api */