map-core-func 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(){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};
|
|
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 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 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:I}}function I(){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:"show",value:function(){this.imgMesh&&(this.threelayer.addMesh(this.imgMesh),this.opacityItems&&this._bindMapEvents())}},{key:"dispose",value:function(){this.imgMesh&&(!0===this.imgMesh.isAdd&&this.threelayer.removeMesh(this.imgMesh),this.imgMesh.object3d.geometry&&this.imgMesh.object3d.geometry.dispose(),this.imgMesh.object3d.material&&(this.imgMesh.object3d.material.dispose(),delete this.m)),this.texture&&(this.texture&&this.texture.dispose(),delete this.texture),this.opacityItems&&(this._closeEvent(),delete this.opacityItems),this.threelayer=null,this.textureLoader&&delete this.textureLoader}}]),t}(),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 I(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 C=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 I(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}(),A={radius:100,altitude:0},L=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({},A,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)}(),O=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 L(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}(),R=6371008.8,P={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*R,kilometers:6371.0088,kilometres:6371.0088,meters:R,metres:R,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:R/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=P[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=N;function N(t,e){this.x=t,this.y=e}N.prototype={clone:function(){return new N(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}},N.convert=function(t){return t instanceof N?t:Array.isArray(t)?new N(t[0],t[1]):t};var G={radius:40,altitude:0},Z=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},G,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 I=d.getColor().getHex();S._colorIndex=I,u.setPickObject3d(S);var C=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++)C.position.set(r.x,r.y,0),C.updateMatrix(),u.getObject3d().setMatrixAt(M,C.matrix),S.setMatrixAt(M,C.matrix),M+=1}}));var A=l.altitudeToVector3(n.altitude,n.altitude).x;return m.z=A,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.hasAlign=i.hasAlign||!1,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.hasAlign&&(this.m.vertexShader="#define HAS_ALIGN\n"+this.m.vertexShader),this.m_pick=this._getRawShaderMaterial(i,s,n,a),this.hasAlign&&(this.m_pick.vertexShader="#define HAS_ALIGN\n"+this.m_pick.vertexShader),this.m_pick.vertexShader="#define PICKING\n"+this.m_pick.vertexShader,this.m_pick.fragmentShader="#define PICKING\n"+this.m_pick.fragmentShader,this.dataItems.forEach((function(t){t.markers&&t.markers.forEach((function(t){t=Object.assign(t,i.xys[t.key])}))})),(h=new Z(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 32: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 vec3 c = vec3(0.0, 0.0, 0.0);\n\n if (utils1.x > 0.) {\n float glyphSize = 24.;\n #ifndef PICKING\n vec2 wh = uv_offset.xy / sdfTextureSize * 32.;\n vec2 xy = uv_image.xy / sdfTextureSize;\n vUv = vec2(xy.x + wh.x, xy.y - wh.y);\n #endif\n \n j = j / glyphSize * size.x;\n float B = camera_to_anchor_distance / cameraToCenterDistance;\n\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n vec2 C = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(C, .0) / zoomScale * B * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n\n #ifndef PICKING\n #ifndef HAS_ALIGN\n vGammaScale = mix(1., B, perspective_ratio);\n #else\n vGammaScale = B + mapPitch / 4.;\n #endif\n vGammaScale = clamp(vGammaScale, .0, 1.);\n vSize = size.x;\n #endif\n } else {\n #ifndef PICKING\n float width = uv_offset.x / imgTextureSize * color.z;\n float height = uv_offset.y / imgTextureSize * color.w;\n float x = uv_image.x;\n float y = 1.0 - uv_image.y;\n vUv = vec2(x + width, y - height);\n #endif\n\n j = j * vec2(1., -1.);\n j = j / 32. * size.xy;\n #ifndef HAS_ALIGN\n vec2 C = j * 2. / canvasSize;\n gl_Position.xy += C * n * camera_to_anchor_distance;\n #else\n float C = camera_to_anchor_distance / cameraToCenterDistance;\n vec2 B = j;\n gl_Position = projectionMatrix * modelViewMatrix * instanceMatrix * vec4(c + vec3(B, .0) / zoomScale * C * n, 1.);\n #endif\n gl_Position.xy += vec2(size.z, size.w) * 2. / canvasSize * camera_to_anchor_distance;\n }\n }\n ",fragmentShader:"\n precision mediump float;\n #define SDF_PX 8.0\n #define DEVICE_PIXEL_RATIO 1.0\n #define EDGE_GAMMA 0.105 / DEVICE_PIXEL_RATIO\n uniform sampler2D sdfTexture;\n uniform sampler2D imgTexture;\n uniform highp float gammaScale;\n varying vec4 vColor;\n #ifndef PICKING\n varying vec2 vUv;\n varying float vSize;\n varying float vGammaScale;\n varying vec4 vUtil;\n #endif\n\n vec2 unpack_float(const float packedValue) {\n int packedIntValue = int(packedValue);\n int v0 = packedIntValue / 256;\n return vec2(v0, packedIntValue - v0 * 256);\n }\n \n vec4 decode_color(const vec2 encodedColor) {\n return vec4(\n unpack_float(encodedColor[0]) / 255.0,\n unpack_float(encodedColor[1]) / 255.0\n );\n }\n void main()\n {\n #ifdef PICKING\n gl_FragColor = vColor;\n #else\n vec4 color = decode_color(vColor.xy);\n vec2 utils1 = unpack_float(vUtil.x) / 255.0;\n if (utils1.x > 0.) {\n /*float vOpacity = 1.0;\n float d = vSize / 24.;\n lowp vec4 e = color;\n highp float f = EDGE_GAMMA / (d * gammaScale);\n lowp float h = 185. / 256.;\n float l = texture2D(texture1, vUv).a;\n highp float m = f * vGammaScale * .7;\n float n = clamp(smoothstep(h - m, h + m, l), .0, 1.);\n gl_FragColor = e * (n * 1.0 * vOpacity);*/\n\n float dist = texture2D(sdfTexture, vUv).a;\n float fontScale = vSize / 24.0;\n\n highp float gamma = EDGE_GAMMA / (fontScale * gammaScale);\n lowp float buff = (177. + floor(fontScale)) / 256.0;\n highp float gamma_scaled = gamma * vGammaScale * 0.7;\n highp float alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n\n if (vUtil.y < 0.) {\n gl_FragColor = color * alpha;\n } else {\n float u_halo_width = vUtil.y;\n float u_halo_blur = 0.;\n vec4 u_halo_color = decode_color(vColor.zw);\n float radius = u_halo_width / fontScale / 10.;\n float halo_width = ceil(u_halo_width - u_halo_width / 10.);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * gammaScale);\n gamma_scaled = gamma * vGammaScale * 0.7;\n alpha = clamp(smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist), .0, 1.);\n gl_FragColor = mix(u_halo_color, color, \n smoothstep(buff + radius - gamma_scaled, buff + radius + gamma_scaled, dist)) * alpha;\n }\n } else {\n if (utils1.y > 0.) {\n gl_FragColor = color * texture2D(imgTexture, vUv);\n } else {\n gl_FragColor = texture2D(imgTexture, vUv);\n }\n }\n #endif\n }\n ",transparent:!0,side: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 C(t,e,i||{},r.threeLayer,r);n(a)}else r.initFlag=!0,r.prepareToDraw().then((function(){var a=new C(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 O(t,e||{},i.threeLayer,i);r(n)}else i.initFlag=!0,i.prepareToDraw().then((function(){var n=new O(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,C as planeSectorClass,_ as radarClass,E as sectorClass,O as shockClass,m as sleep};
|