remove setter/getter

This commit is contained in:
jkonieczny
2021-07-15 09:06:13 +02:00
parent a8f7d955af
commit e1b161bbbe
2 changed files with 2 additions and 44 deletions

View File

@@ -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>):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>):Feature | undefined} cluster creation function
* @api
*/
getCreateClusterFeature() {
return this.createClusterFeature;
}
/**
* Set function used to create cluster features
* @param {function(Point, Array<Feature>):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.

View File

@@ -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 () {