function openlayers_views_style_data::reduce_features in Openlayers 7.2
Basically an algebraic reduction; given whether to group, a feature, a list of features, etc., return a full $features array with the element added, either straight non-grouped, or within a new or existing group
openlayers_views_style_data specific
1 call to openlayers_views_style_data::reduce_features()
- openlayers_views_style_data::map_features in modules/
openlayers_views/ views/ openlayers_views_style_data.inc
File
- modules/
openlayers_views/ views/ openlayers_views_style_data.inc, line 466 - This file holds style plugin for OpenLayers Views
Class
- openlayers_views_style_data
- @class Extension of the Views Plugin Style for OpenLayers
Code
function reduce_features($is_grouped, $features, $feature, $group) {
if ($is_grouped) {
if (isset($features[$group])) {
$features[$group]['attributes']['count']++;
$features[$group]['wkt'][] = $feature['wkt'];
$features[$group]['features'][] = $feature;
return $features;
}
else {
$features[$group] = array(
'attributes' => array(
'count' => 1,
),
'wkt' => array(
$feature['wkt'],
),
'projection' => $feature['projection'],
'features' => array(
$feature,
),
);
return $features;
}
}
else {
array_push($features, $feature);
return $features;
}
}