2018-10-23 23:45:42 +08:00
|
|
|
'use strict';
|
|
|
|
|
2017-05-18 02:16:43 +08:00
|
|
|
var layerStats = require('./layer-stats/factory');
|
2017-05-09 18:31:16 +08:00
|
|
|
|
2017-05-10 23:17:01 +08:00
|
|
|
function StatsBackend() {
|
2017-05-10 00:24:24 +08:00
|
|
|
}
|
2017-05-09 18:31:16 +08:00
|
|
|
|
|
|
|
module.exports = StatsBackend;
|
|
|
|
|
2017-05-12 22:39:54 +08:00
|
|
|
StatsBackend.prototype.getStats = function(mapConfig, dbConnection, callback) {
|
2017-05-09 18:51:22 +08:00
|
|
|
var enabledFeatures = global.environment.enabledFeatures;
|
2017-05-10 23:17:01 +08:00
|
|
|
var layerStatsEnabled = enabledFeatures ? enabledFeatures.layerStats: false;
|
2017-05-12 18:50:57 +08:00
|
|
|
if (layerStatsEnabled) {
|
2017-05-18 02:16:43 +08:00
|
|
|
layerStats().getStats(mapConfig, dbConnection, callback);
|
2017-05-09 18:51:22 +08:00
|
|
|
} else {
|
2017-05-30 16:47:47 +08:00
|
|
|
return callback(null, []);
|
2017-05-09 18:51:22 +08:00
|
|
|
}
|
2017-05-09 18:31:16 +08:00
|
|
|
};
|