Fix TypeScript errors in ol/format/WMSGetFeatureInfo

This commit is contained in:
Kevin Schmidt
2018-09-28 08:15:59 -06:00
parent 63f583e148
commit df7c89baeb

View File

@@ -100,10 +100,12 @@ class WMSGetFeatureInfo extends XMLFeature {
if (layer.nodeType !== Node.ELEMENT_NODE) {
continue;
}
const layerElement = /** @type {Element} */ (layer);
const context = objectStack[0];
const toRemove = layerIdentifier;
const layerName = layer.localName.replace(toRemove, '');
const layerName = layerElement.localName.replace(toRemove, '');
if (this.layers_ && !includes(this.layers_, layerName)) {
continue;
@@ -115,14 +117,15 @@ class WMSGetFeatureInfo extends XMLFeature {
context['featureType'] = featureType;
context['featureNS'] = this.featureNS_;
/** @type {Object<string, import("../xml.js").Parser>} */
const parsers = {};
parsers[featureType] = makeArrayPusher(
this.gmlFormat_.readFeatureElement, this.gmlFormat_);
const parsersNS = makeStructureNS(
[context['featureNS'], null], parsers);
layer.setAttribute('namespaceURI', this.featureNS_);
layerElement.setAttribute('namespaceURI', this.featureNS_);
const layerFeatures = pushParseAndPop(
[], parsersNS, layer, objectStack, this.gmlFormat_);
[], parsersNS, layerElement, objectStack, this.gmlFormat_);
if (layerFeatures) {
extend(features, layerFeatures);
}