diff --git a/src/ol/source/Cluster.js b/src/ol/source/Cluster.js index 33ce42063a..45276a733f 100644 --- a/src/ol/source/Cluster.js +++ b/src/ol/source/Cluster.js @@ -41,8 +41,8 @@ import {getUid} from '../util.js'; * See {@link module:ol/geom/Polygon~Polygon#getInteriorPoint} for a way to get a cluster * calculation point for polygons. * @property {function(Point, Array):Feature} [createClusterFeature] - * Function that takes cluster's ceter {@link module:ol/geom/Point} and array - * of {@link module:ol/Feature} included in this cluster, must return + * Function that takes the cluster's center {@link module:ol/geom/Point} and an array + * of {@link module:ol/Feature} included in this cluster. Must return a * {@link module:ol/Feature} that will be used to render. Default implementation is: * ```js * function(point, features) { @@ -198,28 +198,6 @@ class Cluster extends VectorSource { this.updateDistance(this.distance, minDistance); } - /** - * Current function used to create cluster features - * @return {function(Point, Array):Feature | undefined} cluster creation function - * @api - */ - getCreateClusterFeature() { - return this.createClusterFeature; - } - - /** - * Set function used to create cluster features - * @param {function(Point, Array):Feature | undefined} createClusterFeature creation function - * @api - */ - setCreateClusterFeature(createClusterFeature) { - const changed = this.createClusterFeature != createClusterFeature; - this.createClusterFeature = createClusterFeature; - if (changed) { - this.refresh(); - } - } - /** * The configured minimum distance between clusters. * @return {number} The minimum distance in pixels. diff --git a/test/browser/spec/ol/source/cluster.test.js b/test/browser/spec/ol/source/cluster.test.js index 961962f2cf..5487e4be7d 100644 --- a/test/browser/spec/ol/source/cluster.test.js +++ b/test/browser/spec/ol/source/cluster.test.js @@ -99,26 +99,6 @@ describe('ol.source.Cluster', function () { expect(source.getFeatures().length).to.be(1); expect(source.getFeatures()[0].get('sum')).to.be(3); }); - it('reacts setCreateClusterFeature', function () { - const feature1 = new Feature(new Point([0, 0])); - const feature2 = new Feature(new Point([0, 0])); - const source = new Cluster({ - source: new VectorSource({ - features: [feature1, feature2], - }), - }); - source.loadFeatures(extent, 1, projection); - expect(source.getFeatures().length).to.be(1); - expect(source.getFeatures()[0].get('sum')).to.be(undefined); - source.setCreateClusterFeature(function (clusterPoint, features) { - return new Feature({ - geometry: clusterPoint, - sum: features.length, - }); - }); - expect(source.getFeatures().length).to.be(1); - expect(source.getFeatures()[0].get('sum')).to.be(2); - }); }); describe('#setDistance', function () {