Move static methods

This commit is contained in:
Daniel García Aubert
2017-12-18 17:42:12 +01:00
parent d0c88ce21d
commit 170fcc1973
3 changed files with 16 additions and 16 deletions
@@ -1,7 +1,18 @@
const MapConfig = require('windshaft').model.MapConfig;
const Aggregation = require('./aggregation');
module.exports = class AggregationMapConfig extends MapConfig {
static get THRESHOLD () {
return 1e5; // 100K
}
static get PLACEMENTS () {
return [
'centroid',
'point-grid',
'point-sample'
];
}
constructor (config, datasource) {
super(config, datasource);
@@ -52,7 +63,7 @@ module.exports = class AggregationMapConfig extends MapConfig {
validate () {
const validate = aggregationValidator(this);
const numberValidator = createNumberValidator(this);
const includesValidPlacementsValidator = createIncludesValueValidator(this, Aggregation.PLACEMENTS);
const includesValidPlacementsValidator = createIncludesValueValidator(this, AggregationMapConfig.PLACEMENTS);
validate('resolution', numberValidator);
validate('placement', includesValidPlacementsValidator);
+2 -13
View File
@@ -1,21 +1,10 @@
const aggregationQuery = require('./aggregation-query');
const AggregationMapConfig = require('./aggregation-map-config');
module.exports = class Aggregation {
static get THRESHOLD() {
return 1e5; // 100K
}
static get PLACEMENTS() {
return [
'centroid',
'point-grid',
'point-sample'
];
}
constructor (mapconfig, query, {
resolution = 1,
threshold = Aggregation.THRESHOLD,
threshold = AggregationMapConfig.THRESHOLD,
placement = 'centroid',
columns = {},
dimensions = {}
@@ -123,7 +123,7 @@ module.exports = class AggregationMapConfigAdapter {
const threshold = layer.options.aggregation && layer.options.aggregation.threshold ?
layer.options.aggregation.threshold :
Aggregation.THRESHOLD;
AggregationMapConfig.THRESHOLD;
if (estimatedFeatureCount < threshold) {
return callback(null, shouldAdapt);