Minor improvementes

This commit is contained in:
Daniel García Aubert
2017-12-01 17:06:42 +01:00
parent 6f04214f5d
commit 52630b8084
@@ -1,4 +1,5 @@
const AggregationProxy = require('../../aggregation/aggregation-proxy');
const { MapConfig } = require('windshaft').model;
module.exports = class AggregationMapConfigAdapter {
getMapConfig (user, requestMapConfig, params, context, callback) {
@@ -6,31 +7,33 @@ module.exports = class AggregationMapConfigAdapter {
return callback(null, requestMapConfig);
}
requestMapConfig = this._adaptLayers(requestMapConfig);
requestMapConfig.layers = this._adaptLayers(requestMapConfig);
callback(null, requestMapConfig);
}
_shouldAdaptLayers (requestMapConfig, params) {
let shouldAdapt = false;
if (typeof params.aggregation === 'boolean') {
return params.aggregation;
shouldAdapt = params.aggregation;
}
const mapConfig = new MapConfig(requestMapConfig);
if (params.aggregation === undefined) {
if (requestMapConfig.isVectorLayergroup()) {
return true;
if (mapConfig.isVectorOnlyMapConfig()) {
shouldAdapt = true;
} else if (this._hasAggregation(requestMapConfig)){
return true;
shouldAdapt = true;
}
}
return false;
return shouldAdapt;
}
_hasAggregation (requestMapConfig) {
for (const layer of requestMapConfig.layers) {
if (this._hasLayerAggregation(layer)) {
return true;
}