MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / _getFallbackCS

Method _getFallbackCS

src/map-feature.js:424–444  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

422 // native cs: used by FeatureLayer._geometryToLayer(...),
423 // the fallback cs for map-geometry if its cs attribute is not specified
424 _getFallbackCS() {
425 let csMeta;
426 if (this._parentEl.nodeName === 'MAP-LINK') {
427 // feature attaches to link's shadow root
428 csMeta =
429 this._parentEl.shadowRoot.querySelector('map-meta[name=cs][content]') ||
430 this._parentEl.parentElement.getMeta('cs');
431 } else {
432 let layerEl = this.getLayerEl();
433 csMeta = layerEl.src
434 ? layerEl.shadowRoot.querySelector('map-meta[name=cs][content]')
435 : layerEl.querySelector('map-meta[name=cs][content]');
436 }
437 // even here we could make an effort to use the tref variables to determine
438 // the coordinate system of the response - would only work with WMS, I think
439 // the fallback 'gcrs' SHOULD be specified by the MapML spec
440 // per https://github.com/Maps4HTML/MapML/issues/257
441 return csMeta
442 ? Util._metaContentToObject(csMeta.getAttribute('content')).content
443 : 'gcrs';
444 }
445
446 // Util functions:
447 // internal method to calculate the extent of the feature and store it in cache for the first time

Callers 3

reRenderMethod · 0.95
addFeatureMethod · 0.95
_memoizeExtentMethod · 0.95

Calls 3

getLayerElMethod · 0.95
getAttributeMethod · 0.80
getMetaMethod · 0.45

Tested by

no test coverage detected