map-core-func 0.1.18 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("maptalks"),require("three"),require("maptalks.three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three","maptalks.three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).mapcore=t.mapcore||{},t.maptalks,t.THREE,t.maptalks)}(this,(function(t,e,i,r){function n(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=n(e),o=n(i);function s(){s=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",h=n.toStringTag||"@@toStringTag";function c(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,i){return t[e]=i}}function l(t,e,i,n){var a=e&&e.prototype instanceof d?e:d,o=Object.create(a.prototype),s=new T(n||[]);return r(o,"_invoke",{value:_(t,i,s)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function d(){}function m(){}function p(){}var v={};c(v,a,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(C([])));y&&y!==e&&i.call(y,a)&&(v=y);var x=p.prototype=d.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(r,a,o,s){var h=u(t[r],t,a);if("throw"!==h.type){var c=h.arg,l=c.value;return l&&"object"==typeof l&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return n("throw",t,o,s)}))}s(h.arg)}var a;r(this,"_invoke",{value:function(t,i){function r(){return new e((function(e,r){n(t,i,e,r)}))}return a=a?a.then(r,r):r()}})}function _(t,e,i){var r="suspendedStart";return function(n,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===n)throw a;return I()}for(i.method=n,i.arg=a;;){var o=i.delegate;if(o){var s=k(o,i);if(s){if(s===f)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===r)throw r="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r="executing";var h=u(t,e,i);if("normal"===h.type){if(r=i.done?"completed":"suspendedYield",h.arg===f)continue;return{value:h.arg,done:i.done}}"throw"===h.type&&(r="completed",i.method="throw",i.arg=h.arg)}}}function k(t,e){var i=e.method,r=t.iterator[i];if(void 0===r)return e.delegate=null,"throw"===i&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),f;var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function C(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:I}}function I(){return{value:void 0,done:!0}}return m.prototype=p,r(x,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:m,configurable:!0}),m.displayName=c(p,h,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,h,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,i,r,n,a){void 0===a&&(a=Promise);var o=new b(l(e,i,r,n),a);return t.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},w(x),c(x,h,"Generator"),c(x,a,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),i=[];for(var r in e)i.push(r);return i.reverse(),function t(){for(;i.length;){var r=i.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(i,r){return o.type="throw",o.arg=t,e.next=i,r&&(e.method="next",e.arg=void 0),!!r}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),h=i.call(a,"finallyLoc");if(s&&h){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),S(i),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var r=i.completion;if("throw"===r.type){var n=r.arg;S(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:C(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),f}},t}function h(t,e,i,r,n,a,o){try{var s=t[a](o),h=s.value}catch(t){return void i(t)}s.done?e(h):Promise.resolve(h).then(r,n)}function c(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function o(t){h(a,r,n,o,s,"next",t)}function s(t){h(a,r,n,o,s,"throw",t)}o(void 0)}))}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(n=r.key,a=void 0,"symbol"==typeof(a=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(n,"string"))?a:String(a)),r)}var n,a}function f(t,e,i){return e&&u(t.prototype,e),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,r=m(t);if(e){var n=m(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return v(this,i)}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return y(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?y(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw a}}}}function w(){var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return"iep".concat(t,"layer")}function b(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function _(t,e){return 256*(t=o.MathUtils.clamp(Math.floor(t),0,255))+(e=o.MathUtils.clamp(Math.floor(e),0,255))}var k={altitude:0,imageWidth:512,imageHeight:512,texture:null},M=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i);var c=r=a.Util.extend({},k,r),u=c.altitude;c.imageHeight,c.imageWidth,t instanceof a.Extent||(t=new a.Extent(t));var f=t,d=f.xmin,m=f.ymin,p=f.xmax,v=f.ymax,g=1/0,y=1/0,x=-1/0,w=-1/0;[[d,m],[d,v],[p,v],[p,m]].forEach((function(t){var e=s.coordinateToVector3(t),i=e.x,r=e.y;g=Math.min(i,g),y=Math.min(r,y),x=Math.max(i,x),w=Math.max(r,w)}));var b=Math.abs(x-g),_=Math.abs(w-y),M=new o.PlaneBufferGeometry(b,_);(h=e.call(this))._initOptions(r),h._createMesh(M,n);var S=s.distanceToVector3(u,u).x,T=s.coordinateToVector3(t.getCenter(),S);return h.getObject3d().position.copy(T),h.parent=null,h.type="Image",h}return f(i)}(r.BaseObject),S=function(){function t(e,i,r,n,s){var h=this;l(this,t),this.threelayer=s,this.map=s.map,this.textureLoader=new o.TextureLoader;var c=e.split(","),u=i.split(","),f=parseFloat(c[0]),d=parseFloat(c[1]),m=parseFloat(u[0]),p=parseFloat(u[1]),v=n.maxZoom||11,g=n.renderOrder||0,y=n.opacity||1,x=n.minZoom||3,w=new a.Extent(f,d,m,p);this.xmin_g=f,this.ymin_g=d,this.xmax_g=m,this.ymax_g=p,this.textureLoader.load(r,(function(t){var e=new o.MeshBasicMaterial({map:t,transparent:!0,opacity:y}),i=new M(w,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:x,interactive:void 0!==n.interactive&&n.interactive},e,h.threelayer);i.object3d.renderOrder=g,h.imgMesh=i,h.imgMesh.parent=h,h.m=e,h.texture=t,h.threelayer.addMesh(h.imgMesh),n.opacityItems&&n.opacityItems.length>0&&!isNaN(n.opacityItems[0])&&!isNaN(n.opacityItems[1])&&n.opacityItems[0]>3&&n.opacityItems[0]<=18&&n.opacityItems[1]>=0&&n.opacityItems[1]<=1&&(h.opacityItems=n.opacityItems,h._bindMapEvents(),h._viewChange())}))}return f(t,[{key:"_bindMapEvents",value:function(){this.map.on("viewchange",this._viewChange,this)}},{key:"_viewChange",value:function(){this.opacityItems[0]<=this.map.getZoom()?this.imgMesh.object3d.material.opacity=this.opacityItems[1]:this.imgMesh.object3d.material.opacity=1}},{key:"_closeEvent",value:function(){this.map.off("viewchange",this._viewChange,this)}},{key:"updateImage",value:function(t,e){var i=this;if(e&&e.leftbottom&&e.righttop){var r=parseFloat(e.leftbottom[0]),n=parseFloat(e.leftbottom[1]),s=parseFloat(e.righttop[0]),h=parseFloat(e.righttop[1]);if(r!==this.xmin_g||n!==this.ymin_g||s!==this.xmax_g||h!==this.ymax_g){var c=new a.Extent(r,n,s,h),l=1/0,u=1/0,f=-1/0,d=-1/0;[[r,n],[r,h],[s,h],[s,n]].forEach((function(t){var e=i.threelayer.coordinateToVector3(t),r=e.x,n=e.y;l=Math.min(r,l),u=Math.min(n,u),f=Math.max(r,f),d=Math.max(n,d)}));for(var m=Math.abs(f-l),p=Math.abs(d-u),v=new o.PlaneBufferGeometry(m,p),g=v.attributes.position.array,y=this.imgMesh.object3d.geometry.attributes.position.array,x=0;x<y.length;x++)y[x]=g[x];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var w=this.threelayer.coordinateToVector3(c.getCenter(),0);this.imgMesh.getObject3d().position.copy(w),v.dispose(),this.xmin_g=r,this.ymin_g=n,this.xmax_g=s,this.ymax_g=h}}this.textureLoader.load(t,(function(t){i.texture&&i.texture.dispose(),delete i.texture,t.magFilter=o.NearestFilter,t.minFilter=o.NearestFilter,i.imgMesh.object3d.material.map=t,i.imgMesh.object3d.material.map.needsUpdate=!0,i.texture=t,!1===i.imgMesh.isAdd&&(i.threelayer?(i.threelayer.addMesh(i.imgMesh),i.opacityItems&&i._bindMapEvents()):i.dispose())}))}},{key:"clearImage",value:function(){this.imgMesh&&(this.threelayer.removeMesh(this.imgMesh),this.opacityItems&&this._closeEvent())}},{key:"dispose",value:function(){this.imgMesh&&(!0===this.imgMesh.isAdd&&this.threelayer.removeMesh(this.imgMesh),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.texture&&(this.texture&&this.texture.dispose(),delete this.texture),this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),t}(),T={altitude:0,imageWidth:512,imageHeight:512,texture:null},C=function(t){d(i,t);var e=g(i);function i(t,r,n,s,h){var c;l(this,i);var u=(n=a.Util.extend({},T,n)).altitude,f=h.distanceToVector3(r,r).x,d=new o.CircleGeometry(f,32);(c=e.call(this))._initOptions(n),c._createMesh(d,s);var m=h.distanceToVector3(u,u).x,p=h.coordinateToVector3(t,m);return c.getObject3d().position.copy(p),c.parent=null,c.type="radarObject",c}return f(i)}(r.BaseObject),I=function(){function t(e,i,r,n,a){l(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a,this.imgUrl=r.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var s=new o.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n //vec3 color = vec3(0.0, 0.0, 0.0);\n vec3 color = vec3(0.0, 147. / 255., 1.0);\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n outRad = 0.6;\n move = sin(time/10.0);\n smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n outRad = 0.4;\n move = cos(time/10.0);\n smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n // Radial spoke gradations\n float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr *= 0.75;\n // Blue circular radar blip traces\n vec2 st_trace1 = left2;\n float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n\n vec2 st_trace2 = right1;\n float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n // Red Trianglular radar flight blip trace\n vec2 st_trace3 = left1;\n float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n\n vec2 st_trace4 = right2;\n float st2 = s * (drawPolygon(st_trace4, N, r_red, pos)); \n // Lets add all the bits together and send them to screen\n float s_grn = max(s * mapcol.y, s_blade);\n s_grn = max(s_grn, (s0 + sr + sm));\n s_grn += s1 / 1.5 + smb + smr;\n\n float s_red = st1*2.0 + st2*2.0 + smr;\n \n float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n\n if (s_trace1 > 0.0 || s_trace2 > 0.0) { s_blue = max(s, s_blue); s_grn = max(s_grn, s_blue); }\n\n color += vec3(s_red , s_grn, s_blue); \n vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:o.DoubleSide,transparent:!0});this.radar=new C(e,i,{},s,n),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return f(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),O={radius:100,altitude:0},L=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i),r=a.Util.extend({},O,r,{layer:s,coordinate:t}),(h=e.call(this))._initOptions(r);var c=r,u=c.altitude,f=c.radius,d=s.distanceToVector3(f,f).x,m=r.thetaStart||0,p=r.thetaLength||90,v=new o.CircleGeometry(d,128,m*Math.PI/180,p*Math.PI/180);h._createMesh(v,n);var g=s.distanceToVector3(u,u).x,y=s.coordinateToVector3(t,g);return h.getObject3d().position.copy(y),h}return f(i)}(r.BaseObject),P=function(){function t(e,i,r,n,a){l(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a;var s=r.thetaLength||90,h=r.rotation||0,c=s/2;this.imgUrl=r.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=h-c;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var f=new o.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n varying vec2 vUv;\n void main() {\n vec2 uv = vUv;\n //uv = uv.xy - vec2(0.5, 0.5);\n //gl_FragColor = texture2D(map, uv);\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0.5);\n }",side:o.DoubleSide,transparent:!0,depthTest:!1});this.sector=new L(e,{thetaStart:u,thetaLength:r.thetaLength,radius:i},f,n),this.threelayer.addMesh(this.sector)}return f(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),j={altitude:0,height:0},A=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i),n=a.Util.extend({},j,n,{layer:s}),h=e.call(this);var c=n,u=c.width,f=c.height,d=c.altitude;h._initOptions(n);var m=new o.PlaneGeometry(u,f);m.computeBoundingBox();var p=new o.Mesh(m,r);h._createGroup(),h.getObject3d().add(p);var v=s.distanceToVector3(d,d).x,g=s.coordinateToVector3(t,v);return p.position.set(0,m.boundingBox.max.y,0),h.getObject3d().position.copy(g),h}return f(i)}(r.BaseObject);function z(t,e,i,r,n,a){this.tilesHorizontal=e,this.tilesVertical=i,this.numberOfTiles=r,t.wrapS=t.wrapT=o.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=n,this.currentDisplayTime=0,this.currentTile=0,this.flag=a,this.update=function(e){for(this.currentDisplayTime+=e;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var i=this.currentTile%this.tilesHorizontal;t.offset.x=i/this.tilesHorizontal;var r=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-r/this.tilesVertical:t.offset.y=1-r/this.tilesVertical-1/this.tilesVertical}}}var F=function(){function t(e,i,r,n,a){var s=this;l(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a;var h=r.thetaLength||45;this.millsec=r.millsec||1e3,this.duration=r.duration||75,this.tilesHoriz=r.tilesHoriz||12,this.tilesVert=r.tilesVert||5,this.numTiles=r.numTiles||49;var c=r.rotation||0,u=h/2,f=n.distanceToVector3(i,i).x,d=Math.sin(u*Math.PI/180)*f*2,m=void 0===r.flag;this.imgUrl=r.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s.annie=new z(t,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,m);var i=new o.MeshBasicMaterial({transparent:!0,map:t,side:o.DoubleSide,depthTest:!1});s.imgObj=new A(e,i,{width:d,height:f},n),s.imgObj.object3d.renderOrder=1,s.imgObj.object3d.rotation.z=c*Math.PI/180,s.threelayer.addMesh(s.imgObj),s.layerClass.updatables.push(s)}))}return f(t,[{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),D={radius:100,altitude:0},E=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i),r=a.Util.extend({},D,r,{layer:s}),h=e.call(this);var c=r,u=c.width;c.height;var f=c.altitude;h._initOptions(r);var d=new o.CircleGeometry(u,32);h._createMesh(d,n);var m=s.distanceToVector3(f,f).x,p=s.coordinateToVector3(t,m);return h.getObject3d().position.copy(p),h}return f(i)}(r.BaseObject),U=function(){function t(e,i,r,n){var a=this;l(this,t),this.threelayer=r,this.map=r.map,this.layerClass=n,this.time=0,r.coordinateToVector3(e,0),this.imgUrl=i.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){a.texture=t,a._uniforms={impactPosition:{value:new o.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:a.texture}};var i=new o.ShaderMaterial({uniforms:a._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:o.DoubleSide,transparent:!0,depthTest:!1}),n=new E(e,{width:2,height:2},i,r);a.threelayer.addMesh(n),a.layerClass.updatables.push(a)}))}return f(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),V=6371008.8,R={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*V,kilometers:6371.0088,kilometres:6371.0088,meters:V,metres:V,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:V/1852,radians:1,yards:6967335.223679999};function B(t){return t%360*Math.PI/180}function Z(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function N(t,e,i){void 0===i&&(i={});var r=Z(t),n=Z(e),a=B(n[1]-r[1]),o=B(n[0]-r[0]),s=B(r[1]),h=B(n[1]),c=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(s)*Math.cos(h);return function(t,e){void 0===e&&(e="kilometers");var i=R[e];if(!i)throw new Error(e+" units is invalid");return t*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function G(t,e,i){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var n=0,a=e.length-1;n<e.length;a=n++){var o=e[n][0],s=e[n][1],h=e[a][0],c=e[a][1];if(t[1]*(o-h)+s*(h-t[0])+c*(t[0]-o)==0&&(o-t[0])*(h-t[0])<=0&&(s-t[1])*(c-t[1])<=0)return!i;s>t[1]!=c>t[1]&&t[0]<(h-o)*(t[1]-s)/(c-s)+o&&(r=!r)}return r}var W=document.createElement("canvas"),H=function(){function t(){l(this,t),this.type="gisCommon"}return f(t,null,[{key:"getTexture",value:function(t,e,i,r){var n=t.getContext("2d");n.drawImage(e,i,r);var a=new o.Texture(n.getImageData(0,0,t.width,t.height));return a.minFilter=o.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"getTexture1",value:function(t,e,i,r,n){W.width=W.height=128;var a=W.getContext("2d");a.drawImage(t,e,i,r,n);var s=new o.Texture(a.getImageData(0,0,W.width,W.height));return s.minFilter=o.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,i){var r=document.createElement("img");r&&!r.crossOrigin&&(r.crossOrigin="Anonymous"),r.onload=function(){return e(r)},r.onerror=i,r.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,i){var r=document.createElement("img");r.onload=function(){return e(r)},r.onerror=i,r.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,e,i){if(1e3*N({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.x,e.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.radius){var r=i.coordinateToVector3([e.x,e.y],0),n=i.coordinateToVector3(t,0).sub(r).normalize(),a=i.distanceToVector3(e.radius,e.radius).x,s=new o.Vector3(r.x,r.y+a,0).sub(r).normalize(),h=((n.clone().cross(s).z<0?-1:1)*Math.acos(n.dot(s))*180/Math.PI).toFixed(2);(h=parseFloat(h))<0&&(h=h+180+180);var c=parseFloat(e.begin),l=parseFloat(e.end);if(c>l){if(h>=c||h<=l)return!0}else if(h>=c&&h<=l)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*N({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.getCenter().x,e.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.getRadius()}},{key:"containsCoordinate2",value:function(t,e){return function(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r,n=Z(t),a="Feature"===(r=e).type?r.geometry:r,o=a.type,s=e.bbox,h=a.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,s))return!1;"Polygon"===o&&(h=[h]);for(var c=!1,l=0;l<h.length&&!c;l++)if(G(n,h[l][0],i.ignoreBoundary)){for(var u=!1,f=1;f<h[l].length&&!u;)G(n,h[l][f],!i.ignoreBoundary)&&(u=!0),f++;u||(c=!0)}return c}({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(t,e){var i,r;Array.isArray(t)?(i=t[0],r=t[1]):t instanceof a.Coordinate&&(i=t.x,r=t.y);var n=e.xmin,o=e.ymin,s=e.xmax,h=e.ymax;return n<=i&&i<=s&&o<=r&&r<=h}},{key:"isInLevels",value:function(t,e){for(var i=!1,r=0;r<t.rangeArr.length;r+=2){var n=1*t.rangeArr[r],a=1*t.rangeArr[r+1];if(e>n&&e<=a){i=!0;break}}return i}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,i=1/0,r=-1/0,n=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,i=1*t[0].latitude-.5,r=1*t[0].longitude+.5,n=1*t[0].latitude+.5):t.length>1&&t.slice(0,1/0).map((function(t){var a=1*t.longitude,o=1*t.latitude;e=Math.min(e,a),i=Math.min(i,o),r=Math.max(r,a),n=Math.max(n,o)})),{minX:e,minY:i,maxX:r,maxY:n}}}},{key:"vector2Pixel",value:function(t,e,i){var r=t.project(i),n=e.width/2,a=e.height/2;return{x:Math.round(r.x*n+n),y:Math.round(-r.y*a+a)}}},{key:"generateTextureOne",value:function(t,e,i){W.width=e,W.height=i;var r=W.getContext("2d");r.drawImage(t,0,0,e,i);var n=new o.Texture(r.getImageData(0,0,W.width,W.height));return n.magFilter=o.NearestFilter,n.minFilter=o.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,n}},{key:"generateTexture",value:function(t){var e=[64,128,256,512,1024],i=-1/0;t.forEach((function(t){i=Math.max(i,t.w),Math.max(i,t.h)}));var r=Math.sqrt(t.length),n=parseInt(r);r>n&&(n+=1);for(var a=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(a<e[h]){s=e[h];break}s=1024}W.width=W.height=s;for(var c=W.getContext("2d"),l=0,u=0,f=[],d=0;d<r;d++){for(var m=5*(d+1)+d*l,p=0;p<r;p++){var v=5*(p+1)+p*t[u].w;if("img"===t[u].type){var g=(t[u].w-t[u].iw)/2,y=(t[u].h-t[u].ih)/2;c.drawImage(t[u].src,v+g,m+y,t[u].iw,t[u].ih)}else if("txt"===t[u].type)c.fillStyle=t[u].color,"#fff"===t[u].color?(c.font="lighter "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,v+t[u].offx,m+t[u].offy),c.strokeStyle=t[u].color,c.strokeText(t[u].src,v+t[u].offx,m+t[u].offy)):(c.font="normal "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,v+t[u].offx,m+t[u].offy));else{var x=(t[u].w-t[u].iw)/2,w=(t[u].h-t[u].ih)/2,b=t[u].offx||0,_=t[u].offy||0;c.drawImage(t[u].src,v+x+b,m+w+_,t[u].iw,t[u].ih)}if(f.push({w:t[u].w,h:t[u].h,u:v/s,v:m/s}),l=Math.max(l,t[u].h),(u+=1)>=t.length)break}if(u>=t.length)break}var k=new o.Texture(c.getImageData(0,0,W.width,W.height));return k.minFilter=o.LinearFilter,k.generateMipmaps=!1,k.needsUpdate=!0,{xys:f,texture:k,textureSize:s}}},{key:"generateTextureNew",value:function(t){var e=[64,128,256,512,1024],i=-1/0;t.forEach((function(t){i=Math.max(i,t.w),Math.max(i,t.h)}));var r=Math.sqrt(t.length),n=parseInt(r);r>n&&(n+=1);for(var a=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(a<e[h]){s=e[h];break}s=1024}W.width=W.height=s;for(var c=W.getContext("2d"),l=0,u=0,f=0,d=[],m=0;m<r;m++){for(var p=5*(m+1)+m*l,v=0;v<r;v++){var g=5*(v+1)+f;if("img"===t[u].type){var y=(t[u].w-t[u].iw)/2,x=(t[u].h-t[u].ih)/2;c.drawImage(t[u].src,g+y,p+x,t[u].iw,t[u].ih)}else if("txt"===t[u].type)c.fillStyle=t[u].color,"#fff"===t[u].color?(c.font="lighter "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,g+t[u].offx,p+t[u].offy),c.strokeStyle=t[u].color,c.strokeText(t[u].src,g+t[u].offx,p+t[u].offy)):(c.font="normal "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,g+t[u].offx,p+t[u].offy));else{var w=(t[u].w-t[u].iw)/2,b=(t[u].h-t[u].ih)/2,_=t[u].offx||0,k=t[u].offy||0;c.drawImage(t[u].src,g+w+_,p+b+k,t[u].iw,t[u].ih)}if(d.push({w:t[u].w,h:t[u].h,u:g/s,v:p/s}),l=Math.max(l,t[u].h),f+=t[u].w,(u+=1)>=t.length)break}if(u>=t.length)break}var M=new o.Texture(c.getImageData(0,0,W.width,W.height));return M.minFilter=o.LinearFilter,M.generateMipmaps=!1,M.needsUpdate=!0,{xys:d,texture:M,textureSize:s}}},{key:"generateTextureOptimize",value:function(t){var e=[64,128,256,512,1024],i=-1/0;t.forEach((function(t){i=Math.max(i,t.w),Math.max(i,t.h)}));var r=Math.sqrt(t.length),n=parseInt(r);r>n&&(n+=1);for(var a=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(a<e[h]){s=e[h];break}s=1024}W.width=W.height=s;for(var c=W.getContext("2d"),l=0,u=0,f={},d=0;d<r;d++){for(var m=5*(d+1)+d*l,p=0,v=0;v<r;v++){var g=5*(v+1)+p,y=(t[u].w-t[u].iw)/2,x=(t[u].h-t[u].ih)/2;if(c.drawImage(t[u].src,g+y,m+x,t[u].iw,t[u].ih),f[t[u].key]={w:t[u].w,h:t[u].h,u:g/s,v:m/s},l=Math.max(l,t[u].h),p+=t[u].w,(u+=1)>=t.length)break}if(u>=t.length)break}var w=new o.Texture(c.getImageData(0,0,W.width,W.height));return w.minFilter=o.LinearFilter,w.generateMipmaps=!1,w.needsUpdate=!0,{xys:f,texture:w,textureSize:s}}},{key:"setPointEventStatus",value:function(t,e){t&&t.getMeshes().forEach((function(t){"Points"===t.type&&(t.options.interactive=e)}))}},{key:"createTextTexture",value:function(t,e){W.width=W.height=t;var i=W.width/2,r=W.height/2;if(e){var n=0;e.forEach((function(t){var e=W.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,i,r+n),n+=t.fontsize}))}var a=new o.Texture(W);return a.minFilter=o.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"createTextAndBgTexture",value:function(t,e,i,r){var n=document.createElement("canvas");n.width=t,n.height=e;var a=n.getContext("2d");a.drawImage(i,0,0,t,e);var s=n.width/2,h=n.height/2;a.textAlign="center",a.textBaseline="middle",a.fillStyle="#FFF",a.font="".concat(r.fontsize,"px Arial"),a.fillText(r.txt,s,h);var c=new o.Texture(n);return c.magFilter=o.NearestFilter,c.minFilter=o.NearestFilter,c.needsUpdate=!0,c}},{key:"getIntColor",value:function(t){var e=parseInt(255*t.r);return e=((e=(e<<8)+parseInt(255*t.g))<<8)+parseInt(255*t.b)}},{key:"colorIntToRGB",value:function(t){var e=t>>16&255,i=t>>8&255,r=255&t;return new o.Color("rgb(".concat(e,",").concat(i,",").concat(r,")"))}},{key:"createSimpleShader",value:function(t,e,i){return t.uniforms.texture1={value:e},t.uniforms.size1={value:i},t.uniforms.flag={value:1},t.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+t.vertexShader,t.vertexShader=t.vertexShader.replace("#include <project_vertex>","\n #include <project_vertex>\n vimgflag = imgflag;\n vVisible = visibility;\n ").replace("gl_PointSize = size;","\n gl_PointSize = size1;\n "),t.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+t.fragmentShader,t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( outgoingLight, diffuseColor.a );","\n\n vec2 pUv = gl_PointCoord;\n pUv.y = 1. - pUv.y;\n\n if(vimgflag < 1.0){\n vec4 texColor = texture2D( texture1, pUv );\n outgoingLight *= texColor.xyz;\n gl_FragColor = vec4( outgoingLight, texColor.a * diffuseColor.a );\n }\n\n if (vVisible < 0.5) discard;\n "),t}},{key:"calTextWidth",value:function(t,e){var i=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return i*e+.5*(t.length-i)*e}}]),t}();function Y(t,e,i,r,n,a,o,s,h,c){var l=t.split("\n"),u=[],f={positionedGlyphs:u,text:t,top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,lineCount:l.length};return function(t,e,i,r,n,a,o,s,h){var c=0,l=-17,u=0,f=t.positionedGlyphs,d="right"===a?1:"left"===a?0:.5,m=f.length;i.forEach((function(t){if(t.split("").forEach((function(t){var i=e[h],r=t.charCodeAt(0),n=i&&i[r];n&&(f.push({glyph:r,x:c,y:l+0,vertical:!1,scale:1,fontStack:h}),c+=n.metrics.advance+s)})),f.length!==m){var i=c-s;u=Math.max(i,u),function(t,e,i,r,n){if(n){var a=t[r],o=e[a.fontStack],s=o&&o[a.glyph];if(s)for(var h=s.metrics.advance*a.scale,c=(t[r].x+h)*n,l=i;l<=r;l++)t[l].x-=c}}(f,e,m,f.length-1,d)}c=0,l+=r}));var p=function(t){var e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}(n),v=p.horizontalAlign,g=p.verticalAlign;!function(t,e,i,r,n,a,o){for(var s=(e-i)*n,h=(-r*o+.5)*a,c=0;c<t.length;c++)t[c].x+=s,t[c].y+=h}(f,d,v,g,u,r,i.length);var y=l- -17;t.top+=-g*y,t.bottom=t.top+y,t.left+=-v*u,t.right=t.left+u}(f,e,l,n,a,o,0,s,i),!!u.length&&f}var q=X;function X(t,e){this.x=t,this.y=e}X.prototype={clone:function(){return new X(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=e*this.x-i*this.y,n=i*this.x+e*this.y;return this.x=r,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.x+i*(this.x-e.x)-r*(this.y-e.y),a=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=n,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},X.convert=function(t){return t instanceof X?t:Array.isArray(t)?new X(t[0],t[1]):t};var K={radius:40,altitude:0},J=function(t){d(i,t);var e=g(i);function i(t,r,n,s,h,c,u,f){var d;l(this,i);var m=function(t){for(var e=1/0,i=1/0,r=-1/0,n=-1/0,o=0,s=t.length;o<s;o++){var h=t[o],c=h.coordinate,l=h.lnglat,u=h.lnglats,f=h.xy,d=h.xys,m=c||l||u||f||d||t[o],p=void 0,v=void 0;Array.isArray(m)?(p=m[0],v=m[1]):m instanceof a.Coordinate&&(p=m.x,v=m.y),e=Math.min(e,p),i=Math.min(i,v),r=Math.max(r,p),n=Math.max(n,v)}return new a.Coordinate((e+r)/2,(i+n)/2)}(t);d=e.call(this),r=a.Util.extend({center:m,layer:f},K,r),d._initOptions(r);var p=d.getLayer().getPick();d._colorMap={},d._datas=t,d._childCount=u;var v=f.coordinateToVector3(m);d.glyphMap=h,d.glyphAtlas=c;for(var g=new o.InstancedBufferGeometry,y=new Uint16Array([0,1,2,2,3,0]),x=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),w=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),b=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),k=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),M=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),S=new o.InstancedBufferAttribute(new Float32Array(3*d._childCount),3,!0),T=0,C=function(e){var i=t[e],r=i.texts,n=i.markers,a=p.getColor(),o=a.getHex();d._colorMap[o]=e,d._datas[e].colorIndex=o,n&&n.forEach((function(i){if(w.setXYZW(T,i.markerWidth,i.markerHeight,i.markerDx,i.markerDy),b.setXYZW(T,i.u,i.v,-16,16),i.markerColor){var r=_(0,255);M.setXYZW(T,r,0,0,0);var n=d.getColorVector2(i.markerColor,i.markerOpacity);k.setXYZW(T,n[0],n[1],i.w,i.h)}else{var o=_(0,0);M.setXYZW(T,o,0,0,0);var s=d.getColorVector2("#fff",i.markerOpacity);k.setXYZW(T,s[0],s[1],i.w,i.h)}S.setXYZ(T,a.r,a.g,a.b),i.markerIndex=T,T+=1,t[e].childNum+=1})),r&&r.forEach((function(i){var r=d.getColorVector2(i.textColor,i.textOpacity),n=_(255,0);d.buildTextBuffers("".concat(i.text),i.textAnchor,"center",i.textSpacing).forEach((function(o){if(w.setXYZW(T,i.textSize,0,i.textDx,i.textDy),b.setXYZW(T,o[0],o[1],o[2],o[3]),i.textHaloColor){var s=d.getColorVector2(i.textHaloColor,i.textHaloOpacity);k.setXYZW(T,r[0],r[1],s[0],s[1]);var h=i.textHaloRadius;M.setXYZW(T,n,h,0,0)}else k.setXYZW(T,r[0],r[1],0,0),M.setXYZW(T,n,-1.9,0,0);S.setXYZ(T,a.r,a.g,a.b),i.textIndex.push(T),T+=1,t[e].childNum+=1}))}))},I=0;I<t.length;I++)C(I);g.setIndex(new o.Uint16BufferAttribute(y,1)),g.setAttribute("uv_offset",new o.Float32BufferAttribute(x,4,!0)),g.setAttribute("size",w),g.setAttribute("uv_image",b),g.setAttribute("color",k),g.setAttribute("util",M),g.setAttribute("pickingColor",S),d._createInstancedMesh(g,n,d._childCount),d.getObject3d().instanceMatrix.setUsage(o.DynamicDrawUsage);var O=new o.InstancedMesh(g,s,d._childCount);O.instanceMatrix.setUsage(o.DynamicDrawUsage);var L=p.getColor().getHex();O._colorIndex=L,d.setPickObject3d(O);var P=new o.Object3D;T=0,t.forEach((function(e,i){if(e.visible){var r=f.coordinateToVector3(e.coordinate);r.sub(v),e.height&&(r.z=f.altitudeToVector3(e.height).x);for(var n=0;n<t[i].childNum;n++)P.position.set(r.x,r.y,0),P.updateMatrix(),d.getObject3d().setMatrixAt(T,P.matrix),O.setMatrixAt(T,P.matrix),T+=1}}));var j=f.altitudeToVector3(r.altitude,r.altitude).x;return v.z=j,d.getObject3d().position.copy(v),O.position.copy(d.getObject3d().position),d.parent=null,d.pickMesh=O,d.threeLayer=f,d.center=v,d._init(),d}return f(i,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getColorVector2",value:function(t,e){var i,r=new o.Color(t).getHexString(),n=(i="#".concat(r),{r:parseInt(i.slice(1,3),16),g:parseInt(i.slice(3,5),16),b:parseInt(i.slice(5,7),16)}),a=n.b;return[_(n.r,n.g),_(a,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,i,r){var n=[],a=[0,0],o=Y(t,this.glyphMap,"sans-serif",0,24,e,i,r,a,1);if(o){var s=function(t,e,i,r){for(var n=t.positionedGlyphs,a=[],o=0;o<n.length;o++){var s=n[o],h=r[s.fontStack],c=h&&h[s.glyph];if(c){var l=c.rect;if(l){var u=c.metrics.advance*s.scale/2,f=i?[s.x+u,s.y]:[0,0],d=i?[0,0]:[s.x+u+e[0],s.y+e[1]],m=(c.metrics.left-4)*s.scale-u+d[0],p=(-c.metrics.top-4)*s.scale+d[1],v=m+l.w*s.scale,g=p+l.h*s.scale,y=new q(m,p),x=new q(v,p),w=new q(m,g),b=new q(v,g);a.push({tl:y,tr:x,bl:w,br:b,tex:l,writingMode:t.writingMode,glyphOffset:f})}}}return a}(o,a,!1,this.glyphAtlas.positions);s.forEach((function(t){n.push([t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y])}))}return n}},{key:"changeVisible",value:function(){var t=this,e=new o.Object3D;this._datas.forEach((function(i,r){var n=t.threeLayer.coordinateToVector3(i.coordinate);n.sub(t.center),i.height&&(n.z=t.threeLayer.altitudeToVector3(i.height).x),!1===i.visible?e.position.set(-999,-999,0):e.position.set(n.x,n.y,0),e.updateMatrix(),i.markers&&i.markers.forEach((function(i){t.getObject3d().setMatrixAt(i.markerIndex,e.matrix),t.pickMesh.setMatrixAt(i.markerIndex,e.matrix)})),i.texts&&i.texts.forEach((function(i){i.textIndex.forEach((function(i){t.getObject3d().setMatrixAt(i,e.matrix),t.pickMesh.setMatrixAt(i,e.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),i}(r.BaseObject),$=function(){function t(e,i){l(this,t),this.createImage(e,1,i)}return f(t,[{key:"createImage",value:function(t,e,i){var r=t.width,n=t.height;if(i){if(i.length!==r*n*e)throw new RangeError("mismatched image size")}else i=new Uint8Array(r*n*e);this.width=r,this.height=n,this.data=i}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,i,r,n){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,h=0;h<n.height;h++)for(var c=((i.y+h)*t.width+i.x)*a,l=((r.y+h)*e.width+r.x)*a,u=0;u<n.width*a;u++)s[l+u]=o[c+u];return e}}]),t}();var Q=f((function t(e){l(this,t);var i={},r=[];for(var n in e){var a=e[n],o=i[n]={};for(var s in a){var h=a[+s];if(h&&0!==h.bitmap.width&&0!==h.bitmap.height){var c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),o[s]={rect:c,metrics:h.metrics}}}}var u=function(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,a=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,a=Math.max(a,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}(r),f=u.w,d=u.h,m=new $({width:f||1,height:d||1});for(var p in e){var v=e[p];for(var g in v){var y=v[+g];if(y&&0!==y.bitmap.width&&0!==y.bitmap.height){var x=i[p][g].rect;$.copy(y.bitmap,m,{x:0,y:0},{x:x.x+1,y:x.y+1},y.bitmap)}}}this.image=m,this.positions=i})),tt={exports:{}};tt.exports=it,tt.exports.default=it;var et=1e20;function it(t,e,i,r,n,a){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=r||.25,this.fontFamily=n||"sans-serif",this.fontWeight=a||"normal",this.radius=i||8;var o=this.size=this.fontSize+2*this.buffer,s=o+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=o,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(o/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function rt(t,e,i,r,n,a){for(var o=0;o<e;o++)nt(t,o,e,i,r,n,a);for(var s=0;s<i;s++)nt(t,s*e,1,e,r,n,a)}function nt(t,e,i,r,n,a,o){var s,h,c,l;for(a[0]=0,o[0]=-et,o[1]=et,s=0;s<r;s++)n[s]=t[e+s*i];for(s=1,h=0,c=0;s<r;s++){do{l=a[h],c=(n[s]-n[l]+s*s-l*l)/(s-l)/2}while(c<=o[h]&&--h>-1);a[++h]=s,o[h]=c,o[h+1]=et}for(s=0,h=0;s<r;s++){for(;o[h+1]<s;)h++;l=a[h],t[e+s*i]=n[l]+(s-l)*(s-l)}}it.prototype._draw=function(t,e){var i,r,n,a,o,s,h,c,l,u=this.ctx.measureText(t),f=u.width,d=2*this.buffer;e&&this.useMetrics?(o=Math.floor(u.actualBoundingBoxAscent),c=this.buffer+Math.ceil(u.actualBoundingBoxAscent),s=this.buffer,h=this.buffer,i=(r=Math.min(this.size,Math.ceil(u.actualBoundingBoxRight-u.actualBoundingBoxLeft)))+d,n=(a=Math.min(this.size-s,Math.ceil(u.actualBoundingBoxAscent+u.actualBoundingBoxDescent)))+d,this.ctx.textBaseline="alphabetic"):(i=r=this.size,n=a=this.size,o=19*this.fontSize/24,s=h=0,c=this.middle,this.ctx.textBaseline="middle"),r&&a&&(this.ctx.clearRect(h,s,r,a),this.ctx.fillText(t,this.buffer,c),l=this.ctx.getImageData(h,s,r,a));var m=new Uint8ClampedArray(i*n);return function(t,e,i,r,n,a,o){a.fill(et,0,e*i),o.fill(0,0,e*i);for(var s=(e-r)/2,h=0;h<n;h++)for(var c=0;c<r;c++){var l=(h+s)*e+c+s,u=t.data[4*(h*r+c)+3]/255;if(1===u)a[l]=0,o[l]=et;else if(0===u)a[l]=et,o[l]=0;else{var f=Math.max(0,.5-u),d=Math.max(0,u-.5);a[l]=f*f,o[l]=d*d}}}(l,i,n,r,a,this.gridOuter,this.gridInner),rt(this.gridOuter,i,n,this.f,this.v,this.z),rt(this.gridInner,i,n,this.f,this.v,this.z),function(t,e,i,r,n,a,o){for(var s=0;s<e*i;s++){var h=Math.sqrt(r[s])-Math.sqrt(n[s]);t[s]=Math.round(255-255*(h/a+o))}}(m,i,n,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:m,metrics:{width:r,height:a,sdfWidth:i,sdfHeight:n,top:o,left:0,advance:f}}},it.prototype.draw=function(t){return this._draw(t,!1).data},it.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var at=tt.exports,ot={},st={};var ht=function(){function t(e,i,r){var n=this;l(this,t);var a=i.pointMinZoom,o=i.pointOrder;if(0!=e.length){var s=[];this.charArray="",this.imgDict={},this.threeLayer=r,this.map=r.map,this.interactive=void 0===i.interactive||i.interactive,this.beginSizeZoom=i.beginSizeZoom||3,this.endSizeZoom=i.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=i.altitude||0,this.textMinZoom=i.textMinZoom||0,this.textMaxZoom=i.textMaxZoom||30,this.textMinMaxZooms=i.textMinMaxZooms,this.childCount=0,e.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&n._bindDataItem(s,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=s,this.point=null,this.shader=null,this.minZoom=a||8,this.maxZoom=i.pointMaxZoom||20,this.order=o||0,this.isToolTip=i.isToolTip||!1,this.clickFunc=i.clickFunc||null,this.cFunc=i.cFunc||null,this.mouseMoveFunc=i.mouseMoveFunc||null,this.mouseOutFunc=i.mouseOutFunc||null,this.mMoveFunc=i.mMoveFunc||null,this.hasAlign=i.hasAlign||!1,this.zoomChangeCallback=i.zoomChangeCallback}else console.error("需要绘制的点位数量为0")}var e,i,r,n;return f(t,[{key:"_putImgToDict",value:function(t,e,i){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:i}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+i)/2)}},{key:"_bindDataItem",value:function(t,e){var i={coordinate:[parseFloat(e.longitude),parseFloat(e.latitude)],height:void 0!==e.height?parseFloat(e.height):0,visible:void 0===e.visible||e.visible,code:e.code,status:void 0!==e.status?e.status:1,name:e.name,childNum:0,data:e.data},r=e.texts;if(r){i.texts=[];for(var n=0,a=0;a<r.length;a++){var o=r[a];if(o.text&&o.text.length>0){n+=o.text.length,this.charArray=b(this.charArray,o.text);var s={text:o.text,textSize:o.textSize||14,textDx:o.textDx||0,textDy:o.textDy||0,textColor:o.textColor||"#fff",textAnchor:o.textAnchor||"center",textSpacing:o.textSpacing||2,textOpacity:o.textOpacity||255,textIndex:[]};o.textHaloColor&&(s=Object.assign(s,{textHaloColor:o.textHaloColor,textHaloRadius:o.textHaloRadius||1,textHaloOpacity:void 0!==o.textHaloOpacity?o.textHaloOpacity:255})),i.texts.push(s)}}this.childCount+=n}var h=e.markers;if(h){i.markers=[];for(var c=0,l=0;l<h.length;l++){var u=h[l];u.imgSrc&&(c+=1,this._putImgToDict(u.imgSrc,u.markerWidth||40,u.markerHeight||40),i.markers.push({markerWidth:1*u.markerWidth||40,markerHeight:1*u.markerHeight||40,markerDx:1*u.markerDx||0,markerDy:1*u.markerDy||0,markerColor:u.markerColor,markerOpacity:1*u.markerOpacity||255,key:u.imgSrc,markerIndex:-1}))}this.childCount+=c}t.push(i)}},{key:"_loadTexture",value:(n=c(s().mark((function t(){var e,i,r,n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=s().keys(this.imgDict);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(i=t.t1.value,r=i,!i.includes(".svg")){t.next=12;break}return t.next=8,fetch(i);case 8:return n=t.sent,t.next=11,n.text();case 11:r=t.sent;case 12:return t.next=14,H.addImageProcess(r);case 14:a=t.sent,e.push({key:i,src:a,w:this.imgDict[i].width,h:this.imgDict[i].height,iw:this.imgDict[i].width,ih:this.imgDict[i].height}),t.next=2;break;case 18:return t.abrupt("return",H.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var t=this.charArray.split("").map((function(t){return function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1?arguments[1]:void 0,r=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),i="400";return/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),{fontFamily:e,fontWeight:i}}(e),n=r.fontFamily,a=r.fontWeight,o=i.charCodeAt(0),s=ot[e];return s||(s=ot[e]=new at(24,3,8,.25,n,a)),st[e]||(st[e]={}),st[e][i]||(st[e][i]=s.ctx.measureText(i).width),{id:o,bitmap:new $({width:30,height:30},s.draw(i)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=o,t>=19968&&t<=40959?24:st[e][i])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new Q(this.glyphMap)}},{key:"addPoint",value:(r=c(s().mark((function t(){var e,i,r,n,a,h,c,l=this;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this._loadTexture();case 4:return e=t.sent,this.textures||(this.textures=[]),this.textures.push(e.texture),this.initGlyphAtlas(),i=this.glyphAtlas.image,r=i.width,n=i.height,a=i.data,(h=new o.DataTexture(a,r,n)).needsUpdate=!0,h.magFilter=o.LinearFilter,h.minFilter=o.LinearFilter,h.format=o.AlphaFormat,this.textures.push(h),this.m=this._getRawShaderMaterial(e,h,r,n),this.m.depthTest=!1,this.m_pick=this._getRawShaderMaterial(e,h,r,n),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,e.xys[t.key])}))})),(c=new J(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){l.m.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m.uniforms.zoomScale.value=76.43702828517625/l.map.getResolution(),l.m_pick.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m_pick.uniforms.zoomScale.value=76.43702828517625/l.map.getResolution();for(var t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,i=0,r=0;r<l.dataItems.length;r++){var n=l.dataItems[r];if(n.markers)for(var a=0;a<n.markers.length;a++)e[4*i+0]=n.markers[a].markerWidth*t,e[4*i+1]=n.markers[a].markerHeight*t,e[4*i+2]=n.markers[a].markerDx*t,e[4*i+3]=n.markers[a].markerDy*t,i+=1;if(n.texts)for(var o=function(){var r=n.texts[s].textSize,a=n.texts[s].textDx,o=n.texts[s].textDy;n.texts[s].textIndex.forEach((function(){e[4*i+0]=r*t,e[4*i+1]=0,e[4*i+2]=a*t,e[4*i+3]=o*t,i+=1}))},s=0;s<n.texts.length;s++)o()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},this.isToolTip&&c.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),c.object3d.renderOrder=this.order,this.point=c,this.point.parent=this,this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 30:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,i,r){return new o.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:e},sdfTextureSize:{value:[i,r]},canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:76.43702828517625/this.map.getResolution()},mapPitch:{value:this.map.getPitch()*Math.PI/180},gammaScale:{value:1}},vertexShader:"\n precision mediump float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform float mapPitch;\n uniform vec2 sdfTextureSize;\n uniform float imgTextureSize;\n\n attribute mat4 instanceMatrix;\n attribute vec4 size;\n attribute vec4 uv_offset;\n attribute vec4 uv_image;\n attribute vec4 util;\n varying vec4 vColor;\n\n #ifdef PICKING\n attribute vec3 pickingColor;\n #else\n varying vec2 vUv;\n varying float vGammaScale;\n varying float vSize;\n varying vec4 vUtil;\n attribute vec4 color;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n void main()\n {\n #ifdef PICKING\n vColor = vec4(pickingColor, 1.);\n #else\n vColor = color;\n vUtil = util;\n #endif\n vec2 utils1 = unpack_float(util.x) / 255.0;\n vec2 wh1 = uv_offset.zw * 32.;\n vec2 offset = vec2(uv_image.z + wh1.x, uv_image.w - wh1.y);\n \n vec2 j = vec2(offset.x + 16., offset.y - 16.);\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(0, 0, 0, 1.);\n float camera_to_anchor_distance = gl_Position.w;\n float distance_ratio = camera_to_anchor_distance / cameraToCenterDistance;\n float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, \n 1.5);\n float m = (1. - cameraToCenterDistance / camera_to_anchor_distance) * perspective_ratio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n vGammaScale = mix(1., B, perspective_ratio);\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n float width = uv_offset.x / imgTextureSize * color.z;\n float height = uv_offset.y / imgTextureSize * color.w;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n vec4 color = decode_color(vColor.xy);\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n float dist = texture2D(sdfTexture, vUv).a;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n lowp float buff = (177. + floor(fontScale)) / 256.0;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n gl_FragColor = color * alpha;\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n vec4 u_halo_color = decode_color(vColor.zw);\n float radius = u_halo_width / fontScale / 10.;\n float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n }\n }\n #endif\n }\n ",transparent:!0,side:o.DoubleSide})}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this),this.point&&this.point.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.map.off("pitch",this._setSizeOn,this),this.point&&this.point.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m_pick.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m.uniforms.mapPitch.value=this.map.getPitch()*Math.PI/180}},{key:"addContent",value:(i=c(s().mark((function t(e){return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:this.iconFile&&this._addIcon(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var i=e.name;if(this.isToolTip)this.point.getToolTip()._content="".concat(i)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"changeParaValue",value:(e=c(s().mark((function t(e){return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var i=0;i<this.dataItems.length;i++){this.dataItems[i].visible=!0}null===(e=this.point)||void 0===e||e.changeVisible()}},{key:"hide",value:function(){var t;null===(t=this.point)||void 0===t||t.hide()}},{key:"setInteractiveState",value:function(t){this.point&&(this.point.options.interactive=t)}},{key:"pointShowHideByCode",value:function(t,e,i){for(var r,n=1/0,o=1/0,s=-1/0,h=-1/0,c=0;c<this.dataItems.length;c++){var l=this.dataItems[c];t.includes(l.code)?(n=Math.min(n,this.dataItems[c].coordinate[0]),o=Math.min(o,this.dataItems[c].coordinate[1]),s=Math.max(s,this.dataItems[c].coordinate[0]),h=Math.max(h,this.dataItems[c].coordinate[1]),l.visible=!0):l.visible=!1}null===(r=this.point)||void 0===r||r.changeVisible(),e&&this.map.fitExtent(new a.Extent(n,o,s,h),i||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),i=new o.Object3D,r=0;this.dataItems.forEach((function(n){var a=t.threeLayer.coordinateToVector3(n.coordinate);if(a.sub(t.point.center),n.height&&(a.z=t.threeLayer.altitudeToVector3(n.height).x),n.markers&&(r+=n.markers.length),n.value&&t.showValueFlag)for(var o=0;o<n.value.length;o++)e<t.valueMinZoom||e>t.valueMaxZoom?i.position.set(-999,-999,0):i.position.set(a.x,a.y,0),i.updateMatrix(),t.point.getObject3d().setMatrixAt(r,i.matrix),t.point.pickMesh.setMatrixAt(r,i.matrix),r+=1;if(n.name&&t.showNameFlag)for(var s=0;s<n.name.length;s++)e<t.nameMinZoom||e>t.nameMaxZoom?i.position.set(-999,-999,0):i.position.set(a.x,a.y,0),i.updateMatrix(),t.point.getObject3d().setMatrixAt(r,i.matrix),t.point.pickMesh.setMatrixAt(r,i.matrix),r+=1})),this.point.getObject3d().instanceMatrix.needsUpdate=!0,this.point.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"dispose",value:function(){this.isToolTip&&this.point&&this.point.removeToolTip(),this._closeEvent(),this.point&&(this.threeLayer.removeMesh(this.point),this.point.object3d.geometry&&this.point.object3d.geometry.dispose(),this.point.object3d.material&&this.point.object3d.material.dispose(),this.point.pickObject3d.geometry&&this.point.pickObject3d.geometry.dispose(),this.point.pickObject3d.material&&this.point.pickObject3d.material.dispose(),this.point._datas=[],this.point._colorMap={},delete this.point.object3d,delete this.point.pickObject3d,this.point.toolTip&&delete this.point.toolTip,delete this.point),this.textures&&this.textures.length>0&&(this.textures.forEach((function(t){t.dispose()})),delete this.textures),this.m&&(this.m.dispose(),delete this.m),this.m_pick&&(this.m_pick.dispose(),delete this.m_pick),this.glyphMap={},this.glyphAtlas&&delete this.glyphAtlas}}]),t}(),ct=function(){function t(e,i){var n=this;l(this,t),this.map=i,this.animationId=null,this.updatables=[];var a=w();this.threeLayer=new r.ThreeLayer(a,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var s=function t(){var e,i;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(e=n.threeLayer)||void 0===e||null===(i=e.getRenderer())||void 0===i||i.clearCanvas(),n.threeLayer.renderScene());var r,a=n.clock.getDelta(),o=x(n.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(a)}}catch(t){o.e(t)}finally{o.f()}n.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,i){var r=new o.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),s()},this.threeLayer.addTo(i),this.layerId=a,this.layerName=e,this.dirty=!1,this.initFlag=!1}return f(t,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=w();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var i,r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(i=t.threeLayer)||void 0===i||null===(r=i.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,a=t.clock.getDelta(),o=x(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(a)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(i){t.threeLayer.prepareToDraw=function(t,r,n){var a=new o.DirectionalLight(16777215);a.position.set(0,-10,10).normalize(),r.add(a),r.add(new o.AmbientLight(16777215)),e(),i()}}))}},{key:"drawRadar",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new I(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new I(t,e,i||{},r.threeLayer,r);n(a)}))}))}},{key:"drawSector",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new P(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new P(t,e,i||{},r.threeLayer,r);n(a)}))}))}},{key:"drawSectorImg",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new F(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new F(t,e,i||{},r.threeLayer,r);n(a)}))}))}},{key:"drawImage",value:function(t,e,i,r){var n=this;return new Promise((function(a){if(n.threeLayer.getScene()){var o=new S(t,e,i,r,n.threeLayer);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new S(t,e,i,r,n.threeLayer);a(o)}))}))}},{key:"drawShock",value:function(t,e){var i=this;return new Promise((function(r){if(i.threeLayer.getScene()){var n=new U(t,e||{},i.threeLayer,i);r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new U(t,e||{},i.threeLayer,i);r(n)}))}))}},{key:"drawPlaneMarker",value:function(t,e){var i=this;return new Promise((function(r){if(i.threeLayer.getScene()){var n=null;t.length>0?(n=new ht(t,e,i.threeLayer)).addPoint().then((function(){r(n)})):r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=null;t.length>0?(n=new ht(t,e,i.threeLayer)).addPoint().then((function(){r(n)})):r(n)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),i=this.threeLayer.getScene(),r=this.threeLayer.getPick(),n=r.pickingTexture;r.pickingScene;var a=this.threeLayer.getRenderer();i.remove(e),e=null,i=null,n.dispose(),n=null,a.context.dispose(),a.context.forceContextLoss(),a.context=null,a.remove(),a=null,this.map.removeLayer(this.threeLayer)}}]),t}();t.imgClass=S,t.layerClass=ct,t.planeMark=ht,t.planeSectorClass=F,t.radarClass=I,t.sectorClass=P,t.shockClass=U,t.sleep=function(t){return new Promise((function(e){return setTimeout(e,t)}))}}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("maptalks"),require("three"),require("maptalks.three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three","maptalks.three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).mapcore=t.mapcore||{},t.maptalks,t.THREE,t.maptalks)}(this,(function(t,e,i,r){function n(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=n(e),o=n(i);function s(){s=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},n="function"==typeof Symbol?Symbol:{},a=n.iterator||"@@iterator",o=n.asyncIterator||"@@asyncIterator",h=n.toStringTag||"@@toStringTag";function c(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,i){return t[e]=i}}function l(t,e,i,n){var a=e&&e.prototype instanceof d?e:d,o=Object.create(a.prototype),s=new C(n||[]);return r(o,"_invoke",{value:_(t,i,s)}),o}function u(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function d(){}function m(){}function p(){}var v={};c(v,a,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(T([])));y&&y!==e&&i.call(y,a)&&(v=y);var x=p.prototype=d.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(r,a,o,s){var h=u(t[r],t,a);if("throw"!==h.type){var c=h.arg,l=c.value;return l&&"object"==typeof l&&i.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return n("throw",t,o,s)}))}s(h.arg)}var a;r(this,"_invoke",{value:function(t,i){function r(){return new e((function(e,r){n(t,i,e,r)}))}return a=a?a.then(r,r):r()}})}function _(t,e,i){var r="suspendedStart";return function(n,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===n)throw a;return I()}for(i.method=n,i.arg=a;;){var o=i.delegate;if(o){var s=k(o,i);if(s){if(s===f)continue;return s}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===r)throw r="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r="executing";var h=u(t,e,i);if("normal"===h.type){if(r=i.done?"completed":"suspendedYield",h.arg===f)continue;return{value:h.arg,done:i.done}}"throw"===h.type&&(r="completed",i.method="throw",i.arg=h.arg)}}}function k(t,e){var i=e.method,r=t.iterator[i];if(void 0===r)return e.delegate=null,"throw"===i&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==i&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+i+"' method")),f;var n=u(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var a=n.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function M(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(M,this),this.reset(!0)}function T(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:I}}function I(){return{value:void 0,done:!0}}return m.prototype=p,r(x,"constructor",{value:p,configurable:!0}),r(p,"constructor",{value:m,configurable:!0}),m.displayName=c(p,h,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,h,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,i,r,n,a){void 0===a&&(a=Promise);var o=new b(l(e,i,r,n),a);return t.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},w(x),c(x,h,"Generator"),c(x,a,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),i=[];for(var r in e)i.push(r);return i.reverse(),function t(){for(;i.length;){var r=i.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=T,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(i,r){return o.type="throw",o.arg=t,e.next=i,r&&(e.method="next",e.arg=void 0),!!r}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),h=i.call(a,"finallyLoc");if(s&&h){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),S(i),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var r=i.completion;if("throw"===r.type){var n=r.arg;S(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:T(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),f}},t}function h(t,e,i,r,n,a,o){try{var s=t[a](o),h=s.value}catch(t){return void i(t)}s.done?e(h):Promise.resolve(h).then(r,n)}function c(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function o(t){h(a,r,n,o,s,"next",t)}function s(t){h(a,r,n,o,s,"throw",t)}o(void 0)}))}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,(n=r.key,a=void 0,"symbol"==typeof(a=function(t,e){if("object"!=typeof t||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var r=i.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(n,"string"))?a:String(a)),r)}var n,a}function f(t,e,i){return e&&u(t.prototype,e),i&&u(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function d(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,r=m(t);if(e){var n=m(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return v(this,i)}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function x(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return y(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?y(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw a}}}}function w(){var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}));return"iep".concat(t,"layer")}function b(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function _(t,e){return 256*(t=o.MathUtils.clamp(Math.floor(t),0,255))+(e=o.MathUtils.clamp(Math.floor(e),0,255))}var k={altitude:0,imageWidth:512,imageHeight:512,texture:null},M=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i);var c=r=a.Util.extend({},k,r),u=c.altitude;c.imageHeight,c.imageWidth,t instanceof a.Extent||(t=new a.Extent(t));var f=t,d=f.xmin,m=f.ymin,p=f.xmax,v=f.ymax,g=1/0,y=1/0,x=-1/0,w=-1/0;[[d,m],[d,v],[p,v],[p,m]].forEach((function(t){var e=s.coordinateToVector3(t),i=e.x,r=e.y;g=Math.min(i,g),y=Math.min(r,y),x=Math.max(i,x),w=Math.max(r,w)}));var b=Math.abs(x-g),_=Math.abs(w-y),M=new o.PlaneBufferGeometry(b,_);(h=e.call(this))._initOptions(r),h._createMesh(M,n);var S=s.distanceToVector3(u,u).x,C=s.coordinateToVector3(t.getCenter(),S);return h.getObject3d().position.copy(C),h.parent=null,h.type="Image",h}return f(i)}(r.BaseObject),S=function(){function t(e,i,r,n,s){var h=this;l(this,t),this.threelayer=s,this.map=s.map,this.textureLoader=new o.TextureLoader;var c=e.split(","),u=i.split(","),f=parseFloat(c[0]),d=parseFloat(c[1]),m=parseFloat(u[0]),p=parseFloat(u[1]),v=n.maxZoom||11,g=n.renderOrder||0,y=n.opacity||1,x=n.minZoom||3,w=new a.Extent(f,d,m,p);this.xmin_g=f,this.ymin_g=d,this.xmax_g=m,this.ymax_g=p,this.textureLoader.load(r,(function(t){var e=new o.MeshBasicMaterial({map:t,transparent:!0,opacity:y}),i=new M(w,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:x,interactive:void 0!==n.interactive&&n.interactive},e,h.threelayer);i.object3d.renderOrder=g,h.imgMesh=i,h.imgMesh.parent=h,h.m=e,h.texture=t,h.threelayer.addMesh(h.imgMesh),n.opacityItems&&n.opacityItems.length>0&&!isNaN(n.opacityItems[0])&&!isNaN(n.opacityItems[1])&&n.opacityItems[0]>3&&n.opacityItems[0]<=18&&n.opacityItems[1]>=0&&n.opacityItems[1]<=1&&(h.opacityItems=n.opacityItems,h._bindMapEvents(),h._viewChange())}))}return f(t,[{key:"_bindMapEvents",value:function(){this.map.on("viewchange",this._viewChange,this)}},{key:"_viewChange",value:function(){this.opacityItems[0]<=this.map.getZoom()?this.imgMesh.object3d.material.opacity=this.opacityItems[1]:this.imgMesh.object3d.material.opacity=1}},{key:"_closeEvent",value:function(){this.map.off("viewchange",this._viewChange,this)}},{key:"updateImage",value:function(t,e){var i=this;if(e&&e.leftbottom&&e.righttop){var r=parseFloat(e.leftbottom[0]),n=parseFloat(e.leftbottom[1]),s=parseFloat(e.righttop[0]),h=parseFloat(e.righttop[1]);if(r!==this.xmin_g||n!==this.ymin_g||s!==this.xmax_g||h!==this.ymax_g){var c=new a.Extent(r,n,s,h),l=1/0,u=1/0,f=-1/0,d=-1/0;[[r,n],[r,h],[s,h],[s,n]].forEach((function(t){var e=i.threelayer.coordinateToVector3(t),r=e.x,n=e.y;l=Math.min(r,l),u=Math.min(n,u),f=Math.max(r,f),d=Math.max(n,d)}));for(var m=Math.abs(f-l),p=Math.abs(d-u),v=new o.PlaneBufferGeometry(m,p),g=v.attributes.position.array,y=this.imgMesh.object3d.geometry.attributes.position.array,x=0;x<y.length;x++)y[x]=g[x];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var w=this.threelayer.coordinateToVector3(c.getCenter(),0);this.imgMesh.getObject3d().position.copy(w),v.dispose(),this.xmin_g=r,this.ymin_g=n,this.xmax_g=s,this.ymax_g=h}}this.textureLoader.load(t,(function(t){i.texture&&i.texture.dispose(),delete i.texture,t.magFilter=o.NearestFilter,t.minFilter=o.NearestFilter,i.imgMesh.object3d.material.map=t,i.imgMesh.object3d.material.map.needsUpdate=!0,i.texture=t,!1===i.imgMesh.isAdd&&(i.threelayer?(i.threelayer.addMesh(i.imgMesh),i.opacityItems&&i._bindMapEvents()):i.dispose())}))}},{key:"clearImage",value:function(){this.imgMesh&&(this.threelayer.removeMesh(this.imgMesh),this.opacityItems&&this._closeEvent())}},{key:"show",value:function(){this.imgMesh&&(this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents())}},{key:"dispose",value:function(){this.imgMesh&&(!0===this.imgMesh.isAdd&&this.threelayer.removeMesh(this.imgMesh),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.texture&&(this.texture&&this.texture.dispose(),delete this.texture),this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),t}(),C={altitude:0,imageWidth:512,imageHeight:512,texture:null},T=function(t){d(i,t);var e=g(i);function i(t,r,n,s,h){var c;l(this,i);var u=(n=a.Util.extend({},C,n)).altitude,f=h.distanceToVector3(r,r).x,d=new o.CircleGeometry(f,32);(c=e.call(this))._initOptions(n),c._createMesh(d,s);var m=h.distanceToVector3(u,u).x,p=h.coordinateToVector3(t,m);return c.getObject3d().position.copy(p),c.parent=null,c.type="radarObject",c}return f(i)}(r.BaseObject),I=function(){function t(e,i,r,n,a){l(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a,this.imgUrl=r.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var s=new o.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n const float PI = 3.14159265359;\n const float TWO_PI = 6.28318530718;\n const int N = 3;\n const float r0 = 0.01;\n const float r_blue = 0.025;\n const float r_red = 0.015;\n const float edge = 0.95;\n const float offset = 0.05;\n\n uniform float time;\n varying vec2 vUv;\n uniform sampler2D map;\n float plot(const vec2 st, const float pct, const float width)\n {\n return smoothstep(pct - width, pct, st.y) -\n smoothstep(pct, pct + width, st.y);\n }\n float drawPolygon(const vec2 polygonCenter, const int N, const float radius, vec2 pos)\n {\n pos = pos - polygonCenter;\n float d = 0.0;\n float a = atan(pos.x, pos.y);\n float r = TWO_PI / float(N);\n d = cos(floor(0.5 + a / r)*r - a)*length(pos);\n return (1.0 - smoothstep(radius, radius + radius/10.0, d));\n }\n float gradations(const float a, const float gradNum, const float outRad, const float tickLen, const float tickWidth, const float r, const float move)\n {\n float f = step(0.0, cos((a + move)*gradNum) - tickWidth)*tickLen + (outRad - tickLen);\n return 1.0 - step(f, r) * 1.0 - step(r, outRad - tickLen);\n }\n void main() {\n // Normalized pixel coordinates (from 0 to 1)\n vec2 uv = vUv;\n vec2 pos = uv.xy - vec2(0.5, 0.5) ; // center what being drawn\n vec4 grndSpd = vec4(0.0, time/5.0, 0.0, 0.0);\n vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.85, 0.0, 1.0);\n //vec4 mapcol = texture2D(map,uv) * vec4 (0.0, 0.58, 1.0, 1.0);\n //vec3 color = vec3(0.0, 0.0, 0.0);\n vec3 color = vec3(0.0, 147. / 255., 1.0);\n float r = length(pos) * 2.0;\n float a = atan(pos.y, pos.x); // angle of pixel\n float an = PI - mod(time/ 1.0, TWO_PI); // angle of radar sweep\n float blipSpd = 3.0; // Blip / Trace speed\n vec2 translate1 = vec2(cos(time/ blipSpd), sin(time/ blipSpd));\n vec2 translate2 = vec2(sin(time/ blipSpd), cos(time/ blipSpd));\n vec2 left1 = translate1 * 0.35;\n vec2 right1 = -translate1 * 0.30;\n vec2 left2 = translate2 * 0.15;\n vec2 right2 = -translate2 * 0.25;\n // Radar Sweep\n float sn = step(PI/2.0, an) * step(-PI/2.0, (a + an)) * step(r, edge) * (1.0 - 0.55 * (a + (TWO_PI) - an));\n float sw = step(an, a) * step(r, edge);\n float s_blade = sw * (1.0 - (a - an) * 20.0);\n float s = sw * (1.0 - 0.55 * (a - an));\n s = max(sn,s);\n float se = step(r, edge - 0.05);\n // Center point\n float s1 = smoothstep(edge - 0.00, edge + 0.01, r)* smoothstep(edge + 0.02, edge + 0.01, r);\n // Circular concentric rings\n float s0 = 1.0 - smoothstep(r0 / 2.0, r0, length(pos));\n float smb = (1.0 - smoothstep(0.2, 0.2 + 0.01, length(pos))) * (1.0 - smoothstep(0.2 +0.01, 0.2, length(pos)));\n float smr = (1.0 - smoothstep(0.3, 0.3 + 0.01, length(pos))) * (1.0 - smoothstep(0.3 +0.01, 0.3, length(pos)));\n // Circular concentric gradations\n float gradNum = 120.0;\n float tickWidth = 0.9;\n const float tickLen = 0.04;\n float outRad = edge;\n float move = 0.0;\n float sm = 0.75*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n gradNum = 36.0;\n tickWidth = 0.95;\n outRad = 0.6;\n move = sin(time/10.0);\n smr += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n outRad = 0.4;\n move = cos(time/10.0);\n smb += 0.5*gradations(a, gradNum, outRad, tickLen, tickWidth, r, move);\n // Radial spoke gradations\n float sr = plot(pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.x, 0.002) * step(r, edge - 0.06);\n sr += plot(vec2(0.0, 0.0), pos.y, 0.003) * step(r, edge - 0.06);\n sr += plot(-pos, pos.x, 0.003) * step(r, edge - 0.06);\n sr *= 0.75;\n // Blue circular radar blip traces\n vec2 st_trace1 = left2;\n float s_trace1 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1)));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+offset, +offset))));\n s_trace1 += s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace1 + vec2(+2.0 *offset, +2.0 *offset))));\n\n vec2 st_trace2 = right1;\n float s_trace2 = s * (1.0 - smoothstep(r_blue / 10.0, r_blue, length(pos - st_trace2)));\n // Red Trianglular radar flight blip trace\n vec2 st_trace3 = left1;\n float st1 = s * (drawPolygon(st_trace3, N, r_red , pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(-offset, -offset), N, r_red, pos));\n st1 += s * (drawPolygon(st_trace3 + vec2(+offset, -offset), N, r_red, pos));\n\n vec2 st_trace4 = right2;\n float st2 = s * (drawPolygon(st_trace4, N, r_red, pos)); \n // Lets add all the bits together and send them to screen\n float s_grn = max(s * mapcol.y, s_blade);\n s_grn = max(s_grn, (s0 + sr + sm));\n s_grn += s1 / 1.5 + smb + smr;\n\n float s_red = st1*2.0 + st2*2.0 + smr;\n \n float s_blue = max(s_trace1 + s_trace2, s_blade) + smb;\n\n if (s_trace1 > 0.0 || s_trace2 > 0.0) { s_blue = max(s, s_blue); s_grn = max(s_grn, s_blue); }\n\n color += vec3(s_red , s_grn, s_blue); \n vec4 texColor = mapcol * s;\n // Output to screen \n gl_FragColor = vec4(color, 0.5);//Set the screen pixel to that color\n }",side:o.DoubleSide,transparent:!0});this.radar=new T(e,i,{},s,n),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return f(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.radar),this.radar.object3d.geometry&&this.radar.object3d.geometry.dispose(),this.radar.object3d.material&&this.radar.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),A={radius:100,altitude:0},L=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i),r=a.Util.extend({},A,r,{layer:s,coordinate:t}),(h=e.call(this))._initOptions(r);var c=r,u=c.altitude,f=c.radius,d=s.distanceToVector3(f,f).x,m=r.thetaStart||0,p=r.thetaLength||90,v=new o.CircleGeometry(d,128,m*Math.PI/180,p*Math.PI/180);h._createMesh(v,n);var g=s.distanceToVector3(u,u).x,y=s.coordinateToVector3(t,g);return h.getObject3d().position.copy(y),h}return f(i)}(r.BaseObject),O=function(){function t(e,i,r,n,a){l(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a;var s=r.thetaLength||90,h=r.rotation||0,c=s/2;this.imgUrl=r.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=h-c;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var f=new o.ShaderMaterial({uniforms:this._uniforms,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n varying vec2 vUv;\n void main() {\n vec2 uv = vUv;\n //uv = uv.xy - vec2(0.5, 0.5);\n //gl_FragColor = texture2D(map, uv);\n gl_FragColor = vec4(1.0, 1.0, 1.0, 0.5);\n }",side:o.DoubleSide,transparent:!0,depthTest:!1});this.sector=new L(e,{thetaStart:u,thetaLength:r.thetaLength,radius:i},f,n),this.threelayer.addMesh(this.sector)}return f(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),P={altitude:0,height:0},j=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i),n=a.Util.extend({},P,n,{layer:s}),h=e.call(this);var c=n,u=c.width,f=c.height,d=c.altitude;h._initOptions(n);var m=new o.PlaneGeometry(u,f);m.computeBoundingBox();var p=new o.Mesh(m,r);h._createGroup(),h.getObject3d().add(p);var v=s.distanceToVector3(d,d).x,g=s.coordinateToVector3(t,v);return p.position.set(0,m.boundingBox.max.y,0),h.getObject3d().position.copy(g),h}return f(i)}(r.BaseObject);function z(t,e,i,r,n,a){this.tilesHorizontal=e,this.tilesVertical=i,this.numberOfTiles=r,t.wrapS=t.wrapT=o.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=n,this.currentDisplayTime=0,this.currentTile=0,this.flag=a,this.update=function(e){for(this.currentDisplayTime+=e;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var i=this.currentTile%this.tilesHorizontal;t.offset.x=i/this.tilesHorizontal;var r=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?t.offset.y=this.tilesVertical-r/this.tilesVertical:t.offset.y=1-r/this.tilesVertical-1/this.tilesVertical}}}var F=function(){function t(e,i,r,n,a){var s=this;l(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a;var h=r.thetaLength||45;this.millsec=r.millsec||1e3,this.duration=r.duration||75,this.tilesHoriz=r.tilesHoriz||12,this.tilesVert=r.tilesVert||5,this.numTiles=r.numTiles||49;var c=r.rotation||0,u=h/2,f=n.distanceToVector3(i,i).x,d=Math.sin(u*Math.PI/180)*f*2,m=void 0===r.flag;this.imgUrl=r.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s.annie=new z(t,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,m);var i=new o.MeshBasicMaterial({transparent:!0,map:t,side:o.DoubleSide,depthTest:!1});s.imgObj=new j(e,i,{width:d,height:f},n),s.imgObj.object3d.renderOrder=1,s.imgObj.object3d.rotation.z=c*Math.PI/180,s.threelayer.addMesh(s.imgObj),s.layerClass.updatables.push(s)}))}return f(t,[{key:"tick",value:function(t){var e;null===(e=this.annie)||void 0===e||e.update(this.millsec*t)}},{key:"removeAnimation",value:function(){var t=this.layerClass.updatables.indexOf(this);t>-1&&this.layerClass.updatables.splice(t,1)}},{key:"dispose",value:function(){var t;this.removeAnimation(),this.threelayer.removeMesh(this.imgObj),this.imgObj.object3d.geometry&&this.imgObj.object3d.geometry.dispose(),this.imgObj.object3d.material&&this.imgObj.object3d.material.dispose(),this.loader&&delete this.loader,null===(t=this.texture)||void 0===t||t.dispose()}}]),t}(),D={radius:100,altitude:0},E=function(t){d(i,t);var e=g(i);function i(t,r,n,s){var h;l(this,i),r=a.Util.extend({},D,r,{layer:s}),h=e.call(this);var c=r,u=c.width;c.height;var f=c.altitude;h._initOptions(r);var d=new o.CircleGeometry(u,32);h._createMesh(d,n);var m=s.distanceToVector3(f,f).x,p=s.coordinateToVector3(t,m);return h.getObject3d().position.copy(p),h}return f(i)}(r.BaseObject),U=function(){function t(e,i,r,n){var a=this;l(this,t),this.threelayer=r,this.map=r.map,this.layerClass=n,this.time=0,r.coordinateToVector3(e,0),this.imgUrl=i.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){a.texture=t,a._uniforms={impactPosition:{value:new o.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:a.texture}};var i=new o.ShaderMaterial({uniforms:a._uniforms,vertexShader:"\n varying vec3 vPosition;\n varying vec2 vUv;\n void main(){\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix*viewMatrix*modelMatrix*vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec3 impactPosition;\n uniform float impactMaxRadius;\n uniform float impactRatio;\n varying vec3 vPosition;\n varying vec2 vUv;\n void main() {\n float dist = distance(vPosition, impactPosition);\n float curRadius = impactMaxRadius * impactRatio;\n float sstep = smoothstep(0., curRadius, dist) - smoothstep(curRadius - ( 0.25 * impactRatio ), curRadius, dist);\n sstep = 1. - sstep * (1. - impactRatio);\n vec3 col = mix(vec3(1., 0.5, 0.0625), vec3(1., 0.25, 0.125), impactRatio);\n gl_FragColor = texture2D(map, vUv);\n gl_FragColor = vec4( mix( col, gl_FragColor.rgb, sstep), 1.0 );\n }",side:o.DoubleSide,transparent:!0,depthTest:!1}),n=new E(e,{width:2,height:2},i,r);a.threelayer.addMesh(n),a.layerClass.updatables.push(a)}))}return f(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),V=6371008.8,B={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*V,kilometers:6371.0088,kilometres:6371.0088,meters:V,metres:V,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:V/1852,radians:1,yards:6967335.223679999};function R(t){return t%360*Math.PI/180}function N(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function G(t,e,i){void 0===i&&(i={});var r=N(t),n=N(e),a=R(n[1]-r[1]),o=R(n[0]-r[0]),s=R(r[1]),h=R(n[1]),c=Math.pow(Math.sin(a/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(s)*Math.cos(h);return function(t,e){void 0===e&&(e="kilometers");var i=B[e];if(!i)throw new Error(e+" units is invalid");return t*i}(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),i.units)}function Z(t,e,i){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var n=0,a=e.length-1;n<e.length;a=n++){var o=e[n][0],s=e[n][1],h=e[a][0],c=e[a][1];if(t[1]*(o-h)+s*(h-t[0])+c*(t[0]-o)==0&&(o-t[0])*(h-t[0])<=0&&(s-t[1])*(c-t[1])<=0)return!i;s>t[1]!=c>t[1]&&t[0]<(h-o)*(t[1]-s)/(c-s)+o&&(r=!r)}return r}var H=document.createElement("canvas"),W=function(){function t(){l(this,t),this.type="gisCommon"}return f(t,null,[{key:"getTexture",value:function(t,e,i,r){var n=t.getContext("2d");n.drawImage(e,i,r);var a=new o.Texture(n.getImageData(0,0,t.width,t.height));return a.minFilter=o.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"getTexture1",value:function(t,e,i,r,n){H.width=H.height=128;var a=H.getContext("2d");a.drawImage(t,e,i,r,n);var s=new o.Texture(a.getImageData(0,0,H.width,H.height));return s.minFilter=o.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s}},{key:"addImageProcessImage",value:function(t){return new Promise((function(e,i){var r=document.createElement("img");r&&!r.crossOrigin&&(r.crossOrigin="Anonymous"),r.onload=function(){return e(r)},r.onerror=i,r.setAttribute("src",t)}))}},{key:"addImageProcess",value:function(t){return new Promise((function(e,i){var r=document.createElement("img");r.onload=function(){return e(r)},r.onerror=i,r.setAttribute("src","data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(t))))}))}},{key:"containsCoordinate3",value:function(t,e,i){if(1e3*G({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.x,e.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.radius){var r=i.coordinateToVector3([e.x,e.y],0),n=i.coordinateToVector3(t,0).sub(r).normalize(),a=i.distanceToVector3(e.radius,e.radius).x,s=new o.Vector3(r.x,r.y+a,0).sub(r).normalize(),h=((n.clone().cross(s).z<0?-1:1)*Math.acos(n.dot(s))*180/Math.PI).toFixed(2);(h=parseFloat(h))<0&&(h=h+180+180);var c=parseFloat(e.begin),l=parseFloat(e.end);if(c>l){if(h>=c||h<=l)return!0}else if(h>=c&&h<=l)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*G({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[e.getCenter().x,e.getCenter().y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<e.getRadius()}},{key:"containsCoordinate2",value:function(t,e){return function(t,e,i){if(void 0===i&&(i={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r,n=N(t),a="Feature"===(r=e).type?r.geometry:r,o=a.type,s=e.bbox,h=a.coordinates;if(s&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,s))return!1;"Polygon"===o&&(h=[h]);for(var c=!1,l=0;l<h.length&&!c;l++)if(Z(n,h[l][0],i.ignoreBoundary)){for(var u=!1,f=1;f<h[l].length&&!u;)Z(n,h[l][f],!i.ignoreBoundary)&&(u=!0),f++;u||(c=!0)}return c}({type:"Feature",geometry:{type:"Point",coordinates:t}},{type:"Feature",geometry:{type:"Polygon",coordinates:e.geometry.coordinates[0]}})}},{key:"containsCoordinate",value:function(t,e){var i,r;Array.isArray(t)?(i=t[0],r=t[1]):t instanceof a.Coordinate&&(i=t.x,r=t.y);var n=e.xmin,o=e.ymin,s=e.xmax,h=e.ymax;return n<=i&&i<=s&&o<=r&&r<=h}},{key:"isInLevels",value:function(t,e){for(var i=!1,r=0;r<t.rangeArr.length;r+=2){var n=1*t.rangeArr[r],a=1*t.rangeArr[r+1];if(e>n&&e<=a){i=!0;break}}return i}},{key:"getExtent",value:function(t){if(0!==t.length){var e=1/0,i=1/0,r=-1/0,n=-1/0;return 1===t.length?(e=1*t[0].longitude-.5,i=1*t[0].latitude-.5,r=1*t[0].longitude+.5,n=1*t[0].latitude+.5):t.length>1&&t.slice(0,1/0).map((function(t){var a=1*t.longitude,o=1*t.latitude;e=Math.min(e,a),i=Math.min(i,o),r=Math.max(r,a),n=Math.max(n,o)})),{minX:e,minY:i,maxX:r,maxY:n}}}},{key:"vector2Pixel",value:function(t,e,i){var r=t.project(i),n=e.width/2,a=e.height/2;return{x:Math.round(r.x*n+n),y:Math.round(-r.y*a+a)}}},{key:"generateTextureOne",value:function(t,e,i){H.width=e,H.height=i;var r=H.getContext("2d");r.drawImage(t,0,0,e,i);var n=new o.Texture(r.getImageData(0,0,H.width,H.height));return n.magFilter=o.NearestFilter,n.minFilter=o.NearestFilter,n.generateMipmaps=!1,n.needsUpdate=!0,n}},{key:"generateTexture",value:function(t){var e=[64,128,256,512,1024],i=-1/0;t.forEach((function(t){i=Math.max(i,t.w),Math.max(i,t.h)}));var r=Math.sqrt(t.length),n=parseInt(r);r>n&&(n+=1);for(var a=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(a<e[h]){s=e[h];break}s=1024}H.width=H.height=s;for(var c=H.getContext("2d"),l=0,u=0,f=[],d=0;d<r;d++){for(var m=5*(d+1)+d*l,p=0;p<r;p++){var v=5*(p+1)+p*t[u].w;if("img"===t[u].type){var g=(t[u].w-t[u].iw)/2,y=(t[u].h-t[u].ih)/2;c.drawImage(t[u].src,v+g,m+y,t[u].iw,t[u].ih)}else if("txt"===t[u].type)c.fillStyle=t[u].color,"#fff"===t[u].color?(c.font="lighter "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,v+t[u].offx,m+t[u].offy),c.strokeStyle=t[u].color,c.strokeText(t[u].src,v+t[u].offx,m+t[u].offy)):(c.font="normal "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,v+t[u].offx,m+t[u].offy));else{var x=(t[u].w-t[u].iw)/2,w=(t[u].h-t[u].ih)/2,b=t[u].offx||0,_=t[u].offy||0;c.drawImage(t[u].src,v+x+b,m+w+_,t[u].iw,t[u].ih)}if(f.push({w:t[u].w,h:t[u].h,u:v/s,v:m/s}),l=Math.max(l,t[u].h),(u+=1)>=t.length)break}if(u>=t.length)break}var k=new o.Texture(c.getImageData(0,0,H.width,H.height));return k.minFilter=o.LinearFilter,k.generateMipmaps=!1,k.needsUpdate=!0,{xys:f,texture:k,textureSize:s}}},{key:"generateTextureNew",value:function(t){var e=[64,128,256,512,1024],i=-1/0;t.forEach((function(t){i=Math.max(i,t.w),Math.max(i,t.h)}));var r=Math.sqrt(t.length),n=parseInt(r);r>n&&(n+=1);for(var a=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(a<e[h]){s=e[h];break}s=1024}H.width=H.height=s;for(var c=H.getContext("2d"),l=0,u=0,f=0,d=[],m=0;m<r;m++){for(var p=5*(m+1)+m*l,v=0;v<r;v++){var g=5*(v+1)+f;if("img"===t[u].type){var y=(t[u].w-t[u].iw)/2,x=(t[u].h-t[u].ih)/2;c.drawImage(t[u].src,g+y,p+x,t[u].iw,t[u].ih)}else if("txt"===t[u].type)c.fillStyle=t[u].color,"#fff"===t[u].color?(c.font="lighter "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,g+t[u].offx,p+t[u].offy),c.strokeStyle=t[u].color,c.strokeText(t[u].src,g+t[u].offx,p+t[u].offy)):(c.font="normal "+t[u].size+"px Microsoft YaHei",c.fillText(t[u].src,g+t[u].offx,p+t[u].offy));else{var w=(t[u].w-t[u].iw)/2,b=(t[u].h-t[u].ih)/2,_=t[u].offx||0,k=t[u].offy||0;c.drawImage(t[u].src,g+w+_,p+b+k,t[u].iw,t[u].ih)}if(d.push({w:t[u].w,h:t[u].h,u:g/s,v:p/s}),l=Math.max(l,t[u].h),f+=t[u].w,(u+=1)>=t.length)break}if(u>=t.length)break}var M=new o.Texture(c.getImageData(0,0,H.width,H.height));return M.minFilter=o.LinearFilter,M.generateMipmaps=!1,M.needsUpdate=!0,{xys:d,texture:M,textureSize:s}}},{key:"generateTextureOptimize",value:function(t){var e=[64,128,256,512,1024],i=-1/0;t.forEach((function(t){i=Math.max(i,t.w),Math.max(i,t.h)}));var r=Math.sqrt(t.length),n=parseInt(r);r>n&&(n+=1);for(var a=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(a<e[h]){s=e[h];break}s=1024}H.width=H.height=s;for(var c=H.getContext("2d"),l=0,u=0,f={},d=0;d<r;d++){for(var m=5*(d+1)+d*l,p=0,v=0;v<r;v++){var g=5*(v+1)+p,y=(t[u].w-t[u].iw)/2,x=(t[u].h-t[u].ih)/2;if(c.drawImage(t[u].src,g+y,m+x,t[u].iw,t[u].ih),f[t[u].key]={w:t[u].w,h:t[u].h,u:g/s,v:m/s},l=Math.max(l,t[u].h),p+=t[u].w,(u+=1)>=t.length)break}if(u>=t.length)break}var w=new o.Texture(c.getImageData(0,0,H.width,H.height));return w.minFilter=o.LinearFilter,w.generateMipmaps=!1,w.needsUpdate=!0,{xys:f,texture:w,textureSize:s}}},{key:"setPointEventStatus",value:function(t,e){t&&t.getMeshes().forEach((function(t){"Points"===t.type&&(t.options.interactive=e)}))}},{key:"createTextTexture",value:function(t,e){H.width=H.height=t;var i=H.width/2,r=H.height/2;if(e){var n=0;e.forEach((function(t){var e=H.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,i,r+n),n+=t.fontsize}))}var a=new o.Texture(H);return a.minFilter=o.LinearFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"createTextAndBgTexture",value:function(t,e,i,r){var n=document.createElement("canvas");n.width=t,n.height=e;var a=n.getContext("2d");a.drawImage(i,0,0,t,e);var s=n.width/2,h=n.height/2;a.textAlign="center",a.textBaseline="middle",a.fillStyle="#FFF",a.font="".concat(r.fontsize,"px Arial"),a.fillText(r.txt,s,h);var c=new o.Texture(n);return c.magFilter=o.NearestFilter,c.minFilter=o.NearestFilter,c.needsUpdate=!0,c}},{key:"getIntColor",value:function(t){var e=parseInt(255*t.r);return e=((e=(e<<8)+parseInt(255*t.g))<<8)+parseInt(255*t.b)}},{key:"colorIntToRGB",value:function(t){var e=t>>16&255,i=t>>8&255,r=255&t;return new o.Color("rgb(".concat(e,",").concat(i,",").concat(r,")"))}},{key:"createSimpleShader",value:function(t,e,i){return t.uniforms.texture1={value:e},t.uniforms.size1={value:i},t.uniforms.flag={value:1},t.vertexShader="uniform float size1;\n attribute float imgflag;\n varying float vimgflag;\n attribute float visibility;\n varying float vVisible;\n "+t.vertexShader,t.vertexShader=t.vertexShader.replace("#include <project_vertex>","\n #include <project_vertex>\n vimgflag = imgflag;\n vVisible = visibility;\n ").replace("gl_PointSize = size;","\n gl_PointSize = size1;\n "),t.fragmentShader="\n uniform sampler2D texture1;\n varying float vimgflag;\n varying float vVisible;\n "+t.fragmentShader,t.fragmentShader=t.fragmentShader.replace("gl_FragColor = vec4( outgoingLight, diffuseColor.a );","\n\n vec2 pUv = gl_PointCoord;\n pUv.y = 1. - pUv.y;\n\n if(vimgflag < 1.0){\n vec4 texColor = texture2D( texture1, pUv );\n outgoingLight *= texColor.xyz;\n gl_FragColor = vec4( outgoingLight, texColor.a * diffuseColor.a );\n }\n\n if (vVisible < 0.5) discard;\n "),t}},{key:"calTextWidth",value:function(t,e){var i=(t.match(/[\u4e00-\u9fa5]/g)||"").length;return i*e+.5*(t.length-i)*e}}]),t}();function Y(t,e,i,r,n,a,o,s,h,c){var l=t.split("\n"),u=[],f={positionedGlyphs:u,text:t,top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,lineCount:l.length};return function(t,e,i,r,n,a,o,s,h){var c=0,l=-17,u=0,f=t.positionedGlyphs,d="right"===a?1:"left"===a?0:.5,m=f.length;i.forEach((function(t){if(t.split("").forEach((function(t){var i=e[h],r=t.charCodeAt(0),n=i&&i[r];n&&(f.push({glyph:r,x:c,y:l+0,vertical:!1,scale:1,fontStack:h}),c+=n.metrics.advance+s)})),f.length!==m){var i=c-s;u=Math.max(i,u),function(t,e,i,r,n){if(n){var a=t[r],o=e[a.fontStack],s=o&&o[a.glyph];if(s)for(var h=s.metrics.advance*a.scale,c=(t[r].x+h)*n,l=i;l<=r;l++)t[l].x-=c}}(f,e,m,f.length-1,d)}c=0,l+=r}));var p=function(t){var e=.5,i=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}(n),v=p.horizontalAlign,g=p.verticalAlign;!function(t,e,i,r,n,a,o){for(var s=(e-i)*n,h=(-r*o+.5)*a,c=0;c<t.length;c++)t[c].x+=s,t[c].y+=h}(f,d,v,g,u,r,i.length);var y=l- -17;t.top+=-g*y,t.bottom=t.top+y,t.left+=-v*u,t.right=t.left+u}(f,e,l,n,a,o,0,s,i),!!u.length&&f}var q=X;function X(t,e){this.x=t,this.y=e}X.prototype={clone:function(){return new X(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,i=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=i,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),r=e*this.x-i*this.y,n=i*this.x+e*this.y;return this.x=r,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),r=Math.sin(t),n=e.x+i*(this.x-e.x)-r*(this.y-e.y),a=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=n,this.y=a,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},X.convert=function(t){return t instanceof X?t:Array.isArray(t)?new X(t[0],t[1]):t};var K={radius:40,altitude:0},J=function(t){d(i,t);var e=g(i);function i(t,r,n,s,h,c,u,f){var d;l(this,i);var m=function(t){for(var e=1/0,i=1/0,r=-1/0,n=-1/0,o=0,s=t.length;o<s;o++){var h=t[o],c=h.coordinate,l=h.lnglat,u=h.lnglats,f=h.xy,d=h.xys,m=c||l||u||f||d||t[o],p=void 0,v=void 0;Array.isArray(m)?(p=m[0],v=m[1]):m instanceof a.Coordinate&&(p=m.x,v=m.y),e=Math.min(e,p),i=Math.min(i,v),r=Math.max(r,p),n=Math.max(n,v)}return new a.Coordinate((e+r)/2,(i+n)/2)}(t);d=e.call(this),r=a.Util.extend({center:m,layer:f},K,r),d._initOptions(r);var p=d.getLayer().getPick();d._colorMap={},d._datas=t,d._childCount=u;var v=f.coordinateToVector3(m);d.glyphMap=h,d.glyphAtlas=c;for(var g=new o.InstancedBufferGeometry,y=new Uint16Array([0,1,2,2,3,0]),x=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),w=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),b=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),k=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),M=new o.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),S=new o.InstancedBufferAttribute(new Float32Array(3*d._childCount),3,!0),C=0,T=function(e){var i=t[e],r=i.texts,n=i.markers,a=p.getColor(),o=a.getHex();d._colorMap[o]=e,d._datas[e].colorIndex=o,n&&n.forEach((function(i){if(w.setXYZW(C,i.markerWidth,i.markerHeight,i.markerDx,i.markerDy),b.setXYZW(C,i.u,i.v,-16,16),i.markerColor){var r=_(0,255);M.setXYZW(C,r,0,0,0);var n=d.getColorVector2(i.markerColor,i.markerOpacity);k.setXYZW(C,n[0],n[1],i.w,i.h)}else{var o=_(0,0);M.setXYZW(C,o,0,0,0);var s=d.getColorVector2("#fff",i.markerOpacity);k.setXYZW(C,s[0],s[1],i.w,i.h)}S.setXYZ(C,a.r,a.g,a.b),i.markerIndex=C,C+=1,t[e].childNum+=1})),r&&r.forEach((function(i){var r=d.getColorVector2(i.textColor,i.textOpacity),n=_(255,0);d.buildTextBuffers("".concat(i.text),i.textAnchor,"center",i.textSpacing).forEach((function(o){if(w.setXYZW(C,i.textSize,0,i.textDx,i.textDy),b.setXYZW(C,o[0],o[1],o[2],o[3]),i.textHaloColor){var s=d.getColorVector2(i.textHaloColor,i.textHaloOpacity);k.setXYZW(C,r[0],r[1],s[0],s[1]);var h=i.textHaloRadius;M.setXYZW(C,n,h,0,0)}else k.setXYZW(C,r[0],r[1],0,0),M.setXYZW(C,n,-1.9,0,0);S.setXYZ(C,a.r,a.g,a.b),i.textIndex.push(C),C+=1,t[e].childNum+=1}))}))},I=0;I<t.length;I++)T(I);g.setIndex(new o.Uint16BufferAttribute(y,1)),g.setAttribute("uv_offset",new o.Float32BufferAttribute(x,4,!0)),g.setAttribute("size",w),g.setAttribute("uv_image",b),g.setAttribute("color",k),g.setAttribute("util",M),g.setAttribute("pickingColor",S),d._createInstancedMesh(g,n,d._childCount),d.getObject3d().instanceMatrix.setUsage(o.DynamicDrawUsage);var A=new o.InstancedMesh(g,s,d._childCount);A.instanceMatrix.setUsage(o.DynamicDrawUsage);var L=p.getColor().getHex();A._colorIndex=L,d.setPickObject3d(A);var O=new o.Object3D;C=0,t.forEach((function(e,i){if(e.visible){var r=f.coordinateToVector3(e.coordinate);r.sub(v),e.height&&(r.z=f.altitudeToVector3(e.height).x);for(var n=0;n<t[i].childNum;n++)O.position.set(r.x,r.y,0),O.updateMatrix(),d.getObject3d().setMatrixAt(C,O.matrix),A.setMatrixAt(C,O.matrix),C+=1}}));var P=f.altitudeToVector3(r.altitude,r.altitude).x;return v.z=P,d.getObject3d().position.copy(v),A.position.copy(d.getObject3d().position),d.parent=null,d.pickMesh=A,d.threeLayer=f,d.center=v,d._init(),d}return f(i,[{key:"_init",value:function(){var t=this,e=this.getLayer().getPick();this.on("add",(function(){e.add(t.pickObject3d)})),this.on("remove",(function(){e.remove(t.pickObject3d)}))}},{key:"getSelectMesh",value:function(){return this._datas[this.index]}},{key:"identify",value:function(t){return this.picked}},{key:"getColorVector2",value:function(t,e){var i,r=new o.Color(t).getHexString(),n=(i="#".concat(r),{r:parseInt(i.slice(1,3),16),g:parseInt(i.slice(3,5),16),b:parseInt(i.slice(5,7),16)}),a=n.b;return[_(n.r,n.g),_(a,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,i,r){var n=[],a=[0,0],o=Y(t,this.glyphMap,"sans-serif",0,24,e,i,r,a,1);if(o){var s=function(t,e,i,r){for(var n=t.positionedGlyphs,a=[],o=0;o<n.length;o++){var s=n[o],h=r[s.fontStack],c=h&&h[s.glyph];if(c){var l=c.rect;if(l){var u=c.metrics.advance*s.scale/2,f=i?[s.x+u,s.y]:[0,0],d=i?[0,0]:[s.x+u+e[0],s.y+e[1]],m=(c.metrics.left-4)*s.scale-u+d[0],p=(-c.metrics.top-4)*s.scale+d[1],v=m+l.w*s.scale,g=p+l.h*s.scale,y=new q(m,p),x=new q(v,p),w=new q(m,g),b=new q(v,g);a.push({tl:y,tr:x,bl:w,br:b,tex:l,writingMode:t.writingMode,glyphOffset:f})}}}return a}(o,a,!1,this.glyphAtlas.positions);s.forEach((function(t){n.push([t.tex.x,t.tex.y+t.tex.h,t.bl.x,t.bl.y])}))}return n}},{key:"changeVisible",value:function(){var t=this,e=new o.Object3D;this._datas.forEach((function(i,r){var n=t.threeLayer.coordinateToVector3(i.coordinate);n.sub(t.center),i.height&&(n.z=t.threeLayer.altitudeToVector3(i.height).x),!1===i.visible?e.position.set(-999,-999,0):e.position.set(n.x,n.y,0),e.updateMatrix(),i.markers&&i.markers.forEach((function(i){t.getObject3d().setMatrixAt(i.markerIndex,e.matrix),t.pickMesh.setMatrixAt(i.markerIndex,e.matrix)})),i.texts&&i.texts.forEach((function(i){i.textIndex.forEach((function(i){t.getObject3d().setMatrixAt(i,e.matrix),t.pickMesh.setMatrixAt(i,e.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),i}(r.BaseObject),$=function(){function t(e,i){l(this,t),this.createImage(e,1,i)}return f(t,[{key:"createImage",value:function(t,e,i){var r=t.width,n=t.height;if(i){if(i.length!==r*n*e)throw new RangeError("mismatched image size")}else i=new Uint8Array(r*n*e);this.width=r,this.height=n,this.data=i}},{key:"resize",value:function(){}}],[{key:"copy",value:function(t,e,i,r,n){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;if(0===n.width||0===n.height)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,h=0;h<n.height;h++)for(var c=((i.y+h)*t.width+i.x)*a,l=((r.y+h)*e.width+r.x)*a,u=0;u<n.width*a;u++)s[l+u]=o[c+u];return e}}]),t}();var Q=f((function t(e){l(this,t);var i={},r=[];for(var n in e){var a=e[n],o=i[n]={};for(var s in a){var h=a[+s];if(h&&0!==h.bitmap.width&&0!==h.bitmap.height){var c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),o[s]={rect:c,metrics:h.metrics}}}}var u=function(t){let e=0,i=0;for(const r of t)e+=r.w*r.h,i=Math.max(i,r.w);t.sort(((t,e)=>e.h-t.h));const r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let n=0,a=0;for(const e of t)for(let t=r.length-1;t>=0;t--){const i=r[t];if(!(e.w>i.w||e.h>i.h)){if(e.x=i.x,e.y=i.y,a=Math.max(a,e.y+e.h),n=Math.max(n,e.x+e.w),e.w===i.w&&e.h===i.h){const e=r.pop();t<r.length&&(r[t]=e)}else e.h===i.h?(i.x+=e.w,i.w-=e.w):e.w===i.w?(i.y+=e.h,i.h-=e.h):(r.push({x:i.x+e.w,y:i.y,w:i.w-e.w,h:e.h}),i.y+=e.h,i.h-=e.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}(r),f=u.w,d=u.h,m=new $({width:f||1,height:d||1});for(var p in e){var v=e[p];for(var g in v){var y=v[+g];if(y&&0!==y.bitmap.width&&0!==y.bitmap.height){var x=i[p][g].rect;$.copy(y.bitmap,m,{x:0,y:0},{x:x.x+1,y:x.y+1},y.bitmap)}}}this.image=m,this.positions=i})),tt={exports:{}};tt.exports=it,tt.exports.default=it;var et=1e20;function it(t,e,i,r,n,a){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=r||.25,this.fontFamily=n||"sans-serif",this.fontWeight=a||"normal",this.radius=i||8;var o=this.size=this.fontSize+2*this.buffer,s=o+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=o,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=void 0!==this.ctx.measureText("A").actualBoundingBoxLeft,this.middle=Math.round(o/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function rt(t,e,i,r,n,a){for(var o=0;o<e;o++)nt(t,o,e,i,r,n,a);for(var s=0;s<i;s++)nt(t,s*e,1,e,r,n,a)}function nt(t,e,i,r,n,a,o){var s,h,c,l;for(a[0]=0,o[0]=-et,o[1]=et,s=0;s<r;s++)n[s]=t[e+s*i];for(s=1,h=0,c=0;s<r;s++){do{l=a[h],c=(n[s]-n[l]+s*s-l*l)/(s-l)/2}while(c<=o[h]&&--h>-1);a[++h]=s,o[h]=c,o[h+1]=et}for(s=0,h=0;s<r;s++){for(;o[h+1]<s;)h++;l=a[h],t[e+s*i]=n[l]+(s-l)*(s-l)}}it.prototype._draw=function(t,e){var i,r,n,a,o,s,h,c,l,u=this.ctx.measureText(t),f=u.width,d=2*this.buffer;e&&this.useMetrics?(o=Math.floor(u.actualBoundingBoxAscent),c=this.buffer+Math.ceil(u.actualBoundingBoxAscent),s=this.buffer,h=this.buffer,i=(r=Math.min(this.size,Math.ceil(u.actualBoundingBoxRight-u.actualBoundingBoxLeft)))+d,n=(a=Math.min(this.size-s,Math.ceil(u.actualBoundingBoxAscent+u.actualBoundingBoxDescent)))+d,this.ctx.textBaseline="alphabetic"):(i=r=this.size,n=a=this.size,o=19*this.fontSize/24,s=h=0,c=this.middle,this.ctx.textBaseline="middle"),r&&a&&(this.ctx.clearRect(h,s,r,a),this.ctx.fillText(t,this.buffer,c),l=this.ctx.getImageData(h,s,r,a));var m=new Uint8ClampedArray(i*n);return function(t,e,i,r,n,a,o){a.fill(et,0,e*i),o.fill(0,0,e*i);for(var s=(e-r)/2,h=0;h<n;h++)for(var c=0;c<r;c++){var l=(h+s)*e+c+s,u=t.data[4*(h*r+c)+3]/255;if(1===u)a[l]=0,o[l]=et;else if(0===u)a[l]=et,o[l]=0;else{var f=Math.max(0,.5-u),d=Math.max(0,u-.5);a[l]=f*f,o[l]=d*d}}}(l,i,n,r,a,this.gridOuter,this.gridInner),rt(this.gridOuter,i,n,this.f,this.v,this.z),rt(this.gridInner,i,n,this.f,this.v,this.z),function(t,e,i,r,n,a,o){for(var s=0;s<e*i;s++){var h=Math.sqrt(r[s])-Math.sqrt(n[s]);t[s]=Math.round(255-255*(h/a+o))}}(m,i,n,this.gridOuter,this.gridInner,this.radius,this.cutoff),{data:m,metrics:{width:r,height:a,sdfWidth:i,sdfHeight:n,top:o,left:0,advance:f}}},it.prototype.draw=function(t){return this._draw(t,!1).data},it.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var at=tt.exports,ot={},st={};var ht=function(){function t(e,i,r){var n=this;l(this,t);var a=i.pointMinZoom,o=i.pointOrder;if(0!=e.length){var s=[];this.charArray="",this.imgDict={},this.threeLayer=r,this.map=r.map,this.interactive=void 0===i.interactive||i.interactive,this.beginSizeZoom=i.beginSizeZoom||3,this.endSizeZoom=i.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=i.altitude||0,this.textMinZoom=i.textMinZoom||0,this.textMaxZoom=i.textMaxZoom||30,this.textMinMaxZooms=i.textMinMaxZooms,this.hasAlign=i.hasAlign||!1,this.childCount=0,e.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&n._bindDataItem(s,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=s,this.point=null,this.shader=null,this.minZoom=a||8,this.maxZoom=i.pointMaxZoom||20,this.order=o||0,this.isToolTip=i.isToolTip||!1,this.clickFunc=i.clickFunc||null,this.cFunc=i.cFunc||null,this.mouseMoveFunc=i.mouseMoveFunc||null,this.mouseOutFunc=i.mouseOutFunc||null,this.mMoveFunc=i.mMoveFunc||null,this.hasAlign=i.hasAlign||!1,this.zoomChangeCallback=i.zoomChangeCallback}else console.error("需要绘制的点位数量为0")}var e,i,r,n;return f(t,[{key:"_putImgToDict",value:function(t,e,i){void 0===this.imgDict[t]?this.imgDict[t]={imgSrc:t,width:e,height:i}:(this.imgDict[t].width=(this.imgDict[t].width+e)/2,this.imgDict[t].height=(this.imgDict[t].height+i)/2)}},{key:"_bindDataItem",value:function(t,e){var i={coordinate:[parseFloat(e.longitude),parseFloat(e.latitude)],height:void 0!==e.height?parseFloat(e.height):0,visible:void 0===e.visible||e.visible,code:e.code,status:void 0!==e.status?e.status:1,name:e.name,childNum:0,data:e.data},r=e.texts;if(r){i.texts=[];for(var n=0,a=0;a<r.length;a++){var o=r[a];if(o.text&&o.text.length>0){n+=o.text.length,this.charArray=b(this.charArray,o.text);var s={text:o.text,textSize:o.textSize||14,textDx:o.textDx||0,textDy:o.textDy||0,textColor:o.textColor||"#fff",textAnchor:o.textAnchor||"center",textSpacing:o.textSpacing||2,textOpacity:o.textOpacity||255,textIndex:[]};o.textHaloColor&&(s=Object.assign(s,{textHaloColor:o.textHaloColor,textHaloRadius:o.textHaloRadius||1,textHaloOpacity:void 0!==o.textHaloOpacity?o.textHaloOpacity:255})),i.texts.push(s)}}this.childCount+=n}var h=e.markers;if(h){i.markers=[];for(var c=0,l=0;l<h.length;l++){var u=h[l];u.imgSrc&&(c+=1,this._putImgToDict(u.imgSrc,u.markerWidth||40,u.markerHeight||40),i.markers.push({markerWidth:1*u.markerWidth||40,markerHeight:1*u.markerHeight||40,markerDx:1*u.markerDx||0,markerDy:1*u.markerDy||0,markerColor:u.markerColor,markerOpacity:1*u.markerOpacity||255,key:u.imgSrc,markerIndex:-1}))}this.childCount+=c}t.push(i)}},{key:"_loadTexture",value:(n=c(s().mark((function t(){var e,i,r,n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=s().keys(this.imgDict);case 2:if((t.t1=t.t0()).done){t.next=18;break}if(i=t.t1.value,r=i,!i.includes(".svg")){t.next=12;break}return t.next=8,fetch(i);case 8:return n=t.sent,t.next=11,n.text();case 11:r=t.sent;case 12:return t.next=14,W.addImageProcess(r);case 14:a=t.sent,e.push({key:i,src:a,w:this.imgDict[i].width,h:this.imgDict[i].height,iw:this.imgDict[i].width,ih:this.imgDict[i].height}),t.next=2;break;case 18:return t.abrupt("return",W.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"initGlyphAtlas",value:function(){var t=this.charArray.split("").map((function(t){return function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1?arguments[1]:void 0,r=function(t){var e=t.trim().substring(0,t.lastIndexOf(" ")),i="400";return/bold/i.test(t)?i="900":/medium/i.test(t)?i="500":/light/i.test(t)&&(i="200"),{fontFamily:e,fontWeight:i}}(e),n=r.fontFamily,a=r.fontWeight,o=i.charCodeAt(0),s=ot[e];return s||(s=ot[e]=new at(24,3,8,.25,n,a)),st[e]||(st[e]={}),st[e][i]||(st[e][i]=s.ctx.measureText(i).width),{id:o,bitmap:new $({width:30,height:30},s.draw(i)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=o,t>=19968&&t<=40959?24:st[e][i])}}}("",t)})).reduce((function(t,e){return t[e.id]=e,t}),{});this.glyphMap||(this.glyphMap={}),this.glyphMap["sans-serif"]=t,this.glyphAtlas=new Q(this.glyphMap)}},{key:"addPoint",value:(r=c(s().mark((function t(){var e,i,r,n,a,h,c,l=this;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.dataItems){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this._loadTexture();case 4:return e=t.sent,this.textures||(this.textures=[]),this.textures.push(e.texture),this.initGlyphAtlas(),i=this.glyphAtlas.image,r=i.width,n=i.height,a=i.data,(h=new o.DataTexture(a,r,n)).needsUpdate=!0,h.magFilter=o.LinearFilter,h.minFilter=o.LinearFilter,h.format=o.AlphaFormat,this.textures.push(h),this.m=this._getRawShaderMaterial(e,h,r,n),this.m.depthTest=!1,this.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(e,h,r,n),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,e.xys[t.key])}))})),(c=new J(this.dataItems,{minZoom:this.minZoom,maxZoom:this.maxZoom,interactive:this.interactive,altitude:this.altitude},this.m,this.m_pick,this.glyphMap,this.glyphAtlas,this.childCount,this.threeLayer)).zoomChange=function(){l.m.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m.uniforms.zoomScale.value=76.43702828517625/l.map.getResolution(),l.m_pick.uniforms.cameraToCenterDistance.value=l.map.cameraToCenterDistance,l.m_pick.uniforms.zoomScale.value=76.43702828517625/l.map.getResolution();for(var t=l._getRate(),e=l.point.object3d.geometry.attributes.size.array,i=0,r=0;r<l.dataItems.length;r++){var n=l.dataItems[r];if(n.markers)for(var a=0;a<n.markers.length;a++)e[4*i+0]=n.markers[a].markerWidth*t,e[4*i+1]=n.markers[a].markerHeight*t,e[4*i+2]=n.markers[a].markerDx*t,e[4*i+3]=n.markers[a].markerDy*t,i+=1;if(n.texts)for(var o=function(){var r=n.texts[s].textSize,a=n.texts[s].textDx,o=n.texts[s].textDy;n.texts[s].textIndex.forEach((function(){e[4*i+0]=r*t,e[4*i+1]=0,e[4*i+2]=a*t,e[4*i+3]=o*t,i+=1}))},s=0;s<n.texts.length;s++)o()}l.point.object3d.geometry.attributes.size.needsUpdate=!0,l.zoomChangeCallback&&l.zoomChangeCallback()},this.isToolTip&&c.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),c.object3d.renderOrder=this.order,this.point=c,this.point.parent=this,this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 32:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,i,r){return new o.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:e},sdfTextureSize:{value:[i,r]},canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:76.43702828517625/this.map.getResolution()},mapPitch:{value:this.map.getPitch()*Math.PI/180},gammaScale:{value:1}},vertexShader:"\n precision mediump float;\n\n uniform mat4 modelViewMatrix;\n uniform mat4 projectionMatrix;\n\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform float mapPitch;\n uniform vec2 sdfTextureSize;\n uniform float imgTextureSize;\n\n attribute mat4 instanceMatrix;\n attribute vec4 size;\n attribute vec4 uv_offset;\n attribute vec4 uv_image;\n attribute vec4 util;\n varying vec4 vColor;\n\n #ifdef PICKING\n attribute vec3 pickingColor;\n #else\n varying vec2 vUv;\n varying float vGammaScale;\n varying float vSize;\n varying vec4 vUtil;\n attribute vec4 color;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n void main()\n {\n #ifdef PICKING\n vColor = vec4(pickingColor, 1.);\n #else\n vColor = color;\n vUtil = util;\n #endif\n vec2 utils1 = unpack_float(util.x) / 255.0;\n vec2 wh1 = uv_offset.zw * 32.;\n vec2 offset = vec2(uv_image.z + wh1.x, uv_image.w - wh1.y);\n \n vec2 j = vec2(offset.x + 16., offset.y - 16.);\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(0, 0, 0, 1.);\n float camera_to_anchor_distance = gl_Position.w;\n float distance_ratio = camera_to_anchor_distance / cameraToCenterDistance;\n float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, \n 1.5);\n float m = (1. - cameraToCenterDistance / camera_to_anchor_distance) * perspective_ratio;\n float n = clamp(.5 + .5 * (1. - m), .0, 4.);\n vec3 c = vec3(0.0, 0.0, 0.0);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n vec2 C = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(C, .0) / zoomScale * B * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n #ifndef HAS_ALIGN\n vGammaScale = mix(1., B, perspective_ratio);\n #else\n vGammaScale = B + mapPitch / 4.;\n #endif\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n float width = uv_offset.x / imgTextureSize * color.z;\n float height = uv_offset.y / imgTextureSize * color.w;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n float C = camera_to_anchor_distance / cameraToCenterDistance;\n vec2 B = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(B, .0) / zoomScale * C * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n vec4 color = decode_color(vColor.xy);\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n float dist = texture2D(sdfTexture, vUv).a;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n lowp float buff = (177. + floor(fontScale)) / 256.0;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n gl_FragColor = color * alpha;\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n vec4 u_halo_color = decode_color(vColor.zw);\n float radius = u_halo_width / fontScale / 10.;\n float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n }\n }\n #endif\n }\n ",transparent:!0,side:o.DoubleSide})}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this),this.point&&this.point.on("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_closeEvent",value:function(){this.map.off("pitch",this._setSizeOn,this),this.point&&this.point.off("click empty mousemove mouseout",this._setPointEvent,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m_pick.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance,this.m.uniforms.mapPitch.value=this.map.getPitch()*Math.PI/180}},{key:"addContent",value:(i=c(s().mark((function t(e){return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(e);case 2:this.iconFile&&this._addIcon(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_setPointEvent",value:function(t){var e=t.selectMesh;if("mousemove"===t.type&&e){var i=e.name;if(this.isToolTip)this.point.getToolTip()._content="".concat(i)}"click"===t.type&&e&&this.clickFunc&&!this.cFunc&&this.addContent(e)}},{key:"findItemByCode",value:function(t){for(var e=0;e<this.dataItems.length;e++)if(this.dataItems[e].code===t)return e}},{key:"changeParaValue",value:(e=c(s().mark((function t(e){return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"show",value:function(){var t,e;null===(t=this.point)||void 0===t||t.show();for(var i=0;i<this.dataItems.length;i++){this.dataItems[i].visible=!0}null===(e=this.point)||void 0===e||e.changeVisible()}},{key:"hide",value:function(){var t;null===(t=this.point)||void 0===t||t.hide()}},{key:"setInteractiveState",value:function(t){this.point&&(this.point.options.interactive=t)}},{key:"pointShowHideByCode",value:function(t,e,i){for(var r,n=1/0,o=1/0,s=-1/0,h=-1/0,c=0;c<this.dataItems.length;c++){var l=this.dataItems[c];t.includes(l.code)?(n=Math.min(n,this.dataItems[c].coordinate[0]),o=Math.min(o,this.dataItems[c].coordinate[1]),s=Math.max(s,this.dataItems[c].coordinate[0]),h=Math.max(h,this.dataItems[c].coordinate[1]),l.visible=!0):l.visible=!1}null===(r=this.point)||void 0===r||r.changeVisible(),e&&this.map.fitExtent(new a.Extent(n,o,s,h),i||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),i=new o.Object3D,r=0;this.dataItems.forEach((function(n){var a=t.threeLayer.coordinateToVector3(n.coordinate);if(a.sub(t.point.center),n.height&&(a.z=t.threeLayer.altitudeToVector3(n.height).x),n.markers&&(r+=n.markers.length),n.value&&t.showValueFlag)for(var o=0;o<n.value.length;o++)e<t.valueMinZoom||e>t.valueMaxZoom?i.position.set(-999,-999,0):i.position.set(a.x,a.y,0),i.updateMatrix(),t.point.getObject3d().setMatrixAt(r,i.matrix),t.point.pickMesh.setMatrixAt(r,i.matrix),r+=1;if(n.name&&t.showNameFlag)for(var s=0;s<n.name.length;s++)e<t.nameMinZoom||e>t.nameMaxZoom?i.position.set(-999,-999,0):i.position.set(a.x,a.y,0),i.updateMatrix(),t.point.getObject3d().setMatrixAt(r,i.matrix),t.point.pickMesh.setMatrixAt(r,i.matrix),r+=1})),this.point.getObject3d().instanceMatrix.needsUpdate=!0,this.point.pickMesh.instanceMatrix.needsUpdate=!0}},{key:"dispose",value:function(){this.isToolTip&&this.point&&this.point.removeToolTip(),this._closeEvent(),this.point&&(this.threeLayer.removeMesh(this.point),this.point.object3d.geometry&&this.point.object3d.geometry.dispose(),this.point.object3d.material&&this.point.object3d.material.dispose(),this.point.pickObject3d.geometry&&this.point.pickObject3d.geometry.dispose(),this.point.pickObject3d.material&&this.point.pickObject3d.material.dispose(),this.point._datas=[],this.point._colorMap={},delete this.point.object3d,delete this.point.pickObject3d,this.point.toolTip&&delete this.point.toolTip,delete this.point),this.textures&&this.textures.length>0&&(this.textures.forEach((function(t){t.dispose()})),delete this.textures),this.m&&(this.m.dispose(),delete this.m),this.m_pick&&(this.m_pick.dispose(),delete this.m_pick),this.glyphMap={},this.glyphAtlas&&delete this.glyphAtlas}}]),t}(),ct=function(){function t(e,i){var n=this;l(this,t),this.map=i,this.animationId=null,this.updatables=[];var a=w();this.threeLayer=new r.ThreeLayer(a,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var s=function t(){var e,i;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(e=n.threeLayer)||void 0===e||null===(i=e.getRenderer())||void 0===i||i.clearCanvas(),n.threeLayer.renderScene());var r,a=n.clock.getDelta(),o=x(n.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(a)}}catch(t){o.e(t)}finally{o.f()}n.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,e,i){var r=new o.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),s()},this.threeLayer.addTo(i),this.layerId=a,this.layerName=e,this.dirty=!1,this.initFlag=!1}return f(t,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=w();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function e(){var i,r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(i=t.threeLayer)||void 0===i||null===(r=i.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,a=t.clock.getDelta(),o=x(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(a)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(i){t.threeLayer.prepareToDraw=function(t,r,n){var a=new o.DirectionalLight(16777215);a.position.set(0,-10,10).normalize(),r.add(a),r.add(new o.AmbientLight(16777215)),e(),i()}}))}},{key:"drawRadar",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new I(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new I(t,e,i||{},r.threeLayer,r);n(a)}))}))}},{key:"drawSector",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new O(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new O(t,e,i||{},r.threeLayer,r);n(a)}))}))}},{key:"drawSectorImg",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new F(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new F(t,e,i||{},r.threeLayer,r);n(a)}))}))}},{key:"drawImage",value:function(t,e,i,r){var n=this;return new Promise((function(a){if(n.threeLayer.getScene()){var o=new S(t,e,i,r,n.threeLayer);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new S(t,e,i,r,n.threeLayer);a(o)}))}))}},{key:"drawShock",value:function(t,e){var i=this;return new Promise((function(r){if(i.threeLayer.getScene()){var n=new U(t,e||{},i.threeLayer,i);r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new U(t,e||{},i.threeLayer,i);r(n)}))}))}},{key:"drawPlaneMarker",value:function(t,e){var i=this;return new Promise((function(r){if(i.threeLayer.getScene()){var n=null;t.length>0?(n=new ht(t,e,i.threeLayer)).addPoint().then((function(){r(n)})):r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=null;t.length>0?(n=new ht(t,e,i.threeLayer)).addPoint().then((function(){r(n)})):r(n)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),i=this.threeLayer.getScene(),r=this.threeLayer.getPick(),n=r.pickingTexture;r.pickingScene;var a=this.threeLayer.getRenderer();i.remove(e),e=null,i=null,n.dispose(),n=null,a.context.dispose(),a.context.forceContextLoss(),a.context=null,a.remove(),a=null,this.map.removeLayer(this.threeLayer)}}]),t}();t.imgClass=S,t.layerClass=ct,t.planeMark=ht,t.planeSectorClass=F,t.radarClass=I,t.sectorClass=O,t.shockClass=U,t.sleep=function(t){return new Promise((function(e){return setTimeout(e,t)}))}}));