mobility-toolbox-js
Version:
Toolbox for JavaScript applications in the domains of mobility and logistics.
38 lines (37 loc) • 1 kB
JavaScript
import { Evented } from 'maplibre-gl';
import { v4 as uuid } from 'uuid';
/**
* A class representing a layer to display on an Maplibre map.
*
* @example
* import { Layer } from 'mobility-toolbox-js/Maplibre';
*
* const layer = new Layer({ id:'MyLayer' });
*
* @implements {maplibregl.CustomLayerInterface}
* @extends {maplibregl.Evented}
* @private
*/
class Layer extends Evented {
constructor(options = {}) {
super();
this.options = {};
this.type = 'custom';
this.options = options;
this.id = options.id || uuid();
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onAdd(map, gl) {
this.map = map;
}
onRemove(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
map,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
gl) {
this.map = undefined;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
render(gl) { }
}
export default Layer;