I'm using gwt-openlayers-1.0
, currently learning this example (Animated Cluster Strategy).
In my project each VectoreFeature
has a numeric label and I want to display sums of label values of underlying points on each cluster point. Is there a way to do that?
upd:
According to this article (The “Most Important” Strategy part) in JS it would look like this:
// for each feature:
feature.attributes = { result_count: 10 };
...
var style = new OpenLayers.Style({
...
} , context: {
label: function(feature) {
if (feature.cluster) {
var result_count = 0;
for (var i = 0; i < feature.cluster.length; i++) {
result_count += feature.cluster[i].attributes.result_count;
}
features.attributes.label = result_count.toString();
} else {
features.attributes.label = features.attributes.result_count.toString();
}
}
}
But I can't find a way to implement this in gwt-openlayers:
org.gwtopenmaps.openlayers.client.Style style = new org.gwtopenmaps.openlayers.client.Style();
style.setLabel( ??? );