2018-10-23 23:45:42 +08:00
|
|
|
'use strict';
|
|
|
|
|
2017-05-18 02:16:43 +08:00
|
|
|
var LayerStats = require('./layer-stats');
|
|
|
|
var EmptyLayerStats = require('./empty-layer-stats');
|
|
|
|
var MapnikLayerStats = require('./mapnik-layer-stats');
|
|
|
|
var TorqueLayerStats = require('./torque-layer-stats');
|
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
module.exports = function LayerStatsFactory (type) {
|
2017-05-18 02:16:43 +08:00
|
|
|
var layerStatsIterator = [];
|
|
|
|
var selectedType = type || 'ALL';
|
|
|
|
|
|
|
|
if (selectedType === 'ALL') {
|
|
|
|
layerStatsIterator.push(new EmptyLayerStats({ http: true, plain: true }));
|
|
|
|
layerStatsIterator.push(new MapnikLayerStats());
|
|
|
|
layerStatsIterator.push(new TorqueLayerStats());
|
|
|
|
} else if (selectedType === 'mapnik') {
|
|
|
|
layerStatsIterator.push(new EmptyLayerStats({ http: true, plain: true, torque: true }));
|
|
|
|
layerStatsIterator.push(new MapnikLayerStats());
|
|
|
|
} else if (selectedType === 'torque') {
|
|
|
|
layerStatsIterator.push(new EmptyLayerStats({ http: true, plain: true, mapnik: true }));
|
|
|
|
layerStatsIterator.push(new TorqueLayerStats());
|
|
|
|
}
|
|
|
|
|
|
|
|
return new LayerStats(layerStatsIterator);
|
|
|
|
};
|