let AbstractLayer = require('./abstract');
/**
* Класс GroupLayer
* @extends AbstractLayer
*/
class GroupLayer extends AbstractLayer {
/**
* Создает экземлпяр слоя типа GroupLayer
* @param params
*/
constructor(params) {
super(params);
this.initStore(params);
}
/**
* @param params
* @param params.className - имя класса
* @param params.mappings - объект, содержащий трансляцию полей (подстановка)
*/
initStore(params) {
this.store = {};
this.store.layerType = "opengis.layers.group";
this.store.className = params.className;
this.store.id = params.id;
this.store.visibility = params.visibility || true;
this.store.parent = params.parent || null;
this.store.childs = params.childs || [];
}
setVisibility(value){
this.store.visibility = value;
this.store.childs.forEach(function(item){
item.setVisibility(value);
});
}
search(params){
let layers = this.store.childs;
let results = layers.map(function(item){
return item.search(params);
});
return result;
}
}
module.exports = GroupLayer;