@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
35 lines (34 loc) • 1.32 kB
JavaScript
import LayerWms from './layerwms.js';
/*
* This class is a used in the state of the application, which will be accessed behind a javascript proxy.
* This means that each modification made to its properties must come from outside,
* because they have to be made through the proxy, so that the modification can be listen.
* Therefore, this class must not contain any method which is updating a value directly
* For example, any method doing <this.xxx = value> is forbidden here, because the modification be known from the proxy
*/
export default class LayerWmsExternal extends LayerWms {
static nextAvailableLayerId = 10000000;
selected = false;
get isSelected() {
return this.selected;
}
set isSelected(value) {
this.selected = value;
this.isDefaultChecked = value;
}
constructor(title, name, ogcServer) {
const id = LayerWmsExternal.nextAvailableLayerId++;
const options = {
layers: name,
queryable: true,
legend: true,
isLegendExpanded: false
};
super(id, title, 0, ogcServer, options);
}
clone() {
const clonedLayer = new LayerWmsExternal(this.name, this.layers, this.ogcServer);
clonedLayer.isSelected = this.isSelected;
return clonedLayer;
}
}