Move static methods
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user