cesium_dev_kit 1.1.22 → 1.1.23

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 +60 -0
  2. package/README.md +293 -291
  3. package/README.zh-CN.md +274 -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 +1030 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.mts +338 -0
  70. package/dist/index.d.ts +338 -0
  71. package/dist/index.mjs +1030 -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 +289 -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,140 @@
1
+ 'use strict';var S=class extends Error{constructor(s,m,h={}){super(`[cesium_dev_kit:${s}] ${m}`),this.name="CesiumDevKitError",this.code=s,this.details=h.details,this.cause=h.cause,Object.setPrototypeOf(this,new.target.prototype);}};function Z(t){return t instanceof S?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function E(t,s){let m=s!=null&&s.scope?`[cesium_dev_kit:${s.scope}]`:"[cesium_dev_kit]";console.warn(m,t,s!=null?s:"");}var O=class{constructor(s){this.viewer=null;this.Cesium=s,this.init_data();}init_data(){this.viewer=null;}init({containerId:s,viewerConfig:m,extraConfig:h,MapImageryList:e,imageryProvider:r,viewer:i}){let a=s,n={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},l=this.findCesiumProvider(r),o=h==null?void 0:h.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),n=Object.assign(n,m);let c=i||new this.Cesium.Viewer(a,{...n,...l});if(h&&!h.logo){let u=c.cesiumWidget.creditContainer;u.style.display="none";}if(h&&h.depthTest&&(c.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(c,e[u].type,e[u].option||e[u].classConfig);if(!i){let u=typeof document=="undefined"?null:a&&a.nodeType===1?a:document.getElementById(a);this.bindContainerResize(c,u);}return this.viewer=c,c}bindContainerResize(s,m){if(typeof ResizeObserver=="undefined"||!m)return;let h=()=>{try{(typeof s.isDestroyed!="function"||!s.isDestroyed())&&s.resize();}catch(i){E(i,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(h);e.observe(m),typeof requestAnimationFrame=="function"&&requestAnimationFrame(h);let r=s.destroy.bind(s);s.destroy=function(){try{e.disconnect();}catch(i){E(i,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(s,m,h){s.imageryLayers.addImageryProvider(this.createCesiumProvider({type:m,option:h}));}findCesiumProvider(s){let m={};if(!s)return m;for(let h in s){let e=s[h];if(e&&e.type){m[h]=this.createCesiumProvider(e);continue}m[h]=s[h];}return m}createCesiumProvider(s){switch(s.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[s.type](s.option);case "UrlTemplateImageryProvider":return new this.Cesium[s.type](s.option);case "TileMapServiceImageryProvider":return new this.Cesium[s.type](s.option)}}};function X(t,s){if(!s)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(s)||s.startsWith("data:")||s.startsWith("/"))return s;let m=(t||"").replace(/\/+$/,"");return m?m+"/"+s.replace(/^\/+/,""):s}function M(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 se=Object.assign((t,s)=>t!=null?t:s,{EMPTY_OBJECT:Object.freeze({})}),K=se;function j(t){function s(...m){let h=t();return new h(...m)}return s.prototype=t().prototype,Object.defineProperty(s,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),s}function L(t){let s=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof s=="function"?s():t}function J(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(s){console.warn("[cesium_dev_kit] failed to dispose viewer:",s);}}var x=new WeakMap;function G(t,s){if(!t||typeof s!="function")return;let m=x.get(t);m?m.push(s):x.set(t,[s]);}function W(t,s){if(!t||!s||t===s)return;let m=x.get(t);if(!m||m.length===0)return;x.delete(t);let h=x.get(s);h?h.push(...m):x.set(s,m);}function V(t){if(!t||typeof t!="object"&&typeof t!="function")return;let s=x.get(t);if(s){x.delete(t);for(let m=s.length-1;m>=0;m--)try{s[m]();}catch(h){console.warn("[cesium_dev_kit] cleanup failed:",h);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){V(this);},enumerable:false,configurable:true,writable:true});}function ce(){let t={},s;class m{constructor(e,r,i){if(e){this._viewer=e,t=r,s=i||M(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let a=this._drawLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._drawLayer===a&&(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,i){return e.hasOwnProperty(r)?e[r]:i}getDfSt(e){if(!s)return;let r=s,i=e.reduce((a,n)=>a?a[n]:r[n],void 0);if(i!=null)return typeof i!="string"?i:X(r.baseService,i)}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,i,a;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((a=(i=e.alt)!=null?i:e.height)!=null?a:0)};let n=t.Cartographic.fromCartesian(e);return {lng:t.Math.toDegrees(n.longitude),lat:t.Math.toDegrees(n.latitude),alt:n.height}}}transformWGS84ArrayToCartesianArray(e,r){if(this._viewer&&e){var i=this;return e?e.map(function(a){return i.transformWGS84ToCartesian(a,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(i){return r.transformCartesianToWGS84(i)}).filter(function(i){return !!i}):[]}}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 i=0;i<e.length;i++){let a=t.Cartesian3.fromDegrees(Number(e[i][0]),Number(e[i][1]),Number(e[i][2]||0));r.push(a);}return r}setCameraEotateHeading(e){if(e){let r=this._viewer,i=t.Cartesian3.fromDegrees(e.lng,e.lat,e.height),a=t.Math.toRadians(-30),n=360/30,l=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 c=r.camera.heading,u=function(){let d=t.JulianDate.secondsDifference(r.clock.currentTime,r.clock.startTime),g=t.Math.toRadians(d*n)+c;r.scene.camera.setView({destination:i,orientation:{heading:g,pitch:a}}),r.scene.camera.moveBackward(l),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),i=null,a=false,n=false;if(r instanceof t.Cesium3DTileFeature&&(a=true),a&&(i=this._viewer.scene.pickPosition(e),i)){let o=t.Cartographic.fromCartesian(i);o.height<0&&(o.height=0);let c=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),p=o.height;i=this.transformWGS84ToCartesian({lng:c,lat:u,alt:p});}if(!r){var l=this._viewer.scene.camera.getPickRay(e);if(!l)return null;i=this._viewer.scene.globe.pick(l,this._viewer.scene),n=true;}if(r&&!a&&(i=this._viewer.scene.pickPosition(e),i)){let o=t.Cartographic.fromCartesian(i);o.height<0&&(o.height=0);let c=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),p=o.height;i=this.transformWGS84ToCartesian({lng:c,lat:u,alt:p});}if(!a&&!n&&!r&&(i=this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid)),i){let o=this.transformCartesianToWGS84(i);return o.alt<0&&(i=this.transformWGS84ToCartesian(o,.1)),i}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),i=r.longitude*180/Math.PI,a=r.latitude*180/Math.PI,n=this._viewer.camera._direction,l=t.Math.toDegrees(n.x),o=t.Math.toDegrees(n.y),c=t.Math.toDegrees(n.z),u=this._viewer.camera.positionCartographic.height,p=t.Math.toDegrees(this._viewer.camera.heading),d=t.Math.toDegrees(this._viewer.camera.pitch),g=t.Math.toDegrees(this._viewer.camera.roll),f=this._viewer.camera.computeViewRectangle(),w=f.west/Math.PI*180,b=f.north/Math.PI*180,_=f.east/Math.PI*180,P=f.south/Math.PI*180,T=(w+_)/2,k=(b+P)/2;return {lon:i,lat:a,height:u,heading:p,pitch:d,roll:g,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:T,y:k},direction:new t.Cartesian3(l,o,c)}}}}pickUpPosition(e){return this.getCatesian3FromPX(e.position)}getHandlerClickPosition(e){if(this._viewer){let r=this._viewer.scene,i=this._viewer,a=r.camera.pickEllipsoid(e.position,r.globe.elliposid),n={cameraPosistion:i.camera.position,heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},l=t.Cartographic.fromCartesian(a);l.height<0&&(l.height=0);let o={alt:l.height,lat:t.Math.toDegrees(l.latitude),lon:t.Math.toDegrees(l.longitude)},c=r.pickPosition(e.position),u=t.Cartographic.fromCartesian(c),p={height:u.height,latitude:t.Math.toDegrees(u.latitude),longitude:t.Math.toDegrees(u.longitude)};return {wgs84Coor:o,graphicCoor:p,cameraPosition:n}}}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:i,leftDown:a,mouseWheel:n,leftUp:l}){if(this._viewer){var o=new t.ScreenSpaceEventHandler(this._viewer.canvas);G(this,()=>{o&&!o.isDestroyed()&&o.destroy();}),e&&o.setInputAction(function(c){e(c,o);},t.ScreenSpaceEventType.LEFT_CLICK),r&&o.setInputAction(function(c){r(c,o);},t.ScreenSpaceEventType.MOUSE_MOVE),i&&o.setInputAction(function(c){i(c,o);},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),a&&o.setInputAction(function(c){a(c,o);},t.ScreenSpaceEventType.LEFT_DOWN),n&&o.setInputAction(function(c){n(c,o);},t.ScreenSpaceEventType.WHEEL),l&&o.setInputAction(function(c){l(c,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),i=this;G(this,()=>{r&&!r.isDestroyed()&&r.destroy();}),r.setInputAction(function(a){var n=i._viewer.scene.camera.pickEllipsoid(a.endPosition,i._viewer.scene.globe.ellipsoid);typeof e=="function"&&e(i.transformCartesianToWGS84(n),r);},t.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(e){return this.getHandlePosition(e)}saveSceneImages(){if(this._viewer){let l=function(o){for(var c=o.split(","),u=c[0].match(/:(.*?);/)[1],p=atob(c[1]),d=p.length,g=new Uint8Array(d);d--;)g[d]=p.charCodeAt(d);return new Blob([g],{type:u})};var e=this._viewer.scene.canvas,r=e.toDataURL("image/png").replace("image/png","image/octet-stream"),i=document.createElement("a"),a=l(r),n=URL.createObjectURL(a);i.download="scene.png",i.href=n,i.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 i(a){return a.url=a.style==="img"?e:r,a.subdomains||(a.subdomains=["01","02","03","04"]),new t.UrlTemplateImageryProvider(a)}t.Scene.AmapImageryProvider=i;}_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(i){return new t.WebMapTileServiceImageryProvider({url:e.replace(/\{layer\}/g,i.style||"vec").replace(/\{key\}/g,i.key||""),layer:i.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 i(a){return a.layer==="img"?(a.url||(a.url=e),a.subdomains||(a.subdomains=["0","1","2"]),a.customTags={sx(n,l,o,c){return l>>4},sy(n,l,o,c){return (1<<c)-o>>4}}):a.url||(a.url=r),new t.UrlTemplateImageryProvider(a)}t.Scene.TencentImageryProvider=i;}_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",i="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 a(n){return n.url=n.style==="img"?r:n.style==="ter"?i:e,n.subdomains||(n.subdomains=["1","2","3","4","5"]),new t.UrlTemplateImageryProvider(n)}t.Scene.GoogleImageryProvider=a;}_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(a){e=a.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=a.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 i(a,n,l,o,c){var u=a._url+"&x={x}&y={y}&z={z}&customid={style}",p=a._tilingScheme.getNumberOfXTilesAtLevel(o),d=a._tilingScheme.getNumberOfYTilesAtLevel(o);return u=u.replace("{x}",String(n-p/2)).replace("{y}",String(d/2-l-1)).replace("{z}",String(o)).replace("{style}",c),u}r.prototype.getTileCredits=function(a,n,l){},r.prototype.requestImage=function(a,n,l){if(!this.ready)throw new t.DeveloperError("requestImage must not be called before the imagery provider is ready.");var o=i(this,a,n,l,this._style);return t.ImageryProvider.loadImage(this,o)},t.Scene.BaiduImageryProvider=r;}_installGroundSkyBox(){var e=t.BoxGeometry,r=t.Cartesian3,i=t.defaultValue||K,a=t.defined,n=t.destroyObject,l=t.DeveloperError,o=t.GeometryPipeline,c=t.Matrix3,u=t.Matrix4,p=t.Transforms,d=t.VertexFormat,g=t.BufferUsage,f=t.CubeMap,w=t.DrawCommand,b=t.loadCubeMap,_=t.RenderState,P=t.VertexArray,T=t.BlendingState,k=t.SceneMode,D=t.ShaderProgram,$=t.ShaderSource,ee=`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
+ `,te=`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
+ `,re=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function I(v){this.sources=v.sources,this._sources=void 0,this.show=i(v.show,true),this._command=new w({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var ie=new c;I.prototype.update=function(v,A){var B=this;if(this.show&&!(v.mode!==k.SCENE3D&&v.mode!==k.MORPHING)&&v.passes.render){var R=v.context;if(this._sources!==this.sources){this._sources=this.sources;var y=this.sources;if(!a(y.positiveX)||!a(y.negativeX)||!a(y.positiveY)||!a(y.negativeY)||!a(y.positiveZ)||!a(y.negativeZ))throw new l("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof y.positiveX!=typeof y.negativeX||typeof y.positiveX!=typeof y.positiveY||typeof y.positiveX!=typeof y.negativeY||typeof y.positiveX!=typeof y.positiveZ||typeof y.positiveX!=typeof y.negativeZ)throw new l("this.sources properties must all be the same type.");typeof y.positiveX=="string"?b(R,this._sources).then(function(oe){B._cubeMap=B._cubeMap&&B._cubeMap.destroy(),B._cubeMap=oe;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:R,source:y}));}var C=this._command;if(C.modelMatrix=p.eastNorthUpToFixedFrame(v.camera._positionWC),!a(C.vertexArray)){C.uniformMap={u_cubeMap(){return B._cubeMap},u_rotateMatrix(){return re(C.modelMatrix,ie)}};var Y=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:d.POSITION_ONLY})),ae=this._attributeLocations=o.createAttributeLocations(Y);C.vertexArray=P.fromGeometry({context:R,geometry:Y,attributeLocations:ae,bufferUsage:g._DRAW}),C.renderState=_.fromCache({blending:T.ALPHA_BLEND});}if(!a(C.shaderProgram)||this._useHdr!==A){var ne=new $({defines:[A?"HDR":""],sources:[ee]});C.shaderProgram=D.fromCache({context:R,vertexShaderSource:te,fragmentShaderSource:ne,attributeLocations:this._attributeLocations}),this._useHdr=A;}if(a(this._cubeMap))return C}},I.prototype.isDestroyed=function(){return false},I.prototype.destroy=function(){var v=this._command;return v.vertexArray=v.vertexArray&&v.vertexArray.destroy(),v.shaderProgram=v.shaderProgram&&v.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),n(this)},t.Scene.GroundSkyBox=I;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return m}var F=j(ce);function le(t,s,m,h){function e(r,i){let a={},n=L(i),l=[];if(Array.isArray(r))r.forEach(c=>{let u=L(c),p=new u(t,s,m,h);o(u,n),l.push(p);}),a=new n(t,s,m,h),l.forEach(c=>Object.assign(a,c)),l.forEach(c=>W(c,a));else {let c=L(r),u=new c(t,s,m,h);o(c,n),a=new n(t,s,m,h),Object.assign(a,u),W(u,a);}function o(c,u){let p=Object.getOwnPropertyNames(c.prototype);for(let d=0,g=p.length;d<g;d++)p[d]!=="constructor"&&(u.prototype[p[d]]=c.prototype[p[d]]);}return a}return e}function ue({cesiumGlobal:t,threeGlobal:s,containerId:m,threeContainerId:h,viewerConfig:e={},extraConfig:r={},MapImageryList:i=[],defaultStatic:a,baseExtendsCom:n=[],extendsCom:l,extendsComName:o,viewer:c}){if(!t)throw new S("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!m&&!c)throw new S("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 p=new O(t).init({containerId:m,viewerConfig:e,extraConfig:r,MapImageryList:i,viewer:c}),d=!c,w=le(p,t,a,s?{threeGlobal:s,containerId:m,threeContainerId:h}:"")(n,l),b=false;return {viewer:p,[o]:w,dispose:()=>{if(!b){b=true;try{typeof w.destroy=="function"?w.destroy():V(w);}catch(_){E(_,{scope:"singleImport.dispose"});}d&&J(p);}}}}function q(t,s,m){function h(e){return ue({...e,baseExtendsCom:t,extendsCom:s,extendsComName:m})}return h}var H=null;function me(t){return t&&typeof t=="object"&&t.default?t.default:t}function pe(t,s){return s().then(me).catch(m=>{throw Z(m)?m:new S("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:m,details:{package:t}})})}function Q(){return H||(H=pe("libgif",()=>import('libgif'))),H}function he(){let t=null;class m{constructor(e,r,i){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let a=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._graphicsLayer===a&&(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 i in e.positions){let a=e.positions[i],n=this.createGraphics();n.name=e.name||"",n.oid=e.oid||"point",n.position=a,e.point&&(n.point=this.getPointGraphics()),e.billboard&&(n.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(n.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(n));}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:i,height:a,width:n,material:l,...o}=e;var r=this.createGraphics();return a=a===void 0?6:a,n=n===void 0?15:n,r.corridor={positions:i,height:a,width:n,...o,material:l||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 i=e.entity,a=e.cylinder,n=this;return r.cylinder=this.getCylinderGraphics(a),r.position=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l),c=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,c,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l);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(),i=e.alp||1,a=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 a?(i=i-.05,i<=0&&(a=false)):(i=i+.05,i>=1&&(a=true)),t.Color.RED.withAlpha(i)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var P,T;if(e&&e.center){var r=this.createGraphics(),i=this,a=e.center,n=e.radius||800,l=e.rotateAmount||.05,o=0,c=e.height||1,u=0,p=0,d=0,g=(P=e.scale)!=null?P:0,f=(T=e.scale2)!=null?T:0,w=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 i.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(p),t.Math.toRadians(d)))},false);let k=n,D=false;var b=()=>{(n>=g||n<=k)&&(D=!D),D?n+=2:n-=2;},_=()=>{f>=n?n+=2:n=k;};return r.ellipse={material:w,height:c,semiMajorAxis:new t.CallbackProperty(function(){return n},false),semiMinorAxis:new t.CallbackProperty(function(){return n},false),stRotation:new t.CallbackProperty(function(){return l>0&&(o+=l,o>=360&&(o=0)),g&&b(),f&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,i=e.num||20,a=e.color||t.Color.RED,n=e.speed||.003,l=this.createGraphics();return l.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 i%2===0?r-=n:r+=n,(r<=.1||r>=1)&&i++,a.withAlpha(r)},false)})},this._graphicsLayer.entities.add(l)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,i=document.createElement("img");i.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let a=function(n){if(n.image){var l=document.createElement("canvas");l.width=n.width||150,l.height=n.height||80;var o=l.getContext("2d");o.drawImage(n.image,0,0);var c=n.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(c,55,36),l}};i.onload=function(){e.image=i;var n=r._graphicsLayer.entities.add({position:e.position,billboard:{image:a(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(n);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),i=0,a=e.positions,n=a[0];return r.position=new t.CallbackProperty(function(){return i==0?(n=a[0],i+=1):i<a.length-1?(n=a[i],i+=1):i==a.length-1&&(n=a[i],i=0),n},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 Q();if(e&&e.position){var i=[],a=e.url,n=0,l=6;return function(c,u){var p=document.createElement("img");p.src=c,p.setAttribute("rel:animated_src",c),p.setAttribute("rel:auto_play","0"),document.body.appendChild(p);var d=new r({gif:p});return new Promise(g=>{d.load(()=>{for(let f=1;f<=d.get_length();f++)d.move_to(f),u.push(d.get_canvas().toDataURL());g(u);});})}(a,i),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return i.length?(n<l*(i.length-1)?n++:n=0,i[Math.floor(n/l)]):a},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,i=e.rotateAmount,a=e.position,n=this;a.heading=0,a.pitch=0,a.roll=0,r.position=new t.CallbackProperty(function(){return n.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return i>0&&(a.heading+=i,a.heading===360&&(a.heading=0)),t.Transforms.headingPitchRollQuaternion(n.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(a.heading),t.Math.toRadians(a.pitch),t.Math.toRadians(a.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,i=e.minHeiht||5,a=e.maxHeiht||100,n=e.cartesians,l=e.speed||.06,o=this,c=i,u=!1;n.length?r.positions=new t.CallbackProperty(function(){var p=o.transformCartesianArrayToWGS84Array(n);for(var d in p){var g=p[d];(i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,g.alt=i;}return o.transformWGS84ArrayToCartesianArray(p,0)},!1):r.position=new t.CallbackProperty(function(){var p=o.transformCartesianToWGS84(n);return (i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,p.alt=i,o.transformWGS84ToCartesian(p)},!1);}catch(p){console.log(p);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var i=0,a=document.createElement("canvas"),n=a.getContext("2d"),l=new Image;l.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(n.clearRect(0,0,o,e.cheight||0),i<=o)n.drawImage(l,i,0);else return i=0,i+=3,a};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:i,alt:a,custMaterial:n,speed:l=0,direction:o="+"}){if(e){var c=this.createGraphics(),u=0,p=this._calcPoints(r,i,a,u);c.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(p),false),material:n||t.Color.AQUAMARINE.withAlpha(.5)};let d=()=>{l>0&&(u+=l,p=this._calcPoints(r,i,a,Number(o+u)));};return e.clock.onTick.addEventListener(d),G(this,()=>{e.clock.onTick.removeEventListener(d);}),this._graphicsLayer.entities.add(c)}}_computeCirclularFlight(e,r,i,a,n,l){let o=[];o.push(e),o.push(r),o.push(0);var c=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(i,a));for(let u=n;u<=n+l;u++){let p=c*Math.sin(u*Math.PI/180),d=Math.cos(u*Math.PI/180),g=(i-e)*d+e,f=(a-r)*d+r;o.push(g),o.push(f),o.push(p);}return o}_objHasOwnProperty(e,r,i){let a=e;return a&&a.hasOwnProperty(r)?a[r]:i}_calcPoints(e,r,i,a){var n=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),l=i*Math.cos(a*Math.PI/180),o=i*Math.sin(a*Math.PI/180),c=t.Cartesian3.fromElements(l,o,0),u=t.Matrix4.multiplyByPoint(n,c,new t.Cartesian3),p=t.Cartographic.fromCartesian(u),d=t.Math.toDegrees(p.longitude),g=t.Math.toDegrees(p.latitude);return this._computeCirclularFlight(e,r,d,g,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 m}var z=j(he);var je=q([F],z,"graphics");exports.Graphics=je;//# sourceMappingURL=graphics.cjs.map
140
+ //# sourceMappingURL=graphics.cjs.map