()
| 706 | return queryVarNames; |
| 707 | } |
| 708 | _initTemplateVars() { |
| 709 | // set up the URL template and associated inputs (which yield variable values when processed) |
| 710 | var varNamesRe = new RegExp('(?:{)(.*?)(?:})', 'g'), |
| 711 | zoomInput = this.parentElement.querySelector('map-input[type="zoom" i]'), |
| 712 | includesZoom = false, |
| 713 | linkedZoomInput; |
| 714 | |
| 715 | var template = this.tref; |
| 716 | if (template === M.BLANK_TT_TREF) { |
| 717 | for (let i of this.parentElement.querySelectorAll('map-input')) { |
| 718 | template += `{${i.getAttribute('name')}}`; |
| 719 | } |
| 720 | } |
| 721 | this.zoomInput = zoomInput; |
| 722 | |
| 723 | var v, |
| 724 | vcount = template.match(varNamesRe) || [], |
| 725 | inputs = [], |
| 726 | inputsReady = []; |
| 727 | while ((v = varNamesRe.exec(template)) !== null) { |
| 728 | let varName = v[1], |
| 729 | inp = this.parentElement.querySelector( |
| 730 | 'map-input[name=' + varName + '],map-select[name=' + varName + ']' |
| 731 | ); |
| 732 | if (inp) { |
| 733 | // this "associates" the input to this map-link |
| 734 | inputs.push(inp); |
| 735 | inputsReady.push(inp.whenReady()); |
| 736 | |
| 737 | // I think this means that regardless of whether the tref includes |
| 738 | // a reference to the zoom input, it gets associated to the link |
| 739 | // and used (to specify the native zoom bounds??) for the templated(Tile|Image|Features)Layer |
| 740 | if ( |
| 741 | inp.hasAttribute('type') && |
| 742 | inp.getAttribute('type').toLowerCase() === 'zoom' |
| 743 | ) { |
| 744 | linkedZoomInput = inp; |
| 745 | includesZoom = true; |
| 746 | } |
| 747 | // moved a block to map-select to transcribe the map-select into an |
| 748 | // actual html select for inclusion in the layer control. |
| 749 | |
| 750 | // TODO: if this is an input@type=location |
| 751 | // get the TCRS min,max attribute values at the identified zoom level |
| 752 | // save this information as properties of the mapExtent, |
| 753 | // perhaps as a bounds object so that it can be easily used |
| 754 | // later by the layer control to determine when to enable |
| 755 | // disable the layer for drawing. |
| 756 | } else { |
| 757 | console.log( |
| 758 | 'input with name=' + |
| 759 | varName + |
| 760 | ' not found for template variable of same name' |
| 761 | ); |
| 762 | } |
| 763 | } |
| 764 | if (template && vcount.length === inputs.length) { |
| 765 | if (!includesZoom && zoomInput) { |
no test coverage detected