const MapConfig = require('windshaft').model.MapConfig; module.exports = class AggregationMapConfig extends MapConfig { constructor (config, datasource) { super(config, datasource); } isAggregationMapConfig () { return this.isVectorOnlyMapConfig() || this.hasAnyLayerAggregation(); } isAggregationLayer (index) { return this.isVectorOnlyMapConfig() || this.hasLayerAggregation(index); } hasAnyLayerAggregation () { const layers = this.getLayers(); for (let index = 0; index < layers.length; index++) { if (this.hasLayerAggregation(index)) { return true; } } return false; } hasLayerAggregation (index) { const layer = this.getLayer(index); const { aggregation } = layer.options; return aggregation !== undefined && (typeof aggregation === 'object' || typeof aggregation === 'boolean'); } };