map-core-func 0.1.17 → 0.1.18

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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("maptalks"),t=require("three"),r=require("maptalks.three");function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var a=i(e),n=i(t);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(a=i.key,n=void 0,"symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?n:String(n)),i)}var a,n}function l(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function u(e,t){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},u(e,t)}function d(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){var t=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(e){return!1}}();return function(){var r,i=h(e);if(t){var a=h(this).constructor;r=Reflect.construct(i,arguments,a)}else r=i.apply(this,arguments);return d(this,r)}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function f(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return m(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?m(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}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 n,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw n}}}}function v(){var e="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"iep".concat(e,"layer")}var g={altitude:0,imageWidth:512,imageHeight:512,texture:null},y=function(e){c(i,r.BaseObject);var t=p(i);function i(e,r,s,l){var c;o(this,i);var h=r=a.Util.extend({},g,r),u=h.altitude;h.imageHeight,h.imageWidth,e instanceof a.Extent||(e=new a.Extent(e));var d=e,p=d.xmin,m=d.ymin,f=d.xmax,v=d.ymax,y=1/0,x=1/0,b=-1/0,_=-1/0;[[p,m],[p,v],[f,v],[f,m]].forEach((function(e){var t=l.coordinateToVector3(e),r=t.x,i=t.y;y=Math.min(r,y),x=Math.min(i,x),b=Math.max(r,b),_=Math.max(i,_)}));var w=Math.abs(b-y),M=Math.abs(_-x),L=new n.PlaneBufferGeometry(w,M);(c=t.call(this))._initOptions(r),c._createMesh(L,s);var j=l.distanceToVector3(u,u).x,O=l.coordinateToVector3(e.getCenter(),j);return c.getObject3d().position.copy(O),c.parent=null,c.type="Image",c}return l(i)}(),x=function(){function e(t,r,i,s,l){var c=this;o(this,e),this.threelayer=l,this.map=l.map,this.textureLoader=new n.TextureLoader;var h=t.split(","),u=r.split(","),d=parseFloat(h[0]),p=parseFloat(h[1]),m=parseFloat(u[0]),f=parseFloat(u[1]),v=s.maxZoom||11,g=s.renderOrder||0,x=s.opacity||1,b=s.minZoom||3,_=new a.Extent(d,p,m,f);this.xmin_g=d,this.ymin_g=p,this.xmax_g=m,this.ymax_g=f,this.textureLoader.load(i,(function(e){var t=new n.MeshBasicMaterial({map:e,transparent:!0,opacity:x}),r=new y(_,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:b,interactive:void 0!==s.interactive&&s.interactive},t,c.threelayer);r.object3d.renderOrder=g,c.imgMesh=r,c.imgMesh.parent=c,c.m=t,c.texture=e,c.threelayer.addMesh(c.imgMesh),s.opacityItems&&s.opacityItems.length>0&&!isNaN(s.opacityItems[0])&&!isNaN(s.opacityItems[1])&&s.opacityItems[0]>3&&s.opacityItems[0]<=18&&s.opacityItems[1]>=0&&s.opacityItems[1]<=1&&(c.opacityItems=s.opacityItems,c._bindMapEvents(),c._viewChange())}))}return l(e,[{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(e,t){var r=this;if(t&&t.leftbottom&&t.righttop){var i=parseFloat(t.leftbottom[0]),o=parseFloat(t.leftbottom[1]),s=parseFloat(t.righttop[0]),l=parseFloat(t.righttop[1]);if(i!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||l!==this.ymax_g){var c=new a.Extent(i,o,s,l),h=1/0,u=1/0,d=-1/0,p=-1/0;[[i,o],[i,l],[s,l],[s,o]].forEach((function(e){var t=r.threelayer.coordinateToVector3(e),i=t.x,a=t.y;h=Math.min(i,h),u=Math.min(a,u),d=Math.max(i,d),p=Math.max(a,p)}));for(var m=Math.abs(d-h),f=Math.abs(p-u),v=new n.PlaneBufferGeometry(m,f),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 b=this.threelayer.coordinateToVector3(c.getCenter(),0);this.imgMesh.getObject3d().position.copy(b),v.dispose(),this.xmin_g=i,this.ymin_g=o,this.xmax_g=s,this.ymax_g=l}}this.textureLoader.load(e,(function(e){r.texture&&r.texture.dispose(),delete r.texture,e.magFilter=n.NearestFilter,e.minFilter=n.NearestFilter,r.imgMesh.object3d.material.map=e,r.imgMesh.object3d.material.map.needsUpdate=!0,r.texture=e,!1===r.imgMesh.isAdd&&r.threelayer&&(r.threelayer.addMesh(r.imgMesh),r.opacityItems&&r._bindMapEvents())}))}},{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}}]),e}(),b={altitude:0,imageWidth:512,imageHeight:512,texture:null},_=function(e){c(i,r.BaseObject);var t=p(i);function i(e,r,s,l,c){var h;o(this,i);var u=(s=a.Util.extend({},b,s)).altitude,d=c.distanceToVector3(r,r).x,p=new n.CircleGeometry(d,32);(h=t.call(this))._initOptions(s),h._createMesh(p,l);var m=c.distanceToVector3(u,u).x,f=c.coordinateToVector3(e,m);return h.getObject3d().position.copy(f),h.parent=null,h.type="radarObject",h}return l(i)}(),w=function(){function e(t,r,i,a,s){o(this,e),this.threelayer=a,this.map=a.map,this.layerClass=s,this.imgUrl=i.imgUrl,this.loader=new n.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var l=new n.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:n.DoubleSide,transparent:!0});this.radar=new _(t,r,{},l,a),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return l(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),M={radius:100,altitude:0},L=function(e){c(i,r.BaseObject);var t=p(i);function i(e,r,s,l){var c;o(this,i),r=a.Util.extend({},M,r,{layer:l,coordinate:e}),(c=t.call(this))._initOptions(r);var h=r,u=h.altitude,d=h.radius,p=l.distanceToVector3(d,d).x,m=r.thetaStart||0,f=r.thetaLength||90,v=new n.CircleGeometry(p,128,m*Math.PI/180,f*Math.PI/180);c._createMesh(v,s);var g=l.distanceToVector3(u,u).x,y=l.coordinateToVector3(e,g);return c.getObject3d().position.copy(y),c}return l(i)}(),j=function(){function e(t,r,i,a,s){o(this,e),this.threelayer=a,this.map=a.map,this.layerClass=s;var l=i.thetaLength||90,c=i.rotation||0,h=l/2;this.imgUrl=i.imgUrl,this.loader=new n.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=c-h;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var d=new n.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:n.DoubleSide,transparent:!0,depthTest:!1});this.sector=new L(t,{thetaStart:u,thetaLength:i.thetaLength,radius:r},d,a),this.threelayer.addMesh(this.sector)}return l(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"dispose",value:function(){}}]),e}(),O={altitude:0,height:0},T=function(e){c(i,r.BaseObject);var t=p(i);function i(e,r,s,l){var c;o(this,i),s=a.Util.extend({},O,s,{layer:l}),c=t.call(this);var h=s,u=h.width,d=h.height,p=h.altitude;c._initOptions(s);var m=new n.PlaneGeometry(u,d);m.computeBoundingBox();var f=new n.Mesh(m,r);c._createGroup(),c.getObject3d().add(f);var v=l.distanceToVector3(p,p).x,g=l.coordinateToVector3(e,v);return f.position.set(0,m.boundingBox.max.y,0),c.getObject3d().position.copy(g),c}return l(i)}();function k(e,t,r,i,a,o){this.tilesHorizontal=t,this.tilesVertical=r,this.numberOfTiles=i,e.wrapS=e.wrapT=n.RepeatWrapping,e.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=a,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,this.update=function(t){for(this.currentDisplayTime+=t;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;e.offset.x=r/this.tilesHorizontal;var i=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?e.offset.y=this.tilesVertical-i/this.tilesVertical:e.offset.y=1-i/this.tilesVertical-1/this.tilesVertical}}}var P=function(){function e(t,r,i,a,s){var l=this;o(this,e),this.threelayer=a,this.map=a.map,this.layerClass=s;var c=i.thetaLength||45;this.millsec=i.millsec||1e3,this.duration=i.duration||75,this.tilesHoriz=i.tilesHoriz||12,this.tilesVert=i.tilesVert||5,this.numTiles=i.numTiles||49;var h=i.rotation||0,u=c/2,d=a.distanceToVector3(r,r).x,p=Math.sin(u*Math.PI/180)*d*2,m=void 0===i.flag;this.imgUrl=i.imgUrl,this.textureLoader=new n.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){l.texture=e,l.annie=new k(e,l.tilesHoriz,l.tilesVert,l.numTiles,l.duration,m);var r=new n.MeshBasicMaterial({transparent:!0,map:e,side:n.DoubleSide,depthTest:!1});l.imgObj=new T(t,r,{width:p,height:d},a),l.imgObj.object3d.renderOrder=1,l.imgObj.object3d.rotation.z=h*Math.PI/180,l.threelayer.addMesh(l.imgObj),l.layerClass.updatables.push(l)}))}return l(e,[{key:"tick",value:function(e){var t;null===(t=this.annie)||void 0===t||t.update(this.millsec*e)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),I={radius:100,altitude:0},S=function(e){c(i,r.BaseObject);var t=p(i);function i(e,r,s,l){var c;o(this,i),r=a.Util.extend({},I,r,{layer:l}),c=t.call(this);var h=r,u=h.width;h.height;var d=h.altitude;c._initOptions(r);var p=new n.CircleGeometry(u,32);c._createMesh(p,s);var m=l.distanceToVector3(d,d).x,f=l.coordinateToVector3(e,m);return c.getObject3d().position.copy(f),c}return l(i)}(),C=function(){function e(t,r,i,a){var s=this;o(this,e),this.threelayer=i,this.map=i.map,this.layerClass=a,this.time=0,i.coordinateToVector3(t,0),this.imgUrl=r.imgUrl,this.textureLoader=new n.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){s.texture=e,s._uniforms={impactPosition:{value:new n.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:s.texture}};var r=new n.ShaderMaterial({uniforms:s._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:n.DoubleSide,transparent:!0,depthTest:!1}),a=new S(t,{width:2,height:2},r,i);s.threelayer.addMesh(a),s.layerClass.updatables.push(s)}))}return l(e,[{key:"tick",value:function(e){this.time+=.2*e,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),e}(),R=function(){function e(t,i){var a=this;o(this,e),this.map=i,this.animationId=null,this.updatables=[];var s=v();this.threeLayer=new r.ThreeLayer(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new n.Clock;var l=function e(){var t,r;(a.threeLayer._needsUpdate=!a.threeLayer._needsUpdate,a.threeLayer._needsUpdate)&&(null===(t=a.threeLayer)||void 0===t||null===(r=t.getRenderer())||void 0===r||r.clearCanvas(),a.threeLayer.renderScene());var i,n=a.clock.getDelta(),o=f(a.updatables);try{for(o.s();!(i=o.n()).done;){i.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}a.animationId=requestAnimationFrame(e)};this.threeLayer.prepareToDraw=function(e,t,r){var i=new n.DirectionalLight(16777215);i.position.set(0,-10,10).normalize(),t.add(i),l()},this.threeLayer.addTo(i),this.layerId=s,this.layerName=t,this.dirty=!1,this.initFlag=!1}return l(e,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var e=v();this.threeLayer.setId(e),this.layerId=e}}},{key:"setVisible",value:function(e,t){this.threeLayer&&(!0===e?(this.threeLayer.show(),t&&t()):(this.threeLayer.hide(),t&&t()))}},{key:"prepareToDraw",value:function(){var e=this,t=function t(){var r,i;(e.threeLayer._needsUpdate=!e.threeLayer._needsUpdate,e.threeLayer._needsUpdate)&&(null===(r=e.threeLayer)||void 0===r||null===(i=r.getRenderer())||void 0===i||i.clearCanvas(),e.threeLayer.renderScene());var a,n=e.clock.getDelta(),o=f(e.updatables);try{for(o.s();!(a=o.n()).done;){a.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}e.animationId=requestAnimationFrame(t)};return new Promise((function(r){e.threeLayer.prepareToDraw=function(e,i,a){var o=new n.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),i.add(o),i.add(new n.AmbientLight(16777215)),t(),r()}}))}},{key:"drawRadar",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new w(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new w(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSector",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new j(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new j(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSectorImg",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new P(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new P(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawImage",value:function(e,t,r,i){var a=this;return new Promise((function(n){if(a.threeLayer.getScene()){var o=new x(e,t,r,i,a.threeLayer);n(o)}else a.initFlag=!0,a.prepareToDraw().then((function(){var o=new x(e,t,r,i,a.threeLayer);n(o)}))}))}},{key:"drawShock",value:function(e,t){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var a=new C(e,t||{},r.threeLayer,r);i(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new C(e,t||{},r.threeLayer,r);i(a)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var e=this.threeLayer.getMeshes();this.threeLayer.clear(),e.forEach((function(e){}));var t=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),i=this.threeLayer.getPick(),a=i.pickingTexture;i.pickingScene;var n=this.threeLayer.getRenderer();r.remove(t),t=null,r=null,a.dispose(),a=null,n.context.dispose(),n.context.forceContextLoss(),n.context=null,n.remove(),n=null,this.map.removeLayer(this.threeLayer)}}]),e}();exports.imgClass=x,exports.layerClass=R,exports.planeSectorClass=P,exports.radarClass=w,exports.sectorClass=j,exports.shockClass=C,exports.sleep=function(e){return new Promise((function(t){return setTimeout(t,e)}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("maptalks"),e=require("three"),i=require("maptalks.three");function r(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 n=r(t),a=r(e);function o(){o=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",s=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,s,(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 s(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 h(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function o(t){s(a,r,n,o,h,"next",t)}function h(t){s(a,r,n,o,h,"throw",t)}o(void 0)}))}}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(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 u(t,e,i){return e&&l(t.prototype,e),i&&l(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(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&&m(t,e)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function m(t,e){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},m(t,e)}function p(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 v(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=d(t);if(e){var n=d(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return p(this,i)}}function g(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 y(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 g(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)?g(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 x(){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 w(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function b(t,e){return 256*(t=a.MathUtils.clamp(Math.floor(t),0,255))+(e=a.MathUtils.clamp(Math.floor(e),0,255))}var _={altitude:0,imageWidth:512,imageHeight:512,texture:null},k=function(t){f(r,i.BaseObject);var e=v(r);function r(t,i,o,s){var h;c(this,r);var l=i=n.Util.extend({},_,i),u=l.altitude;l.imageHeight,l.imageWidth,t instanceof n.Extent||(t=new n.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),k=Math.abs(w-y),M=new a.PlaneBufferGeometry(b,k);(h=e.call(this))._initOptions(i),h._createMesh(M,o);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 u(r)}(),M=function(){function t(e,i,r,o,s){var h=this;c(this,t),this.threelayer=s,this.map=s.map,this.textureLoader=new a.TextureLoader;var l=e.split(","),u=i.split(","),f=parseFloat(l[0]),d=parseFloat(l[1]),m=parseFloat(u[0]),p=parseFloat(u[1]),v=o.maxZoom||11,g=o.renderOrder||0,y=o.opacity||1,x=o.minZoom||3,w=new n.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 a.MeshBasicMaterial({map:t,transparent:!0,opacity:y}),i=new k(w,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:x,interactive:void 0!==o.interactive&&o.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),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(h.opacityItems=o.opacityItems,h._bindMapEvents(),h._viewChange())}))}return u(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]),o=parseFloat(e.leftbottom[1]),s=parseFloat(e.righttop[0]),h=parseFloat(e.righttop[1]);if(r!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||h!==this.ymax_g){var c=new n.Extent(r,o,s,h),l=1/0,u=1/0,f=-1/0,d=-1/0;[[r,o],[r,h],[s,h],[s,o]].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 a.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=o,this.xmax_g=s,this.ymax_g=h}}this.textureLoader.load(t,(function(t){i.texture&&i.texture.dispose(),delete i.texture,t.magFilter=a.NearestFilter,t.minFilter=a.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}(),S={altitude:0,imageWidth:512,imageHeight:512,texture:null},C=function(t){f(r,i.BaseObject);var e=v(r);function r(t,i,o,s,h){var l;c(this,r);var u=(o=n.Util.extend({},S,o)).altitude,f=h.distanceToVector3(i,i).x,d=new a.CircleGeometry(f,32);(l=e.call(this))._initOptions(o),l._createMesh(d,s);var m=h.distanceToVector3(u,u).x,p=h.coordinateToVector3(t,m);return l.getObject3d().position.copy(p),l.parent=null,l.type="radarObject",l}return u(r)}(),T=function(){function t(e,i,r,n,o){c(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.imgUrl=r.imgUrl,this.loader=new a.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var s=new a.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:a.DoubleSide,transparent:!0});this.radar=new C(e,i,{},s,n),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return u(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}(),I={radius:100,altitude:0},O=function(t){f(r,i.BaseObject);var e=v(r);function r(t,i,o,s){var h;c(this,r),i=n.Util.extend({},I,i,{layer:s,coordinate:t}),(h=e.call(this))._initOptions(i);var l=i,u=l.altitude,f=l.radius,d=s.distanceToVector3(f,f).x,m=i.thetaStart||0,p=i.thetaLength||90,v=new a.CircleGeometry(d,128,m*Math.PI/180,p*Math.PI/180);h._createMesh(v,o);var g=s.distanceToVector3(u,u).x,y=s.coordinateToVector3(t,g);return h.getObject3d().position.copy(y),h}return u(r)}(),L=function(){function t(e,i,r,n,o){c(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o;var s=r.thetaLength||90,h=r.rotation||0,l=s/2;this.imgUrl=r.imgUrl,this.loader=new a.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=h-l;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var f=new a.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:a.DoubleSide,transparent:!0,depthTest:!1});this.sector=new O(e,{thetaStart:u,thetaLength:r.thetaLength,radius:i},f,n),this.threelayer.addMesh(this.sector)}return u(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){f(r,i.BaseObject);var e=v(r);function r(t,i,o,s){var h;c(this,r),o=n.Util.extend({},P,o,{layer:s}),h=e.call(this);var l=o,u=l.width,f=l.height,d=l.altitude;h._initOptions(o);var m=new a.PlaneGeometry(u,f);m.computeBoundingBox();var p=new a.Mesh(m,i);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 u(r)}();function A(t,e,i,r,n,o){this.tilesHorizontal=e,this.tilesVertical=i,this.numberOfTiles=r,t.wrapS=t.wrapT=a.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=n,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,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 z=function(){function t(e,i,r,n,o){var s=this;c(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o;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 l=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 a.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s.annie=new A(t,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,m);var i=new a.MeshBasicMaterial({transparent:!0,map:t,side:a.DoubleSide,depthTest:!1});s.imgObj=new j(e,i,{width:d,height:f},n),s.imgObj.object3d.renderOrder=1,s.imgObj.object3d.rotation.z=l*Math.PI/180,s.threelayer.addMesh(s.imgObj),s.layerClass.updatables.push(s)}))}return u(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}(),F={radius:100,altitude:0},D=function(t){f(r,i.BaseObject);var e=v(r);function r(t,i,o,s){var h;c(this,r),i=n.Util.extend({},F,i,{layer:s}),h=e.call(this);var l=i,u=l.width;l.height;var f=l.altitude;h._initOptions(i);var d=new a.CircleGeometry(u,32);h._createMesh(d,o);var m=s.distanceToVector3(f,f).x,p=s.coordinateToVector3(t,m);return h.getObject3d().position.copy(p),h}return u(r)}(),E=function(){function t(e,i,r,n){var o=this;c(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 a.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){o.texture=t,o._uniforms={impactPosition:{value:new a.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var i=new a.ShaderMaterial({uniforms:o._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:a.DoubleSide,transparent:!0,depthTest:!1}),n=new D(e,{width:2,height:2},i,r);o.threelayer.addMesh(n),o.layerClass.updatables.push(o)}))}return u(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),U=6371008.8,V={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*U,kilometers:6371.0088,kilometres:6371.0088,meters:U,metres:U,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:U/1852,radians:1,yards:6967335.223679999};function R(t){return t%360*Math.PI/180}function B(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 Z(t,e,i){void 0===i&&(i={});var r=B(t),n=B(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=V[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 N(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 G=document.createElement("canvas"),W=function(){function t(){c(this,t),this.type="gisCommon"}return u(t,null,[{key:"getTexture",value:function(t,e,i,r){var n=t.getContext("2d");n.drawImage(e,i,r);var o=new a.Texture(n.getImageData(0,0,t.width,t.height));return o.minFilter=a.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(t,e,i,r,n){G.width=G.height=128;var o=G.getContext("2d");o.drawImage(t,e,i,r,n);var s=new a.Texture(o.getImageData(0,0,G.width,G.height));return s.minFilter=a.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*Z({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(),o=i.distanceToVector3(e.radius,e.radius).x,s=new a.Vector3(r.x,r.y+o,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*Z({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=B(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(N(n,h[l][0],i.ignoreBoundary)){for(var u=!1,f=1;f<h[l].length&&!u;)N(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 n.Coordinate&&(i=t.x,r=t.y);var a=e.xmin,o=e.ymin,s=e.xmax,h=e.ymax;return a<=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){G.width=e,G.height=i;var r=G.getContext("2d");r.drawImage(t,0,0,e,i);var n=new a.Texture(r.getImageData(0,0,G.width,G.height));return n.magFilter=a.NearestFilter,n.minFilter=a.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 o=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(o<e[h]){s=e[h];break}s=1024}G.width=G.height=s;for(var c=G.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 a.Texture(c.getImageData(0,0,G.width,G.height));return k.minFilter=a.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 o=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(o<e[h]){s=e[h];break}s=1024}G.width=G.height=s;for(var c=G.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 a.Texture(c.getImageData(0,0,G.width,G.height));return M.minFilter=a.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 o=(r=n)*i+5*r,s=0,h=0;h<e.length;h++){if(o<e[h]){s=e[h];break}s=1024}G.width=G.height=s;for(var c=G.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 a.Texture(c.getImageData(0,0,G.width,G.height));return w.minFilter=a.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){G.width=G.height=t;var i=G.width/2,r=G.height/2;if(e){var n=0;e.forEach((function(t){var e=G.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 o=new a.Texture(G);return o.minFilter=a.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(t,e,i,r){var n=document.createElement("canvas");n.width=t,n.height=e;var o=n.getContext("2d");o.drawImage(i,0,0,t,e);var s=n.width/2,h=n.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(r.fontsize,"px Arial"),o.fillText(r.txt,s,h);var c=new a.Texture(n);return c.magFilter=a.NearestFilter,c.minFilter=a.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 a.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 H(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 Y=q;function q(t,e){this.x=t,this.y=e}q.prototype={clone:function(){return new q(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}},q.convert=function(t){return t instanceof q?t:Array.isArray(t)?new q(t[0],t[1]):t};var X={radius:40,altitude:0},K=function(t){f(r,i.BaseObject);var e=v(r);function r(t,i,o,s,h,l,u,f){var d;c(this,r);var m=function(t){for(var e=1/0,i=1/0,r=-1/0,a=-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 n.Coordinate&&(p=m.x,v=m.y),e=Math.min(e,p),i=Math.min(i,v),r=Math.max(r,p),a=Math.max(a,v)}return new n.Coordinate((e+r)/2,(i+a)/2)}(t);d=e.call(this),i=n.Util.extend({center:m,layer:f},X,i),d._initOptions(i);var p=d.getLayer().getPick();d._colorMap={},d._datas=t,d._childCount=u;var v=f.coordinateToVector3(m);d.glyphMap=h,d.glyphAtlas=l;for(var g=new a.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 a.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),_=new a.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),k=new a.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),M=new a.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),S=new a.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),_.setXYZW(C,i.u,i.v,-16,16),i.markerColor){var r=b(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=b(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=b(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),_.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 a.Uint16BufferAttribute(y,1)),g.setAttribute("uv_offset",new a.Float32BufferAttribute(x,4,!0)),g.setAttribute("size",w),g.setAttribute("uv_image",_),g.setAttribute("color",k),g.setAttribute("util",M),g.setAttribute("pickingColor",S),d._createInstancedMesh(g,o,d._childCount),d.getObject3d().instanceMatrix.setUsage(a.DynamicDrawUsage);var O=new a.InstancedMesh(g,s,d._childCount);O.instanceMatrix.setUsage(a.DynamicDrawUsage);var L=p.getColor().getHex();O._colorIndex=L,d.setPickObject3d(O);var P=new a.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++)P.position.set(r.x,r.y,0),P.updateMatrix(),d.getObject3d().setMatrixAt(C,P.matrix),O.setMatrixAt(C,P.matrix),C+=1}}));var j=f.altitudeToVector3(i.altitude,i.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 u(r,[{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 a.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)}),o=n.b;return[b(n.r,n.g),b(o,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,i,r){var n=[],a=[0,0],o=H(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 Y(m,p),x=new Y(v,p),w=new Y(m,g),b=new Y(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 a.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}}]),r}(),J=function(){function t(e,i){c(this,t),this.createImage(e,1,i)}return u(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 $=u((function t(e){c(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 l={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(l),o[s]={rect:l,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 J({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;J.copy(y.bitmap,m,{x:0,y:0},{x:x.x+1,y:x.y+1},y.bitmap)}}}this.image=m,this.positions=i})),Q={exports:{}};Q.exports=et,Q.exports.default=et;var tt=1e20;function et(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 it(t,e,i,r,n,a){for(var o=0;o<e;o++)rt(t,o,e,i,r,n,a);for(var s=0;s<i;s++)rt(t,s*e,1,e,r,n,a)}function rt(t,e,i,r,n,a,o){var s,h,c,l;for(a[0]=0,o[0]=-tt,o[1]=tt,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]=tt}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)}}et.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(tt,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]=tt;else if(0===u)a[l]=tt,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),it(this.gridOuter,i,n,this.f,this.v,this.z),it(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}}},et.prototype.draw=function(t){return this._draw(t,!1).data},et.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var nt=Q.exports,at={},ot={};var st=function(){function t(e,i,r){var n=this;c(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,s;return u(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=w(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:(s=h(o().mark((function t(){var e,i,r,n,a;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=o().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 s.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=at[e];return s||(s=at[e]=new nt(24,3,8,.25,n,a)),ot[e]||(ot[e]={}),ot[e][i]||(ot[e][i]=s.ctx.measureText(i).width),{id:o,bitmap:new J({width:30,height:30},s.draw(i)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=o,t>=19968&&t<=40959?24:ot[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 $(this.glyphMap)}},{key:"addPoint",value:(r=h(o().mark((function t(){var e,i,r,n,s,h,c,l=this;return o().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,s=i.data,(h=new a.DataTexture(s,r,n)).needsUpdate=!0,h.magFilter=a.LinearFilter,h.minFilter=a.LinearFilter,h.format=a.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 K(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 a.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:a.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=h(o().mark((function t(e){return o().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=h(o().mark((function t(e){return o().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,a=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)?(a=Math.min(a,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 n.Extent(a,o,s,h),i||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),i=new a.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}(),ht=function(){function t(e,r){var n=this;c(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=x();this.threeLayer=new i.ThreeLayer(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new a.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=y(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 a.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=e,this.dirty=!1,this.initFlag=!1}return u(t,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=x();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=y(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 o=new a.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),r.add(o),r.add(new a.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 T(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new T(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 L(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new L(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 z(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new z(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 M(t,e,i,r,n.threeLayer);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new M(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 E(t,e||{},i.threeLayer,i);r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new E(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 st(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 st(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}();exports.imgClass=M,exports.layerClass=ht,exports.planeMark=st,exports.planeSectorClass=z,exports.radarClass=T,exports.sectorClass=L,exports.shockClass=E,exports.sleep=function(t){return new Promise((function(e){return setTimeout(e,t)}))};
@@ -1 +1 @@
1
- import*as e from"maptalks";import*as t from"three";import{BaseObject as r,ThreeLayer as i}from"maptalks.three";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(a=i.key,n=void 0,"symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?n:String(n)),i)}var a,n}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function h(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function u(e){var t=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(e){return!1}}();return function(){var r,i=l(e);if(t){var a=l(this).constructor;r=Reflect.construct(i,arguments,a)}else r=i.apply(this,arguments);return h(this,r)}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function m(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}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 n,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw n}}}}function p(){var e="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"iep".concat(e,"layer")}function f(e){return new Promise((function(t){return setTimeout(t,e)}))}var v={altitude:0,imageWidth:512,imageHeight:512,texture:null},g=function(i){s(l,r);var n=u(l);function l(r,i,o,s){var c;a(this,l);var h=i=e.Util.extend({},v,i),u=h.altitude;h.imageHeight,h.imageWidth,r instanceof e.Extent||(r=new e.Extent(r));var d=r,m=d.xmin,p=d.ymin,f=d.xmax,g=d.ymax,y=1/0,x=1/0,b=-1/0,_=-1/0;[[m,p],[m,g],[f,g],[f,p]].forEach((function(e){var t=s.coordinateToVector3(e),r=t.x,i=t.y;y=Math.min(r,y),x=Math.min(i,x),b=Math.max(r,b),_=Math.max(i,_)}));var w=Math.abs(b-y),M=Math.abs(_-x),L=new t.PlaneBufferGeometry(w,M);(c=n.call(this))._initOptions(i),c._createMesh(L,o);var T=s.distanceToVector3(u,u).x,k=s.coordinateToVector3(r.getCenter(),T);return c.getObject3d().position.copy(k),c.parent=null,c.type="Image",c}return o(l)}(),y=function(){function r(i,n,o,s,l){var c=this;a(this,r),this.threelayer=l,this.map=l.map,this.textureLoader=new t.TextureLoader;var h=i.split(","),u=n.split(","),d=parseFloat(h[0]),m=parseFloat(h[1]),p=parseFloat(u[0]),f=parseFloat(u[1]),v=s.maxZoom||11,y=s.renderOrder||0,x=s.opacity||1,b=s.minZoom||3,_=new e.Extent(d,m,p,f);this.xmin_g=d,this.ymin_g=m,this.xmax_g=p,this.ymax_g=f,this.textureLoader.load(o,(function(e){var r=new t.MeshBasicMaterial({map:e,transparent:!0,opacity:x}),i=new g(_,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:b,interactive:void 0!==s.interactive&&s.interactive},r,c.threelayer);i.object3d.renderOrder=y,c.imgMesh=i,c.imgMesh.parent=c,c.m=r,c.texture=e,c.threelayer.addMesh(c.imgMesh),s.opacityItems&&s.opacityItems.length>0&&!isNaN(s.opacityItems[0])&&!isNaN(s.opacityItems[1])&&s.opacityItems[0]>3&&s.opacityItems[0]<=18&&s.opacityItems[1]>=0&&s.opacityItems[1]<=1&&(c.opacityItems=s.opacityItems,c._bindMapEvents(),c._viewChange())}))}return o(r,[{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(r,i){var a=this;if(i&&i.leftbottom&&i.righttop){var n=parseFloat(i.leftbottom[0]),o=parseFloat(i.leftbottom[1]),s=parseFloat(i.righttop[0]),l=parseFloat(i.righttop[1]);if(n!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||l!==this.ymax_g){var c=new e.Extent(n,o,s,l),h=1/0,u=1/0,d=-1/0,m=-1/0;[[n,o],[n,l],[s,l],[s,o]].forEach((function(e){var t=a.threelayer.coordinateToVector3(e),r=t.x,i=t.y;h=Math.min(r,h),u=Math.min(i,u),d=Math.max(r,d),m=Math.max(i,m)}));for(var p=Math.abs(d-h),f=Math.abs(m-u),v=new t.PlaneBufferGeometry(p,f),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 b=this.threelayer.coordinateToVector3(c.getCenter(),0);this.imgMesh.getObject3d().position.copy(b),v.dispose(),this.xmin_g=n,this.ymin_g=o,this.xmax_g=s,this.ymax_g=l}}this.textureLoader.load(r,(function(e){a.texture&&a.texture.dispose(),delete a.texture,e.magFilter=t.NearestFilter,e.minFilter=t.NearestFilter,a.imgMesh.object3d.material.map=e,a.imgMesh.object3d.material.map.needsUpdate=!0,a.texture=e,!1===a.imgMesh.isAdd&&a.threelayer&&(a.threelayer.addMesh(a.imgMesh),a.opacityItems&&a._bindMapEvents())}))}},{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}}]),r}(),x={altitude:0,imageWidth:512,imageHeight:512,texture:null},b=function(i){s(l,r);var n=u(l);function l(r,i,o,s,c){var h;a(this,l);var u=(o=e.Util.extend({},x,o)).altitude,d=c.distanceToVector3(i,i).x,m=new t.CircleGeometry(d,32);(h=n.call(this))._initOptions(o),h._createMesh(m,s);var p=c.distanceToVector3(u,u).x,f=c.coordinateToVector3(r,p);return h.getObject3d().position.copy(f),h.parent=null,h.type="radarObject",h}return o(l)}(),_=function(){function e(r,i,n,o,s){a(this,e),this.threelayer=o,this.map=o.map,this.layerClass=s,this.imgUrl=n.imgUrl,this.loader=new t.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var l=new t.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:t.DoubleSide,transparent:!0});this.radar=new b(r,i,{},l,o),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return o(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),w={radius:100,altitude:0},M=function(i){s(l,r);var n=u(l);function l(r,i,o,s){var c;a(this,l),i=e.Util.extend({},w,i,{layer:s,coordinate:r}),(c=n.call(this))._initOptions(i);var h=i,u=h.altitude,d=h.radius,m=s.distanceToVector3(d,d).x,p=i.thetaStart||0,f=i.thetaLength||90,v=new t.CircleGeometry(m,128,p*Math.PI/180,f*Math.PI/180);c._createMesh(v,o);var g=s.distanceToVector3(u,u).x,y=s.coordinateToVector3(r,g);return c.getObject3d().position.copy(y),c}return o(l)}(),L=function(){function e(r,i,n,o,s){a(this,e),this.threelayer=o,this.map=o.map,this.layerClass=s;var l=n.thetaLength||90,c=n.rotation||0,h=l/2;this.imgUrl=n.imgUrl,this.loader=new t.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=c-h;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var d=new t.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:t.DoubleSide,transparent:!0,depthTest:!1});this.sector=new M(r,{thetaStart:u,thetaLength:n.thetaLength,radius:i},d,o),this.threelayer.addMesh(this.sector)}return o(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"dispose",value:function(){}}]),e}(),T={altitude:0,height:0},k=function(i){s(l,r);var n=u(l);function l(r,i,o,s){var c;a(this,l),o=e.Util.extend({},T,o,{layer:s}),c=n.call(this);var h=o,u=h.width,d=h.height,m=h.altitude;c._initOptions(o);var p=new t.PlaneGeometry(u,d);p.computeBoundingBox();var f=new t.Mesh(p,i);c._createGroup(),c.getObject3d().add(f);var v=s.distanceToVector3(m,m).x,g=s.coordinateToVector3(r,v);return f.position.set(0,p.boundingBox.max.y,0),c.getObject3d().position.copy(g),c}return o(l)}();function j(e,r,i,a,n,o){this.tilesHorizontal=r,this.tilesVertical=i,this.numberOfTiles=a,e.wrapS=e.wrapT=t.RepeatWrapping,e.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=n,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,this.update=function(t){for(this.currentDisplayTime+=t;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;e.offset.x=r/this.tilesHorizontal;var i=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?e.offset.y=this.tilesVertical-i/this.tilesVertical:e.offset.y=1-i/this.tilesVertical-1/this.tilesVertical}}}var O=function(){function e(r,i,n,o,s){var l=this;a(this,e),this.threelayer=o,this.map=o.map,this.layerClass=s;var c=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var h=n.rotation||0,u=c/2,d=o.distanceToVector3(i,i).x,m=Math.sin(u*Math.PI/180)*d*2,p=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new t.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){l.texture=e,l.annie=new j(e,l.tilesHoriz,l.tilesVert,l.numTiles,l.duration,p);var i=new t.MeshBasicMaterial({transparent:!0,map:e,side:t.DoubleSide,depthTest:!1});l.imgObj=new k(r,i,{width:m,height:d},o),l.imgObj.object3d.renderOrder=1,l.imgObj.object3d.rotation.z=h*Math.PI/180,l.threelayer.addMesh(l.imgObj),l.layerClass.updatables.push(l)}))}return o(e,[{key:"tick",value:function(e){var t;null===(t=this.annie)||void 0===t||t.update(this.millsec*e)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),P={radius:100,altitude:0},I=function(i){s(l,r);var n=u(l);function l(r,i,o,s){var c;a(this,l),i=e.Util.extend({},P,i,{layer:s}),c=n.call(this);var h=i,u=h.width;h.height;var d=h.altitude;c._initOptions(i);var m=new t.CircleGeometry(u,32);c._createMesh(m,o);var p=s.distanceToVector3(d,d).x,f=s.coordinateToVector3(r,p);return c.getObject3d().position.copy(f),c}return o(l)}(),S=function(){function e(r,i,n,o){var s=this;a(this,e),this.threelayer=n,this.map=n.map,this.layerClass=o,this.time=0,n.coordinateToVector3(r,0),this.imgUrl=i.imgUrl,this.textureLoader=new t.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){s.texture=e,s._uniforms={impactPosition:{value:new t.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:s.texture}};var i=new t.ShaderMaterial({uniforms:s._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:t.DoubleSide,transparent:!0,depthTest:!1}),a=new I(r,{width:2,height:2},i,n);s.threelayer.addMesh(a),s.layerClass.updatables.push(s)}))}return o(e,[{key:"tick",value:function(e){this.time+=.2*e,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),e}(),C=function(){function e(r,n){var o=this;a(this,e),this.map=n,this.animationId=null,this.updatables=[];var s=p();this.threeLayer=new i(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new t.Clock;var l=function e(){var t,r;(o.threeLayer._needsUpdate=!o.threeLayer._needsUpdate,o.threeLayer._needsUpdate)&&(null===(t=o.threeLayer)||void 0===t||null===(r=t.getRenderer())||void 0===r||r.clearCanvas(),o.threeLayer.renderScene());var i,a=o.clock.getDelta(),n=m(o.updatables);try{for(n.s();!(i=n.n()).done;){i.value.tick(a)}}catch(e){n.e(e)}finally{n.f()}o.animationId=requestAnimationFrame(e)};this.threeLayer.prepareToDraw=function(e,r,i){var a=new t.DirectionalLight(16777215);a.position.set(0,-10,10).normalize(),r.add(a),l()},this.threeLayer.addTo(n),this.layerId=s,this.layerName=r,this.dirty=!1,this.initFlag=!1}return o(e,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var e=p();this.threeLayer.setId(e),this.layerId=e}}},{key:"setVisible",value:function(e,t){this.threeLayer&&(!0===e?(this.threeLayer.show(),t&&t()):(this.threeLayer.hide(),t&&t()))}},{key:"prepareToDraw",value:function(){var e=this,r=function t(){var r,i;(e.threeLayer._needsUpdate=!e.threeLayer._needsUpdate,e.threeLayer._needsUpdate)&&(null===(r=e.threeLayer)||void 0===r||null===(i=r.getRenderer())||void 0===i||i.clearCanvas(),e.threeLayer.renderScene());var a,n=e.clock.getDelta(),o=m(e.updatables);try{for(o.s();!(a=o.n()).done;){a.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}e.animationId=requestAnimationFrame(t)};return new Promise((function(i){e.threeLayer.prepareToDraw=function(e,a,n){var o=new t.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),a.add(o),a.add(new t.AmbientLight(16777215)),r(),i()}}))}},{key:"drawRadar",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new _(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new _(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSector",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new L(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new L(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSectorImg",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new O(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new O(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawImage",value:function(e,t,r,i){var a=this;return new Promise((function(n){if(a.threeLayer.getScene()){var o=new y(e,t,r,i,a.threeLayer);n(o)}else a.initFlag=!0,a.prepareToDraw().then((function(){var o=new y(e,t,r,i,a.threeLayer);n(o)}))}))}},{key:"drawShock",value:function(e,t){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var a=new S(e,t||{},r.threeLayer,r);i(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new S(e,t||{},r.threeLayer,r);i(a)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var e=this.threeLayer.getMeshes();this.threeLayer.clear(),e.forEach((function(e){}));var t=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),i=this.threeLayer.getPick(),a=i.pickingTexture;i.pickingScene;var n=this.threeLayer.getRenderer();r.remove(t),t=null,r=null,a.dispose(),a=null,n.context.dispose(),n.context.forceContextLoss(),n.context=null,n.remove(),n=null,this.map.removeLayer(this.threeLayer)}}]),e}();export{y as imgClass,C as layerClass,O as planeSectorClass,_ as radarClass,L as sectorClass,S as shockClass,f as sleep};
1
+ import*as t from"maptalks";import*as e from"three";import{BaseObject as i,ThreeLayer as r}from"maptalks.three";function n(){n=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,r=Object.defineProperty||function(t,e,i){t[e]=i.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",h=a.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,o,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(C([])));y&&y!==e&&i.call(y,o)&&(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[o];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,s,(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,o,(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 a(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 o(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var o=t.apply(e,i);function s(t){a(o,r,n,s,h,"next",t)}function h(t){a(o,r,n,s,h,"throw",t)}s(void 0)}))}}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(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 c(t,e,i){return e&&h(t.prototype,e),i&&h(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(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&&f(t,e)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function d(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 m(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=u(t);if(e){var n=u(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return d(this,i)}}function p(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 v(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 p(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)?p(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 g(){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 y(t){return new Promise((function(e){return setTimeout(e,t)}))}function x(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function w(t,i){return 256*(t=e.MathUtils.clamp(Math.floor(t),0,255))+(i=e.MathUtils.clamp(Math.floor(i),0,255))}var b={altitude:0,imageWidth:512,imageHeight:512,texture:null},_=function(r){l(a,i);var n=m(a);function a(i,r,o,h){var c;s(this,a);var l=r=t.Util.extend({},b,r),u=l.altitude;l.imageHeight,l.imageWidth,i instanceof t.Extent||(i=new t.Extent(i));var f=i,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=h.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 _=Math.abs(x-g),k=Math.abs(w-y),M=new e.PlaneBufferGeometry(_,k);(c=n.call(this))._initOptions(r),c._createMesh(M,o);var S=h.distanceToVector3(u,u).x,T=h.coordinateToVector3(i.getCenter(),S);return c.getObject3d().position.copy(T),c.parent=null,c.type="Image",c}return c(a)}(),k=function(){function i(r,n,a,o,h){var c=this;s(this,i),this.threelayer=h,this.map=h.map,this.textureLoader=new e.TextureLoader;var l=r.split(","),u=n.split(","),f=parseFloat(l[0]),d=parseFloat(l[1]),m=parseFloat(u[0]),p=parseFloat(u[1]),v=o.maxZoom||11,g=o.renderOrder||0,y=o.opacity||1,x=o.minZoom||3,w=new t.Extent(f,d,m,p);this.xmin_g=f,this.ymin_g=d,this.xmax_g=m,this.ymax_g=p,this.textureLoader.load(a,(function(t){var i=new e.MeshBasicMaterial({map:t,transparent:!0,opacity:y}),r=new _(w,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:x,interactive:void 0!==o.interactive&&o.interactive},i,c.threelayer);r.object3d.renderOrder=g,c.imgMesh=r,c.imgMesh.parent=c,c.m=i,c.texture=t,c.threelayer.addMesh(c.imgMesh),o.opacityItems&&o.opacityItems.length>0&&!isNaN(o.opacityItems[0])&&!isNaN(o.opacityItems[1])&&o.opacityItems[0]>3&&o.opacityItems[0]<=18&&o.opacityItems[1]>=0&&o.opacityItems[1]<=1&&(c.opacityItems=o.opacityItems,c._bindMapEvents(),c._viewChange())}))}return c(i,[{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(i,r){var n=this;if(r&&r.leftbottom&&r.righttop){var a=parseFloat(r.leftbottom[0]),o=parseFloat(r.leftbottom[1]),s=parseFloat(r.righttop[0]),h=parseFloat(r.righttop[1]);if(a!==this.xmin_g||o!==this.ymin_g||s!==this.xmax_g||h!==this.ymax_g){var c=new t.Extent(a,o,s,h),l=1/0,u=1/0,f=-1/0,d=-1/0;[[a,o],[a,h],[s,h],[s,o]].forEach((function(t){var e=n.threelayer.coordinateToVector3(t),i=e.x,r=e.y;l=Math.min(i,l),u=Math.min(r,u),f=Math.max(i,f),d=Math.max(r,d)}));for(var m=Math.abs(f-l),p=Math.abs(d-u),v=new e.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=a,this.ymin_g=o,this.xmax_g=s,this.ymax_g=h}}this.textureLoader.load(i,(function(t){n.texture&&n.texture.dispose(),delete n.texture,t.magFilter=e.NearestFilter,t.minFilter=e.NearestFilter,n.imgMesh.object3d.material.map=t,n.imgMesh.object3d.material.map.needsUpdate=!0,n.texture=t,!1===n.imgMesh.isAdd&&(n.threelayer?(n.threelayer.addMesh(n.imgMesh),n.opacityItems&&n._bindMapEvents()):n.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}}]),i}(),M={altitude:0,imageWidth:512,imageHeight:512,texture:null},S=function(r){l(a,i);var n=m(a);function a(i,r,o,h,c){var l;s(this,a);var u=(o=t.Util.extend({},M,o)).altitude,f=c.distanceToVector3(r,r).x,d=new e.CircleGeometry(f,32);(l=n.call(this))._initOptions(o),l._createMesh(d,h);var m=c.distanceToVector3(u,u).x,p=c.coordinateToVector3(i,m);return l.getObject3d().position.copy(p),l.parent=null,l.type="radarObject",l}return c(a)}(),T=function(){function t(i,r,n,a,o){s(this,t),this.threelayer=a,this.map=a.map,this.layerClass=o,this.imgUrl=n.imgUrl,this.loader=new e.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var h=new e.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:e.DoubleSide,transparent:!0});this.radar=new S(i,r,{},h,a),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return c(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}(),C={radius:100,altitude:0},I=function(r){l(a,i);var n=m(a);function a(i,r,o,h){var c;s(this,a),r=t.Util.extend({},C,r,{layer:h,coordinate:i}),(c=n.call(this))._initOptions(r);var l=r,u=l.altitude,f=l.radius,d=h.distanceToVector3(f,f).x,m=r.thetaStart||0,p=r.thetaLength||90,v=new e.CircleGeometry(d,128,m*Math.PI/180,p*Math.PI/180);c._createMesh(v,o);var g=h.distanceToVector3(u,u).x,y=h.coordinateToVector3(i,g);return c.getObject3d().position.copy(y),c}return c(a)}(),L=function(){function t(i,r,n,a,o){s(this,t),this.threelayer=a,this.map=a.map,this.layerClass=o;var h=n.thetaLength||90,c=n.rotation||0,l=h/2;this.imgUrl=n.imgUrl,this.loader=new e.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=c-l;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var f=new e.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:e.DoubleSide,transparent:!0,depthTest:!1});this.sector=new I(i,{thetaStart:u,thetaLength:n.thetaLength,radius:r},f,a),this.threelayer.addMesh(this.sector)}return c(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),O={altitude:0,height:0},P=function(r){l(a,i);var n=m(a);function a(i,r,o,h){var c;s(this,a),o=t.Util.extend({},O,o,{layer:h}),c=n.call(this);var l=o,u=l.width,f=l.height,d=l.altitude;c._initOptions(o);var m=new e.PlaneGeometry(u,f);m.computeBoundingBox();var p=new e.Mesh(m,r);c._createGroup(),c.getObject3d().add(p);var v=h.distanceToVector3(d,d).x,g=h.coordinateToVector3(i,v);return p.position.set(0,m.boundingBox.max.y,0),c.getObject3d().position.copy(g),c}return c(a)}();function A(t,i,r,n,a,o){this.tilesHorizontal=i,this.tilesVertical=r,this.numberOfTiles=n,t.wrapS=t.wrapT=e.RepeatWrapping,t.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=a,this.currentDisplayTime=0,this.currentTile=0,this.flag=o,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 z=function(){function t(i,r,n,a,o){var h=this;s(this,t),this.threelayer=a,this.map=a.map,this.layerClass=o;var c=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var l=n.rotation||0,u=c/2,f=a.distanceToVector3(r,r).x,d=Math.sin(u*Math.PI/180)*f*2,m=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new e.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){h.texture=t,h.annie=new A(t,h.tilesHoriz,h.tilesVert,h.numTiles,h.duration,m);var r=new e.MeshBasicMaterial({transparent:!0,map:t,side:e.DoubleSide,depthTest:!1});h.imgObj=new P(i,r,{width:d,height:f},a),h.imgObj.object3d.renderOrder=1,h.imgObj.object3d.rotation.z=l*Math.PI/180,h.threelayer.addMesh(h.imgObj),h.layerClass.updatables.push(h)}))}return c(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}(),F={radius:100,altitude:0},j=function(r){l(a,i);var n=m(a);function a(i,r,o,h){var c;s(this,a),r=t.Util.extend({},F,r,{layer:h}),c=n.call(this);var l=r,u=l.width;l.height;var f=l.altitude;c._initOptions(r);var d=new e.CircleGeometry(u,32);c._createMesh(d,o);var m=h.distanceToVector3(f,f).x,p=h.coordinateToVector3(i,m);return c.getObject3d().position.copy(p),c}return c(a)}(),D=function(){function t(i,r,n,a){var o=this;s(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a,this.time=0,n.coordinateToVector3(i,0),this.imgUrl=r.imgUrl,this.textureLoader=new e.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){o.texture=t,o._uniforms={impactPosition:{value:new e.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var r=new e.ShaderMaterial({uniforms:o._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:e.DoubleSide,transparent:!0,depthTest:!1}),a=new j(i,{width:2,height:2},r,n);o.threelayer.addMesh(a),o.layerClass.updatables.push(o)}))}return c(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),E=6371008.8,U={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*E,kilometers:6371.0088,kilometres:6371.0088,meters:E,metres:E,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:E/1852,radians:1,yards:6967335.223679999};function V(t){return t%360*Math.PI/180}function R(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 B(t,e,i){void 0===i&&(i={});var r=R(t),n=R(e),a=V(n[1]-r[1]),o=V(n[0]-r[0]),s=V(r[1]),h=V(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=U[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 N=document.createElement("canvas"),G=function(){function i(){s(this,i),this.type="gisCommon"}return c(i,null,[{key:"getTexture",value:function(t,i,r,n){var a=t.getContext("2d");a.drawImage(i,r,n);var o=new e.Texture(a.getImageData(0,0,t.width,t.height));return o.minFilter=e.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"getTexture1",value:function(t,i,r,n,a){N.width=N.height=128;var o=N.getContext("2d");o.drawImage(t,i,r,n,a);var s=new e.Texture(o.getImageData(0,0,N.width,N.height));return s.minFilter=e.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,i,r){if(1e3*B({type:"Feature",properties:{},geometry:{type:"Point",coordinates:[i.x,i.y]}},{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t}},"kilometers")<i.radius){var n=r.coordinateToVector3([i.x,i.y],0),a=r.coordinateToVector3(t,0).sub(n).normalize(),o=r.distanceToVector3(i.radius,i.radius).x,s=new e.Vector3(n.x,n.y+o,0).sub(n).normalize(),h=((a.clone().cross(s).z<0?-1:1)*Math.acos(a.dot(s))*180/Math.PI).toFixed(2);(h=parseFloat(h))<0&&(h=h+180+180);var c=parseFloat(i.begin),l=parseFloat(i.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*B({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=R(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(e,i){var r,n;Array.isArray(e)?(r=e[0],n=e[1]):e instanceof t.Coordinate&&(r=e.x,n=e.y);var a=i.xmin,o=i.ymin,s=i.xmax,h=i.ymax;return a<=r&&r<=s&&o<=n&&n<=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,i,r){N.width=i,N.height=r;var n=N.getContext("2d");n.drawImage(t,0,0,i,r);var a=new e.Texture(n.getImageData(0,0,N.width,N.height));return a.magFilter=e.NearestFilter,a.minFilter=e.NearestFilter,a.generateMipmaps=!1,a.needsUpdate=!0,a}},{key:"generateTexture",value:function(t){var i=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),a=parseInt(n);n>a&&(a+=1);for(var o=(n=a)*r+5*n,s=0,h=0;h<i.length;h++){if(o<i[h]){s=i[h];break}s=1024}N.width=N.height=s;for(var c=N.getContext("2d"),l=0,u=0,f=[],d=0;d<n;d++){for(var m=5*(d+1)+d*l,p=0;p<n;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 e.Texture(c.getImageData(0,0,N.width,N.height));return k.minFilter=e.LinearFilter,k.generateMipmaps=!1,k.needsUpdate=!0,{xys:f,texture:k,textureSize:s}}},{key:"generateTextureNew",value:function(t){var i=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),a=parseInt(n);n>a&&(a+=1);for(var o=(n=a)*r+5*n,s=0,h=0;h<i.length;h++){if(o<i[h]){s=i[h];break}s=1024}N.width=N.height=s;for(var c=N.getContext("2d"),l=0,u=0,f=0,d=[],m=0;m<n;m++){for(var p=5*(m+1)+m*l,v=0;v<n;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 e.Texture(c.getImageData(0,0,N.width,N.height));return M.minFilter=e.LinearFilter,M.generateMipmaps=!1,M.needsUpdate=!0,{xys:d,texture:M,textureSize:s}}},{key:"generateTextureOptimize",value:function(t){var i=[64,128,256,512,1024],r=-1/0;t.forEach((function(t){r=Math.max(r,t.w),Math.max(r,t.h)}));var n=Math.sqrt(t.length),a=parseInt(n);n>a&&(a+=1);for(var o=(n=a)*r+5*n,s=0,h=0;h<i.length;h++){if(o<i[h]){s=i[h];break}s=1024}N.width=N.height=s;for(var c=N.getContext("2d"),l=0,u=0,f={},d=0;d<n;d++){for(var m=5*(d+1)+d*l,p=0,v=0;v<n;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 e.Texture(c.getImageData(0,0,N.width,N.height));return w.minFilter=e.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,i){N.width=N.height=t;var r=N.width/2,n=N.height/2;if(i){var a=0;i.forEach((function(t){var e=N.getContext("2d");e.fillStyle=t.fontcolor,e.font="".concat(t.fontsize,"px Arial"),e.textAlign="center",e.textBaseline="middle",e.fillText(t.txt,r,n+a),a+=t.fontsize}))}var o=new e.Texture(N);return o.minFilter=e.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{key:"createTextAndBgTexture",value:function(t,i,r,n){var a=document.createElement("canvas");a.width=t,a.height=i;var o=a.getContext("2d");o.drawImage(r,0,0,t,i);var s=a.width/2,h=a.height/2;o.textAlign="center",o.textBaseline="middle",o.fillStyle="#FFF",o.font="".concat(n.fontsize,"px Arial"),o.fillText(n.txt,s,h);var c=new e.Texture(a);return c.magFilter=e.NearestFilter,c.minFilter=e.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 i=t>>16&255,r=t>>8&255,n=255&t;return new e.Color("rgb(".concat(i,",").concat(r,",").concat(n,")"))}},{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}}]),i}();function W(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 H=Y;function Y(t,e){this.x=t,this.y=e}Y.prototype={clone:function(){return new Y(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}},Y.convert=function(t){return t instanceof Y?t:Array.isArray(t)?new Y(t[0],t[1]):t};var X={radius:40,altitude:0},q=function(r){l(a,i);var n=m(a);function a(i,r,o,h,c,l,u,f){var d;s(this,a);var m=function(e){for(var i=1/0,r=1/0,n=-1/0,a=-1/0,o=0,s=e.length;o<s;o++){var h=e[o],c=h.coordinate,l=h.lnglat,u=h.lnglats,f=h.xy,d=h.xys,m=c||l||u||f||d||e[o],p=void 0,v=void 0;Array.isArray(m)?(p=m[0],v=m[1]):m instanceof t.Coordinate&&(p=m.x,v=m.y),i=Math.min(i,p),r=Math.min(r,v),n=Math.max(n,p),a=Math.max(a,v)}return new t.Coordinate((i+n)/2,(r+a)/2)}(i);d=n.call(this),r=t.Util.extend({center:m,layer:f},X,r),d._initOptions(r);var p=d.getLayer().getPick();d._colorMap={},d._datas=i,d._childCount=u;var v=f.coordinateToVector3(m);d.glyphMap=c,d.glyphAtlas=l;for(var g=new e.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]),b=new e.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),_=new e.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),k=new e.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),M=new e.InstancedBufferAttribute(new Float32Array(4*d._childCount),4,!0),S=new e.InstancedBufferAttribute(new Float32Array(3*d._childCount),3,!0),T=0,C=function(t){var e=i[t],r=e.texts,n=e.markers,a=p.getColor(),o=a.getHex();d._colorMap[o]=t,d._datas[t].colorIndex=o,n&&n.forEach((function(e){if(b.setXYZW(T,e.markerWidth,e.markerHeight,e.markerDx,e.markerDy),_.setXYZW(T,e.u,e.v,-16,16),e.markerColor){var r=w(0,255);M.setXYZW(T,r,0,0,0);var n=d.getColorVector2(e.markerColor,e.markerOpacity);k.setXYZW(T,n[0],n[1],e.w,e.h)}else{var o=w(0,0);M.setXYZW(T,o,0,0,0);var s=d.getColorVector2("#fff",e.markerOpacity);k.setXYZW(T,s[0],s[1],e.w,e.h)}S.setXYZ(T,a.r,a.g,a.b),e.markerIndex=T,T+=1,i[t].childNum+=1})),r&&r.forEach((function(e){var r=d.getColorVector2(e.textColor,e.textOpacity),n=w(255,0);d.buildTextBuffers("".concat(e.text),e.textAnchor,"center",e.textSpacing).forEach((function(o){if(b.setXYZW(T,e.textSize,0,e.textDx,e.textDy),_.setXYZW(T,o[0],o[1],o[2],o[3]),e.textHaloColor){var s=d.getColorVector2(e.textHaloColor,e.textHaloOpacity);k.setXYZW(T,r[0],r[1],s[0],s[1]);var h=e.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),e.textIndex.push(T),T+=1,i[t].childNum+=1}))}))},I=0;I<i.length;I++)C(I);g.setIndex(new e.Uint16BufferAttribute(y,1)),g.setAttribute("uv_offset",new e.Float32BufferAttribute(x,4,!0)),g.setAttribute("size",b),g.setAttribute("uv_image",_),g.setAttribute("color",k),g.setAttribute("util",M),g.setAttribute("pickingColor",S),d._createInstancedMesh(g,o,d._childCount),d.getObject3d().instanceMatrix.setUsage(e.DynamicDrawUsage);var L=new e.InstancedMesh(g,h,d._childCount);L.instanceMatrix.setUsage(e.DynamicDrawUsage);var O=p.getColor().getHex();L._colorIndex=O,d.setPickObject3d(L);var P=new e.Object3D;T=0,i.forEach((function(t,e){if(t.visible){var r=f.coordinateToVector3(t.coordinate);r.sub(v),t.height&&(r.z=f.altitudeToVector3(t.height).x);for(var n=0;n<i[e].childNum;n++)P.position.set(r.x,r.y,0),P.updateMatrix(),d.getObject3d().setMatrixAt(T,P.matrix),L.setMatrixAt(T,P.matrix),T+=1}}));var A=f.altitudeToVector3(r.altitude,r.altitude).x;return v.z=A,d.getObject3d().position.copy(v),L.position.copy(d.getObject3d().position),d.parent=null,d.pickMesh=L,d.threeLayer=f,d.center=v,d._init(),d}return c(a,[{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,i){var r,n=new e.Color(t).getHexString(),a=(r="#".concat(n),{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}),o=a.b;return[w(a.r,a.g),w(o,void 0!==i?i:255)]}},{key:"buildTextBuffers",value:function(t,e,i,r){var n=[],a=[0,0],o=W(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 H(m,p),x=new H(v,p),w=new H(m,g),b=new H(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,i=new e.Object3D;this._datas.forEach((function(e,r){var n=t.threeLayer.coordinateToVector3(e.coordinate);n.sub(t.center),e.height&&(n.z=t.threeLayer.altitudeToVector3(e.height).x),!1===e.visible?i.position.set(-999,-999,0):i.position.set(n.x,n.y,0),i.updateMatrix(),e.markers&&e.markers.forEach((function(e){t.getObject3d().setMatrixAt(e.markerIndex,i.matrix),t.pickMesh.setMatrixAt(e.markerIndex,i.matrix)})),e.texts&&e.texts.forEach((function(e){e.textIndex.forEach((function(e){t.getObject3d().setMatrixAt(e,i.matrix),t.pickMesh.setMatrixAt(e,i.matrix)}))}))})),this.getObject3d().instanceMatrix.needsUpdate=!0,this.pickMesh.instanceMatrix.needsUpdate=!0}}]),a}(),K=function(){function t(e,i){s(this,t),this.createImage(e,1,i)}return c(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 J=c((function t(e){s(this,t);var i={},r=[];for(var n in e){var a=e[n],o=i[n]={};for(var h in a){var c=a[+h];if(c&&0!==c.bitmap.width&&0!==c.bitmap.height){var l={x:0,y:0,w:c.bitmap.width+2,h:c.bitmap.height+2};r.push(l),o[h]={rect:l,metrics:c.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 K({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;K.copy(y.bitmap,m,{x:0,y:0},{x:x.x+1,y:x.y+1},y.bitmap)}}}this.image=m,this.positions=i})),$={exports:{}};$.exports=tt,$.exports.default=tt;var Q=1e20;function tt(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 et(t,e,i,r,n,a){for(var o=0;o<e;o++)it(t,o,e,i,r,n,a);for(var s=0;s<i;s++)it(t,s*e,1,e,r,n,a)}function it(t,e,i,r,n,a,o){var s,h,c,l;for(a[0]=0,o[0]=-Q,o[1]=Q,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]=Q}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)}}tt.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(Q,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]=Q;else if(0===u)a[l]=Q,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),et(this.gridOuter,i,n,this.f,this.v,this.z),et(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}}},tt.prototype.draw=function(t){return this._draw(t,!1).data},tt.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var rt=$.exports,nt={},at={};var ot=function(){function i(t,e,r){var n=this;s(this,i);var a=e.pointMinZoom,o=e.pointOrder;if(0!=t.length){var h=[];this.charArray="",this.imgDict={},this.threeLayer=r,this.map=r.map,this.interactive=void 0===e.interactive||e.interactive,this.beginSizeZoom=e.beginSizeZoom||3,this.endSizeZoom=e.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.altitude=e.altitude||0,this.textMinZoom=e.textMinZoom||0,this.textMaxZoom=e.textMaxZoom||30,this.textMinMaxZooms=e.textMinMaxZooms,this.childCount=0,t.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(h,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=h,this.point=null,this.shader=null,this.minZoom=a||8,this.maxZoom=e.pointMaxZoom||20,this.order=o||0,this.isToolTip=e.isToolTip||!1,this.clickFunc=e.clickFunc||null,this.cFunc=e.cFunc||null,this.mouseMoveFunc=e.mouseMoveFunc||null,this.mouseOutFunc=e.mouseOutFunc||null,this.mMoveFunc=e.mMoveFunc||null,this.hasAlign=e.hasAlign||!1,this.zoomChangeCallback=e.zoomChangeCallback}else console.error("需要绘制的点位数量为0")}var r,a,h,l;return c(i,[{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=x(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:(l=o(n().mark((function t(){var e,i,r,a,o;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],t.t0=n().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 a=t.sent,t.next=11,a.text();case 11:r=t.sent;case 12:return t.next=14,G.addImageProcess(r);case 14:o=t.sent,e.push({key:i,src:o,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",G.generateTextureOptimize(e));case 19:case"end":return t.stop()}}),t,this)}))),function(){return l.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=nt[e];return s||(s=nt[e]=new rt(24,3,8,.25,n,a)),at[e]||(at[e]={}),at[e][i]||(at[e][i]=s.ctx.measureText(i).width),{id:o,bitmap:new K({width:30,height:30},s.draw(i)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=o,t>=19968&&t<=40959?24:at[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 J(this.glyphMap)}},{key:"addPoint",value:(h=o(n().mark((function t(){var i,r,a,o,s,h,c,l=this;return n().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 i=t.sent,this.textures||(this.textures=[]),this.textures.push(i.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,a=r.width,o=r.height,s=r.data,(h=new e.DataTexture(s,a,o)).needsUpdate=!0,h.magFilter=e.LinearFilter,h.minFilter=e.LinearFilter,h.format=e.AlphaFormat,this.textures.push(h),this.m=this._getRawShaderMaterial(i,h,a,o),this.m.depthTest=!1,this.m_pick=this._getRawShaderMaterial(i,h,a,o),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,i.xys[t.key])}))})),(c=new q(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 h.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,i,r,n){return new e.RawShaderMaterial({uniforms:{imgTexture:{type:"t",value:t.texture},imgTextureSize:{type:"f",value:t.textureSize},sdfTexture:{type:"t",value:i},sdfTextureSize:{value:[r,n]},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:e.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:(a=o(n().mark((function t(e){return n().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 a.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:(r=o(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(t){return r.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(e,i,r){for(var n,a=1/0,o=1/0,s=-1/0,h=-1/0,c=0;c<this.dataItems.length;c++){var l=this.dataItems[c];e.includes(l.code)?(a=Math.min(a,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===(n=this.point)||void 0===n||n.changeVisible(),i&&this.map.fitExtent(new t.Extent(a,o,s,h),r||0)}},{key:"updateByZoom",value:function(){var t=this,i=this.map.getZoom(),r=new e.Object3D,n=0;this.dataItems.forEach((function(e){var a=t.threeLayer.coordinateToVector3(e.coordinate);if(a.sub(t.point.center),e.height&&(a.z=t.threeLayer.altitudeToVector3(e.height).x),e.markers&&(n+=e.markers.length),e.value&&t.showValueFlag)for(var o=0;o<e.value.length;o++)i<t.valueMinZoom||i>t.valueMaxZoom?r.position.set(-999,-999,0):r.position.set(a.x,a.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=1;if(e.name&&t.showNameFlag)for(var s=0;s<e.name.length;s++)i<t.nameMinZoom||i>t.nameMaxZoom?r.position.set(-999,-999,0):r.position.set(a.x,a.y,0),r.updateMatrix(),t.point.getObject3d().setMatrixAt(n,r.matrix),t.point.pickMesh.setMatrixAt(n,r.matrix),n+=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}}]),i}(),st=function(){function t(i,n){var a=this;s(this,t),this.map=n,this.animationId=null,this.updatables=[];var o=g();this.threeLayer=new r(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new e.Clock;var h=function t(){var e,i;(a.threeLayer._needsUpdate=!a.threeLayer._needsUpdate,a.threeLayer._needsUpdate)&&(null===(e=a.threeLayer)||void 0===e||null===(i=e.getRenderer())||void 0===i||i.clearCanvas(),a.threeLayer.renderScene());var r,n=a.clock.getDelta(),o=v(a.updatables);try{for(o.s();!(r=o.n()).done;){r.value.tick(n)}}catch(t){o.e(t)}finally{o.f()}a.animationId=requestAnimationFrame(t)};this.threeLayer.prepareToDraw=function(t,i,r){var n=new e.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),i.add(n),h()},this.threeLayer.addTo(n),this.layerId=o,this.layerName=i,this.dirty=!1,this.initFlag=!1}return c(t,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=g();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,i=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=v(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(r){t.threeLayer.prepareToDraw=function(t,n,a){var o=new e.DirectionalLight(16777215);o.position.set(0,-10,10).normalize(),n.add(o),n.add(new e.AmbientLight(16777215)),i(),r()}}))}},{key:"drawRadar",value:function(t,e,i){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var a=new T(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new T(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 L(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new L(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 z(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new z(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 k(t,e,i,r,n.threeLayer);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new k(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 D(t,e||{},i.threeLayer,i);r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new D(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 ot(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 ot(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}();export{k as imgClass,st as layerClass,ot as planeMark,z as planeSectorClass,T as radarClass,L as sectorClass,D as shockClass,y as sleep};
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("maptalks"),require("three"),require("maptalks.three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three","maptalks.three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).mapcore=e.mapcore||{},e.maptalks,e.THREE,e.maptalks)}(this,(function(e,t,r,i){function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=a(t),o=a(r);function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(a=i.key,n=void 0,"symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?n:String(n)),i)}var a,n}function c(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function m(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function p(e){var t=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(e){return!1}}();return function(){var r,i=u(e);if(t){var a=u(this).constructor;r=Reflect.construct(i,arguments,a)}else r=i.apply(this,arguments);return m(this,r)}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}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 n,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw n}}}}function y(){var e="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"iep".concat(e,"layer")}var g={altitude:0,imageWidth:512,imageHeight:512,texture:null},x=function(e){h(r,e);var t=p(r);function r(e,i,a,l){var c;s(this,r);var h=i=n.Util.extend({},g,i),u=h.altitude;h.imageHeight,h.imageWidth,e instanceof n.Extent||(e=new n.Extent(e));var d=e,m=d.xmin,p=d.ymin,f=d.xmax,v=d.ymax,y=1/0,x=1/0,b=-1/0,_=-1/0;[[m,p],[m,v],[f,v],[f,p]].forEach((function(e){var t=l.coordinateToVector3(e),r=t.x,i=t.y;y=Math.min(r,y),x=Math.min(i,x),b=Math.max(r,b),_=Math.max(i,_)}));var w=Math.abs(b-y),M=Math.abs(_-x),L=new o.PlaneBufferGeometry(w,M);(c=t.call(this))._initOptions(i),c._createMesh(L,a);var j=l.distanceToVector3(u,u).x,T=l.coordinateToVector3(e.getCenter(),j);return c.getObject3d().position.copy(T),c.parent=null,c.type="Image",c}return c(r)}(i.BaseObject),b=function(){function e(t,r,i,a,l){var c=this;s(this,e),this.threelayer=l,this.map=l.map,this.textureLoader=new o.TextureLoader;var h=t.split(","),u=r.split(","),d=parseFloat(h[0]),m=parseFloat(h[1]),p=parseFloat(u[0]),f=parseFloat(u[1]),v=a.maxZoom||11,y=a.renderOrder||0,g=a.opacity||1,b=a.minZoom||3,_=new n.Extent(d,m,p,f);this.xmin_g=d,this.ymin_g=m,this.xmax_g=p,this.ymax_g=f,this.textureLoader.load(i,(function(e){var t=new o.MeshBasicMaterial({map:e,transparent:!0,opacity:g}),r=new x(_,{imageWidth:512,imageHeight:512,maxZoom:v,minZoom:b,interactive:void 0!==a.interactive&&a.interactive},t,c.threelayer);r.object3d.renderOrder=y,c.imgMesh=r,c.imgMesh.parent=c,c.m=t,c.texture=e,c.threelayer.addMesh(c.imgMesh),a.opacityItems&&a.opacityItems.length>0&&!isNaN(a.opacityItems[0])&&!isNaN(a.opacityItems[1])&&a.opacityItems[0]>3&&a.opacityItems[0]<=18&&a.opacityItems[1]>=0&&a.opacityItems[1]<=1&&(c.opacityItems=a.opacityItems,c._bindMapEvents(),c._viewChange())}))}return c(e,[{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(e,t){var r=this;if(t&&t.leftbottom&&t.righttop){var i=parseFloat(t.leftbottom[0]),a=parseFloat(t.leftbottom[1]),s=parseFloat(t.righttop[0]),l=parseFloat(t.righttop[1]);if(i!==this.xmin_g||a!==this.ymin_g||s!==this.xmax_g||l!==this.ymax_g){var c=new n.Extent(i,a,s,l),h=1/0,u=1/0,d=-1/0,m=-1/0;[[i,a],[i,l],[s,l],[s,a]].forEach((function(e){var t=r.threelayer.coordinateToVector3(e),i=t.x,a=t.y;h=Math.min(i,h),u=Math.min(a,u),d=Math.max(i,d),m=Math.max(a,m)}));for(var p=Math.abs(d-h),f=Math.abs(m-u),v=new o.PlaneBufferGeometry(p,f),y=v.attributes.position.array,g=this.imgMesh.object3d.geometry.attributes.position.array,x=0;x<g.length;x++)g[x]=y[x];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var b=this.threelayer.coordinateToVector3(c.getCenter(),0);this.imgMesh.getObject3d().position.copy(b),v.dispose(),this.xmin_g=i,this.ymin_g=a,this.xmax_g=s,this.ymax_g=l}}this.textureLoader.load(e,(function(e){r.texture&&r.texture.dispose(),delete r.texture,e.magFilter=o.NearestFilter,e.minFilter=o.NearestFilter,r.imgMesh.object3d.material.map=e,r.imgMesh.object3d.material.map.needsUpdate=!0,r.texture=e,!1===r.imgMesh.isAdd&&r.threelayer&&(r.threelayer.addMesh(r.imgMesh),r.opacityItems&&r._bindMapEvents())}))}},{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}}]),e}(),_={altitude:0,imageWidth:512,imageHeight:512,texture:null},w=function(e){h(r,e);var t=p(r);function r(e,i,a,l,c){var h;s(this,r);var u=(a=n.Util.extend({},_,a)).altitude,d=c.distanceToVector3(i,i).x,m=new o.CircleGeometry(d,32);(h=t.call(this))._initOptions(a),h._createMesh(m,l);var p=c.distanceToVector3(u,u).x,f=c.coordinateToVector3(e,p);return h.getObject3d().position.copy(f),h.parent=null,h.type="radarObject",h}return c(r)}(i.BaseObject),M=function(){function e(t,r,i,a,n){s(this,e),this.threelayer=a,this.map=a.map,this.layerClass=n,this.imgUrl=i.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var l=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 w(t,r,{},l,a),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return c(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),L={radius:100,altitude:0},j=function(e){h(r,e);var t=p(r);function r(e,i,a,l){var c;s(this,r),i=n.Util.extend({},L,i,{layer:l,coordinate:e}),(c=t.call(this))._initOptions(i);var h=i,u=h.altitude,d=h.radius,m=l.distanceToVector3(d,d).x,p=i.thetaStart||0,f=i.thetaLength||90,v=new o.CircleGeometry(m,128,p*Math.PI/180,f*Math.PI/180);c._createMesh(v,a);var y=l.distanceToVector3(u,u).x,g=l.coordinateToVector3(e,y);return c.getObject3d().position.copy(g),c}return c(r)}(i.BaseObject),T=function(){function e(t,r,i,a,n){s(this,e),this.threelayer=a,this.map=a.map,this.layerClass=n;var l=i.thetaLength||90,c=i.rotation||0,h=l/2;this.imgUrl=i.imgUrl,this.loader=new o.TextureLoader,this.texture=this.loader.load(this.imgUrl);var u=c-h;u=u<0?u+360:u,this._uniforms={map:{value:this.texture},time:{value:0}};var d=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 j(t,{thetaStart:u,thetaLength:i.thetaLength,radius:r},d,a),this.threelayer.addMesh(this.sector)}return c(e,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"dispose",value:function(){}}]),e}(),k={altitude:0,height:0},O=function(e){h(r,e);var t=p(r);function r(e,i,a,l){var c;s(this,r),a=n.Util.extend({},k,a,{layer:l}),c=t.call(this);var h=a,u=h.width,d=h.height,m=h.altitude;c._initOptions(a);var p=new o.PlaneGeometry(u,d);p.computeBoundingBox();var f=new o.Mesh(p,i);c._createGroup(),c.getObject3d().add(f);var v=l.distanceToVector3(m,m).x,y=l.coordinateToVector3(e,v);return f.position.set(0,p.boundingBox.max.y,0),c.getObject3d().position.copy(y),c}return c(r)}(i.BaseObject);function P(e,t,r,i,a,n){this.tilesHorizontal=t,this.tilesVertical=r,this.numberOfTiles=i,e.wrapS=e.wrapT=o.RepeatWrapping,e.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=a,this.currentDisplayTime=0,this.currentTile=0,this.flag=n,this.update=function(t){for(this.currentDisplayTime+=t;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;e.offset.x=r/this.tilesHorizontal;var i=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?e.offset.y=this.tilesVertical-i/this.tilesVertical:e.offset.y=1-i/this.tilesVertical-1/this.tilesVertical}}}var I=function(){function e(t,r,i,a,n){var l=this;s(this,e),this.threelayer=a,this.map=a.map,this.layerClass=n;var c=i.thetaLength||45;this.millsec=i.millsec||1e3,this.duration=i.duration||75,this.tilesHoriz=i.tilesHoriz||12,this.tilesVert=i.tilesVert||5,this.numTiles=i.numTiles||49;var h=i.rotation||0,u=c/2,d=a.distanceToVector3(r,r).x,m=Math.sin(u*Math.PI/180)*d*2,p=void 0===i.flag;this.imgUrl=i.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){l.texture=e,l.annie=new P(e,l.tilesHoriz,l.tilesVert,l.numTiles,l.duration,p);var r=new o.MeshBasicMaterial({transparent:!0,map:e,side:o.DoubleSide,depthTest:!1});l.imgObj=new O(t,r,{width:m,height:d},a),l.imgObj.object3d.renderOrder=1,l.imgObj.object3d.rotation.z=h*Math.PI/180,l.threelayer.addMesh(l.imgObj),l.layerClass.updatables.push(l)}))}return c(e,[{key:"tick",value:function(e){var t;null===(t=this.annie)||void 0===t||t.update(this.millsec*e)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),e}(),S={radius:100,altitude:0},C=function(e){h(r,e);var t=p(r);function r(e,i,a,l){var c;s(this,r),i=n.Util.extend({},S,i,{layer:l}),c=t.call(this);var h=i,u=h.width;h.height;var d=h.altitude;c._initOptions(i);var m=new o.CircleGeometry(u,32);c._createMesh(m,a);var p=l.distanceToVector3(d,d).x,f=l.coordinateToVector3(e,p);return c.getObject3d().position.copy(f),c}return c(r)}(i.BaseObject),R=function(){function e(t,r,i,a){var n=this;s(this,e),this.threelayer=i,this.map=i.map,this.layerClass=a,this.time=0,i.coordinateToVector3(t,0),this.imgUrl=r.imgUrl,this.textureLoader=new o.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){n.texture=e,n._uniforms={impactPosition:{value:new o.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:n.texture}};var r=new o.ShaderMaterial({uniforms:n._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}),a=new C(t,{width:2,height:2},r,i);n.threelayer.addMesh(a),n.layerClass.updatables.push(n)}))}return c(e,[{key:"tick",value:function(e){this.time+=.2*e,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),e}(),U=function(){function e(t,r){var a=this;s(this,e),this.map=r,this.animationId=null,this.updatables=[];var n=y();this.threeLayer=new i.ThreeLayer(n,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new o.Clock;var l=function e(){var t,r;(a.threeLayer._needsUpdate=!a.threeLayer._needsUpdate,a.threeLayer._needsUpdate)&&(null===(t=a.threeLayer)||void 0===t||null===(r=t.getRenderer())||void 0===r||r.clearCanvas(),a.threeLayer.renderScene());var i,n=a.clock.getDelta(),o=v(a.updatables);try{for(o.s();!(i=o.n()).done;){i.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}a.animationId=requestAnimationFrame(e)};this.threeLayer.prepareToDraw=function(e,t,r){var i=new o.DirectionalLight(16777215);i.position.set(0,-10,10).normalize(),t.add(i),l()},this.threeLayer.addTo(r),this.layerId=n,this.layerName=t,this.dirty=!1,this.initFlag=!1}return c(e,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var e=y();this.threeLayer.setId(e),this.layerId=e}}},{key:"setVisible",value:function(e,t){this.threeLayer&&(!0===e?(this.threeLayer.show(),t&&t()):(this.threeLayer.hide(),t&&t()))}},{key:"prepareToDraw",value:function(){var e=this,t=function t(){var r,i;(e.threeLayer._needsUpdate=!e.threeLayer._needsUpdate,e.threeLayer._needsUpdate)&&(null===(r=e.threeLayer)||void 0===r||null===(i=r.getRenderer())||void 0===i||i.clearCanvas(),e.threeLayer.renderScene());var a,n=e.clock.getDelta(),o=v(e.updatables);try{for(o.s();!(a=o.n()).done;){a.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}e.animationId=requestAnimationFrame(t)};return new Promise((function(r){e.threeLayer.prepareToDraw=function(e,i,a){var n=new o.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),i.add(n),i.add(new o.AmbientLight(16777215)),t(),r()}}))}},{key:"drawRadar",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new M(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new M(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSector",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new T(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new T(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSectorImg",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new I(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new I(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawImage",value:function(e,t,r,i){var a=this;return new Promise((function(n){if(a.threeLayer.getScene()){var o=new b(e,t,r,i,a.threeLayer);n(o)}else a.initFlag=!0,a.prepareToDraw().then((function(){var o=new b(e,t,r,i,a.threeLayer);n(o)}))}))}},{key:"drawShock",value:function(e,t){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var a=new R(e,t||{},r.threeLayer,r);i(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new R(e,t||{},r.threeLayer,r);i(a)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var e=this.threeLayer.getMeshes();this.threeLayer.clear(),e.forEach((function(e){}));var t=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),i=this.threeLayer.getPick(),a=i.pickingTexture;i.pickingScene;var n=this.threeLayer.getRenderer();r.remove(t),t=null,r=null,a.dispose(),a=null,n.context.dispose(),n.context.forceContextLoss(),n.context=null,n.remove(),n=null,this.map.removeLayer(this.threeLayer)}}]),e}();e.imgClass=b,e.layerClass=U,e.planeSectorClass=I,e.radarClass=M,e.sectorClass=T,e.shockClass=R,e.sleep=function(e){return new Promise((function(t){return setTimeout(t,e)}))}}));
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 +1 @@
1
- function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(a=i.key,n=void 0,"symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?n:String(n)),i)}var a,n}function r(e,r,i){return r&&t(e.prototype,r),i&&t(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function n(e,t){return n=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},n(e,t)}function o(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function s(e){var t=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(e){return!1}}();return function(){var r,i=a(e);if(t){var n=a(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return o(this,r)}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function c(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}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 n,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw n}}}}function h(){var e="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));return"iep".concat(e,"layer")}function u(e){return new Promise((function(t){return setTimeout(t,e)}))}var d={altitude:0,imageWidth:512,imageHeight:512,texture:null},m=function(t){i(n,maptalks.BaseObject);var a=s(n);function n(t,r,i,o){var s;e(this,n);var l=r=maptalks.Util.extend({},d,r),c=l.altitude;l.imageHeight,l.imageWidth,t instanceof maptalks.Extent||(t=new maptalks.Extent(t));var h=t,u=h.xmin,m=h.ymin,p=h.xmax,f=h.ymax,v=1/0,g=1/0,y=-1/0,x=-1/0;[[u,m],[u,f],[p,f],[p,m]].forEach((function(e){var t=o.coordinateToVector3(e),r=t.x,i=t.y;v=Math.min(r,v),g=Math.min(i,g),y=Math.max(r,y),x=Math.max(i,x)}));var b=Math.abs(y-v),_=Math.abs(x-g),w=new THREE.PlaneBufferGeometry(b,_);(s=a.call(this))._initOptions(r),s._createMesh(w,i);var T=o.distanceToVector3(c,c).x,M=o.coordinateToVector3(t.getCenter(),T);return s.getObject3d().position.copy(M),s.parent=null,s.type="Image",s}return r(n)}(),p=function(){function t(r,i,a,n,o){var s=this;e(this,t),this.threelayer=o,this.map=o.map,this.textureLoader=new THREE.TextureLoader;var l=r.split(","),c=i.split(","),h=parseFloat(l[0]),u=parseFloat(l[1]),d=parseFloat(c[0]),p=parseFloat(c[1]),f=n.maxZoom||11,v=n.renderOrder||0,g=n.opacity||1,y=n.minZoom||3,x=new maptalks.Extent(h,u,d,p);this.xmin_g=h,this.ymin_g=u,this.xmax_g=d,this.ymax_g=p,this.textureLoader.load(a,(function(e){var t=new THREE.MeshBasicMaterial({map:e,transparent:!0,opacity:g}),r=new m(x,{imageWidth:512,imageHeight:512,maxZoom:f,minZoom:y,interactive:void 0!==n.interactive&&n.interactive},t,s.threelayer);r.object3d.renderOrder=v,s.imgMesh=r,s.imgMesh.parent=s,s.m=t,s.texture=e,s.threelayer.addMesh(s.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&&(s.opacityItems=n.opacityItems,s._bindMapEvents(),s._viewChange())}))}return r(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(e,t){var r=this;if(t&&t.leftbottom&&t.righttop){var i=parseFloat(t.leftbottom[0]),a=parseFloat(t.leftbottom[1]),n=parseFloat(t.righttop[0]),o=parseFloat(t.righttop[1]);if(i!==this.xmin_g||a!==this.ymin_g||n!==this.xmax_g||o!==this.ymax_g){var s=new maptalks.Extent(i,a,n,o),l=1/0,c=1/0,h=-1/0,u=-1/0;[[i,a],[i,o],[n,o],[n,a]].forEach((function(e){var t=r.threelayer.coordinateToVector3(e),i=t.x,a=t.y;l=Math.min(i,l),c=Math.min(a,c),h=Math.max(i,h),u=Math.max(a,u)}));for(var d=Math.abs(h-l),m=Math.abs(u-c),p=new THREE.PlaneBufferGeometry(d,m),f=p.attributes.position.array,v=this.imgMesh.object3d.geometry.attributes.position.array,g=0;g<v.length;g++)v[g]=f[g];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var y=this.threelayer.coordinateToVector3(s.getCenter(),0);this.imgMesh.getObject3d().position.copy(y),p.dispose(),this.xmin_g=i,this.ymin_g=a,this.xmax_g=n,this.ymax_g=o}}this.textureLoader.load(e,(function(e){r.texture&&r.texture.dispose(),delete r.texture,e.magFilter=THREE.NearestFilter,e.minFilter=THREE.NearestFilter,r.imgMesh.object3d.material.map=e,r.imgMesh.object3d.material.map.needsUpdate=!0,r.texture=e,!1===r.imgMesh.isAdd&&r.threelayer&&(r.threelayer.addMesh(r.imgMesh),r.opacityItems&&r._bindMapEvents())}))}},{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}(),f={altitude:0,imageWidth:512,imageHeight:512,texture:null},v=function(t){i(n,maptalks.BaseObject);var a=s(n);function n(t,r,i,o,s){var l;e(this,n);var c=(i=maptalks.Util.extend({},f,i)).altitude,h=s.distanceToVector3(r,r).x,u=new THREE.CircleGeometry(h,32);(l=a.call(this))._initOptions(i),l._createMesh(u,o);var d=s.distanceToVector3(c,c).x,m=s.coordinateToVector3(t,d);return l.getObject3d().position.copy(m),l.parent=null,l.type="radarObject",l}return r(n)}(),g=function(){function t(r,i,a,n,o){e(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o,this.imgUrl=a.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var s=new THREE.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:THREE.DoubleSide,transparent:!0});this.radar=new v(r,i,{},s,n),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return r(t,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),t}(),y={radius:100,altitude:0},x=function(t){i(n,maptalks.BaseObject);var a=s(n);function n(t,r,i,o){var s;e(this,n),r=maptalks.Util.extend({},y,r,{layer:o,coordinate:t}),(s=a.call(this))._initOptions(r);var l=r,c=l.altitude,h=l.radius,u=o.distanceToVector3(h,h).x,d=r.thetaStart||0,m=r.thetaLength||90,p=new THREE.CircleGeometry(u,128,d*Math.PI/180,m*Math.PI/180);s._createMesh(p,i);var f=o.distanceToVector3(c,c).x,v=o.coordinateToVector3(t,f);return s.getObject3d().position.copy(v),s}return r(n)}(),b=function(){function t(r,i,a,n,o){e(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o;var s=a.thetaLength||90,l=a.rotation||0,c=s/2;this.imgUrl=a.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl);var h=l-c;h=h<0?h+360:h,this._uniforms={map:{value:this.texture},time:{value:0}};var u=new THREE.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:THREE.DoubleSide,transparent:!0,depthTest:!1});this.sector=new x(r,{thetaStart:h,thetaLength:a.thetaLength,radius:i},u,n),this.threelayer.addMesh(this.sector)}return r(t,[{key:"tick",value:function(e){this._uniforms.time.value+=2.4*e}},{key:"dispose",value:function(){}}]),t}(),_={altitude:0,height:0},w=function(t){i(n,maptalks.BaseObject);var a=s(n);function n(t,r,i,o){var s;e(this,n),i=maptalks.Util.extend({},_,i,{layer:o}),s=a.call(this);var l=i,c=l.width,h=l.height,u=l.altitude;s._initOptions(i);var d=new THREE.PlaneGeometry(c,h);d.computeBoundingBox();var m=new THREE.Mesh(d,r);s._createGroup(),s.getObject3d().add(m);var p=o.distanceToVector3(u,u).x,f=o.coordinateToVector3(t,p);return m.position.set(0,d.boundingBox.max.y,0),s.getObject3d().position.copy(f),s}return r(n)}();function T(e,t,r,i,a,n){this.tilesHorizontal=t,this.tilesVertical=r,this.numberOfTiles=i,e.wrapS=e.wrapT=THREE.RepeatWrapping,e.repeat.set(1/this.tilesHorizontal,1/this.tilesVertical),this.tileDisplayDuration=a,this.currentDisplayTime=0,this.currentTile=0,this.flag=n,this.update=function(t){for(this.currentDisplayTime+=t;this.currentDisplayTime>this.tileDisplayDuration;){this.currentDisplayTime-=this.tileDisplayDuration,this.currentTile++,this.currentTile==this.numberOfTiles&&(this.currentTile=0);var r=this.currentTile%this.tilesHorizontal;e.offset.x=r/this.tilesHorizontal;var i=Math.floor(this.currentTile/this.tilesHorizontal);this.flag?e.offset.y=this.tilesVertical-i/this.tilesVertical:e.offset.y=1-i/this.tilesVertical-1/this.tilesVertical}}}var M=function(){function t(r,i,a,n,o){var s=this;e(this,t),this.threelayer=n,this.map=n.map,this.layerClass=o;var l=a.thetaLength||45;this.millsec=a.millsec||1e3,this.duration=a.duration||75,this.tilesHoriz=a.tilesHoriz||12,this.tilesVert=a.tilesVert||5,this.numTiles=a.numTiles||49;var c=a.rotation||0,h=l/2,u=n.distanceToVector3(i,i).x,d=Math.sin(h*Math.PI/180)*u*2,m=void 0===a.flag;this.imgUrl=a.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){s.texture=e,s.annie=new T(e,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,m);var t=new THREE.MeshBasicMaterial({transparent:!0,map:e,side:THREE.DoubleSide,depthTest:!1});s.imgObj=new w(r,t,{width:d,height:u},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 r(t,[{key:"tick",value:function(e){var t;null===(t=this.annie)||void 0===t||t.update(this.millsec*e)}},{key:"removeAnimation",value:function(){var e=this.layerClass.updatables.indexOf(this);e>-1&&this.layerClass.updatables.splice(e,1)}},{key:"dispose",value:function(){var e;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===(e=this.texture)||void 0===e||e.dispose()}}]),t}(),E={radius:100,altitude:0},L=function(t){i(n,maptalks.BaseObject);var a=s(n);function n(t,r,i,o){var s;e(this,n),r=maptalks.Util.extend({},E,r,{layer:o}),s=a.call(this);var l=r,c=l.width;l.height;var h=l.altitude;s._initOptions(r);var u=new THREE.CircleGeometry(c,32);s._createMesh(u,i);var d=o.distanceToVector3(h,h).x,m=o.coordinateToVector3(t,d);return s.getObject3d().position.copy(m),s}return r(n)}(),k=function(){function t(r,i,a,n){var o=this;e(this,t),this.threelayer=a,this.map=a.map,this.layerClass=n,this.time=0,a.coordinateToVector3(r,0),this.imgUrl=i.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(e){o.texture=e,o._uniforms={impactPosition:{value:new THREE.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var t=new THREE.ShaderMaterial({uniforms:o._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:THREE.DoubleSide,transparent:!0,depthTest:!1}),i=new L(r,{width:2,height:2},t,a);o.threelayer.addMesh(i),o.layerClass.updatables.push(o)}))}return r(t,[{key:"tick",value:function(e){this.time+=.2*e,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),R=function(){function t(r,i){var a=this;e(this,t),this.map=i,this.animationId=null,this.updatables=[];var n=h();this.threeLayer=new maptalks.ThreeLayer(n,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new THREE.Clock;var o=function e(){var t,r;(a.threeLayer._needsUpdate=!a.threeLayer._needsUpdate,a.threeLayer._needsUpdate)&&(null===(t=a.threeLayer)||void 0===t||null===(r=t.getRenderer())||void 0===r||r.clearCanvas(),a.threeLayer.renderScene());var i,n=a.clock.getDelta(),o=c(a.updatables);try{for(o.s();!(i=o.n()).done;){i.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}a.animationId=requestAnimationFrame(e)};this.threeLayer.prepareToDraw=function(e,t,r){var i=new THREE.DirectionalLight(16777215);i.position.set(0,-10,10).normalize(),t.add(i),o()},this.threeLayer.addTo(i),this.layerId=n,this.layerName=r,this.dirty=!1,this.initFlag=!1}return r(t,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var e=h();this.threeLayer.setId(e),this.layerId=e}}},{key:"setVisible",value:function(e,t){this.threeLayer&&(!0===e?(this.threeLayer.show(),t&&t()):(this.threeLayer.hide(),t&&t()))}},{key:"prepareToDraw",value:function(){var e=this,t=function t(){var r,i;(e.threeLayer._needsUpdate=!e.threeLayer._needsUpdate,e.threeLayer._needsUpdate)&&(null===(r=e.threeLayer)||void 0===r||null===(i=r.getRenderer())||void 0===i||i.clearCanvas(),e.threeLayer.renderScene());var a,n=e.clock.getDelta(),o=c(e.updatables);try{for(o.s();!(a=o.n()).done;){a.value.tick(n)}}catch(e){o.e(e)}finally{o.f()}e.animationId=requestAnimationFrame(t)};return new Promise((function(r){e.threeLayer.prepareToDraw=function(e,i,a){var n=new THREE.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),i.add(n),i.add(new THREE.AmbientLight(16777215)),t(),r()}}))}},{key:"drawRadar",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new g(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new g(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSector",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new b(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new b(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawSectorImg",value:function(e,t,r){var i=this;return new Promise((function(a){if(i.threeLayer.getScene()){var n=new M(e,t,r||{},i.threeLayer,i);a(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new M(e,t,r||{},i.threeLayer,i);a(n)}))}))}},{key:"drawImage",value:function(e,t,r,i){var a=this;return new Promise((function(n){if(a.threeLayer.getScene()){var o=new p(e,t,r,i,a.threeLayer);n(o)}else a.initFlag=!0,a.prepareToDraw().then((function(){var o=new p(e,t,r,i,a.threeLayer);n(o)}))}))}},{key:"drawShock",value:function(e,t){var r=this;return new Promise((function(i){if(r.threeLayer.getScene()){var a=new k(e,t||{},r.threeLayer,r);i(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new k(e,t||{},r.threeLayer,r);i(a)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var e=this.threeLayer.getMeshes();this.threeLayer.clear(),e.forEach((function(e){}));var t=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),i=this.threeLayer.getPick(),a=i.pickingTexture;i.pickingScene;var n=this.threeLayer.getRenderer();r.remove(t),t=null,r=null,a.dispose(),a=null,n.context.dispose(),n.context.forceContextLoss(),n.context=null,n.remove(),n=null,this.map.removeLayer(this.threeLayer)}}]),t}();export{p as imgClass,R as layerClass,M as planeSectorClass,g as radarClass,b as sectorClass,k as shockClass,u as sleep};
1
+ function t(){t=function(){return e};var e={},i=Object.prototype,r=i.hasOwnProperty,n=Object.defineProperty||function(t,e,i){t[e]=i.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",h=a.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,r){var a=e&&e.prototype instanceof d?e:d,o=Object.create(a.prototype),s=new T(r||[]);return n(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}}}e.wrap=l;var f={};function d(){}function m(){}function p(){}var v={};c(v,o,(function(){return this}));var g=Object.getPrototypeOf,y=g&&g(g(S([])));y&&y!==i&&r.call(y,o)&&(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 i(n,a,o,s){var h=u(t[n],t,a);if("throw"!==h.type){var c=h.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){i("next",t,o,s)}),(function(t){i("throw",t,o,s)})):e.resolve(l).then((function(t){c.value=t,o(c)}),(function(t){return i("throw",t,o,s)}))}s(h.arg)}var a;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}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 C()}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 E(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 S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,n=function e(){for(;++i<t.length;)if(r.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:C}}function C(){return{value:void 0,done:!0}}return m.prototype=p,n(x,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:m,configurable:!0}),m.displayName=c(p,h,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,h,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},w(b.prototype),c(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,i,r,n,a){void 0===a&&(a=Promise);var o=new b(l(t,i,r,n),a);return e.isGeneratorFunction(i)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},w(x),c(x,h,"Generator"),c(x,o,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),e.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}},e.values=S,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(E),!t)for(var e in this)"t"===e.charAt(0)&&r.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 i(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 i("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),h=r.call(a,"finallyLoc");if(s&&h){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.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),E(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;E(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:S(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),f}},e}function e(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 i(t){return function(){var i=this,r=arguments;return new Promise((function(n,a){var o=t.apply(i,r);function s(t){e(o,n,a,s,h,"next",t)}function h(t){e(o,n,a,s,h,"throw",t)}s(void 0)}))}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(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 a(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(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&&h(t,e)}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},s(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function c(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 l(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=s(t);if(e){var n=s(this).constructor;i=Reflect.construct(r,arguments,n)}else i=r.apply(this,arguments);return c(this,i)}}function u(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 f(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 u(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)?u(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 d(){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 m(t){return new Promise((function(e){return setTimeout(e,t)}))}function p(t,e){return e.split("").forEach((function(e){-1===t.indexOf(e)&&(t+=e)})),t}function v(t,e){return 256*(t=THREE.MathUtils.clamp(Math.floor(t),0,255))+(e=THREE.MathUtils.clamp(Math.floor(e),0,255))}var g={altitude:0,imageWidth:512,imageHeight:512,texture:null},y=function(t){o(i,maptalks.BaseObject);var e=l(i);function i(t,n,a,o){var s;r(this,i);var h=n=maptalks.Util.extend({},g,n),c=h.altitude;h.imageHeight,h.imageWidth,t instanceof maptalks.Extent||(t=new maptalks.Extent(t));var l=t,u=l.xmin,f=l.ymin,d=l.xmax,m=l.ymax,p=1/0,v=1/0,y=-1/0,x=-1/0;[[u,f],[u,m],[d,m],[d,f]].forEach((function(t){var e=o.coordinateToVector3(t),i=e.x,r=e.y;p=Math.min(i,p),v=Math.min(r,v),y=Math.max(i,y),x=Math.max(r,x)}));var w=Math.abs(y-p),b=Math.abs(x-v),_=new THREE.PlaneBufferGeometry(w,b);(s=e.call(this))._initOptions(n),s._createMesh(_,a);var k=o.distanceToVector3(c,c).x,M=o.coordinateToVector3(t.getCenter(),k);return s.getObject3d().position.copy(M),s.parent=null,s.type="Image",s}return a(i)}(),x=function(){function t(e,i,n,a,o){var s=this;r(this,t),this.threelayer=o,this.map=o.map,this.textureLoader=new THREE.TextureLoader;var h=e.split(","),c=i.split(","),l=parseFloat(h[0]),u=parseFloat(h[1]),f=parseFloat(c[0]),d=parseFloat(c[1]),m=a.maxZoom||11,p=a.renderOrder||0,v=a.opacity||1,g=a.minZoom||3,x=new maptalks.Extent(l,u,f,d);this.xmin_g=l,this.ymin_g=u,this.xmax_g=f,this.ymax_g=d,this.textureLoader.load(n,(function(t){var e=new THREE.MeshBasicMaterial({map:t,transparent:!0,opacity:v}),i=new y(x,{imageWidth:512,imageHeight:512,maxZoom:m,minZoom:g,interactive:void 0!==a.interactive&&a.interactive},e,s.threelayer);i.object3d.renderOrder=p,s.imgMesh=i,s.imgMesh.parent=s,s.m=e,s.texture=t,s.threelayer.addMesh(s.imgMesh),a.opacityItems&&a.opacityItems.length>0&&!isNaN(a.opacityItems[0])&&!isNaN(a.opacityItems[1])&&a.opacityItems[0]>3&&a.opacityItems[0]<=18&&a.opacityItems[1]>=0&&a.opacityItems[1]<=1&&(s.opacityItems=a.opacityItems,s._bindMapEvents(),s._viewChange())}))}return a(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]),a=parseFloat(e.righttop[0]),o=parseFloat(e.righttop[1]);if(r!==this.xmin_g||n!==this.ymin_g||a!==this.xmax_g||o!==this.ymax_g){var s=new maptalks.Extent(r,n,a,o),h=1/0,c=1/0,l=-1/0,u=-1/0;[[r,n],[r,o],[a,o],[a,n]].forEach((function(t){var e=i.threelayer.coordinateToVector3(t),r=e.x,n=e.y;h=Math.min(r,h),c=Math.min(n,c),l=Math.max(r,l),u=Math.max(n,u)}));for(var f=Math.abs(l-h),d=Math.abs(u-c),m=new THREE.PlaneBufferGeometry(f,d),p=m.attributes.position.array,v=this.imgMesh.object3d.geometry.attributes.position.array,g=0;g<v.length;g++)v[g]=p[g];this.imgMesh.object3d.geometry.attributes.position.needsUpdate=!0;var y=this.threelayer.coordinateToVector3(s.getCenter(),0);this.imgMesh.getObject3d().position.copy(y),m.dispose(),this.xmin_g=r,this.ymin_g=n,this.xmax_g=a,this.ymax_g=o}}this.textureLoader.load(t,(function(t){i.texture&&i.texture.dispose(),delete i.texture,t.magFilter=THREE.NearestFilter,t.minFilter=THREE.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}(),w={altitude:0,imageWidth:512,imageHeight:512,texture:null},b=function(t){o(i,maptalks.BaseObject);var e=l(i);function i(t,n,a,o,s){var h;r(this,i);var c=(a=maptalks.Util.extend({},w,a)).altitude,l=s.distanceToVector3(n,n).x,u=new THREE.CircleGeometry(l,32);(h=e.call(this))._initOptions(a),h._createMesh(u,o);var f=s.distanceToVector3(c,c).x,d=s.coordinateToVector3(t,f);return h.getObject3d().position.copy(d),h.parent=null,h.type="radarObject",h}return a(i)}(),_=function(){function t(e,i,n,a,o){r(this,t),this.threelayer=a,this.map=a.map,this.layerClass=o,this.imgUrl=n.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl),this._uniforms={map:{value:this.texture},time:{value:0}};var s=new THREE.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:THREE.DoubleSide,transparent:!0});this.radar=new b(e,i,{},s,a),this.threelayer.addMesh(this.radar),this.layerClass.updatables.push(this)}return a(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}(),k={radius:100,altitude:0},M=function(t){o(i,maptalks.BaseObject);var e=l(i);function i(t,n,a,o){var s;r(this,i),n=maptalks.Util.extend({},k,n,{layer:o,coordinate:t}),(s=e.call(this))._initOptions(n);var h=n,c=h.altitude,l=h.radius,u=o.distanceToVector3(l,l).x,f=n.thetaStart||0,d=n.thetaLength||90,m=new THREE.CircleGeometry(u,128,f*Math.PI/180,d*Math.PI/180);s._createMesh(m,a);var p=o.distanceToVector3(c,c).x,v=o.coordinateToVector3(t,p);return s.getObject3d().position.copy(v),s}return a(i)}(),E=function(){function t(e,i,n,a,o){r(this,t),this.threelayer=a,this.map=a.map,this.layerClass=o;var s=n.thetaLength||90,h=n.rotation||0,c=s/2;this.imgUrl=n.imgUrl,this.loader=new THREE.TextureLoader,this.texture=this.loader.load(this.imgUrl);var l=h-c;l=l<0?l+360:l,this._uniforms={map:{value:this.texture},time:{value:0}};var u=new THREE.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:THREE.DoubleSide,transparent:!0,depthTest:!1});this.sector=new M(e,{thetaStart:l,thetaLength:n.thetaLength,radius:i},u,a),this.threelayer.addMesh(this.sector)}return a(t,[{key:"tick",value:function(t){this._uniforms.time.value+=2.4*t}},{key:"dispose",value:function(){}}]),t}(),T={altitude:0,height:0},S=function(t){o(i,maptalks.BaseObject);var e=l(i);function i(t,n,a,o){var s;r(this,i),a=maptalks.Util.extend({},T,a,{layer:o}),s=e.call(this);var h=a,c=h.width,l=h.height,u=h.altitude;s._initOptions(a);var f=new THREE.PlaneGeometry(c,l);f.computeBoundingBox();var d=new THREE.Mesh(f,n);s._createGroup(),s.getObject3d().add(d);var m=o.distanceToVector3(u,u).x,p=o.coordinateToVector3(t,m);return d.position.set(0,f.boundingBox.max.y,0),s.getObject3d().position.copy(p),s}return a(i)}();function C(t,e,i,r,n,a){this.tilesHorizontal=e,this.tilesVertical=i,this.numberOfTiles=r,t.wrapS=t.wrapT=THREE.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 I=function(){function t(e,i,n,a,o){var s=this;r(this,t),this.threelayer=a,this.map=a.map,this.layerClass=o;var h=n.thetaLength||45;this.millsec=n.millsec||1e3,this.duration=n.duration||75,this.tilesHoriz=n.tilesHoriz||12,this.tilesVert=n.tilesVert||5,this.numTiles=n.numTiles||49;var c=n.rotation||0,l=h/2,u=a.distanceToVector3(i,i).x,f=Math.sin(l*Math.PI/180)*u*2,d=void 0===n.flag;this.imgUrl=n.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){s.texture=t,s.annie=new C(t,s.tilesHoriz,s.tilesVert,s.numTiles,s.duration,d);var i=new THREE.MeshBasicMaterial({transparent:!0,map:t,side:THREE.DoubleSide,depthTest:!1});s.imgObj=new S(e,i,{width:f,height:u},a),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 a(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}(),L={radius:100,altitude:0},O=function(t){o(i,maptalks.BaseObject);var e=l(i);function i(t,n,a,o){var s;r(this,i),n=maptalks.Util.extend({},L,n,{layer:o}),s=e.call(this);var h=n,c=h.width;h.height;var l=h.altitude;s._initOptions(n);var u=new THREE.CircleGeometry(c,32);s._createMesh(u,a);var f=o.distanceToVector3(l,l).x,d=o.coordinateToVector3(t,f);return s.getObject3d().position.copy(d),s}return a(i)}(),R=function(){function t(e,i,n,a){var o=this;r(this,t),this.threelayer=n,this.map=n.map,this.layerClass=a,this.time=0,n.coordinateToVector3(e,0),this.imgUrl=i.imgUrl,this.textureLoader=new THREE.TextureLoader,this.imgUrl&&this.textureLoader.load(this.imgUrl,(function(t){o.texture=t,o._uniforms={impactPosition:{value:new THREE.Vector3(0,0,0)},impactMaxRadius:{value:2},impactRatio:{value:.25},map:{value:o.texture}};var i=new THREE.ShaderMaterial({uniforms:o._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:THREE.DoubleSide,transparent:!0,depthTest:!1}),r=new O(e,{width:2,height:2},i,n);o.threelayer.addMesh(r),o.layerClass.updatables.push(o)}))}return a(t,[{key:"tick",value:function(t){this.time+=.2*t,this.time%=1,this._uniforms.impactRatio.value=this.time}},{key:"dispose",value:function(){}}]),t}(),P=6371008.8,A={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*P,kilometers:6371.0088,kilometres:6371.0088,meters:P,metres:P,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:P/1852,radians:1,yards:6967335.223679999};function z(t){return t%360*Math.PI/180}function j(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 F(t,e,i){void 0===i&&(i={});var r=j(t),n=j(e),a=z(n[1]-r[1]),o=z(n[0]-r[0]),s=z(r[1]),h=z(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=A[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 D(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"),U=function(){function t(){r(this,t),this.type="gisCommon"}return a(t,null,[{key:"getTexture",value:function(t,e,i,r){var n=t.getContext("2d");n.drawImage(e,i,r);var a=new THREE.Texture(n.getImageData(0,0,t.width,t.height));return a.minFilter=THREE.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 o=new THREE.Texture(a.getImageData(0,0,H.width,H.height));return o.minFilter=THREE.LinearFilter,o.generateMipmaps=!1,o.needsUpdate=!0,o}},{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*F({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,o=new THREE.Vector3(r.x,r.y+a,0).sub(r).normalize(),s=((n.clone().cross(o).z<0?-1:1)*Math.acos(n.dot(o))*180/Math.PI).toFixed(2);(s=parseFloat(s))<0&&(s=s+180+180);var h=parseFloat(e.begin),c=parseFloat(e.end);if(h>c){if(s>=h||s<=c)return!0}else if(s>=h&&s<=c)return!0;return!1}return!1}},{key:"containsCoordinate1",value:function(t,e){return 1e3*F({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=j(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(D(n,h[l][0],i.ignoreBoundary)){for(var u=!1,f=1;f<h[l].length&&!u;)D(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 maptalks.Coordinate&&(i=t.x,r=t.y);var n=e.xmin,a=e.ymin,o=e.xmax,s=e.ymax;return n<=i&&i<=o&&a<=r&&r<=s}},{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 THREE.Texture(r.getImageData(0,0,H.width,H.height));return n.magFilter=THREE.NearestFilter,n.minFilter=THREE.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,o=0,s=0;s<e.length;s++){if(a<e[s]){o=e[s];break}o=1024}H.width=H.height=o;for(var h=H.getContext("2d"),c=0,l=0,u=[],f=0;f<r;f++){for(var d=5*(f+1)+f*c,m=0;m<r;m++){var p=5*(m+1)+m*t[l].w;if("img"===t[l].type){var v=(t[l].w-t[l].iw)/2,g=(t[l].h-t[l].ih)/2;h.drawImage(t[l].src,p+v,d+g,t[l].iw,t[l].ih)}else if("txt"===t[l].type)h.fillStyle=t[l].color,"#fff"===t[l].color?(h.font="lighter "+t[l].size+"px Microsoft YaHei",h.fillText(t[l].src,p+t[l].offx,d+t[l].offy),h.strokeStyle=t[l].color,h.strokeText(t[l].src,p+t[l].offx,d+t[l].offy)):(h.font="normal "+t[l].size+"px Microsoft YaHei",h.fillText(t[l].src,p+t[l].offx,d+t[l].offy));else{var y=(t[l].w-t[l].iw)/2,x=(t[l].h-t[l].ih)/2,w=t[l].offx||0,b=t[l].offy||0;h.drawImage(t[l].src,p+y+w,d+x+b,t[l].iw,t[l].ih)}if(u.push({w:t[l].w,h:t[l].h,u:p/o,v:d/o}),c=Math.max(c,t[l].h),(l+=1)>=t.length)break}if(l>=t.length)break}var _=new THREE.Texture(h.getImageData(0,0,H.width,H.height));return _.minFilter=THREE.LinearFilter,_.generateMipmaps=!1,_.needsUpdate=!0,{xys:u,texture:_,textureSize:o}}},{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,o=0,s=0;s<e.length;s++){if(a<e[s]){o=e[s];break}o=1024}H.width=H.height=o;for(var h=H.getContext("2d"),c=0,l=0,u=0,f=[],d=0;d<r;d++){for(var m=5*(d+1)+d*c,p=0;p<r;p++){var v=5*(p+1)+u;if("img"===t[l].type){var g=(t[l].w-t[l].iw)/2,y=(t[l].h-t[l].ih)/2;h.drawImage(t[l].src,v+g,m+y,t[l].iw,t[l].ih)}else if("txt"===t[l].type)h.fillStyle=t[l].color,"#fff"===t[l].color?(h.font="lighter "+t[l].size+"px Microsoft YaHei",h.fillText(t[l].src,v+t[l].offx,m+t[l].offy),h.strokeStyle=t[l].color,h.strokeText(t[l].src,v+t[l].offx,m+t[l].offy)):(h.font="normal "+t[l].size+"px Microsoft YaHei",h.fillText(t[l].src,v+t[l].offx,m+t[l].offy));else{var x=(t[l].w-t[l].iw)/2,w=(t[l].h-t[l].ih)/2,b=t[l].offx||0,_=t[l].offy||0;h.drawImage(t[l].src,v+x+b,m+w+_,t[l].iw,t[l].ih)}if(f.push({w:t[l].w,h:t[l].h,u:v/o,v:m/o}),c=Math.max(c,t[l].h),u+=t[l].w,(l+=1)>=t.length)break}if(l>=t.length)break}var k=new THREE.Texture(h.getImageData(0,0,H.width,H.height));return k.minFilter=THREE.LinearFilter,k.generateMipmaps=!1,k.needsUpdate=!0,{xys:f,texture:k,textureSize:o}}},{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,o=0,s=0;s<e.length;s++){if(a<e[s]){o=e[s];break}o=1024}H.width=H.height=o;for(var h=H.getContext("2d"),c=0,l=0,u={},f=0;f<r;f++){for(var d=5*(f+1)+f*c,m=0,p=0;p<r;p++){var v=5*(p+1)+m,g=(t[l].w-t[l].iw)/2,y=(t[l].h-t[l].ih)/2;if(h.drawImage(t[l].src,v+g,d+y,t[l].iw,t[l].ih),u[t[l].key]={w:t[l].w,h:t[l].h,u:v/o,v:d/o},c=Math.max(c,t[l].h),m+=t[l].w,(l+=1)>=t.length)break}if(l>=t.length)break}var x=new THREE.Texture(h.getImageData(0,0,H.width,H.height));return x.minFilter=THREE.LinearFilter,x.generateMipmaps=!1,x.needsUpdate=!0,{xys:u,texture:x,textureSize:o}}},{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 THREE.Texture(H);return a.minFilter=THREE.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 o=n.width/2,s=n.height/2;a.textAlign="center",a.textBaseline="middle",a.fillStyle="#FFF",a.font="".concat(r.fontsize,"px Arial"),a.fillText(r.txt,o,s);var h=new THREE.Texture(n);return h.magFilter=THREE.NearestFilter,h.minFilter=THREE.NearestFilter,h.needsUpdate=!0,h}},{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 THREE.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 V(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 B=Z;function Z(t,e){this.x=t,this.y=e}Z.prototype={clone:function(){return new Z(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}},Z.convert=function(t){return t instanceof Z?t:Array.isArray(t)?new Z(t[0],t[1]):t};var N={radius:40,altitude:0},G=function(t){o(i,maptalks.BaseObject);var e=l(i);function i(t,n,a,o,s,h,c,l){var u;r(this,i);var f=function(t){for(var e=1/0,i=1/0,r=-1/0,n=-1/0,a=0,o=t.length;a<o;a++){var s=t[a],h=s.coordinate,c=s.lnglat,l=s.lnglats,u=s.xy,f=s.xys,d=h||c||l||u||f||t[a],m=void 0,p=void 0;Array.isArray(d)?(m=d[0],p=d[1]):d instanceof maptalks.Coordinate&&(m=d.x,p=d.y),e=Math.min(e,m),i=Math.min(i,p),r=Math.max(r,m),n=Math.max(n,p)}return new maptalks.Coordinate((e+r)/2,(i+n)/2)}(t);u=e.call(this),n=maptalks.Util.extend({center:f,layer:l},N,n),u._initOptions(n);var d=u.getLayer().getPick();u._colorMap={},u._datas=t,u._childCount=c;var m=l.coordinateToVector3(f);u.glyphMap=s,u.glyphAtlas=h;for(var p=new THREE.InstancedBufferGeometry,g=new Uint16Array([0,1,2,2,3,0]),y=new Float32Array([0,1,-.5,-.5,1,1,.5,-.5,1,0,.5,.5,0,0,-.5,.5]),x=new THREE.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),w=new THREE.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),b=new THREE.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),_=new THREE.InstancedBufferAttribute(new Float32Array(4*u._childCount),4,!0),k=new THREE.InstancedBufferAttribute(new Float32Array(3*u._childCount),3,!0),M=0,E=function(e){var i=t[e],r=i.texts,n=i.markers,a=d.getColor(),o=a.getHex();u._colorMap[o]=e,u._datas[e].colorIndex=o,n&&n.forEach((function(i){if(x.setXYZW(M,i.markerWidth,i.markerHeight,i.markerDx,i.markerDy),w.setXYZW(M,i.u,i.v,-16,16),i.markerColor){var r=v(0,255);_.setXYZW(M,r,0,0,0);var n=u.getColorVector2(i.markerColor,i.markerOpacity);b.setXYZW(M,n[0],n[1],i.w,i.h)}else{var o=v(0,0);_.setXYZW(M,o,0,0,0);var s=u.getColorVector2("#fff",i.markerOpacity);b.setXYZW(M,s[0],s[1],i.w,i.h)}k.setXYZ(M,a.r,a.g,a.b),i.markerIndex=M,M+=1,t[e].childNum+=1})),r&&r.forEach((function(i){var r=u.getColorVector2(i.textColor,i.textOpacity),n=v(255,0);u.buildTextBuffers("".concat(i.text),i.textAnchor,"center",i.textSpacing).forEach((function(o){if(x.setXYZW(M,i.textSize,0,i.textDx,i.textDy),w.setXYZW(M,o[0],o[1],o[2],o[3]),i.textHaloColor){var s=u.getColorVector2(i.textHaloColor,i.textHaloOpacity);b.setXYZW(M,r[0],r[1],s[0],s[1]);var h=i.textHaloRadius;_.setXYZW(M,n,h,0,0)}else b.setXYZW(M,r[0],r[1],0,0),_.setXYZW(M,n,-1.9,0,0);k.setXYZ(M,a.r,a.g,a.b),i.textIndex.push(M),M+=1,t[e].childNum+=1}))}))},T=0;T<t.length;T++)E(T);p.setIndex(new THREE.Uint16BufferAttribute(g,1)),p.setAttribute("uv_offset",new THREE.Float32BufferAttribute(y,4,!0)),p.setAttribute("size",x),p.setAttribute("uv_image",w),p.setAttribute("color",b),p.setAttribute("util",_),p.setAttribute("pickingColor",k),u._createInstancedMesh(p,a,u._childCount),u.getObject3d().instanceMatrix.setUsage(THREE.DynamicDrawUsage);var S=new THREE.InstancedMesh(p,o,u._childCount);S.instanceMatrix.setUsage(THREE.DynamicDrawUsage);var C=d.getColor().getHex();S._colorIndex=C,u.setPickObject3d(S);var I=new THREE.Object3D;M=0,t.forEach((function(e,i){if(e.visible){var r=l.coordinateToVector3(e.coordinate);r.sub(m),e.height&&(r.z=l.altitudeToVector3(e.height).x);for(var n=0;n<t[i].childNum;n++)I.position.set(r.x,r.y,0),I.updateMatrix(),u.getObject3d().setMatrixAt(M,I.matrix),S.setMatrixAt(M,I.matrix),M+=1}}));var L=l.altitudeToVector3(n.altitude,n.altitude).x;return m.z=L,u.getObject3d().position.copy(m),S.position.copy(u.getObject3d().position),u.parent=null,u.pickMesh=S,u.threeLayer=l,u.center=m,u._init(),u}return a(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 THREE.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[v(n.r,n.g),v(a,void 0!==e?e:255)]}},{key:"buildTextBuffers",value:function(t,e,i,r){var n=[],a=[0,0],o=V(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 B(m,p),x=new B(v,p),w=new B(m,g),b=new B(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 THREE.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}(),W=function(){function t(e,i){r(this,t),this.createImage(e,1,i)}return a(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 Y=a((function t(e){r(this,t);var i={},n=[];for(var a in e){var o=e[a],s=i[a]={};for(var h in o){var c=o[+h];if(c&&0!==c.bitmap.width&&0!==c.bitmap.height){var l={x:0,y:0,w:c.bitmap.width+2,h:c.bitmap.height+2};n.push(l),s[h]={rect:l,metrics:c.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}}(n),f=u.w,d=u.h,m=new W({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;W.copy(y.bitmap,m,{x:0,y:0},{x:x.x+1,y:x.y+1},y.bitmap)}}}this.image=m,this.positions=i})),X={exports:{}};X.exports=K,X.exports.default=K;var q=1e20;function K(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 J(t,e,i,r,n,a){for(var o=0;o<e;o++)$(t,o,e,i,r,n,a);for(var s=0;s<i;s++)$(t,s*e,1,e,r,n,a)}function $(t,e,i,r,n,a,o){var s,h,c,l;for(a[0]=0,o[0]=-q,o[1]=q,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]=q}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)}}K.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(q,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]=q;else if(0===u)a[l]=q,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),J(this.gridOuter,i,n,this.f,this.v,this.z),J(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}}},K.prototype.draw=function(t){return this._draw(t,!1).data},K.prototype.drawWithMetrics=function(t){return this._draw(t,!0)};var Q=X.exports,tt={},et={};var it=function(){function e(t,i,n){var a=this;r(this,e);var o=i.pointMinZoom,s=i.pointOrder;if(0!=t.length){var h=[];this.charArray="",this.imgDict={},this.threeLayer=n,this.map=n.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,t.slice(0,1/0).map((function(t){1*t.longitude>70&&1*t.longitude<138&&1*t.latitude>0&&1*t.latitude<56&&a._bindDataItem(h,t)})),this.textures=null,this.glyphMap=null,this.glyphAtlas=null,this.dataItems=h,this.point=null,this.shader=null,this.minZoom=o||8,this.maxZoom=i.pointMaxZoom||20,this.order=s||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 n,o,s,h;return a(e,[{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=p(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:(h=i(t().mark((function e(){var i,r,n,a,o;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=[],e.t0=t().keys(this.imgDict);case 2:if((e.t1=e.t0()).done){e.next=18;break}if(r=e.t1.value,n=r,!r.includes(".svg")){e.next=12;break}return e.next=8,fetch(r);case 8:return a=e.sent,e.next=11,a.text();case 11:n=e.sent;case 12:return e.next=14,U.addImageProcess(n);case 14:o=e.sent,i.push({key:r,src:o,w:this.imgDict[r].width,h:this.imgDict[r].height,iw:this.imgDict[r].width,ih:this.imgDict[r].height}),e.next=2;break;case 18:return e.abrupt("return",U.generateTextureOptimize(i));case 19:case"end":return e.stop()}}),e,this)}))),function(){return h.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=tt[e];return s||(s=tt[e]=new Q(24,3,8,.25,n,a)),et[e]||(et[e]={}),et[e][i]||(et[e][i]=s.ctx.measureText(i).width),{id:o,bitmap:new W({width:30,height:30},s.draw(i)),metrics:{width:24,height:24,left:0,top:-5,advance:(t=o,t>=19968&&t<=40959?24:et[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 Y(this.glyphMap)}},{key:"addPoint",value:(s=i(t().mark((function e(){var i,r,n,a,o,s,h,c=this;return t().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 i=t.sent,this.textures||(this.textures=[]),this.textures.push(i.texture),this.initGlyphAtlas(),r=this.glyphAtlas.image,n=r.width,a=r.height,o=r.data,(s=new THREE.DataTexture(o,n,a)).needsUpdate=!0,s.magFilter=THREE.LinearFilter,s.minFilter=THREE.LinearFilter,s.format=THREE.AlphaFormat,this.textures.push(s),this.m=this._getRawShaderMaterial(i,s,n,a),this.m.depthTest=!1,this.m_pick=this._getRawShaderMaterial(i,s,n,a),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,i.xys[t.key])}))})),(h=new G(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(){c.m.uniforms.cameraToCenterDistance.value=c.map.cameraToCenterDistance,c.m.uniforms.zoomScale.value=76.43702828517625/c.map.getResolution(),c.m_pick.uniforms.cameraToCenterDistance.value=c.map.cameraToCenterDistance,c.m_pick.uniforms.zoomScale.value=76.43702828517625/c.map.getResolution();for(var t=c._getRate(),e=c.point.object3d.geometry.attributes.size.array,i=0,r=0;r<c.dataItems.length;r++){var n=c.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()}c.point.object3d.geometry.attributes.size.needsUpdate=!0,c.zoomChangeCallback&&c.zoomChangeCallback()},this.isToolTip&&h.setToolTip("hello",{showTimeout:0,eventsPropagation:!0,dx:10}),h.object3d.renderOrder=this.order,this.point=h,this.point.parent=this,this.threeLayer.addMesh(this.point),this._bindMapEvents(),t.abrupt("return",this);case 30:case"end":return t.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"_getRawShaderMaterial",value:function(t,e,i,r){return new THREE.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:THREE.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:(o=i(t().mark((function e(i){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.clickFunc(i);case 2:this.iconFile&&this._addIcon(i);case 3:case"end":return t.stop()}}),e,this)}))),function(t){return o.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:(n=i(t().mark((function e(i){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),e)}))),function(t){return n.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,a=1/0,o=-1/0,s=-1/0,h=0;h<this.dataItems.length;h++){var c=this.dataItems[h];t.includes(c.code)?(n=Math.min(n,this.dataItems[h].coordinate[0]),a=Math.min(a,this.dataItems[h].coordinate[1]),o=Math.max(o,this.dataItems[h].coordinate[0]),s=Math.max(s,this.dataItems[h].coordinate[1]),c.visible=!0):c.visible=!1}null===(r=this.point)||void 0===r||r.changeVisible(),e&&this.map.fitExtent(new maptalks.Extent(n,a,o,s),i||0)}},{key:"updateByZoom",value:function(){var t=this,e=this.map.getZoom(),i=new THREE.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}}]),e}(),rt=function(){function t(e,i){var n=this;r(this,t),this.map=i,this.animationId=null,this.updatables=[];var a=d();this.threeLayer=new maptalks.ThreeLayer(a,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new THREE.Clock;var o=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=f(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 THREE.DirectionalLight(16777215);r.position.set(0,-10,10).normalize(),e.add(r),o()},this.threeLayer.addTo(i),this.layerId=a,this.layerName=e,this.dirty=!1,this.initFlag=!1}return a(t,[{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=d();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=f(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 THREE.DirectionalLight(16777215);a.position.set(0,-10,10).normalize(),r.add(a),r.add(new THREE.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 _(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new _(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 E(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new E(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 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:"drawImage",value:function(t,e,i,r){var n=this;return new Promise((function(a){if(n.threeLayer.getScene()){var o=new x(t,e,i,r,n.threeLayer);a(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new x(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 R(t,e||{},i.threeLayer,i);r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new R(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 it(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 it(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}();export{x as imgClass,rt as layerClass,it as planeMark,I as planeSectorClass,_ as radarClass,E as sectorClass,R as shockClass,m as sleep};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "map-core-func",
3
3
  "umdName": "map-core-func",
4
- "version": "0.1.17",
4
+ "version": "0.1.18",
5
5
  "description": "map-core-func",
6
6
  "files": [
7
7
  "dist"
@@ -24,14 +24,18 @@
24
24
  "@rollup/plugin-node-resolve": "^13.0.4",
25
25
  "@rollup/plugin-replace": "^3.0.0",
26
26
  "maptalks": "^1.0.0-rc.18",
27
+ "maptalks.three": "^0.35.2",
27
28
  "rollup": "^2.55.0",
28
29
  "rollup-plugin-external-globals": "^0.7.3",
29
30
  "rollup-plugin-livereload": "^2.0.5",
30
31
  "rollup-plugin-terser": "^7.0.2",
31
- "three": "0.127.0",
32
- "maptalks.three": "^0.35.2"
32
+ "three": "0.127.0"
33
33
  },
34
34
  "dependencies": {
35
-
35
+ "@mapbox/point-geometry": "^0.1.0",
36
+ "@mapbox/tiny-sdf": "1.2.5",
37
+ "@turf/boolean-point-in-polygon": "^6.5.0",
38
+ "@turf/distance": "^6.5.0",
39
+ "potpack": "^2.0.0"
36
40
  }
37
41
  }