Hi Charles,
Yes, it is possible, though there is no support integrated into the Indicia framework directly. In the report_helper.php file you will find a method called addFeaturesLoadingJs. Replace this with the following for a quick "hack":
private static function addFeaturesLoadingJs($addFeaturesJs, $defsettings='',
$selsettings='{"strokeColor":"#ff0000","fillColor":"#ff0000","strokeWidth":2}', $styleFns='', $zoomToExtent=true) {
if (!empty($addFeaturesJs)) {
report_helper::$javascript.= "
if (typeof OpenLayers !== \"undefined\") {
var style = new OpenLayers.Style({
pointRadius: '\${radius}',
fillColor: '\${color}',
fillOpacity: 0.8,
strokeColor: '\${color}',
strokeWidth: 2,
strokeOpacity: 0.8,
fontColor: '#FFFFFF',
label: '\${label}'
}, {
context: {
radius: function(feature) {
return Math.min(feature.attributes.count, 7) + 3;
},
label: function (feature) {
return feature.attributes.count;
},
color: function(feature) {
var n=Math.min(feature.attributes.count, 7)*36;
return 'rgb('+n+', 0, '+(255-n)+')';
}
}
});
indiciaData.reportlayer = new OpenLayers.Layer.Vector('Report output', {rendererOptions: {zIndexing: true},
strategies: [
new OpenLayers.Strategy.Cluster()
],
styleMap: new OpenLayers.StyleMap({
'default': style,
'select': {
fillColor: '#8aeeef',
strokeColor: '#32a8a9'
}
})
});
mapInitialisationHooks.push(function(div) {
features = [];
$addFeaturesJs
indiciaData.reportlayer.addFeatures(features);\n";
if ($zoomToExtent)
self::$javascript .= " div.map.zoomToExtent(indiciaData.reportlayer.getDataExtent());\n";
self::$javascript .= " div.map.addLayer(indiciaData.reportlayer);
});
}\n";
}
}
Of course, it would be essential to make these changes an option rather than an enforced hack so that it can become part of the core code, plus it needs to be fairly flexible in how it calculates the point size, point colour and label output. In fact it might be nice to allow the strategy to switch off when you've zoomed in enough. Not sure if you fancy to take that on?
John van Breda
Biodiverse IT