#overviewMap;
+ select;
+
/** Styled layer descriptor */
#sld;
}),
],
});
+ this.select = new Select();
this.#map = new Map({
controls: defaultControls({
attribution: false,
// }),
target: this.getMapName(),
});
+ this.#map.addInteraction(this.select);
//this.#map.getView().set('projection', 'EPSG:4326', true);
}
return true;
});
if (feature !== null)
- mapPart.callbacks['onFeatureSingleClick'](feature.get('path'));
+ mapPart.callbacks['onFeatureSingleClick'](feature.get('cr:path'));
});
}
select.on('select', function(e) {
if (e.selected.length > 0) {
let feature = e.selected[0];
- mapPart.callbacks['onFeatureSelected'](feature.get('path'));
+ mapPart.callbacks['onFeatureSelected'](feature.get('cr:path'));
}
});
}
return;
}
const coordinate = e.coordinate;
- const path = selected.get('path');
+ const path = selected.get('cr:path');
if (path === null)
return true;
const res = mapPart.callbacks['onFeaturePopup'](path);
return 'map';
}
+ selectFeatures(layerName, featureIds) {
+ // we cannot use 'this' in the function provided to OpenLayers
+ let mapPart = this;
+ this.select.getFeatures().clear();
+ const layer = this.getLayerByName(layerName);
+ const source = layer.getSource();
+ for (const featureId of featureIds) {
+ let feature = source.getFeatureById(featureId);
+ if (feature === null) {
+ source.on('featuresloadend', function(e) {
+ feature = source.getFeatureById(featureId);
+ if (feature !== null)
+ mapPart.select.getFeatures().push(feature);
+ });
+ } else {
+ this.select.getFeatures().push(feature);
+ }
+ }
+ }
+
//
// STATIC FOR EXTENSION
//