/** * * SmartEarth WebSDK - https://websdk.terra-it.cn * Version 5.4.1.2 * **/ (()=>{function p(e,a){"use strict";a=a||{};var t="<",r="<".charCodeAt(0),s=">",n=">".charCodeAt(0),o="-",l="-".charCodeAt(0),h="/",g="/".charCodeAt(0),u="!",y="!".charCodeAt(0),k="'",P="'".charCodeAt(0),J='"',C='"'.charCodeAt(0);function b(){for(var f=[];e[i];){if(e.charCodeAt(i)==r){if(e.charCodeAt(i+1)===g)return i=e.indexOf(s,i),f;if(e.charCodeAt(i+1)===y){if(e.charCodeAt(i+2)==l){for(;!(e.charCodeAt(i)===n&&e.charCodeAt(i-1)==l&&e.charCodeAt(i-2)==l&&i!=-1);)i=e.indexOf(s,i+1);i===-1&&(i=e.length)}else for(i+=2;e.charCodeAt(i)!==n;)i++;i++;continue}var v=w();f.push(v)}else{var d=G();d.trim().length>0&&f.push(d)}i++}return f}function G(){var f=i;return i=e.indexOf(t,i)-1,i===-2&&(i=e.length),e.slice(f,i+1)}var N=` >/= `;function A(){for(var f=i;N.indexOf(e[i])===-1;)i++;return e.slice(f,i)}var M=[];function w(){var f={};i++,f.tagName=A();for(var v=!1;e.charCodeAt(i)!==n;){var d=e.charCodeAt(i);if(d>64&&d<91||d>96&&d<123){for(var F=A(),m=e.charCodeAt(i);m!==P&&m!==C&&!(m>64&&m<91||m>96&&m<123)&&m!==n;)i++,m=e.charCodeAt(i);if(v||(f.attributes={},v=!0),m===P||m===C)var L=I();else L=null,i--;f.attributes[F]=L}i++}if(e.charCodeAt(i-1)!==g)if(f.tagName=="script"){var _=i+1;i=e.indexOf("<\/script>",i),f.children=[e.slice(_,i-1)],i+=8}else if(f.tagName=="style"){var _=i+1;i=e.indexOf("",i),f.children=[e.slice(_,i-1)],i+=7}else M.indexOf(f.tagName)==-1&&(i++,f.children=b(F));return f}function I(){var f=e[i],v=++i;return i=e.indexOf(f,v),e.slice(v,i)}function B(){return new RegExp(`s*ids*=s*['"]`+a.searchId+`['"]`).exec(e).index}var c=null;if(a.searchId){var i=B();return i!==-1&&(i=e.lastIndexOf("<",i),i!==-1&&(c=w())),i}else{var i=0;c=b()}return a.filter&&(c=p.filter(c,a.filter)),a.simplify&&(c=p.simplify(c)),c}p.simplify=function(a){var t={};if(a==null)return t;if(a.length===1&&typeof a[0]=="string")return{value:a[0]};a.forEach(function(s){if(t[s.tagName]||(t[s.tagName]=[]),typeof s=="object"){var n=p.simplify(s.children);t[s.tagName].push(n),s.attributes&&(n._attributes=s.attributes)}else t[s.tagName].push(s)});for(var r in t)t[r].length==1&&(t[r]=t[r][0]);return t};p.filter=function(e,a){var t=[];return e.forEach(function(r){if(typeof r=="object"&&a(r)&&t.push(r),r.children){var s=p.filter(r.children,a);t=t.concat(s)}}),t};var E=p;function x(e,a,t,r,s,n){this._extractAttributes=e,this._featureName=s||"featureMember",this._xy=a,this._gmlns=t||"http://www.opengis.net/gml",this._wfs=r||"http://www.opengis.net/wfs",this._geometryAttribute=n,this._regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g}}Object.defineProperties(x.prototype,{extractAttributes:{get:function(){return this._extractAttributes},set:function(e){this._extractAttributes=e}},xy:{get:function(){return this._xy}}});x.prototype.read=function(e){this._wfsPrefix==null&&this.detectPrefixes();var a=e["?xml"];if(a==null?a=e[this._wfsPrefix+"FeatureCollection"]:a=e["?xml"][this._wfsPrefix+"FeatureCollection"],a==null)throw"Invalid GML format. Could not find root element";var t=a[this._gmlPrefix+this._featureName]||[],r=[],s=this._featureName;if(t.length==null){var n=Object.keys(t).map(function(u){return{objName:t[u]}});t=n}for(var o=0;o0&&t==e.length-a.length-1}x.prototype.parseFeature=function(e){var a=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point"];this._geometryAttribute==null&&this.detectGeometryAttribute(e);var t,r,s,n={},o="";for(var l in e)if(o==""&&(o=l),l==this._geometryAttribute||j(l,this._geometryAttribute)){var h=Object.getOwnPropertyNames(e[l])[0];r=h.replace(this._gmlPrefix,""),s=this.parseGeometry[r.toLowerCase()],s?t=s.apply(this,[e[l][h]]):console.log("unsupportedGeometryType:"+r)}else l!="_attributes"&&(n[l]=e[l].value);var g;this.extractAttributes==!1&&(n=void 0);var u={geometryType:r.toLowerCase(),positions:t,attributes:n};return u.bounds=g,e._attributes!=null?u.fid=e._attributes.fid||e._attributes.id:u.fid=e[o].value,u};x.prototype.parseGeometry={point:function(e){var a,t,r=[];if(e[this._gmlPrefix+"pos"])t=e[this._gmlPrefix+"pos"].value,t=t.replace(this._regExes.trimSpace,""),r=t.split(this._regExes.splitSpace);else if(e[this._gmlPrefix+"coordinates"])t=e[this._gmlPrefix+"coordinates"].value,t=t.replace(this._regExes.removeSpace,""),r=t.split(",");else if(e[this._gmlPrefix+"coord"]){var s=e[this._gmlPrefix+"coord"][this._gmlPrefix+"X"].value,n=e[this._gmlPrefix+"coord"][this._gmlPrefix+"Y"].value;s!=null&&n!=null&&(r=[s,n])}return r.length==2&&(r[2]=null),this.xy?[parseFloat(r[0]),parseFloat(r[1]),parseFloat(r[2])]:[parseFloat(r[1]),parseFloat(r[0]),parseFloat(r[2])]},multipoint:function(e){var a=e[this._gmlPrefix+"pointMember"],t=[];if(a.length==null&&(a=[a]),a.length>0)for(var r,s=0;s0)for(var r,s=0;s0)for(var s,t=0;t0)for(var r,s=0;s{n.positions=[],n.geometry.coordinates.forEach(o=>{if(Array.isArray(o)){let l=[];o.forEach(h=>{if(Array.isArray(h[0])){let g=[];h.forEach(u=>{g.push(u[0],u[1],u[2])}),l.push(g)}else l.push(h[0],h[1],h[2])}),n.positions.push(l)}else n.positions.push(o)}),n.attributes=n.properties,n.fid=n.id,n.geometryType=n.geometry.type.toLocaleLowerCase(),n.bounds=void 0,delete n.geometry,delete n.id,delete n.properties,delete n.geometry_name,delete n.type})):(r=E(t.text,{simplify:!0}),s=a.read(r)),delete t.text,t.features=s,postMessage(t)});})();