The cluster strategy originally destroyed all features on the layer because it created them. When the threshold property was introduced, the strategy should have been removing instead of destroying features that it didn't create. This wasn't a problem until r10597 when the destroyMethod method was made to actually work. With this change, the cluster strategy removes instead of destroys features. r=crschmidt (closes #2815).

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10714 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-09-02 18:29:06 +00:00
parent f76f8ded46
commit 95512dfa5a

View File

@@ -159,7 +159,7 @@ OpenLayers.Strategy.Cluster = OpenLayers.Class(OpenLayers.Strategy, {
feature = this.features[i];
if(feature.geometry) {
clustered = false;
for(var j=0; j<clusters.length; ++j) {
for(var j=clusters.length-1; j>=0; --j) {
cluster = clusters[j];
if(this.shouldCluster(cluster, feature)) {
this.addToCluster(cluster, feature);
@@ -172,7 +172,7 @@ OpenLayers.Strategy.Cluster = OpenLayers.Class(OpenLayers.Strategy, {
}
}
}
this.layer.destroyFeatures();
this.layer.removeAllFeatures();
if(clusters.length > 0) {
if(this.threshold > 1) {
var clone = clusters.slice();