+
+ /* CALLBACKS */
+ enableFeatureSingleClick() {
+ // we cannot use 'this' in the function provided to OpenLayers
+ let mapPart = this;
+ this.#map.on('singleclick', function(e) {
+ let feature = null;
+ // we chose only one
+ e.map.forEachFeatureAtPixel(e.pixel, function(f) {
+ feature = f;
+ });
+ if (feature !== null)
+ mapPart.callbacks['onFeatureSingleClick'](feature.get('path'));
+ });
+ }
+
+ enableFeatureSelected() {
+ // we cannot use 'this' in the function provided to OpenLayers
+ let mapPart = this;
+ var select = new Select();
+ this.#map.addInteraction(select);
+ select.on('select', function(e) {
+ if (e.selected.length > 0) {
+ let feature = e.selected[0];
+ mapPart.callbacks['onFeatureSelected'](feature.get('path'));
+ }
+ });
+ }