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

Method selectAlternateOrChangeProjection

src/layer.js:409–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407 }
408
409 selectAlternateOrChangeProjection() {
410 let mapml = this.src ? this.shadowRoot : this;
411 let selectedAlternate =
412 this.getProjection() !== this.parentElement.projection &&
413 mapml.querySelector(
414 'map-link[rel=alternate][projection=' +
415 this.parentElement.projection +
416 '][href]'
417 );
418
419 if (selectedAlternate) {
420 let url = new URL(
421 selectedAlternate.getAttribute('href'),
422 selectedAlternate.getBase()
423 ).href;
424 throw new Error('changeprojection', {
425 cause: { href: url }
426 });
427 }
428 let contentProjection = this.getProjection();
429 if (
430 contentProjection !== this.parentElement.projection &&
431 this.parentElement.layers.length === 1
432 ) {
433 throw new Error('changeprojection', {
434 cause: { mapprojection: contentProjection }
435 });
436 }
437 }
438
439 copyRemoteContentToShadowRoot(mapml) {
440 let shadowRoot = this.shadowRoot;

Callers 1

_onAddMethod · 0.95

Calls 3

getProjectionMethod · 0.95
getAttributeMethod · 0.80
getBaseMethod · 0.80

Tested by

no test coverage detected