Extract method
This commit is contained in:
@@ -34,10 +34,7 @@ module.exports = class AggregationMapConfigAdapter {
|
||||
for (let index = 0; index < layers.length; index++) {
|
||||
const layer = layers[index];
|
||||
const { aggregation } = layer.options;
|
||||
const hasAggregationColumns = aggregation !== undefined &&
|
||||
typeof aggregation !== 'boolean' &&
|
||||
typeof aggregation.columns === 'object';
|
||||
const aggregationColumns = hasAggregationColumns ? Object.keys(aggregation.columns) : [];
|
||||
const aggregationColumns = this._getAggregationColumns(aggregation);
|
||||
const layerColumns = mapConfig.getColumnsByLayer(index);
|
||||
|
||||
if (layerColumns.length === 0) {
|
||||
@@ -126,8 +123,23 @@ module.exports = class AggregationMapConfigAdapter {
|
||||
_getAggregationMetadata (requestMapConfig) {
|
||||
return requestMapConfig.layers.map(layer => {
|
||||
return this._hasLayerAggregation(layer) ?
|
||||
{ aggregated: true } :
|
||||
{ aggregated: false };
|
||||
{ png: false, mvt: true } :
|
||||
{ png: false, mvt: false };
|
||||
});
|
||||
}
|
||||
|
||||
_getAggregationColumns (aggregation) {
|
||||
const hasAggregationColumns = aggregation !== undefined &&
|
||||
typeof aggregation !== 'boolean' &&
|
||||
typeof aggregation.columns === 'object';
|
||||
let aggregationColumns = [];
|
||||
|
||||
if (hasAggregationColumns) {
|
||||
aggregationColumns = Object.keys(aggregation.columns).map(key => {
|
||||
return aggregation.columns[key].aggregated_column;
|
||||
});
|
||||
}
|
||||
|
||||
return aggregationColumns;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user