cesium_dev_kit 1.1.22 → 1.1.24

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +299 -291
  3. package/README.zh-CN.md +279 -0
  4. package/SECURITY.md +21 -0
  5. package/dist/Analysis-BLpVrGfg.d.mts +143 -0
  6. package/dist/Analysis-DmO1gtgS.d.ts +143 -0
  7. package/dist/Base-DH8H9suE.d.mts +635 -0
  8. package/dist/Base-DH8H9suE.d.ts +635 -0
  9. package/dist/Base-_BOXyMdS.d.ts +43 -0
  10. package/dist/Base-skqjcPfo.d.mts +43 -0
  11. package/dist/Control-B7AMFmHe.d.ts +98 -0
  12. package/dist/Control-BrpRU7RP.d.mts +98 -0
  13. package/dist/CustomCesiumPlugin-BqgAvlhi.d.ts +29 -0
  14. package/dist/CustomCesiumPlugin-CKYQ-7i9.d.mts +29 -0
  15. package/dist/Draw-1NhPP8z3.d.mts +490 -0
  16. package/dist/Draw-DRh7yNzc.d.ts +490 -0
  17. package/dist/Graphics-CuFNsQ3b.d.ts +1565 -0
  18. package/dist/Graphics-QE3Gb43w.d.mts +1565 -0
  19. package/dist/Material-CeZ4l-tY.d.mts +165 -0
  20. package/dist/Material-Cqbyf2Pn.d.ts +165 -0
  21. package/dist/Math3d-0nO-vFbT.d.mts +179 -0
  22. package/dist/Math3d-t635PYzU.d.ts +179 -0
  23. package/dist/PassEffect-DEFyytQZ.d.ts +41 -0
  24. package/dist/PassEffect-DEgElnVk.d.mts +41 -0
  25. package/dist/Plugin-BPCX0zTu.d.mts +197 -0
  26. package/dist/Plugin-DnYT0bue.d.ts +197 -0
  27. package/dist/Primitive-BNXp-9_6.d.mts +199 -0
  28. package/dist/Primitive-UEAuUimH.d.ts +199 -0
  29. package/dist/ThreeJs-BAlEWxa1.d.mts +44 -0
  30. package/dist/ThreeJs-DpAcw_qf.d.ts +44 -0
  31. package/dist/analysis.cjs +145 -0
  32. package/dist/analysis.cjs.map +1 -0
  33. package/dist/analysis.d.mts +6 -0
  34. package/dist/analysis.d.ts +6 -0
  35. package/dist/analysis.mjs +145 -0
  36. package/dist/analysis.mjs.map +1 -0
  37. package/dist/control.cjs +140 -0
  38. package/dist/control.cjs.map +1 -0
  39. package/dist/control.d.mts +4 -0
  40. package/dist/control.d.ts +4 -0
  41. package/dist/control.mjs +140 -0
  42. package/dist/control.mjs.map +1 -0
  43. package/dist/custom-cesium-plugin.cjs +507 -0
  44. package/dist/custom-cesium-plugin.cjs.map +1 -0
  45. package/dist/custom-cesium-plugin.d.mts +4 -0
  46. package/dist/custom-cesium-plugin.d.ts +4 -0
  47. package/dist/custom-cesium-plugin.mjs +507 -0
  48. package/dist/custom-cesium-plugin.mjs.map +1 -0
  49. package/dist/default-static.cjs +3 -0
  50. package/dist/default-static.cjs.map +1 -0
  51. package/dist/default-static.d.mts +37 -0
  52. package/dist/default-static.d.ts +37 -0
  53. package/dist/default-static.mjs +3 -0
  54. package/dist/default-static.mjs.map +1 -0
  55. package/dist/draw.cjs +140 -0
  56. package/dist/draw.cjs.map +1 -0
  57. package/dist/draw.d.mts +6 -0
  58. package/dist/draw.d.ts +6 -0
  59. package/dist/draw.mjs +140 -0
  60. package/dist/draw.mjs.map +1 -0
  61. package/dist/graphics.cjs +140 -0
  62. package/dist/graphics.cjs.map +1 -0
  63. package/dist/graphics.d.mts +19 -0
  64. package/dist/graphics.d.ts +19 -0
  65. package/dist/graphics.mjs +140 -0
  66. package/dist/graphics.mjs.map +1 -0
  67. package/dist/index.cjs +1112 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.mts +674 -0
  70. package/dist/index.d.ts +674 -0
  71. package/dist/index.mjs +1112 -0
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/material.cjs +391 -0
  74. package/dist/material.cjs.map +1 -0
  75. package/dist/material.d.mts +4 -0
  76. package/dist/material.d.ts +4 -0
  77. package/dist/material.mjs +391 -0
  78. package/dist/material.mjs.map +1 -0
  79. package/dist/pass-effect.cjs +416 -0
  80. package/dist/pass-effect.cjs.map +1 -0
  81. package/dist/pass-effect.d.mts +4 -0
  82. package/dist/pass-effect.d.ts +4 -0
  83. package/dist/pass-effect.mjs +416 -0
  84. package/dist/pass-effect.mjs.map +1 -0
  85. package/dist/plugin.cjs +141 -0
  86. package/dist/plugin.cjs.map +1 -0
  87. package/dist/plugin.d.mts +4 -0
  88. package/dist/plugin.d.ts +4 -0
  89. package/dist/plugin.mjs +141 -0
  90. package/dist/plugin.mjs.map +1 -0
  91. package/dist/primitive.cjs +370 -0
  92. package/dist/primitive.cjs.map +1 -0
  93. package/dist/primitive.d.mts +4 -0
  94. package/dist/primitive.d.ts +4 -0
  95. package/dist/primitive.mjs +370 -0
  96. package/dist/primitive.mjs.map +1 -0
  97. package/dist/three.cjs +140 -0
  98. package/dist/three.cjs.map +1 -0
  99. package/dist/three.d.mts +4 -0
  100. package/dist/three.d.ts +4 -0
  101. package/dist/three.mjs +140 -0
  102. package/dist/three.mjs.map +1 -0
  103. package/package.json +290 -46
  104. package/dist/index.js +0 -1
  105. package/dist/index.min.js +0 -1
  106. package/dist/index.umd.js +0 -1
  107. package/index.js +0 -37
@@ -0,0 +1,416 @@
1
+ 'use strict';var D=class extends Error{constructor(c,s,p={}){super(`[cesium_dev_kit:${c}] ${s}`),this.name="CesiumDevKitError",this.code=c,this.details=p.details,this.cause=p.cause,Object.setPrototypeOf(this,new.target.prototype);}};function ee(t){return t instanceof D?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function L(t,c){let s=c!=null&&c.scope?`[cesium_dev_kit:${c.scope}]`:"[cesium_dev_kit]";console.warn(s,t,c!=null?c:"");}var H=class{constructor(c){this.viewer=null;this.Cesium=c,this.init_data();}init_data(){this.viewer=null;}init({containerId:c,viewerConfig:s,extraConfig:p,MapImageryList:e,imageryProvider:r,viewer:a}){let n=c,i={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},m=this.findCesiumProvider(r),o=p==null?void 0:p.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),i=Object.assign(i,s);let l=a||new this.Cesium.Viewer(n,{...i,...m});if(p&&!p.logo){let u=l.cesiumWidget.creditContainer;u.style.display="none";}if(p&&p.depthTest&&(l.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(l,e[u].type,e[u].option||e[u].classConfig);if(!a){let u=typeof document=="undefined"?null:n&&n.nodeType===1?n:document.getElementById(n);this.bindContainerResize(l,u);}return this.viewer=l,l}bindContainerResize(c,s){if(typeof ResizeObserver=="undefined"||!s)return;let p=()=>{try{(typeof c.isDestroyed!="function"||!c.isDestroyed())&&c.resize();}catch(a){L(a,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(p);e.observe(s),typeof requestAnimationFrame=="function"&&requestAnimationFrame(p);let r=c.destroy.bind(c);c.destroy=function(){try{e.disconnect();}catch(a){L(a,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(c,s,p){c.imageryLayers.addImageryProvider(this.createCesiumProvider({type:s,option:p}));}findCesiumProvider(c){let s={};if(!c)return s;for(let p in c){let e=c[p];if(e&&e.type){s[p]=this.createCesiumProvider(e);continue}s[p]=c[p];}return s}createCesiumProvider(c){switch(c.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[c.type](c.option);case "UrlTemplateImageryProvider":return new this.Cesium[c.type](c.option);case "TileMapServiceImageryProvider":return new this.Cesium[c.type](c.option)}}};function te(t,c){if(!c)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(c)||c.startsWith("data:")||c.startsWith("/"))return c;let s=(t||"").replace(/\/+$/,"");return s?s+"/"+c.replace(/^\/+/,""):c}function z(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var me=Object.assign((t,c)=>t!=null?t:c,{EMPTY_OBJECT:Object.freeze({})}),re=me;function A(t){function c(...s){let p=t();return new p(...s)}return c.prototype=t().prototype,Object.defineProperty(c,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),c}function Y(t){let c=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof c=="function"?c():t}function ae(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(c){console.warn("[cesium_dev_kit] failed to dispose viewer:",c);}}var M=new WeakMap;function G(t,c){if(!t||typeof c!="function")return;let s=M.get(t);s?s.push(c):M.set(t,[c]);}function Z(t,c){if(!t||!c||t===c)return;let s=M.get(t);if(!s||s.length===0)return;M.delete(t);let p=M.get(c);p?p.push(...s):M.set(c,s);}function j(t){if(!t||typeof t!="object"&&typeof t!="function")return;let c=M.get(t);if(c){M.delete(t);for(let s=c.length-1;s>=0;s--)try{c[s]();}catch(p){console.warn("[cesium_dev_kit] cleanup failed:",p);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){j(this);},enumerable:false,configurable:true,writable:true});}function ne(t,c){Object.getOwnPropertyNames(c.prototype).forEach(s=>{s!=="constructor"&&(t.prototype[s]=c.prototype[s]);});}function ue(){let t={},c;class s{constructor(e,r,a){if(e){this._viewer=e,t=r,c=a||z(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let n=this._drawLayer;N(this),G(this,()=>{this._viewer&&n&&(this._viewer.dataSources.remove(n,true),this._drawLayer===n&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,a){return e.hasOwnProperty(r)?e[r]:a}getDfSt(e){if(!c)return;let r=c,a=e.reduce((n,i)=>n?n[i]:r[i],void 0);if(a!=null)return typeof a!="string"?a:te(r.baseService,a)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
2
+ in vec2 v_textureCoordinates;
3
+ uniform float scale;
4
+ uniform vec3 offset;
5
+ void main() {
6
+ vec4 color = texture(colorTexture, v_textureCoordinates);
7
+ out_FragColor = vec4(color.r*0.2,color.g * 0.4,color.b*0.6, 1.0);
8
+ }
9
+ `;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({name:"darkEffect",fragmentShader:r,uniforms:{scale:1,offset(){return e.offset||new t.Cartesian3(.1,.2,.3)}}}))}setBlurBloom(e){if(this._viewer&&e){var r=`uniform float height;
10
+ uniform float width;
11
+ uniform sampler2D colorTexture1;
12
+
13
+ in vec2 v_textureCoordinates;
14
+
15
+ const int SAMPLES = 9;
16
+ void main()
17
+ {
18
+ vec2 st = v_textureCoordinates;
19
+ float wr = float(1.0 / width);
20
+ float hr = float(1.0 / height);
21
+ vec4 result = vec4(0.0);
22
+ int count = 0;
23
+ for(int i = -SAMPLES; i <= SAMPLES; ++i){
24
+ for(int j = -SAMPLES; j <= SAMPLES; ++j){
25
+ vec2 offset = vec2(float(i) * wr, float(j) * hr);
26
+ result += texture(colorTexture1, st + offset);
27
+ }
28
+ }
29
+ result = result / float(count);
30
+ out_FragColor = result;
31
+ }
32
+ `;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({name:"blur_x_direction",fragmentShader:r,uniforms:{width:e.width,height:e.height,colorTexture1:"Bright"}}))}}setRainEffect(){if(this._viewer){var e=`uniform sampler2D colorTexture;
33
+ in vec2 v_textureCoordinates;
34
+
35
+ float hash(float x){
36
+ return fract(sin(x*23.3)*13.13);
37
+ }
38
+
39
+ void main(){
40
+ float time = czm_frameNumber / 60.0;
41
+ vec2 resolution = czm_viewport.zw;
42
+ vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);
43
+ vec3 c=vec3(.6,.7,.8);
44
+ float a=-.4;
45
+ float si=sin(a),co=cos(a);
46
+ uv*=mat2(co,-si,si,co);
47
+ uv*=length(uv+vec2(0,4.9))*.3+1.;
48
+ float v=1.-sin(hash(floor(uv.x*100.))*2.);
49
+ float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;
50
+ c*=v*b;
51
+ out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1), 0.2);
52
+ }
53
+ `;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({name:"rainEffect",fragmentShader:e}))}}setSnowEffect(){if(this._viewer){var e=`uniform sampler2D colorTexture;
54
+ in vec2 v_textureCoordinates;
55
+ float snow(vec2 uv,float scale){
56
+ float time = czm_frameNumber / 60.0;
57
+ float w=smoothstep(1.,0.,-uv.y*(scale/10.));
58
+ if(w<.1)return 0.;
59
+ uv+=time/scale;
60
+ uv.y+=time*2./scale;
61
+ uv.x+=sin(uv.y+time*.5)/scale;
62
+ uv*=scale;
63
+ vec2 s=floor(uv),f=fract(uv),p;
64
+ float k=3.,d;
65
+ p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;
66
+ d=length(p);
67
+ k=min(d,k);
68
+ k=smoothstep(0.,k,sin(f.x+f.y)*0.01);
69
+ return k*w;
70
+ }
71
+
72
+ void main(){
73
+ vec2 resolution = czm_viewport.zw;
74
+ vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);
75
+ vec3 finalColor=vec3(0);
76
+ float c = 0.0;
77
+ c+=snow(uv,30.)*.0;
78
+ c+=snow(uv,20.)*.0;
79
+ c+=snow(uv,15.)*.0;
80
+ c+=snow(uv,10.);
81
+ c+=snow(uv,8.);
82
+ c+=snow(uv,6.);
83
+ c+=snow(uv,5.);
84
+ finalColor=(vec3(c));
85
+ out_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);
86
+
87
+ }
88
+ `;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({name:"snowEffect",fragmentShader:e}))}}setFogEffect(){if(this._viewer){var e=`float getDistance(sampler2D depthTexture, vec2 texCoords)
89
+ {
90
+ float depth = czm_unpackDepth(texture(depthTexture, texCoords));
91
+ if (depth == 0.0) {
92
+ return czm_infinity;
93
+ }
94
+ vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth);
95
+ return -eyeCoordinate.z / eyeCoordinate.w;
96
+ }
97
+ float interpolateByDistance(vec4 nearFarScalar, float distance)
98
+ {
99
+ float startDistance = nearFarScalar.x;
100
+ float startValue = nearFarScalar.y;
101
+ float endDistance = nearFarScalar.z;
102
+ float endValue = nearFarScalar.w;
103
+ float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
104
+ return mix(startValue, endValue, t);
105
+ }
106
+ vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
107
+ {
108
+ return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
109
+ }
110
+ uniform sampler2D colorTexture;
111
+ uniform sampler2D depthTexture;
112
+ uniform vec4 fogByDistance;
113
+ uniform vec4 fogColor;
114
+ in vec2 v_textureCoordinates;
115
+ void main(void)
116
+ {
117
+ float distance = getDistance(depthTexture, v_textureCoordinates);
118
+ vec4 sceneColor = texture(colorTexture, v_textureCoordinates);
119
+ float blendAmount = interpolateByDistance(fogByDistance, distance);
120
+ vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);
121
+ out_FragColor = alphaBlend(finalFogColor, sceneColor);
122
+ }
123
+ `;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({fragmentShader:e,uniforms:{fogByDistance:new t.Cartesian4(10,0,200,.3),fogColor:t.Color.AZURE}}))}}setDefSceneConfig(){this._viewer&&(this._viewer.scene.sun.show=false,this._viewer.scene.moon.show=false,this._viewer.scene.fxaa=true,this._viewer.scene.globe.depthTestAgainstTerrain=true,this._viewer.scene.undergroundMode=false,this._viewer.scene.terrainProvider.isCreateSkirt=false,this._viewer.scene.skyAtmosphere.show=false,this._viewer.scene.globe.showGroundAtmosphere=false,this._viewer.scene.globe.enableLighting=true,this._viewer.scene.fog.enabled=false,this._viewer.cesiumWidget.creditContainer.style.display="none");}setBloomLightScene(){this._viewer&&(this._viewer.scene.postProcessStages.bloom.enabled=true,this._viewer.scene.postProcessStages.bloom.uniforms.contrast=119,this._viewer.scene.postProcessStages.bloom.uniforms.brightness=-0.4,this._viewer.scene.postProcessStages.bloom.uniforms.glowOnly=false,this._viewer.scene.postProcessStages.bloom.uniforms.delta=.9,this._viewer.scene.postProcessStages.bloom.uniforms.sigma=3.78,this._viewer.scene.postProcessStages.bloom.uniforms.stepSize=5,this._viewer.scene.postProcessStages.bloom.uniforms.isSelected=false);}removePostProcessStage(e){e&&(Array.isArray(e)?e.forEach(r=>{this._viewer.scene.postProcessStages.contains(r)&&this._viewer.scene.postProcessStages.remove(r);}):this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e));}setView(e){if(this._viewer&&e&&e.position){if(e.distance){var r=new t.Cartesian3(0,e.distance,window.opt.distance);e.position=t.Cartesian3.add(e.position,r,new t.Cartesian3);}this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)}});}}flyTo(e){if(this._viewer&&e&&e.position){if(e.distance){var r=new t.Cartesian3(0,e.distance,0);e.position=t.Cartesian3.add(e.position,r,new t.Cartesian3);}this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)},easingFunction:e.easingFunction||t.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback});}}transformCartesianToWGS84(e){var r,a,n;if(this._viewer&&e){if(e.x===void 0&&(e.lng!==void 0||e.lon!==void 0))return {lng:Number((r=e.lng)!=null?r:e.lon),lat:Number(e.lat),alt:Number((n=(a=e.alt)!=null?a:e.height)!=null?n:0)};let i=t.Cartographic.fromCartesian(e);return {lng:t.Math.toDegrees(i.longitude),lat:t.Math.toDegrees(i.latitude),alt:i.height}}}transformWGS84ArrayToCartesianArray(e,r){if(this._viewer&&e){var a=this;return e?e.map(function(n){return a.transformWGS84ToCartesian(n,r)}):[]}}transformWGS84ToCartesian(e,r){if(this._viewer)return e?t.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=r||e.alt,t.Ellipsoid.WGS84):t.Cartesian3.ZERO}transformCartesianArrayToWGS84Array(e){if(this._viewer){var r=this;return e?e.map(function(a){return r.transformCartesianToWGS84(a)}).filter(function(a){return !!a}):[]}}transformWGS84ToCartographic(e){return e?t.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):t.Cartographic.ZERO}lnglatArrayToCartesians(e){if(!e||e.length<1)return [];let r=[];for(let a=0;a<e.length;a++){let n=t.Cartesian3.fromDegrees(Number(e[a][0]),Number(e[a][1]),Number(e[a][2]||0));r.push(n);}return r}setCameraEotateHeading(e){if(e){let r=this._viewer,a=t.Cartesian3.fromDegrees(e.lng,e.lat,e.height),n=t.Math.toRadians(-30),i=360/30,m=5e3,o=t.JulianDate.fromDate(new Date);r.clock.startTime=o.clone(),r.clock.currentTime=o.clone(),r.clock.clockRange=t.ClockRange.CLAMPED,r.clock.clockStep=t.ClockStep.SYSTEM_CLOCK;let l=r.camera.heading,u=function(){let g=t.JulianDate.secondsDifference(r.clock.currentTime,r.clock.startTime),f=t.Math.toRadians(g*i)+l;r.scene.camera.setView({destination:a,orientation:{heading:f,pitch:n}}),r.scene.camera.moveBackward(m),t.JulianDate.compare(r.clock.currentTime,r.clock.stopTime)>=0&&r.clock.onTick.removeEventListener(u);};r.clock.onTick.addEventListener(u),G(this,()=>{r.clock.onTick.removeEventListener(u);});}}getCatesian3FromPX(e){if(this._viewer&&e){var r=this._viewer.scene.pick(e),a=null,n=false,i=false;if(r instanceof t.Cesium3DTileFeature&&(n=true),n&&(a=this._viewer.scene.pickPosition(e),a)){let o=t.Cartographic.fromCartesian(a);o.height<0&&(o.height=0);let l=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),d=o.height;a=this.transformWGS84ToCartesian({lng:l,lat:u,alt:d});}if(!r){var m=this._viewer.scene.camera.getPickRay(e);if(!m)return null;a=this._viewer.scene.globe.pick(m,this._viewer.scene),i=true;}if(r&&!n&&(a=this._viewer.scene.pickPosition(e),a)){let o=t.Cartographic.fromCartesian(a);o.height<0&&(o.height=0);let l=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),d=o.height;a=this.transformWGS84ToCartesian({lng:l,lat:u,alt:d});}if(!n&&!i&&!r&&(a=this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid)),a){let o=this.transformCartesianToWGS84(a);return o.alt<0&&(a=this.transformWGS84ToCartesian(o,.1)),a}return false}}getCameraPosition(){if(this._viewer){var e=this._viewer.scene.camera.pickEllipsoid(new t.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(e){var r=t.Ellipsoid.WGS84.cartesianToCartographic(e),a=r.longitude*180/Math.PI,n=r.latitude*180/Math.PI,i=this._viewer.camera._direction,m=t.Math.toDegrees(i.x),o=t.Math.toDegrees(i.y),l=t.Math.toDegrees(i.z),u=this._viewer.camera.positionCartographic.height,d=t.Math.toDegrees(this._viewer.camera.heading),g=t.Math.toDegrees(this._viewer.camera.pitch),f=t.Math.toDegrees(this._viewer.camera.roll),h=this._viewer.camera.computeViewRectangle(),v=h.west/Math.PI*180,w=h.north/Math.PI*180,_=h.east/Math.PI*180,y=h.south/Math.PI*180,k=(v+_)/2,E=(w+y)/2;return {lon:a,lat:n,height:u,heading:d,pitch:g,roll:f,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:k,y:E},direction:new t.Cartesian3(m,o,l)}}}}pickUpPosition(e){return this.getCatesian3FromPX(e.position)}getHandlerClickPosition(e){if(this._viewer){let r=this._viewer.scene,a=this._viewer,n=r.camera.pickEllipsoid(e.position,r.globe.elliposid),i={cameraPosistion:a.camera.position,heading:a.camera.heading,pitch:a.camera.pitch,roll:a.camera.roll},m=t.Cartographic.fromCartesian(n);m.height<0&&(m.height=0);let o={alt:m.height,lat:t.Math.toDegrees(m.latitude),lon:t.Math.toDegrees(m.longitude)},l=r.pickPosition(e.position),u=t.Cartographic.fromCartesian(l),d={height:u.height,latitude:t.Math.toDegrees(u.latitude),longitude:t.Math.toDegrees(u.longitude)};return {wgs84Coor:o,graphicCoor:d,cameraPosition:i}}}updateCameraState(e){this._viewer.scene._screenSpaceCameraController.enableRotate=e,this._viewer.scene._screenSpaceCameraController.enableTranslate=e,this._viewer.scene._screenSpaceCameraController.enableZoom=e,this._viewer.scene._screenSpaceCameraController.enableTilt=e,this._viewer.scene._screenSpaceCameraController.enableLook=e;}bindHandleEvent({leftClick:e,mouseMove:r,doubleClick:a,leftDown:n,mouseWheel:i,leftUp:m}){if(this._viewer){var o=new t.ScreenSpaceEventHandler(this._viewer.canvas);G(this,()=>{o&&!o.isDestroyed()&&o.destroy();}),e&&o.setInputAction(function(l){e(l,o);},t.ScreenSpaceEventType.LEFT_CLICK),r&&o.setInputAction(function(l){r(l,o);},t.ScreenSpaceEventType.MOUSE_MOVE),a&&o.setInputAction(function(l){a(l,o);},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),n&&o.setInputAction(function(l){n(l,o);},t.ScreenSpaceEventType.LEFT_DOWN),i&&o.setInputAction(function(l){i(l,o);},t.ScreenSpaceEventType.WHEEL),m&&o.setInputAction(function(l){m(l,o);},t.ScreenSpaceEventType.LEFT_UP);}}bindHandelEvent(e){return this.bindHandleEvent(e)}getHandlePosition(e){if(this._viewer){var r=new t.ScreenSpaceEventHandler(this._viewer.scene.canvas),a=this;G(this,()=>{r&&!r.isDestroyed()&&r.destroy();}),r.setInputAction(function(n){var i=a._viewer.scene.camera.pickEllipsoid(n.endPosition,a._viewer.scene.globe.ellipsoid);typeof e=="function"&&e(a.transformCartesianToWGS84(i),r);},t.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(e){return this.getHandlePosition(e)}saveSceneImages(){if(this._viewer){let m=function(o){for(var l=o.split(","),u=l[0].match(/:(.*?);/)[1],d=atob(l[1]),g=d.length,f=new Uint8Array(g);g--;)f[g]=d.charCodeAt(g);return new Blob([f],{type:u})};var e=this._viewer.scene.canvas,r=e.toDataURL("image/png").replace("image/png","image/octet-stream"),a=document.createElement("a"),n=m(r),i=URL.createObjectURL(n);a.download="scene.png",a.href=i,a.click();}}_installAmapImageryProvider(){let e="https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",r="https://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";function a(n){return n.url=n.style==="img"?e:r,n.subdomains||(n.subdomains=["01","02","03","04"]),new t.UrlTemplateImageryProvider(n)}t.Scene.AmapImageryProvider=a;}_installTdtImageryProvider(){let e="https://{s}.tianditu.gov.cn/{layer}_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER={layer}&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk={key}";function r(a){return new t.WebMapTileServiceImageryProvider({url:e.replace(/\{layer\}/g,a.style||"vec").replace(/\{key\}/g,a.key||""),layer:a.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}t.Scene.TdtImageryProvider=r;}_installTencentImageryProvider(){let e="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229",r="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1";function a(n){return n.layer==="img"?(n.url||(n.url=e),n.subdomains||(n.subdomains=["0","1","2"]),n.customTags={sx(i,m,o,l){return m>>4},sy(i,m,o,l){return (1<<l)-o>>4}}):n.url||(n.url=r),new t.UrlTemplateImageryProvider(n)}t.Scene.TencentImageryProvider=a;}_installGoogleImageryProvider(){let e="https://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",r="https://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali",a="https://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile";function n(i){return i.url=i.style==="img"?r:i.style==="ter"?a:e,i.subdomains||(i.subdomains=["1","2","3","4","5"]),new t.UrlTemplateImageryProvider(i)}t.Scene.GoogleImageryProvider=n;}_installGooGleImageryProvider(){return this._installGoogleImageryProvider()}_installBaiduImageryProvider(){var e="https://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function r(n){e=n.url||e,this._url=e,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1,this._tilingScheme=new t.WebMercatorTilingScheme({rectangleSouthwestInMeters:new t.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new t.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=n.style||"normal",this._ready=true;}Object.defineProperties(r.prototype,{url:{get(){return this._url}},token:{get(){return this._token}},tileWidth:{get(){if(!this.ready)throw new t.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get(){if(!this.ready)throw new t.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get(){if(!this.ready)throw new t.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},minimumLevel:{get(){if(!this.ready)throw new t.DeveloperError("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get(){if(!this.ready)throw new t.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get(){if(!this.ready)throw new t.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},ready:{get(){return !!this._url}},credit:{get(){return this._credit}},readyPromise:{get(){return this._readyPromise.promise}},usingPrecachedTiles:{get(){return this._useTiles}},hasAlphaChannel:{get(){return true}},layers:{get(){return this._layers}}});function a(n,i,m,o,l){var u=n._url+"&x={x}&y={y}&z={z}&customid={style}",d=n._tilingScheme.getNumberOfXTilesAtLevel(o),g=n._tilingScheme.getNumberOfYTilesAtLevel(o);return u=u.replace("{x}",String(i-d/2)).replace("{y}",String(g/2-m-1)).replace("{z}",String(o)).replace("{style}",l),u}r.prototype.getTileCredits=function(n,i,m){},r.prototype.requestImage=function(n,i,m){if(!this.ready)throw new t.DeveloperError("requestImage must not be called before the imagery provider is ready.");var o=a(this,n,i,m,this._style);return t.ImageryProvider.loadImage(this,o)},t.Scene.BaiduImageryProvider=r;}_installGroundSkyBox(){var e=t.BoxGeometry,r=t.Cartesian3,a=t.defaultValue||re,n=t.defined,i=t.destroyObject,m=t.DeveloperError,o=t.GeometryPipeline,l=t.Matrix3,u=t.Matrix4,d=t.Transforms,g=t.VertexFormat,f=t.BufferUsage,h=t.CubeMap,v=t.DrawCommand,w=t.loadCubeMap,_=t.RenderState,y=t.VertexArray,k=t.BlendingState,E=t.SceneMode,B=t.ShaderProgram,S=t.ShaderSource,T=`uniform samplerCube u_cubeMap;
124
+ in vec3 v_texCoord;
125
+ void main()
126
+ {
127
+ vec4 color = texture(u_cubeMap, normalize(v_texCoord));
128
+ out_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
129
+ }
130
+ `,V=`in vec3 position;
131
+ out vec3 v_texCoord;
132
+ uniform mat3 u_rotateMatrix;
133
+ void main()
134
+ {
135
+ vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));
136
+ gl_Position = czm_projection * vec4(p, 1.0);
137
+ v_texCoord = position.xyz;
138
+ }
139
+ `,b=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function P(x){this.sources=x.sources,this._sources=void 0,this.show=a(x.show,true),this._command=new v({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var O=new l;P.prototype.update=function(x,X){var R=this;if(this.show&&!(x.mode!==E.SCENE3D&&x.mode!==E.MORPHING)&&x.passes.render){var F=x.context;if(this._sources!==this.sources){this._sources=this.sources;var C=this.sources;if(!n(C.positiveX)||!n(C.negativeX)||!n(C.positiveY)||!n(C.negativeY)||!n(C.positiveZ)||!n(C.negativeZ))throw new m("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof C.positiveX!=typeof C.negativeX||typeof C.positiveX!=typeof C.positiveY||typeof C.positiveX!=typeof C.negativeY||typeof C.positiveX!=typeof C.positiveZ||typeof C.positiveX!=typeof C.negativeZ)throw new m("this.sources properties must all be the same type.");typeof C.positiveX=="string"?w(F,this._sources).then(function(le){R._cubeMap=R._cubeMap&&R._cubeMap.destroy(),R._cubeMap=le;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new h({context:F,source:C}));}var I=this._command;if(I.modelMatrix=d.eastNorthUpToFixedFrame(x.camera._positionWC),!n(I.vertexArray)){I.uniformMap={u_cubeMap(){return R._cubeMap},u_rotateMatrix(){return b(I.modelMatrix,O)}};var Q=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:g.POSITION_ONLY})),se=this._attributeLocations=o.createAttributeLocations(Q);I.vertexArray=y.fromGeometry({context:F,geometry:Q,attributeLocations:se,bufferUsage:f._DRAW}),I.renderState=_.fromCache({blending:k.ALPHA_BLEND});}if(!n(I.shaderProgram)||this._useHdr!==X){var ce=new S({defines:[X?"HDR":""],sources:[T]});I.shaderProgram=B.fromCache({context:F,vertexShaderSource:V,fragmentShaderSource:ce,attributeLocations:this._attributeLocations}),this._useHdr=X;}if(n(this._cubeMap))return I}},P.prototype.isDestroyed=function(){return false},P.prototype.destroy=function(){var x=this._command;return x.vertexArray=x.vertexArray&&x.vertexArray.destroy(),x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),i(this)},t.Scene.GroundSkyBox=P;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return s}var W=A(ue);function pe(t,c,s,p){function e(r,a){let n={},i=Y(a),m=[];if(Array.isArray(r))r.forEach(l=>{let u=Y(l),d=new u(t,c,s,p);o(u,i),m.push(d);}),n=new i(t,c,s,p),m.forEach(l=>Object.assign(n,l)),m.forEach(l=>Z(l,n));else {let l=Y(r),u=new l(t,c,s,p);o(l,i),n=new i(t,c,s,p),Object.assign(n,u),Z(u,n);}function o(l,u){let d=Object.getOwnPropertyNames(l.prototype);for(let g=0,f=d.length;g<f;g++)d[g]!=="constructor"&&(u.prototype[d[g]]=l.prototype[d[g]]);}return n}return e}function de({cesiumGlobal:t,threeGlobal:c,containerId:s,threeContainerId:p,viewerConfig:e={},extraConfig:r={},MapImageryList:a=[],defaultStatic:n,baseExtendsCom:i=[],extendsCom:m,extendsComName:o,viewer:l}){if(!t)throw new D("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!s&&!l)throw new D("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let d=new H(t).init({containerId:s,viewerConfig:e,extraConfig:r,MapImageryList:a,viewer:l}),g=!l,v=pe(d,t,n,c?{threeGlobal:c,containerId:s,threeContainerId:p}:"")(i,m),w=false;return {viewer:d,[o]:v,dispose:()=>{if(!w){w=true;try{typeof v.destroy=="function"?v.destroy():j(v);}catch(_){L(_,{scope:"singleImport.dispose"});}g&&ae(d);}}}}function ie(t,c,s){function p(e){return de({...e,baseExtendsCom:t,extendsCom:c,extendsComName:s})}return p}var K=null;function ge(t){return t&&typeof t=="object"&&t.default?t.default:t}function fe(t,c){return c().then(ge).catch(s=>{throw ee(s)?s:new D("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:s,details:{package:t}})})}function oe(){return K||(K=fe("libgif",()=>import('libgif'))),K}function he(){let t=null;class s{constructor(e,r,a){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let n=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&n&&(this._viewer.dataSources.remove(n,true),this._graphicsLayer===n&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let a in e.positions){let n=e.positions[a],i=this.createGraphics();i.name=e.name||"",i.oid=e.oid||"point",i.position=n,e.point&&(i.point=this.getPointGraphics()),e.billboard&&(i.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(i.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(i));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:a,height:n,width:i,material:m,...o}=e;var r=this.createGraphics();return n=n===void 0?6:n,i=i===void 0?15:i,r.corridor={positions:a,height:n,width:i,...o,material:m||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var a=e.entity,n=e.cylinder,i=this;return r.cylinder=this.getCylinderGraphics(n),r.position=new t.CallbackProperty(function(){var m=a.position.getValue(i._viewer.clock.currentTime),o=i._viewer.scene.globe.ellipsoid.cartesianToCartographic(m),l=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,l,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var m=a.position.getValue(i._viewer.clock.currentTime),o=i._viewer.scene.globe.ellipsoid.cartesianToCartographic(m);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),a=e.alp||1,n=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return n?(a=a-.05,a<=0&&(n=false)):(a=a+.05,a>=1&&(n=true)),t.Color.RED.withAlpha(a)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var y,k;if(e&&e.center){var r=this.createGraphics(),a=this,n=e.center,i=e.radius||800,m=e.rotateAmount||.05,o=0,l=e.height||1,u=0,d=0,g=0,f=(y=e.scale)!=null?y:0,h=(k=e.scale2)!=null?k:0,v=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return a.transformWGS84ToCartesian(n)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(a.transformWGS84ToCartesian(n),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(d),t.Math.toRadians(g)))},false);let E=i,B=false;var w=()=>{(i>=f||i<=E)&&(B=!B),B?i+=2:i-=2;},_=()=>{h>=i?i+=2:i=E;};return r.ellipse={material:v,height:l,semiMajorAxis:new t.CallbackProperty(function(){return i},false),semiMinorAxis:new t.CallbackProperty(function(){return i},false),stRotation:new t.CallbackProperty(function(){return m>0&&(o+=m,o>=360&&(o=0)),f&&w(),h&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,a=e.num||20,n=e.color||t.Color.RED,i=e.speed||.003,m=this.createGraphics();return m.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return a%2===0?r-=i:r+=i,(r<=.1||r>=1)&&a++,n.withAlpha(r)},false)})},this._graphicsLayer.entities.add(m)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,a=document.createElement("img");a.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let n=function(i){if(i.image){var m=document.createElement("canvas");m.width=i.width||150,m.height=i.height||80;var o=m.getContext("2d");o.drawImage(i.image,0,0);var l=i.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(l,55,36),m}};a.onload=function(){e.image=a;var i=r._graphicsLayer.entities.add({position:e.position,billboard:{image:n(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(i);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),a=0,n=e.positions,i=n[0];return r.position=new t.CallbackProperty(function(){return a==0?(i=n[0],a+=1):a<n.length-1?(i=n[a],a+=1):a==n.length-1&&(i=n[a],a=0),i},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await oe();if(e&&e.position){var a=[],n=e.url,i=0,m=6;return function(l,u){var d=document.createElement("img");d.src=l,d.setAttribute("rel:animated_src",l),d.setAttribute("rel:auto_play","0"),document.body.appendChild(d);var g=new r({gif:d});return new Promise(f=>{g.load(()=>{for(let h=1;h<=g.get_length();h++)g.move_to(h),u.push(g.get_canvas().toDataURL());f(u);});})}(n,a),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return a.length?(i<m*(a.length-1)?i++:i=0,a[Math.floor(i/m)]):n},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,a=e.rotateAmount,n=e.position,i=this;n.heading=0,n.pitch=0,n.roll=0,r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(n)},false),r.orientation=new t.CallbackProperty(function(){return a>0&&(n.heading+=a,n.heading===360&&(n.heading=0)),t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(n),new t.HeadingPitchRoll(t.Math.toRadians(n.heading),t.Math.toRadians(n.pitch),t.Math.toRadians(n.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,a=e.minHeiht||5,n=e.maxHeiht||100,i=e.cartesians,m=e.speed||.06,o=this,l=a,u=!1;i.length?r.positions=new t.CallbackProperty(function(){var d=o.transformCartesianArrayToWGS84Array(i);for(var g in d){var f=d[g];(a>=n||a<=l)&&(u=!u),u?a+=m:a-=m,f.alt=a;}return o.transformWGS84ArrayToCartesianArray(d,0)},!1):r.position=new t.CallbackProperty(function(){var d=o.transformCartesianToWGS84(i);return (a>=n||a<=l)&&(u=!u),u?a+=m:a-=m,d.alt=a,o.transformWGS84ToCartesian(d)},!1);}catch(d){console.log(d);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var a=0,n=document.createElement("canvas"),i=n.getContext("2d"),m=new Image;m.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(i.clearRect(0,0,o,e.cheight||0),a<=o)i.drawImage(m,a,0);else return a=0,a+=3,n};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:a,alt:n,custMaterial:i,speed:m=0,direction:o="+"}){if(e){var l=this.createGraphics(),u=0,d=this._calcPoints(r,a,n,u);l.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(d),false),material:i||t.Color.AQUAMARINE.withAlpha(.5)};let g=()=>{m>0&&(u+=m,d=this._calcPoints(r,a,n,Number(o+u)));};return e.clock.onTick.addEventListener(g),G(this,()=>{e.clock.onTick.removeEventListener(g);}),this._graphicsLayer.entities.add(l)}}_computeCirclularFlight(e,r,a,n,i,m){let o=[];o.push(e),o.push(r),o.push(0);var l=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(a,n));for(let u=i;u<=i+m;u++){let d=l*Math.sin(u*Math.PI/180),g=Math.cos(u*Math.PI/180),f=(a-e)*g+e,h=(n-r)*g+r;o.push(f),o.push(h),o.push(d);}return o}_objHasOwnProperty(e,r,a){let n=e;return n&&n.hasOwnProperty(r)?n[r]:a}_calcPoints(e,r,a,n){var i=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),m=a*Math.cos(n*Math.PI/180),o=a*Math.sin(n*Math.PI/180),l=t.Cartesian3.fromElements(m,o,0),u=t.Matrix4.multiplyByPoint(i,l,new t.Cartesian3),d=t.Cartographic.fromCartesian(u),g=t.Math.toDegrees(d.longitude),f=t.Math.toDegrees(d.latitude);return this._computeCirclularFlight(e,r,g,f,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return s}var J=A(he);var U=function(){};U.prototype={_getFlowLineShader:function(){return `uniform vec4 color;
140
+ uniform float duration;
141
+
142
+ czm_material czm_getMaterial(czm_materialInput materialInput){
143
+ czm_material material = czm_getDefaultMaterial(materialInput);
144
+ vec2 st = materialInput.st;
145
+ float t =fract(czm_frameNumber / duration);
146
+ t *= 1.03;
147
+ float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s);
148
+ alpha += 0.1;
149
+ vec4 fragColor;
150
+ fragColor.rgb = (color.rgb) / 0.5;
151
+ fragColor = czm_gammaCorrect(fragColor);
152
+ material.diffuse = fragColor.rgb;
153
+ material.alpha = alpha;
154
+ material.emission = fragColor.rgb;
155
+ return material;
156
+ }
157
+ `},_getDynamicLineShader:function(t){if(t&&t.get)return `czm_material czm_getMaterial(czm_materialInput materialInput)
158
+ {
159
+ czm_material material = czm_getDefaultMaterial(materialInput);
160
+ vec2 st = materialInput.st;
161
+
162
+ if(texture(image, vec2(0.0, 0.0)).a == 1.0){
163
+ discard;
164
+ }else{
165
+ material.alpha = texture(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;
166
+ }
167
+
168
+ material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);
169
+
170
+ return material;
171
+ }
172
+ `},_getDynamicLightLineShader:function(t){if(t&&t.get)return `czm_material czm_getMaterial(czm_materialInput materialInput)
173
+ {
174
+ czm_material material = czm_getDefaultMaterial(materialInput);
175
+ vec2 st = materialInput.st;
176
+
177
+ vec4 colorImage = texture(image, vec2(fract(1.0 *st.s - time), fract(st.t)));
178
+
179
+ vec4 fragColor;
180
+ fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;
181
+ fragColor = czm_gammaCorrect(fragColor);
182
+ material.diffuse = colorImage.rgb;
183
+ material.alpha = colorImage.a;
184
+ material.emission = fragColor.rgb;
185
+
186
+ return material;
187
+ }
188
+ `},_getDirectionWallShader:function(t){if(t&&t.get){var c=`czm_material czm_getMaterial(czm_materialInput materialInput)
189
+ {
190
+ czm_material material = czm_getDefaultMaterial(materialInput);
191
+ vec2 st = materialInput.st;
192
+
193
+ `;return t.freely=="vertical"?c+="vec4 colorImage = texture(image, vec2(fract(float("+t.count+")*st.t "+t.direction+` time), fract(st.s)));
194
+ `:c+="vec4 colorImage = texture(image, vec2(fract(float("+t.count+")*st.s "+t.direction+` time), fract(st.t)));
195
+ `,c+=`vec4 fragColor;
196
+ fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;
197
+ fragColor = czm_gammaCorrect(fragColor);
198
+ `,c+=` material.diffuse = colorImage.rgb;
199
+ material.alpha = colorImage.a;
200
+ material.emission = fragColor.rgb;
201
+
202
+ return material;
203
+ }
204
+ `,c}},_getCircleFadeShader:function(t){if(t&&t.get)return `czm_material czm_getMaterial(czm_materialInput materialInput)
205
+
206
+ {
207
+
208
+ czm_material material = czm_getDefaultMaterial(materialInput);
209
+
210
+ material.diffuse = 1.5 * color.rgb;
211
+
212
+ vec2 st = materialInput.st;
213
+
214
+ float dis = distance(st, vec2(0.5, 0.5));
215
+
216
+ float per = fract(time);
217
+
218
+ if(dis > per * 0.5){
219
+
220
+ //material.alpha = 0.0;
221
+
222
+ discard;
223
+
224
+ }else {
225
+
226
+ material.alpha = color.a * dis / per / 2.0;
227
+
228
+ }
229
+
230
+ return material;
231
+
232
+ }`},_getDynamicCircleShader:function(t){if(t&&t.get)return `uniform vec4 color;
233
+ uniform float duration;
234
+ uniform float count;
235
+ uniform float gradient;
236
+
237
+ czm_material czm_getMaterial(czm_materialInput materialInput)
238
+ {
239
+ czm_material material = czm_getDefaultMaterial(materialInput);
240
+ material.diffuse = 1.5 * color.rgb;
241
+ vec2 st = materialInput.st;
242
+ vec3 str = materialInput.str;
243
+ float dis = distance(st, vec2(0.5, 0.5));
244
+ float per = fract(czm_frameNumber / duration);
245
+ if(abs(str.z) > 0.001){
246
+ discard;
247
+ }
248
+ if(dis > 0.5){
249
+ discard;
250
+ } else {
251
+ float perDis = 0.5 / count;
252
+ float disNum;
253
+ float bl = .0;
254
+ for (int i = 0; i <= 10; i++) {
255
+ if (float(i) <= count) {
256
+ disNum = perDis * float(i) - dis + per / count;
257
+ if (disNum > 0.0) {
258
+ if (disNum < perDis) {
259
+ bl = 1.0 - disNum / perDis;
260
+ } else if (disNum - perDis < perDis) {
261
+ bl = 1.0 - abs(1.0 - disNum / perDis);
262
+ }
263
+ material.alpha = pow(bl, gradient);
264
+ }
265
+ }
266
+ }
267
+ }
268
+ return material;
269
+ }
270
+ `},_getRadarScanShader:function(t){if(t&&t.get)return `uniform sampler2D colorTexture;
271
+ uniform sampler2D depthTexture;
272
+ in vec2 v_textureCoordinates;
273
+ uniform vec4 u_scanCenterEC;
274
+ uniform vec3 u_scanPlaneNormalEC;
275
+ uniform vec3 u_scanLineNormalEC;
276
+ uniform float u_radius;
277
+ uniform vec4 u_scanColor;
278
+
279
+ vec4 toEye(in vec2 uv, in float depth){
280
+ vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));
281
+ vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);
282
+ posInCamera =posInCamera / posInCamera.w;
283
+ return posInCamera;
284
+ }
285
+
286
+ bool isPointOnLineRight(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){
287
+ vec3 v01 = testPt - ptOnLine;
288
+ normalize(v01);
289
+ vec3 temp = cross(v01, lineNormal);
290
+ float d = dot(temp, u_scanPlaneNormalEC);
291
+ return d > 0.5;
292
+ }
293
+
294
+ vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){
295
+ vec3 v01 = point -planeOrigin;
296
+ float d = dot(planeNormal, v01) ;
297
+ return (point - planeNormal * d);
298
+ }
299
+
300
+ float distancePointToLine(in vec3 ptOnLine, in vec3 lineNormal, in vec3 testPt){
301
+ vec3 tempPt = pointProjectOnPlane(lineNormal, ptOnLine, testPt);
302
+ return length(tempPt - ptOnLine);
303
+ }
304
+
305
+ float getDepth(in vec4 depth){
306
+ float z_window = czm_unpackDepth(depth);
307
+ z_window = czm_reverseLogDepth(z_window);
308
+ float n_range = czm_depthRange.near;
309
+ float f_range = czm_depthRange.far;
310
+ return (2.0 * z_window - n_range - f_range) / (f_range - n_range);
311
+ }
312
+
313
+ void main(){
314
+ out_FragColor = texture(colorTexture, v_textureCoordinates);
315
+ float depth = getDepth( texture(depthTexture, v_textureCoordinates));
316
+ vec4 viewPos = toEye(v_textureCoordinates, depth);
317
+ vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);
318
+ float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);
319
+ float twou_radius = u_radius * 2.0;
320
+ if(dis < u_radius){
321
+ float f0 = 1.0 -abs(u_radius - dis) / u_radius;
322
+ f0 = pow(f0, 64.0);
323
+ vec3 lineEndPt = vec3(u_scanCenterEC.xyz) + u_scanLineNormalEC * u_radius;
324
+ float f = 0.0;
325
+ if(isPointOnLineRight(u_scanCenterEC.xyz, u_scanLineNormalEC.xyz, prjOnPlane.xyz)){
326
+ float dis1= length(prjOnPlane.xyz - lineEndPt);
327
+ f = abs(twou_radius -dis1) / twou_radius;
328
+ f = pow(f, float(`+t.width+`));
329
+ }
330
+ if(float(`+t.border+`) > 0.0){
331
+ out_FragColor = mix(out_FragColor, u_scanColor, f + f0);
332
+ } else {
333
+ out_FragColor = mix(out_FragColor, u_scanColor, f);
334
+ }
335
+ }
336
+ }
337
+ `},_getCircleScanShader:function(t){if(t&&t.get)return `uniform sampler2D colorTexture;
338
+ uniform sampler2D depthTexture;
339
+ in vec2 v_textureCoordinates;
340
+ uniform vec4 u_scanCenterEC;
341
+ uniform vec3 u_scanPlaneNormalEC;
342
+ uniform float u_radius;
343
+ uniform vec4 u_scanColor;
344
+
345
+ vec4 toEye(in vec2 uv, in float depth){
346
+ vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));
347
+ vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);
348
+ posInCamera =posInCamera / posInCamera.w;
349
+ return posInCamera;
350
+ }
351
+
352
+ vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){
353
+ vec3 v01 = point - planeOrigin;
354
+ float d = dot(planeNormal, v01) ;
355
+ return (point - planeNormal * d);
356
+ }
357
+
358
+ float getDepth(in vec4 depth){
359
+ float z_window = czm_unpackDepth(depth);
360
+ z_window = czm_reverseLogDepth(z_window);
361
+ float n_range = czm_depthRange.near;
362
+ float f_range = czm_depthRange.far;
363
+ return (2.0 * z_window - n_range - f_range) / (f_range - n_range);
364
+ }
365
+
366
+ void main(){
367
+ out_FragColor = texture(colorTexture, v_textureCoordinates);
368
+ float depth = getDepth(texture(depthTexture, v_textureCoordinates));
369
+ vec4 viewPos = toEye(v_textureCoordinates, depth);
370
+ vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);
371
+ float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);
372
+ if(dis < u_radius){
373
+ float f = 1.0 - abs(u_radius - dis) / u_radius;
374
+ f = pow(f, float(`+t.border+`));
375
+ out_FragColor = mix(out_FragColor, u_scanColor, f);
376
+ }
377
+ }
378
+ `}};function ye(){let t=null,c=function(s,p){if(s){this._viewer=s,ne(J,W),this.$graphics=new J(s,p),t=p;let e=this.$graphics;N(this),G(this,()=>{j(e);});}};return c.prototype={setCircleScanEffect:function(s){if(s&&s.position){var p=s.id||"CircleScan"+parseInt(Math.random()*1e3),e=s.position,r=s.radius,a=s.color||t.Color.RED,n=s.duration||1500,i=this,m=s.circleMode||"CircleScan",o=s.border||4,l=e,u=new t.Cartesian4(l.x,l.y,l.z,1),d=this.transformCartesianToWGS84(e),g=this.transformWGS84ToCartesian({lng:d.lng,lat:d.lat,alt:d.alt+500}),f=new t.Cartesian4(g.x,g.y,g.z,1),h=new Date().getTime(),v=new t.PostProcessStage({name:p,fragmentShader:this._getCircleScanShader({get:true,border:o}),uniforms:{u_scanCenterEC:function(){return t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,new t.Cartesian4)},u_scanPlaneNormalEC:function(){var w=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,new t.Cartesian4),_=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,f,new t.Cartesian4),y=new t.Cartesian3;return y.x=_.x-w.x,y.y=_.y-w.y,y.z=_.z-w.z,t.Cartesian3.normalize(y,y),y},u_radius:function(){return m=="CircleScan"?r*((new Date().getTime()-h)%n)/n:r},u_scanColor:a}});return this._viewer.scene.postProcessStages.add(v),v}},setRadarScanEffect:function(s){if(s&&s.position){var p=s.id||"radarScan"+parseInt(Math.random()*1e3),e=s.position,r=s.radius,a=s.color||t.Color.RED,n=s.duration||1500,i=this,m=s.border||1,o=s.width||3,l=e,u=new t.Cartesian4(l.x,l.y,l.z,1),d=this.transformCartesianToWGS84(e),g=this.transformWGS84ToCartesian({lng:d.lng,lat:d.lat,alt:d.alt+500}),f=new t.Cartesian4(g.x,g.y,g.z,1),h=this.transformWGS84ToCartesian({lng:d.lng+.001,lat:d.lat,alt:d.alt}),v=new t.Cartesian4(h.x,h.y,h.z,1),w=new Date().getTime(),_=new t.Quaternion,y=new t.Matrix3,k=new t.Cartesian4,E=new t.Cartesian4,B=new t.Cartesian4,S=new t.Cartesian3,T=new t.Cartesian3,V=new t.PostProcessStage({name:p,fragmentShader:this._getRadarScanShader({border:m,width:o,get:true}),uniforms:{u_scanCenterEC:function(){return t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,k)},u_scanPlaneNormalEC:function(){var b=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,k),P=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,f,E);return S.x=P.x-b.x,S.y=P.y-b.y,S.z=P.z-b.z,t.Cartesian3.normalize(S,S),S},u_scanLineNormalEC:function(){var b=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,k),P=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,f,E),O=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,v,B);S.x=P.x-b.x,S.y=P.y-b.y,S.z=P.z-b.z,t.Cartesian3.normalize(S,S),T.x=O.x-b.x,T.y=O.y-b.y,T.z=O.z-b.z;var x=(new Date().getTime()-w)%n/n;return t.Quaternion.fromAxisAngle(S,x*t.Math.PI*2,_),t.Matrix3.fromQuaternion(_,y),t.Matrix3.multiplyByVector(y,T,T),t.Cartesian3.normalize(T,T),T},u_radius:r,u_scanColor:a}});return this._viewer.scene.postProcessStages.add(V),V}},satelliteScan:function(s){if(s&&s.position){var p=t.Cartesian3,e=t.GeometryInstance,r=t.Primitive,o=t.MaterialAppearance,a=t.Material,n=t.Color,i=t.Matrix4,m=t.Transforms,o=t.MaterialAppearance,l=t.CylinderGeometry;let v=s.position||[116.39,39.9],w=s.length||4e4;var u=p.fromDegrees(v[0],v[1]),d=i.multiplyByTranslation(m.eastNorthUpToFixedFrame(u),new p(0,0,w*.5),new i),g=new l({length:w,topRadius:0,bottomRadius:w*.5,vertexFormat:o.MaterialSupport.TEXTURED.vertexFormat}),f=new e({geometry:g,modelMatrix:d}),h=this._viewer.scene.primitives.add(new r({geometryInstances:f,appearance:new o({material:new a({fabric:{uniforms:{color:s.color||new n(.2,1,0,1),repeat:s.repeat||30,offset:0,thickness:s.thickness||.2},source:`
379
+ uniform vec4 color;
380
+ uniform float repeat;
381
+ uniform float offset;
382
+ uniform float thickness;
383
+ czm_material czm_getMaterial(czm_materialInput materialInput)
384
+ {
385
+ czm_material material = czm_getDefaultMaterial(materialInput);
386
+ float sp = 1.0/repeat;
387
+ vec2 st = materialInput.st;
388
+ float dis = distance(st, vec2(0.5));
389
+ float m = mod(dis + offset, sp);
390
+ float a = step(sp*(1.0-thickness), m);
391
+ material.diffuse = color.rgb;
392
+ material.alpha = a * color.a;
393
+ vec3 normalMC = material.normal;
394
+ if(normalMC.y < 0.0 && normalMC.z < 0.0)
395
+ {
396
+ discard;
397
+ }
398
+ return material;
399
+ }`},translucent:true}),faceForward:false,closed:true,vertexShaderSource:`
400
+ in vec3 position3DHigh;
401
+ in vec3 position3DLow;
402
+ in vec3 normal;
403
+ in vec2 st;
404
+ in float batchId;
405
+ out vec3 v_positionEC;
406
+ out vec3 v_normalEC;
407
+ out vec2 v_st;
408
+ void main()
409
+ {
410
+ vec4 p = czm_computePosition();
411
+ v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
412
+ v_normalEC = normal; // normal in world coordinates
413
+ v_st = st;
414
+ gl_Position = czm_modelViewProjectionRelativeToEye * p;
415
+ }`})}));let _=function(){var y=h.appearance.material.uniforms.offset;y-=.001,y>1&&(y=0),h.appearance.material.uniforms.offset=y;};return this._viewer.scene.preUpdate.addEventListener(_),G(this,()=>{this._viewer.scene.preUpdate.removeEventListener(_);}),h}},lighitCentrumScanEffect:function(s){let p=this.createLightScan_getCirclePoints(s.circle[0],s.circle[1],s.circle[2],s.circle[3]),e=this.createLightScan_entityCList(this._viewer,p,s);for(let r=0;r<e.length;r++)r!==e.length-1?this.createLightScan_changeOnePosition(s,e[r],[p[r].x,p[r].y,p[r+1].x,p[r+1].y]):this.createLightScan_changeOnePosition(s,e[r],[p[r].x,p[r].y,p[0].x,p[0].y]);return e},createLightScan_getCirclePoints:function(s,p,e,r){let a=[],n=Math.PI/180*Math.round(360/r),i=0;for(;i<r;i++){let m=p+s*Math.sin(n*i),o=e+s*Math.cos(n*i);a.unshift({x:m,y:o});}return a},createLightScan_changeOnePosition:function(s,p,e){let r=s.positionList,a,n,i,m,o,l,u=0,d=0;function g(f){a=r[f+1][0]-r[f][0],n=r[f+1][1]-r[f][1],i=a/s.number,m=n/s.number,d=0;}g(u),p.polygon.hierarchy=new t.CallbackProperty(function(){return Math.abs(o)>=Math.abs(a)&&Math.abs(l)>=Math.abs(n)&&(u=u+1,u===r.length-1&&(u=0),e[0]=e[0]+o,e[1]=e[1]+l,e[2]=e[2]+o,e[3]=e[3]+l,g(u)),o=d*i,l=d*m,d++,new t.PolygonHierarchy(t.Cartesian3.fromDegreesArrayHeights([s.observer[0],s.observer[1],s.observer[2],e[0]+o,e[1]+l,0,e[2]+o,e[3]+l,0]))},false);},createLightScan_entityCList:function(s,p,e){let r=e.observer[0],a=e.observer[1],n=e.observer[2],i=[];for(let m=0;m<p.length;m++){let o;m===p.length-1?o=new t.PolygonHierarchy(t.Cartesian3.fromDegreesArrayHeights([r,a,n,p[m].x,p[m].y,0,p[0].x,p[0].y,0])):o=new t.PolygonHierarchy(t.Cartesian3.fromDegreesArrayHeights([r,a,n,p[m].x,p[m].y,0,p[m+1].x,p[m+1].y,0]));let l=s.entities.add({name:"\u4E09\u89D2\u5F62",polygon:{hierarchy:o,outline:false,perPositionHeight:true,material:e.material}});i.push(l);}return i},createFireParticleSystem(s){if(s&&s.position){let p=Object.assign({},{fireImage:"static/data/images/file/fire.png",startScale:3,endScale:1.5,minimumParticleLife:1.5,maximumParticleLife:1.8,minimumSpeed:7,maximumSpeed:9,particleSize:2,emissionRate:200,startColor:new t.Color(1,1,1,1),endColor:new t.Color(.5,0,0,0),emitter:new t.ConeEmitter(t.Math.toRadians(45))},s),{fireImage:e,startScale:r,endScale:a,minimumParticleLife:n,maximumParticleLife:i,minimumSpeed:m,maximumSpeed:o,particleSize:l,emissionRate:u,position:d,startColor:g,endColor:f,emitter:h}=p;return new t.ParticleSystem({image:e,startScale:r,endScale:a,minimumParticleLife:n,maximumParticleLife:i,minimumSpeed:m,maximumSpeed:o,emissionRate:u,startColor:g,endColor:f,emitter:h,imageSize:new t.Cartesian2(l,l),lifetime:16,loop:true,sizeInMeters:true,modelMatrix:t.Transforms.eastNorthUpToFixedFrame(d)})}}},c}var q=A(ye);var Ze=ie([W,U],q,"passEffect");exports.PassEffect=Ze;//# sourceMappingURL=pass-effect.cjs.map
416
+ //# sourceMappingURL=pass-effect.cjs.map