Adding a check to make sure features have a geometry before entering the cluster algorithm. r=crschmidt (closes #1816)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8316 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -147,17 +147,19 @@ OpenLayers.Strategy.Cluster = OpenLayers.Class(OpenLayers.Strategy, {
|
||||
var feature, clustered, cluster;
|
||||
for(var i=0; i<this.features.length; ++i) {
|
||||
feature = this.features[i];
|
||||
clustered = false;
|
||||
for(var j=0; j<clusters.length; ++j) {
|
||||
cluster = clusters[j];
|
||||
if(this.shouldCluster(cluster, feature)) {
|
||||
this.addToCluster(cluster, feature);
|
||||
clustered = true;
|
||||
break;
|
||||
if(feature.geometry) {
|
||||
clustered = false;
|
||||
for(var j=0; j<clusters.length; ++j) {
|
||||
cluster = clusters[j];
|
||||
if(this.shouldCluster(cluster, feature)) {
|
||||
this.addToCluster(cluster, feature);
|
||||
clustered = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!clustered) {
|
||||
clusters.push(this.createCluster(this.features[i]));
|
||||
}
|
||||
}
|
||||
if(!clustered) {
|
||||
clusters.push(this.createCluster(this.features[i]));
|
||||
}
|
||||
}
|
||||
this.layer.destroyFeatures();
|
||||
|
||||
Reference in New Issue
Block a user