{"size": 6496, "ext": "js", "max_stars_repo_path": "build/TC/control/ExternalWMS.min.js", "max_stars_repo_name": "mvinent/api-sitna", "max_stars_repo_stars_event_min_datetime": "2020-11-04T17:08:37.000Z", "max_stars_repo_stars_event_max_datetime": "2020-11-04T17:08:37.000Z", "max_issues_repo_path": "build/TC/control/ExternalWMS.min.js", "max_issues_repo_name": "gtoranzo/api-sitna", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "build/TC/control/ExternalWMS.min.js", "max_forks_repo_name": "gtoranzo/api-sitna", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 3248.0, "max_line_length": 6436, "alphanum_fraction": 0.6530172414}
TC.control=TC.control||{};TC.Control||TC.syncLoadJS(TC.apiLocation+"TC/Control");TC.control.ExternalWMS=function(e){this.count=0;this._addedUrls=[];TC.Control.apply(this,arguments);this.allowReprojection="boolean"!=typeof this.options.allowReprojection||this.options.allowReprojection};TC.inherit(TC.control.ExternalWMS,TC.Control);!function(){var e=TC.control.ExternalWMS.prototype;e.CLASS="tc-ctl-xwms";e.markServicesAsSelected=function(e){if(e.length>0){const t=e[0];t.disabled=!0;t.classList.add("tc-ctl-xwms-option-selected")}};e.register=function(e){const t=this,r=TC.Control.prototype.register.call(t,e);t.div.addEventListener("change",TC.EventTarget.listenerBySelector("select",function(e){if(""!==e.target.value){var r=e.target.value;0===r.indexOf("//")&&(r=location.protocol+r);t.div.querySelector("input").value=r;e.target.value=""}}));const n=function(){var e=t.div.querySelector("input").value.trim();if(e)if(/^((https?|ftp):)?(\/\/)?(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(e))if(t._addedUrls.some(function(t){return t.replace(/https?:\/\/|\/\//,"")===e.replace(/https?:\/\/|\/\//,"")}))TC.alert(t.getLocaleString("serviceAlreadyAdded"));else{var r=t.map.getControlsByClass("TC.control.LoadingIndicator")[0];r.show();var n=TC.Util.getQueryStringParams(e);/https?:\/\/|\/\//i.test(e)||(e="//"+e);var o=["version","service","request"],i=function(e,t){for(var r=0;r<t.length;r++)e=TC.Util.removeURLParameter(e,t[r]);e.match(/\?$/)&&(e=e.substr(0,e.length-1));return e}(e,Object.keys(n));for(var u in n)o.indexOf(u.toLowerCase())>=0&&delete n[u];const c=t.div.querySelector("button");c.disabled=!0;for(var l={id:"xwms"+ ++t.count,type:"WMS",url:i,hideTree:!1,queryParams:n},a=0;a<t.options.suggestions.length;a++){var s=t.options.suggestions[a].items.filter(function(t,r){return t.url===e});if(s.length>0&&s[0].layerNames){l.layerNames=s[0].layerNames;break}}var d=new TC.layer.Raster(l);d.getCapabilitiesPromise().then(function(n){if(void 0!==n.Capability){var o=n.Capability.Layer;if(o.CRS&&-1==o.CRS.indexOf(t.map.crs)&&!t.allowReprojection){TC.alert(t.getLocaleString("serviceSrsNotCompatible"));r.hide();c.disabled=!1;return}t.map.trigger(TC.Consts.event.EXTERNALSERVICEADDED,{layer:d});t.div.querySelector("input").value="";const i=[];t.div.querySelectorAll("select option").forEach(function(t){t.value.replace(/https?:\/\/|\/\//,"")===e.replace(/https?:\/\/|\/\//,"")&&i.push(t)});t.markServicesAsSelected(i);t._addedUrls.push(e);r.hide();c.disabled=!1}else{TC.alert(t.getLocaleString("noLayersFoundInService"));r.hide();c.disabled=!1}},function(e){TC.alert(t.getLocaleString("serviceCouldNotBeLoaded")+":\n"+e);r.hide();c.disabled=!1})}else TC.alert(t.getLocaleString("typeAValidAddress"));else TC.alert(t.getLocaleString("typeAnAddress"))};t.renderPromise().then(()=>{t.div.querySelector("input").addEventListener("keyup",e=>{e.key&&"enter"===e.key.toLowerCase()&&t.div.querySelector("input").value.trim().length>0&&n()})});t.div.addEventListener("click",TC.EventTarget.listenerBySelector('button[name="agregar"]',n));e.on(TC.Consts.event.LAYERADD,function(e){const r=e.layer;if(r&&!r.isBase){var n=r.url;if(n){t.pending_markServicesAsSelected=t.pending_markServicesAsSelected||[];0===t.div.querySelectorAll("select option").length&&n&&-1===t.pending_markServicesAsSelected.indexOf(n)&&t.pending_markServicesAsSelected.push(n);const e=[];t.div.querySelectorAll("select option").forEach(function(t){t.value.replace(/https?:\/\/|\/\//,"")===n.replace(/https?:\/\/|\/\//,"")&&e.push(t)});t.markServicesAsSelected(e);t._addedUrls.push(n)}}});return r};e.template={};e.template[e.CLASS]=function(){dust.register(e.CLASS,t);function t(e,t){return e.x(t.get(["title"],!1),t,{block:r},{}).w('<div><div class="tc-group tc-ctl-xwms-cnt">        <select class="tc-combo" title="WMS (Web Map Service)"><option value="">WMS</option>').s(t.get(["suggestions"],!1),t,{block:n},{}).w('</select><input type="url" class="tc-textbox" placeholder="').h("i18n",t,{},{$key:"writeAddressOrSelect"}).w('" /></div><div class="tc-group tc-group tc-ctl-xwms-cnt" style="text-align:right;"><button type="button" class="tc-button tc-icon-button" title="').h("i18n",t,{},{$key:"addService.title"}).w('" name="agregar">').h("i18n",t,{},{$key:"addService"}).w("</button></div></div>")}t.__dustBody=!0;function r(e,t){return e.w("<h2>").h("i18n",t,{},{$key:"addMaps"}).w("</h2>")}r.__dustBody=!0;function n(e,t){return e.x(t.get(["group"],!1),t,{block:o},{}).s(t.get(["items"],!1),t,{block:i},{}).x(t.get(["group"],!1),t,{block:u},{})}n.__dustBody=!0;function o(e,t){return e.w('<optgroup label="').f(t.get(["group"],!1),t,"h").w('">')}o.__dustBody=!0;function i(e,t){return e.w('<option value="').f(t.get(["url"],!1),t,"h").w('">').f(t.get(["name"],!1),t,"h").w("</option>")}i.__dustBody=!0;function u(e,t){return e.w("\t</optgroup>")}u.__dustBody=!0;return t};e.render=function(e){const t=this;return t._set1stRenderPromise(t.renderData(t.options,function(){t.pending_markServicesAsSelected=t.pending_markServicesAsSelected||[];t.pending_markServicesAsSelected.forEach(function(e){const r=[];t.div.querySelectorAll("select option").forEach(function(t){TC.Util.addProtocol(t.value)===TC.Util.addProtocol(e)&&r.push(t)});t.markServicesAsSelected(r);t._addedUrls.push(e)});t.pending_markServicesAsSelected=[]}))}}();
//# sourceMappingURL=../maps/control/ExternalWMS.min.js.map