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
package/dist/three.cjs ADDED
@@ -0,0 +1,140 @@
1
+ 'use strict';var T=class extends Error{constructor(n,d,h={}){super(`[cesium_dev_kit:${n}] ${d}`),this.name="CesiumDevKitError",this.code=n,this.details=h.details,this.cause=h.cause,Object.setPrototypeOf(this,new.target.prototype);}};function P(t,n){let d=n!=null&&n.scope?`[cesium_dev_kit:${n.scope}]`:"[cesium_dev_kit]";console.warn(d,t,n!=null?n:"");}var E=class{constructor(n){this.viewer=null;this.Cesium=n,this.init_data();}init_data(){this.viewer=null;}init({containerId:n,viewerConfig:d,extraConfig:h,MapImageryList:r,imageryProvider:a,viewer:e}){let i=n,s={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},o=this.findCesiumProvider(a),c=h==null?void 0:h.AccessToken;c&&(this.Cesium.Ion.defaultAccessToken=c),s=Object.assign(s,d);let l=e||new this.Cesium.Viewer(i,{...s,...o});if(h&&!h.logo){let u=l.cesiumWidget.creditContainer;u.style.display="none";}if(h&&h.depthTest&&(l.scene.globe.depthTestAgainstTerrain=true),r&&r.length>0)for(let u=0;u<r.length;u++)this.addImageryProvider(l,r[u].type,r[u].option||r[u].classConfig);if(!e){let u=typeof document=="undefined"?null:i&&i.nodeType===1?i:document.getElementById(i);this.bindContainerResize(l,u);}return this.viewer=l,l}bindContainerResize(n,d){if(typeof ResizeObserver=="undefined"||!d)return;let h=()=>{try{(typeof n.isDestroyed!="function"||!n.isDestroyed())&&n.resize();}catch(e){P(e,{scope:"Controller.bindContainerResize"});}},r=new ResizeObserver(h);r.observe(d),typeof requestAnimationFrame=="function"&&requestAnimationFrame(h);let a=n.destroy.bind(n);n.destroy=function(){try{r.disconnect();}catch(e){P(e,{scope:"Controller.bindContainerResize.disconnect"});}return a()};}addImageryProvider(n,d,h){n.imageryLayers.addImageryProvider(this.createCesiumProvider({type:d,option:h}));}findCesiumProvider(n){let d={};if(!n)return d;for(let h in n){let r=n[h];if(r&&r.type){d[h]=this.createCesiumProvider(r);continue}d[h]=n[h];}return d}createCesiumProvider(n){switch(n.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[n.type](n.option);case "UrlTemplateImageryProvider":return new this.Cesium[n.type](n.option);case "TileMapServiceImageryProvider":return new this.Cesium[n.type](n.option)}}};function U(t,n){if(!n)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(n)||n.startsWith("data:")||n.startsWith("/"))return n;let d=(t||"").replace(/\/+$/,"");return d?d+"/"+n.replace(/^\/+/,""):n}function V(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 ne=Object.assign((t,n)=>t!=null?t:n,{EMPTY_OBJECT:Object.freeze({})}),Y=ne;function j(t){function n(...d){let h=t();return new h(...d)}return n.prototype=t().prototype,Object.defineProperty(n,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),n}function M(t){let n=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof n=="function"?n():t}function H(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(n){console.warn("[cesium_dev_kit] failed to dispose viewer:",n);}}var _=new WeakMap;function b(t,n){if(!t||typeof n!="function")return;let d=_.get(t);d?d.push(n):_.set(t,[n]);}function R(t,n){if(!t||!n||t===n)return;let d=_.get(t);if(!d||d.length===0)return;_.delete(t);let h=_.get(n);h?h.push(...d):_.set(n,d);}function A(t){if(!t||typeof t!="object"&&typeof t!="function")return;let n=_.get(t);if(n){_.delete(t);for(let d=n.length-1;d>=0;d--)try{n[d]();}catch(h){console.warn("[cesium_dev_kit] cleanup failed:",h);}}}function z(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){A(this);},enumerable:false,configurable:true,writable:true});}function ae(){let t={},n;class d{constructor(r,a,e){if(r){this._viewer=r,t=a,n=e||V(),this._drawLayer=new t.CustomDataSource("drawLayer"),r&&r.dataSources.add(this._drawLayer);let i=this._drawLayer;z(this),b(this,()=>{this._viewer&&i&&(this._viewer.dataSources.remove(i,true),this._drawLayer===i&&(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(r,a,e){return r.hasOwnProperty(a)?r[a]:e}getDfSt(r){if(!n)return;let a=n,e=r.reduce((i,s)=>i?i[s]:a[s],void 0);if(e!=null)return typeof e!="string"?e:U(a.baseService,e)}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(r){r=r||{};var a=`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:a,uniforms:{scale:1,offset(){return r.offset||new t.Cartesian3(.1,.2,.3)}}}))}setBlurBloom(r){if(this._viewer&&r){var a=`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:a,uniforms:{width:r.width,height:r.height,colorTexture1:"Bright"}}))}}setRainEffect(){if(this._viewer){var r=`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:r}))}}setSnowEffect(){if(this._viewer){var r=`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:r}))}}setFogEffect(){if(this._viewer){var r=`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:r,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(r){r&&(Array.isArray(r)?r.forEach(a=>{this._viewer.scene.postProcessStages.contains(a)&&this._viewer.scene.postProcessStages.remove(a);}):this._viewer.scene.postProcessStages.contains(r)&&this._viewer.scene.postProcessStages.remove(r));}setView(r){if(this._viewer&&r&&r.position){if(r.distance){var a=new t.Cartesian3(0,r.distance,window.opt.distance);r.position=t.Cartesian3.add(r.position,a,new t.Cartesian3);}this._viewer.scene.camera.setView({destination:r.position,orientation:r.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)}});}}flyTo(r){if(this._viewer&&r&&r.position){if(r.distance){var a=new t.Cartesian3(0,r.distance,0);r.position=t.Cartesian3.add(r.position,a,new t.Cartesian3);}this._viewer.scene.camera.flyTo({destination:r.position,orientation:r.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)},easingFunction:r.easingFunction||t.EasingFunction.LINEAR_NONE,duration:r.duration||3,complete:r.callback});}}transformCartesianToWGS84(r){var a,e,i;if(this._viewer&&r){if(r.x===void 0&&(r.lng!==void 0||r.lon!==void 0))return {lng:Number((a=r.lng)!=null?a:r.lon),lat:Number(r.lat),alt:Number((i=(e=r.alt)!=null?e:r.height)!=null?i:0)};let s=t.Cartographic.fromCartesian(r);return {lng:t.Math.toDegrees(s.longitude),lat:t.Math.toDegrees(s.latitude),alt:s.height}}}transformWGS84ArrayToCartesianArray(r,a){if(this._viewer&&r){var e=this;return r?r.map(function(i){return e.transformWGS84ToCartesian(i,a)}):[]}}transformWGS84ToCartesian(r,a){if(this._viewer)return r?t.Cartesian3.fromDegrees(r.lng||r.lon,r.lat,r.alt=a||r.alt,t.Ellipsoid.WGS84):t.Cartesian3.ZERO}transformCartesianArrayToWGS84Array(r){if(this._viewer){var a=this;return r?r.map(function(e){return a.transformCartesianToWGS84(e)}).filter(function(e){return !!e}):[]}}transformWGS84ToCartographic(r){return r?t.Cartographic.fromDegrees(r.lng||r.lon,r.lat,r.alt):t.Cartographic.ZERO}lnglatArrayToCartesians(r){if(!r||r.length<1)return [];let a=[];for(let e=0;e<r.length;e++){let i=t.Cartesian3.fromDegrees(Number(r[e][0]),Number(r[e][1]),Number(r[e][2]||0));a.push(i);}return a}setCameraEotateHeading(r){if(r){let a=this._viewer,e=t.Cartesian3.fromDegrees(r.lng,r.lat,r.height),i=t.Math.toRadians(-30),s=360/30,o=5e3,c=t.JulianDate.fromDate(new Date);a.clock.startTime=c.clone(),a.clock.currentTime=c.clone(),a.clock.clockRange=t.ClockRange.CLAMPED,a.clock.clockStep=t.ClockStep.SYSTEM_CLOCK;let l=a.camera.heading,u=function(){let p=t.JulianDate.secondsDifference(a.clock.currentTime,a.clock.startTime),f=t.Math.toRadians(p*s)+l;a.scene.camera.setView({destination:e,orientation:{heading:f,pitch:i}}),a.scene.camera.moveBackward(o),t.JulianDate.compare(a.clock.currentTime,a.clock.stopTime)>=0&&a.clock.onTick.removeEventListener(u);};a.clock.onTick.addEventListener(u),b(this,()=>{a.clock.onTick.removeEventListener(u);});}}getCatesian3FromPX(r){if(this._viewer&&r){var a=this._viewer.scene.pick(r),e=null,i=false,s=false;if(a instanceof t.Cesium3DTileFeature&&(i=true),i&&(e=this._viewer.scene.pickPosition(r),e)){let c=t.Cartographic.fromCartesian(e);c.height<0&&(c.height=0);let l=t.Math.toDegrees(c.longitude),u=t.Math.toDegrees(c.latitude),m=c.height;e=this.transformWGS84ToCartesian({lng:l,lat:u,alt:m});}if(!a){var o=this._viewer.scene.camera.getPickRay(r);if(!o)return null;e=this._viewer.scene.globe.pick(o,this._viewer.scene),s=true;}if(a&&!i&&(e=this._viewer.scene.pickPosition(r),e)){let c=t.Cartographic.fromCartesian(e);c.height<0&&(c.height=0);let l=t.Math.toDegrees(c.longitude),u=t.Math.toDegrees(c.latitude),m=c.height;e=this.transformWGS84ToCartesian({lng:l,lat:u,alt:m});}if(!i&&!s&&!a&&(e=this._viewer.scene.camera.pickEllipsoid(r,this._viewer.scene.globe.ellipsoid)),e){let c=this.transformCartesianToWGS84(e);return c.alt<0&&(e=this.transformWGS84ToCartesian(c,.1)),e}return false}}getCameraPosition(){if(this._viewer){var r=this._viewer.scene.camera.pickEllipsoid(new t.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(r){var a=t.Ellipsoid.WGS84.cartesianToCartographic(r),e=a.longitude*180/Math.PI,i=a.latitude*180/Math.PI,s=this._viewer.camera._direction,o=t.Math.toDegrees(s.x),c=t.Math.toDegrees(s.y),l=t.Math.toDegrees(s.z),u=this._viewer.camera.positionCartographic.height,m=t.Math.toDegrees(this._viewer.camera.heading),p=t.Math.toDegrees(this._viewer.camera.pitch),f=t.Math.toDegrees(this._viewer.camera.roll),S=this._viewer.camera.computeViewRectangle(),v=S.west/Math.PI*180,x=S.north/Math.PI*180,g=S.east/Math.PI*180,O=S.south/Math.PI*180,L=(v+g)/2,I=(x+O)/2;return {lon:e,lat:i,height:u,heading:m,pitch:p,roll:f,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:L,y:I},direction:new t.Cartesian3(o,c,l)}}}}pickUpPosition(r){return this.getCatesian3FromPX(r.position)}getHandlerClickPosition(r){if(this._viewer){let a=this._viewer.scene,e=this._viewer,i=a.camera.pickEllipsoid(r.position,a.globe.elliposid),s={cameraPosistion:e.camera.position,heading:e.camera.heading,pitch:e.camera.pitch,roll:e.camera.roll},o=t.Cartographic.fromCartesian(i);o.height<0&&(o.height=0);let c={alt:o.height,lat:t.Math.toDegrees(o.latitude),lon:t.Math.toDegrees(o.longitude)},l=a.pickPosition(r.position),u=t.Cartographic.fromCartesian(l),m={height:u.height,latitude:t.Math.toDegrees(u.latitude),longitude:t.Math.toDegrees(u.longitude)};return {wgs84Coor:c,graphicCoor:m,cameraPosition:s}}}updateCameraState(r){this._viewer.scene._screenSpaceCameraController.enableRotate=r,this._viewer.scene._screenSpaceCameraController.enableTranslate=r,this._viewer.scene._screenSpaceCameraController.enableZoom=r,this._viewer.scene._screenSpaceCameraController.enableTilt=r,this._viewer.scene._screenSpaceCameraController.enableLook=r;}bindHandleEvent({leftClick:r,mouseMove:a,doubleClick:e,leftDown:i,mouseWheel:s,leftUp:o}){if(this._viewer){var c=new t.ScreenSpaceEventHandler(this._viewer.canvas);b(this,()=>{c&&!c.isDestroyed()&&c.destroy();}),r&&c.setInputAction(function(l){r(l,c);},t.ScreenSpaceEventType.LEFT_CLICK),a&&c.setInputAction(function(l){a(l,c);},t.ScreenSpaceEventType.MOUSE_MOVE),e&&c.setInputAction(function(l){e(l,c);},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),i&&c.setInputAction(function(l){i(l,c);},t.ScreenSpaceEventType.LEFT_DOWN),s&&c.setInputAction(function(l){s(l,c);},t.ScreenSpaceEventType.WHEEL),o&&c.setInputAction(function(l){o(l,c);},t.ScreenSpaceEventType.LEFT_UP);}}bindHandelEvent(r){return this.bindHandleEvent(r)}getHandlePosition(r){if(this._viewer){var a=new t.ScreenSpaceEventHandler(this._viewer.scene.canvas),e=this;b(this,()=>{a&&!a.isDestroyed()&&a.destroy();}),a.setInputAction(function(i){var s=e._viewer.scene.camera.pickEllipsoid(i.endPosition,e._viewer.scene.globe.ellipsoid);typeof r=="function"&&r(e.transformCartesianToWGS84(s),a);},t.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(r){return this.getHandlePosition(r)}saveSceneImages(){if(this._viewer){let o=function(c){for(var l=c.split(","),u=l[0].match(/:(.*?);/)[1],m=atob(l[1]),p=m.length,f=new Uint8Array(p);p--;)f[p]=m.charCodeAt(p);return new Blob([f],{type:u})};var r=this._viewer.scene.canvas,a=r.toDataURL("image/png").replace("image/png","image/octet-stream"),e=document.createElement("a"),i=o(a),s=URL.createObjectURL(i);e.download="scene.png",e.href=s,e.click();}}_installAmapImageryProvider(){let r="https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",a="https://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";function e(i){return i.url=i.style==="img"?r:a,i.subdomains||(i.subdomains=["01","02","03","04"]),new t.UrlTemplateImageryProvider(i)}t.Scene.AmapImageryProvider=e;}_installTdtImageryProvider(){let r="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 a(e){return new t.WebMapTileServiceImageryProvider({url:r.replace(/\{layer\}/g,e.style||"vec").replace(/\{key\}/g,e.key||""),layer:e.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}t.Scene.TdtImageryProvider=a;}_installTencentImageryProvider(){let r="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229",a="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1";function e(i){return i.layer==="img"?(i.url||(i.url=r),i.subdomains||(i.subdomains=["0","1","2"]),i.customTags={sx(s,o,c,l){return o>>4},sy(s,o,c,l){return (1<<l)-c>>4}}):i.url||(i.url=a),new t.UrlTemplateImageryProvider(i)}t.Scene.TencentImageryProvider=e;}_installGoogleImageryProvider(){let r="https://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",a="https://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali",e="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 i(s){return s.url=s.style==="img"?a:s.style==="ter"?e:r,s.subdomains||(s.subdomains=["1","2","3","4","5"]),new t.UrlTemplateImageryProvider(s)}t.Scene.GoogleImageryProvider=i;}_installGooGleImageryProvider(){return this._installGoogleImageryProvider()}_installBaiduImageryProvider(){var r="https://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function a(i){r=i.url||r,this._url=r,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=i.style||"normal",this._ready=true;}Object.defineProperties(a.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 e(i,s,o,c,l){var u=i._url+"&x={x}&y={y}&z={z}&customid={style}",m=i._tilingScheme.getNumberOfXTilesAtLevel(c),p=i._tilingScheme.getNumberOfYTilesAtLevel(c);return u=u.replace("{x}",String(s-m/2)).replace("{y}",String(p/2-o-1)).replace("{z}",String(c)).replace("{style}",l),u}a.prototype.getTileCredits=function(i,s,o){},a.prototype.requestImage=function(i,s,o){if(!this.ready)throw new t.DeveloperError("requestImage must not be called before the imagery provider is ready.");var c=e(this,i,s,o,this._style);return t.ImageryProvider.loadImage(this,c)},t.Scene.BaiduImageryProvider=a;}_installGroundSkyBox(){var r=t.BoxGeometry,a=t.Cartesian3,e=t.defaultValue||Y,i=t.defined,s=t.destroyObject,o=t.DeveloperError,c=t.GeometryPipeline,l=t.Matrix3,u=t.Matrix4,m=t.Transforms,p=t.VertexFormat,f=t.BufferUsage,S=t.CubeMap,v=t.DrawCommand,x=t.loadCubeMap,g=t.RenderState,O=t.VertexArray,L=t.BlendingState,I=t.SceneMode,J=t.ShaderProgram,K=t.ShaderSource,q=`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
+ `,$=`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
+ `,Q=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function B(w){this.sources=w.sources,this._sources=void 0,this.show=e(w.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 ee=new l;B.prototype.update=function(w,G){var k=this;if(this.show&&!(w.mode!==I.SCENE3D&&w.mode!==I.MORPHING)&&w.passes.render){var D=w.context;if(this._sources!==this.sources){this._sources=this.sources;var y=this.sources;if(!i(y.positiveX)||!i(y.negativeX)||!i(y.positiveY)||!i(y.negativeY)||!i(y.positiveZ)||!i(y.negativeZ))throw new o("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 o("this.sources properties must all be the same type.");typeof y.positiveX=="string"?x(D,this._sources).then(function(ie){k._cubeMap=k._cubeMap&&k._cubeMap.destroy(),k._cubeMap=ie;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new S({context:D,source:y}));}var C=this._command;if(C.modelMatrix=m.eastNorthUpToFixedFrame(w.camera._positionWC),!i(C.vertexArray)){C.uniformMap={u_cubeMap(){return k._cubeMap},u_rotateMatrix(){return Q(C.modelMatrix,ee)}};var F=r.createGeometry(r.fromDimensions({dimensions:new a(2,2,2),vertexFormat:p.POSITION_ONLY})),te=this._attributeLocations=c.createAttributeLocations(F);C.vertexArray=O.fromGeometry({context:D,geometry:F,attributeLocations:te,bufferUsage:f._DRAW}),C.renderState=g.fromCache({blending:L.ALPHA_BLEND});}if(!i(C.shaderProgram)||this._useHdr!==G){var re=new K({defines:[G?"HDR":""],sources:[q]});C.shaderProgram=J.fromCache({context:D,vertexShaderSource:$,fragmentShaderSource:re,attributeLocations:this._attributeLocations}),this._useHdr=G;}if(i(this._cubeMap))return C}},B.prototype.isDestroyed=function(){return false},B.prototype.destroy=function(){var w=this._command;return w.vertexArray=w.vertexArray&&w.vertexArray.destroy(),w.shaderProgram=w.shaderProgram&&w.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),s(this)},t.Scene.GroundSkyBox=B;}removeHandlerByName(r=[]){r.forEach(a=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[a]);});}}return d}j(ae);function se(t,n,d,h){function r(a,e){let i={},s=M(e),o=[];if(Array.isArray(a))a.forEach(l=>{let u=M(l),m=new u(t,n,d,h);c(u,s),o.push(m);}),i=new s(t,n,d,h),o.forEach(l=>Object.assign(i,l)),o.forEach(l=>R(l,i));else {let l=M(a),u=new l(t,n,d,h);c(l,s),i=new s(t,n,d,h),Object.assign(i,u),R(u,i);}function c(l,u){let m=Object.getOwnPropertyNames(l.prototype);for(let p=0,f=m.length;p<f;p++)m[p]!=="constructor"&&(u.prototype[m[p]]=l.prototype[m[p]]);}return i}return r}function oe({cesiumGlobal:t,threeGlobal:n,containerId:d,threeContainerId:h,viewerConfig:r={},extraConfig:a={},MapImageryList:e=[],defaultStatic:i,baseExtendsCom:s=[],extendsCom:o,extendsComName:c,viewer:l}){if(!t)throw new T("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!d&&!l)throw new T("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 m=new E(t).init({containerId:d,viewerConfig:r,extraConfig:a,MapImageryList:e,viewer:l}),p=!l,v=se(m,t,i,n?{threeGlobal:n,containerId:d,threeContainerId:h}:"")(s,o),x=false;return {viewer:m,[c]:v,dispose:()=>{if(!x){x=true;try{typeof v.destroy=="function"?v.destroy():A(v);}catch(g){P(g,{scope:"singleImport.dispose"});}p&&H(m);}}}}function X(t,n,d){function h(r){return oe({...r,baseExtendsCom:t,extendsCom:n,extendsComName:d})}return h}function Z({THREE:t,Cesium:n,viewer:d}){function h(a,e){e||(e=new t.BufferGeometry);let i=a.attributes;for(let c in i)if(i.hasOwnProperty(c)&&i[c]){var s=i[c],o=s.values;o instanceof Float64Array&&(o=new Float32Array(o));let l=new t.BufferAttribute(o,s.componentsPerAttribute,s.normalize);e.setAttribute(c,l);}if(i.st&&(e.attributes.uv=e.attributes.st,e.deleteAttribute("st")),a.indices){let c=new t.BufferAttribute(a.indices,1,false);e.setIndex(c);}if(a.boundingSphere){let c=a.boundingSphere;e.boundingSphere||(e.boundingSphere=new t.Sphere),e.boundingSphere.center.copy(c.center),e.boundingSphere.radius=c.radius;}return e}class r extends t.Scene{constructor(e={}){if(super(),this.type="ThreeCesiumScene",!e.cesiumDom)throw new Error("THREE.ThreeCesiumScene not found cesiumDom.");if(!e.camera||!(e.camera instanceof t.PerspectiveCamera))throw new Error("THREE.ThreeCesiumScene (not found cesiumDom) OR ( not THREE.PerspectiveCamera ).");if(!e.renderer)throw new Error("THREE.ThreeCesiumScene not found THREE.WebGLRender.");this.options=e,this.cesiumViewer=d;let s=(typeof e.cesiumDom=="string"?document.getElementById(e.cesiumDom):e.cesiumDom).children[0].children;for(let g=0;g<s.length;g++)g!==0&&(s[g].style.zIndex="100");this.ellipsoid=this.cesiumViewer.scene.globe.ellipsoid,e.threeHabit&&(this.cesiumViewer.scene.screenSpaceCameraController.tiltEventTypes=[n.CameraEventType.LEFT_DRAG],this.cesiumViewer.scene.screenSpaceCameraController.zoomEventTypes=[n.CameraEventType.MIDDLE_DRAG,n.CameraEventType.WHEEL,n.CameraEventType.PINCH],this.cesiumViewer.scene.screenSpaceCameraController.rotateEventTypes=[n.CameraEventType.RIGHT_DRAG]),this.camera=e.camera,this.cameraOffset=new t.Vector3,this.renderer=e.renderer,this.lngLat=e.lngLat&&e.lngLat.length>1?e.lngLat:[114.23,31.55],this.cameraCenter=new t.Vector3(0,0,0);let o=new n.EllipsoidGeometry({vertexFormat:n.VertexFormat.POSITION_ONLY,radii:new n.Cartesian3(this.ellipsoid.maximumRadius-1,this.ellipsoid.maximumRadius-1,this.ellipsoid.minimumRadius-1),slicePartitions:1024,stackPartitions:1024}),c=h(n.EllipsoidGeometry.createGeometry(o)),l=new t.MeshBasicMaterial({color:"#ff00ff",blending:t.MultiplyBlending}),u=new t.Mesh(c,l);e.axesHelper&&u.add(new t.AxesHelper(8e6)),super.add(u),this.sphere=u;let m=new t.Group;super.add(m),this.syncGroup=m;let p=new t.SphereGeometry(this.ellipsoid.minimumRadius,512,256,0,Math.PI*2,3.1,Math.PI-3.1),f=new t.MeshBasicMaterial({color:"#fff00f",blending:t.MultiplyBlending}),S=new t.Mesh(p,f);S.rotateX(90*Math.PI/180),S.position.z=this.ellipsoid.minimumRadius,this.sphere3=S;let v=new t.Group;v.rotateX(-90*Math.PI/180),v.position.z=-1,this.syncGroup=m,this.childrenGroup=v,this.sunUp=new t.Group,this.sunLightColor=new t.Color,this.sunLightIntensity=1;let x=this.cesiumViewer.scene.light;if(this.sunLightColor.r=x.color.red,this.sunLightColor.g=x.color.green,this.sunLightColor.b=x.color.blue,this.sunLightIntensity=x.intensity,this.sun=new t.DirectionalLight(this.sunLightColor,this.sunLightIntensity),this.sun.castShadow=true,this.sun.shadow.camera.far=Math.pow(10,14),this.sun.position.set(0,0,this.ellipsoid.maximumRadius*2+1e3),this.sun.target=this.childrenGroup,this.sunUp.add(this.sun),m.add(S),m.add(v),m.add(this.sunUp),this._enableLighting=false,Object.defineProperty(this,"enableLighting",{get(){return this._enableLighting},set(g){if(this.cesiumViewer.scene.globe.enableLighting=g,this._enableLighting=g,g){this.sun.visible=true;return}this.sun.visible=false;}}),e.enableLighting!==void 0&&e.enableLighting!==null&&(this.enableLighting=e.enableLighting),e.cesiumLayers&&e.cesiumLayers.length>0)for(let g=0;g<e.cesiumLayers.length;g++)this.addImageryProvider(e.cesiumLayers[g].type,e.cesiumLayers[g].option);}renderCesium(){return this.cesiumViewer.isDestroyed()||this.cesiumViewer.resize(),this.cesiumViewer.render(),this}renderThree(){return this.renderer.render(this,this.camera),this}updateSunMatrix(){if(this.isColumbusViewMode())return this;let e=this.cesiumViewer.scene.sun._boundingVolume.center,i=this.cartesian3ToVector(e);return this.sunUp.lookAt(i.x-this.cameraOffset.x,i.y-this.cameraOffset.y,-(i.z-this.cameraOffset.z)),this}updateCameraMatrix(){this.camera.fov=n.Math.toDegrees(this.cesiumViewer.camera.frustum.fovy),this.camera.updateProjectionMatrix(),this.camera.matrixAutoUpdate=false;let e=this.cesiumViewer.camera.viewMatrix,i=this.cesiumViewer.camera.inverseViewMatrix;this.camera.lookAt(this.cameraCenter),this.camera.matrixWorld.set(i[0],i[4],i[8],i[12]-this.cameraOffset.x,i[1],i[5],i[9],i[13]-this.cameraOffset.y,i[2],i[6],i[10],i[14]-this.cameraOffset.z,i[3],i[7],i[11],i[15]),this.camera.matrixWorldInverse.set(e[0],e[4],e[8],e[12]-this.cameraOffset.x,e[1],e[5],e[9],e[13]-this.cameraOffset.y,e[2],e[6],e[10],e[14]-this.cameraOffset.z,e[3],e[7],e[11],e[15]);let s=this.cesiumViewer.scene.canvas.clientWidth,o=this.cesiumViewer.scene.canvas.clientHeight;return this.camera.aspect=s/o,this.camera.updateProjectionMatrix(),this.renderer.setSize(s,o),this}isColumbusViewMode(){return this.cesiumViewer.scene.mode===n.SceneMode.COLUMBUS_VIEW}isThreeRenderable(){let e=this.cesiumViewer.scene;return e.mode===n.SceneMode.SCENE2D?false:Math.abs(e.morphTime)<n.Math.EPSILON6||Math.abs(e.morphTime-1)<n.Math.EPSILON6}getSceneOriginPosition(){return this.isColumbusViewMode()?this.cartesianToCVWorld(n.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],0)):n.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],0)}cartesianToCVWorld(e){let i=this.cesiumViewer.scene.mapProjection.project(n.Cartographic.fromCartesian(e));return new t.Vector3(i.z,i.x,i.y)}updateGroupMatrixWorld(){if(this.isColumbusViewMode())return this.cameraOffset.copy(this.getSceneOriginPosition()),this.syncGroup.rotation.set(-Math.PI/2,-Math.PI/2,0),this.syncGroup.updateMatrix(),this.syncGroup.up.set(1,0,0),this.up.set(1,0,0),this.sphere.visible=false,this.sphere3.visible=false,this;this.sphere.visible=true,this.sphere3.visible=true;let e=this.cartesian3ToVector(n.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],0)),i=this.cartesian3ToVector(n.Cartesian3.fromDegrees(this.lngLat[0],this.lngLat[1],2)),s=new t.Vector3().subVectors(e,i).normalize();return this.syncGroup.up.set(0,0,-1),this.syncGroup.lookAt(s),this.syncGroup.up.copy(s),this.syncGroup.updateMatrix(),this.cameraOffset.copy(e),this.syncGroup.up.set(0,0,-1),this.up.set(0,0,-1),this}update(){this.updateSunMatrix(),this.updateGroupMatrixWorld(),this.renderCesium(),this.updateCameraMatrix(),this.isThreeRenderable()?this.renderThree():this.renderer.clear();}add(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.childrenGroup.add(arguments[i]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this.childrenGroup,this.childrenGroup.children.push(e),e.dispatchEvent({type:"added"})):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let s=0;s<arguments.length;s++)this.childrenGroup.remove(arguments[s]);return this}let i=this.childrenGroup.children.indexOf(e);return i!==-1&&(e.parent=null,this.childrenGroup.children.splice(i,1),e.dispatchEvent({type:"removed"})),this}clear(){for(let e=0;e<this.childrenGroup.children.length;e++){let i=this.childrenGroup.children[e];i.parent=null,i.dispatchEvent({type:"removed"});}return this.childrenGroup.children.length=0,this}traverse(e){e(this.childrenGroup);let i=this.childrenGroup.children;for(let s=0,o=i.length;s<o;s++)i[s].traverse(e);}traverseVisible(e){if(this.visible===false||this.childrenGroup.visible===false)return;e(this.childrenGroup);let i=this.childrenGroup.children;for(let s=0,o=i.length;s<o;s++)i[s].traverseVisible(e);}toJSON(e){let i=e===void 0||typeof e=="string",s={};i&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{},options:{}},s.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let o={};if(o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.castShadow===true&&(o.castShadow=true),this.receiveShadow===true&&(o.receiveShadow=true),this.visible===false&&(o.visible=false),this.frustumCulled===false&&(o.frustumCulled=false),this.renderOrder!==0&&(o.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(o.userData=this.userData),o.layers=this.layers.mask,o.matrix=this.matrix.toArray(),this.matrixAutoUpdate===false&&(o.matrixAutoUpdate=false),this.background&&(this.background.isColor?o.background=this.background.toJSON():this.background.isTexture&&(o.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(o.environment=this.environment.toJSON(e).uuid),this.fog!==null&&(o.fog=this.fog.toJSON()),this.options){o.options={};for(let l in this.options)["camera","renderer"].includes(l)||(o.options[l]=this.options[l]);}if(this.childrenGroup.children.length>0){o.children=[];for(let l=0;l<this.childrenGroup.children.length;l++)o.children.push(this.childrenGroup.children[l].toJSON(e).object);}if(i){let l=c(e.geometries),u=c(e.materials),m=c(e.textures),p=c(e.images),f=c(e.shapes),S=c(e.skeletons),v=c(e.animations),x=c(e.nodes);l.length>0&&(s.geometries=l),u.length>0&&(s.materials=u),m.length>0&&(s.textures=m),p.length>0&&(s.images=p),f.length>0&&(s.shapes=f),S.length>0&&(s.skeletons=S),v.length>0&&(s.animations=v),x.length>0&&(s.nodes=x);}return o.isGIS=true,s.object=o,s;function c(l){let u=[];for(let m in l){let p=l[m];delete p.metadata,u.push(p);}return u}}dispose(){this.update=()=>{},this.renderCesium=()=>{},this.renderThree=()=>{},this.updateSunMatrix=()=>{},this.updateCameraMatrix=()=>{},this.updateGroupMatrixWorld=()=>{},this.cesiumViewer.destroy();}cartesian3ToVector(e){return new t.Vector3(e.x,e.y,e.z)}positionToCartesian(e){if(Array.isArray(e))return n.Cartesian3.fromDegrees(e[0],e[1],e.length>2?e[2]:0);if(e&&typeof e=="object"){if(typeof e.longitude=="number"&&typeof e.latitude=="number")return n.Cartesian3.fromRadians(e.longitude,e.latitude,e.height||0);if(typeof e.x=="number"&&typeof e.y=="number"&&typeof e.z=="number")return new n.Cartesian3(e.x,e.y,e.z)}throw new Error("THREE.ThreeCesiumScene: invalid position, expect [lng, lat, height] | Cesium.Cartesian3 | Cesium.Cartographic.")}positionToWorldVector(e){let i=this.positionToCartesian(e),s=this.getSceneOriginPosition();if(this.isColumbusViewMode()){let o=this.cartesianToCVWorld(i);return new t.Vector3(o.x-s.x,o.y-s.y,o.z-s.z)}return new t.Vector3(i.x-s.x,i.y-s.y,i.z-s.z)}setObjectPosition(e,i){if(!e||!e.isObject3D)return console.error("THREE.ThreeCesiumScene.setObjectPosition: object must be an instance of THREE.Object3D.",e),this;this.updateGroupMatrixWorld(),this.updateMatrixWorld(true);let s=this.positionToWorldVector(i);return e.position.copy(this.childrenGroup.worldToLocal(s)),this}getObjectPosition(e){if(!e||!e.isObject3D)return console.error("THREE.ThreeCesiumScene.getObjectPosition: object must be an instance of THREE.Object3D.",e),null;this.updateGroupMatrixWorld(),this.updateMatrixWorld(true);let i=this.getSceneOriginPosition(),s=this.childrenGroup.localToWorld(e.position.clone()),o=new n.Cartesian3(s.x+i.x,s.y+i.y,s.z+i.z),c;return this.isColumbusViewMode()?c=this.cesiumViewer.scene.mapProjection.unproject(new n.Cartesian3(o.y,o.z,o.x)):c=n.Cartographic.fromCartesian(o),[n.Math.toDegrees(c.longitude),n.Math.toDegrees(c.latitude),c.height]}}return r.prototype.isScene=true,r.prototype.isGIS=true,r}function ce(){let t=null,n=null,d=function(h,r,a,e){if(h&&e){let{threeGlobal:i,containerId:s,threeContainerId:o}=e;t=r,n=i,this._viewer=h,this._containerId=s,this._threeContainerId=o,this._Scene=Z({THREE:n,Cesium:t,viewer:h}),this._initContainer(),z(this),b(this,()=>{this.destroyThreeJS();});}};return d.prototype={_initContainer:function(){if(this.cesiumContainer=void 0,this.threeContainer=void 0,this.cesiumContainer=document.getElementById(this._containerId),this.threeContainer=document.getElementById(this._threeContainerId),this.cesiumContainer)this.cesiumContainer.style.position!=="absolute"&&(this.cesiumContainer.style.position="absolute",this.cesiumContainer.style.top=0,this.cesiumContainer.style.left=0,this.cesiumContainer.style.height="100%",this.cesiumContainer.style.width="100%",this.cesiumContainer.style.margin=0,this.cesiumContainer.style.overflow="hidden",this.cesiumContainer.style.padding=0,this.cesiumContainer.style.fontFamily="sans-serif");else return alert("\u672A\u83B7\u53D6\u5230 cesiumContainer \u5BB9\u5668!"),false;if(!this.threeContainer){var h=document.getElementsByTagName("body")[0];h&&(this.threeContainer=document.createElement("div"),this.threeContainer.id=this._threeContainerId,this.threeContainer.style.position="absolute",this.threeContainer.style.top=0,this.threeContainer.style.left=0,this.threeContainer.style.height="100%",this.threeContainer.style.width="100%",this.threeContainer.style.margin=0,this.threeContainer.style.overflow="hidden",this.threeContainer.style.padding=0,this.threeContainer.style.fontFamily="sans-serif",this.threeContainer.style.pointerEvents="none",h.appendChild(this.threeContainer));}},initThree:function(h){var r=h.fov||45,a=window.innerWidth,e=window.innerHeight,i=h.aspect||a/e,s=h.near||1,o=h.far||10*1e3*1e3;return this._three={renderer:null,camera:null,scene:null},this._three.camera=new n.PerspectiveCamera(r,i,s,o),this._three.renderer=new n.WebGLRenderer({alpha:true,antialias:true,logarithmicDepthBuffer:true,stencil:true,depth:true}),this._three.renderer.outputEncoding=n.sRGBEncoding,this._three.renderer.shadowMap.enabled=true,this._three.renderer.shadowMap.type=n.PCFSoftShadowMap,this._three.scene=new this._Scene({cesiumDom:this._containerId,threeHabit:this._objHasOwnProperty(h,"threeHabit",true),enableLighting:this._objHasOwnProperty(h,"enableLighting",true),axesHelper:this._objHasOwnProperty(h,"axesHelper",false),camera:this._three.camera,renderer:this._three.renderer,lngLat:h.center||[104.081701757991,30.627042558105988]}),this.threeContainer&&this.threeContainer.appendChild(this._three.renderer.domElement),this._three},loop(h){let r=a=>{this._rafId=requestAnimationFrame(r),h&&h(a);};this._rafId=requestAnimationFrame(r);},setPosition(h,r){return !this._three||!this._three.scene?(console.error("ThreeJs.setPosition: please call initThree first."),this):(this._three.scene.setObjectPosition(h,r),this)},getPosition(h){return !this._three||!this._three.scene?(console.error("ThreeJs.getPosition: please call initThree first."),null):this._three.scene.getObjectPosition(h)},_objHasOwnProperty(h,r,a){return h.hasOwnProperty(r)?h[r]:a},destroyThreeJS(){this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._three&&this._three.scene&&typeof this._three.scene.dispose=="function"&&this._three.scene.dispose();}},d}var N=j(ce);var Ee=X([],N,"threeJs");exports.ThreeJs=Ee;//# sourceMappingURL=three.cjs.map
140
+ //# sourceMappingURL=three.cjs.map