@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
60 lines (59 loc) • 2.27 kB
JavaScript
import Layer from './layer';
import ConfigManager from '../../tools/configuration/configmanager';
class LayerLocalFile extends Layer {
constructor(file, features, extent) {
super(0, file.name, 0, { isDefaultChecked: true });
/**
* 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
*/
Object.defineProperty(this, "_features", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "lastModifiedDate", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "legend", {
enumerable: true,
configurable: true,
writable: true,
value: true
});
Object.defineProperty(this, "isLegendExpanded", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "wasLegendExpanded", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
Object.defineProperty(this, "extent", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
this._features = features;
this.extent = extent;
this.lastModifiedDate = new Date(file.lastModified).toLocaleDateString(ConfigManager.getInstance().Config.general.locale);
this.isLegendExpanded = true;
this.wasLegendExpanded = false;
}
clone() {
throw new Error('Cannot clone layer for local file.');
}
}
export default LayerLocalFile;