cesium_dev_kit 1.1.22 → 1.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +299 -291
  3. package/README.zh-CN.md +279 -0
  4. package/SECURITY.md +21 -0
  5. package/dist/Analysis-BLpVrGfg.d.mts +143 -0
  6. package/dist/Analysis-DmO1gtgS.d.ts +143 -0
  7. package/dist/Base-DH8H9suE.d.mts +635 -0
  8. package/dist/Base-DH8H9suE.d.ts +635 -0
  9. package/dist/Base-_BOXyMdS.d.ts +43 -0
  10. package/dist/Base-skqjcPfo.d.mts +43 -0
  11. package/dist/Control-B7AMFmHe.d.ts +98 -0
  12. package/dist/Control-BrpRU7RP.d.mts +98 -0
  13. package/dist/CustomCesiumPlugin-BqgAvlhi.d.ts +29 -0
  14. package/dist/CustomCesiumPlugin-CKYQ-7i9.d.mts +29 -0
  15. package/dist/Draw-1NhPP8z3.d.mts +490 -0
  16. package/dist/Draw-DRh7yNzc.d.ts +490 -0
  17. package/dist/Graphics-CuFNsQ3b.d.ts +1565 -0
  18. package/dist/Graphics-QE3Gb43w.d.mts +1565 -0
  19. package/dist/Material-CeZ4l-tY.d.mts +165 -0
  20. package/dist/Material-Cqbyf2Pn.d.ts +165 -0
  21. package/dist/Math3d-0nO-vFbT.d.mts +179 -0
  22. package/dist/Math3d-t635PYzU.d.ts +179 -0
  23. package/dist/PassEffect-DEFyytQZ.d.ts +41 -0
  24. package/dist/PassEffect-DEgElnVk.d.mts +41 -0
  25. package/dist/Plugin-BPCX0zTu.d.mts +197 -0
  26. package/dist/Plugin-DnYT0bue.d.ts +197 -0
  27. package/dist/Primitive-BNXp-9_6.d.mts +199 -0
  28. package/dist/Primitive-UEAuUimH.d.ts +199 -0
  29. package/dist/ThreeJs-BAlEWxa1.d.mts +44 -0
  30. package/dist/ThreeJs-DpAcw_qf.d.ts +44 -0
  31. package/dist/analysis.cjs +145 -0
  32. package/dist/analysis.cjs.map +1 -0
  33. package/dist/analysis.d.mts +6 -0
  34. package/dist/analysis.d.ts +6 -0
  35. package/dist/analysis.mjs +145 -0
  36. package/dist/analysis.mjs.map +1 -0
  37. package/dist/control.cjs +140 -0
  38. package/dist/control.cjs.map +1 -0
  39. package/dist/control.d.mts +4 -0
  40. package/dist/control.d.ts +4 -0
  41. package/dist/control.mjs +140 -0
  42. package/dist/control.mjs.map +1 -0
  43. package/dist/custom-cesium-plugin.cjs +507 -0
  44. package/dist/custom-cesium-plugin.cjs.map +1 -0
  45. package/dist/custom-cesium-plugin.d.mts +4 -0
  46. package/dist/custom-cesium-plugin.d.ts +4 -0
  47. package/dist/custom-cesium-plugin.mjs +507 -0
  48. package/dist/custom-cesium-plugin.mjs.map +1 -0
  49. package/dist/default-static.cjs +3 -0
  50. package/dist/default-static.cjs.map +1 -0
  51. package/dist/default-static.d.mts +37 -0
  52. package/dist/default-static.d.ts +37 -0
  53. package/dist/default-static.mjs +3 -0
  54. package/dist/default-static.mjs.map +1 -0
  55. package/dist/draw.cjs +140 -0
  56. package/dist/draw.cjs.map +1 -0
  57. package/dist/draw.d.mts +6 -0
  58. package/dist/draw.d.ts +6 -0
  59. package/dist/draw.mjs +140 -0
  60. package/dist/draw.mjs.map +1 -0
  61. package/dist/graphics.cjs +140 -0
  62. package/dist/graphics.cjs.map +1 -0
  63. package/dist/graphics.d.mts +19 -0
  64. package/dist/graphics.d.ts +19 -0
  65. package/dist/graphics.mjs +140 -0
  66. package/dist/graphics.mjs.map +1 -0
  67. package/dist/index.cjs +1112 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.mts +674 -0
  70. package/dist/index.d.ts +674 -0
  71. package/dist/index.mjs +1112 -0
  72. package/dist/index.mjs.map +1 -0
  73. package/dist/material.cjs +391 -0
  74. package/dist/material.cjs.map +1 -0
  75. package/dist/material.d.mts +4 -0
  76. package/dist/material.d.ts +4 -0
  77. package/dist/material.mjs +391 -0
  78. package/dist/material.mjs.map +1 -0
  79. package/dist/pass-effect.cjs +416 -0
  80. package/dist/pass-effect.cjs.map +1 -0
  81. package/dist/pass-effect.d.mts +4 -0
  82. package/dist/pass-effect.d.ts +4 -0
  83. package/dist/pass-effect.mjs +416 -0
  84. package/dist/pass-effect.mjs.map +1 -0
  85. package/dist/plugin.cjs +141 -0
  86. package/dist/plugin.cjs.map +1 -0
  87. package/dist/plugin.d.mts +4 -0
  88. package/dist/plugin.d.ts +4 -0
  89. package/dist/plugin.mjs +141 -0
  90. package/dist/plugin.mjs.map +1 -0
  91. package/dist/primitive.cjs +370 -0
  92. package/dist/primitive.cjs.map +1 -0
  93. package/dist/primitive.d.mts +4 -0
  94. package/dist/primitive.d.ts +4 -0
  95. package/dist/primitive.mjs +370 -0
  96. package/dist/primitive.mjs.map +1 -0
  97. package/dist/three.cjs +140 -0
  98. package/dist/three.cjs.map +1 -0
  99. package/dist/three.d.mts +4 -0
  100. package/dist/three.d.ts +4 -0
  101. package/dist/three.mjs +140 -0
  102. package/dist/three.mjs.map +1 -0
  103. package/package.json +290 -46
  104. package/dist/index.js +0 -1
  105. package/dist/index.min.js +0 -1
  106. package/dist/index.umd.js +0 -1
  107. package/index.js +0 -37
@@ -0,0 +1,507 @@
1
+ 'use strict';var le=class extends Error{constructor(o,d,s={}){super(`[cesium_dev_kit:${o}] ${d}`),this.name="CesiumDevKitError",this.code=o,this.details=s.details,this.cause=s.cause,Object.setPrototypeOf(this,new.target.prototype);}};function ce(t,o){let d=o!=null&&o.scope?`[cesium_dev_kit:${o.scope}]`:"[cesium_dev_kit]";console.warn(d,t,o!=null?o:"");}var he=class{constructor(o){this.viewer=null;this.Cesium=o,this.init_data();}init_data(){this.viewer=null;}init({containerId:o,viewerConfig:d,extraConfig:s,MapImageryList:e,imageryProvider:n,viewer:i}){let a=o,m={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},c=this.findCesiumProvider(n),y=s==null?void 0:s.AccessToken;y&&(this.Cesium.Ion.defaultAccessToken=y),m=Object.assign(m,d);let h=i||new this.Cesium.Viewer(a,{...m,...c});if(s&&!s.logo){let u=h.cesiumWidget.creditContainer;u.style.display="none";}if(s&&s.depthTest&&(h.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(h,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(h,u);}return this.viewer=h,h}bindContainerResize(o,d){if(typeof ResizeObserver=="undefined"||!d)return;let s=()=>{try{(typeof o.isDestroyed!="function"||!o.isDestroyed())&&o.resize();}catch(i){ce(i,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(s);e.observe(d),typeof requestAnimationFrame=="function"&&requestAnimationFrame(s);let n=o.destroy.bind(o);o.destroy=function(){try{e.disconnect();}catch(i){ce(i,{scope:"Controller.bindContainerResize.disconnect"});}return n()};}addImageryProvider(o,d,s){o.imageryLayers.addImageryProvider(this.createCesiumProvider({type:d,option:s}));}findCesiumProvider(o){let d={};if(!o)return d;for(let s in o){let e=o[s];if(e&&e.type){d[s]=this.createCesiumProvider(e);continue}d[s]=o[s];}return d}createCesiumProvider(o){switch(o.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[o.type](o.option);case "UrlTemplateImageryProvider":return new this.Cesium[o.type](o.option);case "TileMapServiceImageryProvider":return new this.Cesium[o.type](o.option)}}};function Ie(t,o){if(!o)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(o)||o.startsWith("data:")||o.startsWith("/"))return o;let d=(t||"").replace(/\/+$/,"");return d?d+"/"+o.replace(/^\/+/,""):o}function _e(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 ot=Object.assign((t,o)=>t!=null?t:o,{EMPTY_OBJECT:Object.freeze({})}),de=ot;function we(t){function o(...d){let s=t();return new s(...d)}return o.prototype=t().prototype,Object.defineProperty(o,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),o}function me(t){let o=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof o=="function"?o():t}function Be(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(o){console.warn("[cesium_dev_kit] failed to dispose viewer:",o);}}var ne=new WeakMap;function ye(t,o){if(!t||typeof o!="function")return;let d=ne.get(t);d?d.push(o):ne.set(t,[o]);}function Se(t,o){if(!t||!o||t===o)return;let d=ne.get(t);if(!d||d.length===0)return;ne.delete(t);let s=ne.get(o);s?s.push(...d):ne.set(o,d);}function Ce(t){if(!t||typeof t!="object"&&typeof t!="function")return;let o=ne.get(t);if(o){ne.delete(t);for(let d=o.length-1;d>=0;d--)try{o[d]();}catch(s){console.warn("[cesium_dev_kit] cleanup failed:",s);}}}function st(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){Ce(this);},enumerable:false,configurable:true,writable:true});}function lt(){let t={},o;class d{constructor(e,n,i){if(e){this._viewer=e,t=n,o=i||_e(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let a=this._drawLayer;st(this),ye(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,n,i){return e.hasOwnProperty(n)?e[n]:i}getDfSt(e){if(!o)return;let n=o,i=e.reduce((a,m)=>a?a[m]:n[m],void 0);if(i!=null)return typeof i!="string"?i:Ie(n.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 n=`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:n,uniforms:{scale:1,offset(){return e.offset||new t.Cartesian3(.1,.2,.3)}}}))}setBlurBloom(e){if(this._viewer&&e){var n=`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:n,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(n=>{this._viewer.scene.postProcessStages.contains(n)&&this._viewer.scene.postProcessStages.remove(n);}):this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e));}setView(e){if(this._viewer&&e&&e.position){if(e.distance){var n=new t.Cartesian3(0,e.distance,window.opt.distance);e.position=t.Cartesian3.add(e.position,n,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 n=new t.Cartesian3(0,e.distance,0);e.position=t.Cartesian3.add(e.position,n,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 n,i,a;if(this._viewer&&e){if(e.x===void 0&&(e.lng!==void 0||e.lon!==void 0))return {lng:Number((n=e.lng)!=null?n:e.lon),lat:Number(e.lat),alt:Number((a=(i=e.alt)!=null?i:e.height)!=null?a:0)};let m=t.Cartographic.fromCartesian(e);return {lng:t.Math.toDegrees(m.longitude),lat:t.Math.toDegrees(m.latitude),alt:m.height}}}transformWGS84ArrayToCartesianArray(e,n){if(this._viewer&&e){var i=this;return e?e.map(function(a){return i.transformWGS84ToCartesian(a,n)}):[]}}transformWGS84ToCartesian(e,n){if(this._viewer)return e?t.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=n||e.alt,t.Ellipsoid.WGS84):t.Cartesian3.ZERO}transformCartesianArrayToWGS84Array(e){if(this._viewer){var n=this;return e?e.map(function(i){return n.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 n=[];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));n.push(a);}return n}setCameraEotateHeading(e){if(e){let n=this._viewer,i=t.Cartesian3.fromDegrees(e.lng,e.lat,e.height),a=t.Math.toRadians(-30),m=360/30,c=5e3,y=t.JulianDate.fromDate(new Date);n.clock.startTime=y.clone(),n.clock.currentTime=y.clone(),n.clock.clockRange=t.ClockRange.CLAMPED,n.clock.clockStep=t.ClockStep.SYSTEM_CLOCK;let h=n.camera.heading,u=function(){let _=t.JulianDate.secondsDifference(n.clock.currentTime,n.clock.startTime),x=t.Math.toRadians(_*m)+h;n.scene.camera.setView({destination:i,orientation:{heading:x,pitch:a}}),n.scene.camera.moveBackward(c),t.JulianDate.compare(n.clock.currentTime,n.clock.stopTime)>=0&&n.clock.onTick.removeEventListener(u);};n.clock.onTick.addEventListener(u),ye(this,()=>{n.clock.onTick.removeEventListener(u);});}}getCatesian3FromPX(e){if(this._viewer&&e){var n=this._viewer.scene.pick(e),i=null,a=false,m=false;if(n instanceof t.Cesium3DTileFeature&&(a=true),a&&(i=this._viewer.scene.pickPosition(e),i)){let y=t.Cartographic.fromCartesian(i);y.height<0&&(y.height=0);let h=t.Math.toDegrees(y.longitude),u=t.Math.toDegrees(y.latitude),g=y.height;i=this.transformWGS84ToCartesian({lng:h,lat:u,alt:g});}if(!n){var c=this._viewer.scene.camera.getPickRay(e);if(!c)return null;i=this._viewer.scene.globe.pick(c,this._viewer.scene),m=true;}if(n&&!a&&(i=this._viewer.scene.pickPosition(e),i)){let y=t.Cartographic.fromCartesian(i);y.height<0&&(y.height=0);let h=t.Math.toDegrees(y.longitude),u=t.Math.toDegrees(y.latitude),g=y.height;i=this.transformWGS84ToCartesian({lng:h,lat:u,alt:g});}if(!a&&!m&&!n&&(i=this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid)),i){let y=this.transformCartesianToWGS84(i);return y.alt<0&&(i=this.transformWGS84ToCartesian(y,.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 n=t.Ellipsoid.WGS84.cartesianToCartographic(e),i=n.longitude*180/Math.PI,a=n.latitude*180/Math.PI,m=this._viewer.camera._direction,c=t.Math.toDegrees(m.x),y=t.Math.toDegrees(m.y),h=t.Math.toDegrees(m.z),u=this._viewer.camera.positionCartographic.height,g=t.Math.toDegrees(this._viewer.camera.heading),_=t.Math.toDegrees(this._viewer.camera.pitch),x=t.Math.toDegrees(this._viewer.camera.roll),D=this._viewer.camera.computeViewRectangle(),O=D.west/Math.PI*180,z=D.north/Math.PI*180,b=D.east/Math.PI*180,F=D.south/Math.PI*180,P=(O+b)/2,V=(z+F)/2;return {lon:i,lat:a,height:u,heading:g,pitch:_,roll:x,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:P,y:V},direction:new t.Cartesian3(c,y,h)}}}}pickUpPosition(e){return this.getCatesian3FromPX(e.position)}getHandlerClickPosition(e){if(this._viewer){let n=this._viewer.scene,i=this._viewer,a=n.camera.pickEllipsoid(e.position,n.globe.elliposid),m={cameraPosistion:i.camera.position,heading:i.camera.heading,pitch:i.camera.pitch,roll:i.camera.roll},c=t.Cartographic.fromCartesian(a);c.height<0&&(c.height=0);let y={alt:c.height,lat:t.Math.toDegrees(c.latitude),lon:t.Math.toDegrees(c.longitude)},h=n.pickPosition(e.position),u=t.Cartographic.fromCartesian(h),g={height:u.height,latitude:t.Math.toDegrees(u.latitude),longitude:t.Math.toDegrees(u.longitude)};return {wgs84Coor:y,graphicCoor:g,cameraPosition:m}}}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:n,doubleClick:i,leftDown:a,mouseWheel:m,leftUp:c}){if(this._viewer){var y=new t.ScreenSpaceEventHandler(this._viewer.canvas);ye(this,()=>{y&&!y.isDestroyed()&&y.destroy();}),e&&y.setInputAction(function(h){e(h,y);},t.ScreenSpaceEventType.LEFT_CLICK),n&&y.setInputAction(function(h){n(h,y);},t.ScreenSpaceEventType.MOUSE_MOVE),i&&y.setInputAction(function(h){i(h,y);},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),a&&y.setInputAction(function(h){a(h,y);},t.ScreenSpaceEventType.LEFT_DOWN),m&&y.setInputAction(function(h){m(h,y);},t.ScreenSpaceEventType.WHEEL),c&&y.setInputAction(function(h){c(h,y);},t.ScreenSpaceEventType.LEFT_UP);}}bindHandelEvent(e){return this.bindHandleEvent(e)}getHandlePosition(e){if(this._viewer){var n=new t.ScreenSpaceEventHandler(this._viewer.scene.canvas),i=this;ye(this,()=>{n&&!n.isDestroyed()&&n.destroy();}),n.setInputAction(function(a){var m=i._viewer.scene.camera.pickEllipsoid(a.endPosition,i._viewer.scene.globe.ellipsoid);typeof e=="function"&&e(i.transformCartesianToWGS84(m),n);},t.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(e){return this.getHandlePosition(e)}saveSceneImages(){if(this._viewer){let c=function(y){for(var h=y.split(","),u=h[0].match(/:(.*?);/)[1],g=atob(h[1]),_=g.length,x=new Uint8Array(_);_--;)x[_]=g.charCodeAt(_);return new Blob([x],{type:u})};var e=this._viewer.scene.canvas,n=e.toDataURL("image/png").replace("image/png","image/octet-stream"),i=document.createElement("a"),a=c(n),m=URL.createObjectURL(a);i.download="scene.png",i.href=m,i.click();}}_installAmapImageryProvider(){let e="https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",n="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:n,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 n(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=n;}_installTencentImageryProvider(){let e="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229",n="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(m,c,y,h){return c>>4},sy(m,c,y,h){return (1<<h)-y>>4}}):a.url||(a.url=n),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",n="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(m){return m.url=m.style==="img"?n:m.style==="ter"?i:e,m.subdomains||(m.subdomains=["1","2","3","4","5"]),new t.UrlTemplateImageryProvider(m)}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 n(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(n.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,m,c,y,h){var u=a._url+"&x={x}&y={y}&z={z}&customid={style}",g=a._tilingScheme.getNumberOfXTilesAtLevel(y),_=a._tilingScheme.getNumberOfYTilesAtLevel(y);return u=u.replace("{x}",String(m-g/2)).replace("{y}",String(_/2-c-1)).replace("{z}",String(y)).replace("{style}",h),u}n.prototype.getTileCredits=function(a,m,c){},n.prototype.requestImage=function(a,m,c){if(!this.ready)throw new t.DeveloperError("requestImage must not be called before the imagery provider is ready.");var y=i(this,a,m,c,this._style);return t.ImageryProvider.loadImage(this,y)},t.Scene.BaiduImageryProvider=n;}_installGroundSkyBox(){var e=t.BoxGeometry,n=t.Cartesian3,i=t.defaultValue||de,a=t.defined,m=t.destroyObject,c=t.DeveloperError,y=t.GeometryPipeline,h=t.Matrix3,u=t.Matrix4,g=t.Transforms,_=t.VertexFormat,x=t.BufferUsage,D=t.CubeMap,O=t.DrawCommand,z=t.loadCubeMap,b=t.RenderState,F=t.VertexArray,P=t.BlendingState,V=t.SceneMode,f=t.ShaderProgram,I=t.ShaderSource,G=`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
+ `,L=`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
+ `,S=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function B(E){this.sources=E.sources,this._sources=void 0,this.show=i(E.show,true),this._command=new O({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var U=new h;B.prototype.update=function(E,H){var Y=this;if(this.show&&!(E.mode!==V.SCENE3D&&E.mode!==V.MORPHING)&&E.passes.render){var q=E.context;if(this._sources!==this.sources){this._sources=this.sources;var N=this.sources;if(!a(N.positiveX)||!a(N.negativeX)||!a(N.positiveY)||!a(N.negativeY)||!a(N.positiveZ)||!a(N.negativeZ))throw new c("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof N.positiveX!=typeof N.negativeX||typeof N.positiveX!=typeof N.positiveY||typeof N.positiveX!=typeof N.negativeY||typeof N.positiveX!=typeof N.positiveZ||typeof N.positiveX!=typeof N.negativeZ)throw new c("this.sources properties must all be the same type.");typeof N.positiveX=="string"?z(q,this._sources).then(function(te){Y._cubeMap=Y._cubeMap&&Y._cubeMap.destroy(),Y._cubeMap=te;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new D({context:q,source:N}));}var Q=this._command;if(Q.modelMatrix=g.eastNorthUpToFixedFrame(E.camera._positionWC),!a(Q.vertexArray)){Q.uniformMap={u_cubeMap(){return Y._cubeMap},u_rotateMatrix(){return S(Q.modelMatrix,U)}};var W=e.createGeometry(e.fromDimensions({dimensions:new n(2,2,2),vertexFormat:_.POSITION_ONLY})),ee=this._attributeLocations=y.createAttributeLocations(W);Q.vertexArray=F.fromGeometry({context:q,geometry:W,attributeLocations:ee,bufferUsage:x._DRAW}),Q.renderState=b.fromCache({blending:P.ALPHA_BLEND});}if(!a(Q.shaderProgram)||this._useHdr!==H){var A=new I({defines:[H?"HDR":""],sources:[G]});Q.shaderProgram=f.fromCache({context:q,vertexShaderSource:L,fragmentShaderSource:A,attributeLocations:this._attributeLocations}),this._useHdr=H;}if(a(this._cubeMap))return Q}},B.prototype.isDestroyed=function(){return false},B.prototype.destroy=function(){var E=this._command;return E.vertexArray=E.vertexArray&&E.vertexArray.destroy(),E.shaderProgram=E.shaderProgram&&E.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),m(this)},t.Scene.GroundSkyBox=B;}removeHandlerByName(e=[]){e.forEach(n=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[n]);});}}return d}var xe=we(lt);function ct(t,o,d,s){function e(n,i){let a={},m=me(i),c=[];if(Array.isArray(n))n.forEach(h=>{let u=me(h),g=new u(t,o,d,s);y(u,m),c.push(g);}),a=new m(t,o,d,s),c.forEach(h=>Object.assign(a,h)),c.forEach(h=>Se(h,a));else {let h=me(n),u=new h(t,o,d,s);y(h,m),a=new m(t,o,d,s),Object.assign(a,u),Se(u,a);}function y(h,u){let g=Object.getOwnPropertyNames(h.prototype);for(let _=0,x=g.length;_<x;_++)g[_]!=="constructor"&&(u.prototype[g[_]]=h.prototype[g[_]]);}return a}return e}function ut({cesiumGlobal:t,threeGlobal:o,containerId:d,threeContainerId:s,viewerConfig:e={},extraConfig:n={},MapImageryList:i=[],defaultStatic:a,baseExtendsCom:m=[],extendsCom:c,extendsComName:y,viewer:h}){if(!t)throw new le("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!d&&!h)throw new le("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 g=new he(t).init({containerId:d,viewerConfig:e,extraConfig:n,MapImageryList:i,viewer:h}),_=!h,O=ct(g,t,a,o?{threeGlobal:o,containerId:d,threeContainerId:s}:"")(m,c),z=false;return {viewer:g,[y]:O,dispose:()=>{if(!z){z=true;try{typeof O.destroy=="function"?O.destroy():Ce(O);}catch(b){ce(b,{scope:"singleImport.dispose"});}_&&Be(g);}}}}function Le(t,o,d){function s(e){return ut({...e,baseExtendsCom:t,extendsCom:o,extendsComName:d})}return s}var Ve=`#ifdef GL_OES_standard_derivatives
140
+ #extension GL_OES_standard_derivatives : enable
141
+ #endif
142
+
143
+ uniform bool u_showIntersection;
144
+ uniform bool u_showThroughEllipsoid;
145
+
146
+ uniform float u_radius;
147
+ uniform float u_xHalfAngle;
148
+ uniform float u_yHalfAngle;
149
+ uniform float u_normalDirection;
150
+ uniform vec4 u_color;
151
+
152
+ in vec3 v_position;
153
+ in vec3 v_positionWC;
154
+ in vec3 v_positionEC;
155
+ in vec3 v_normalEC;
156
+
157
+ vec4 getColor(float sensorRadius, vec3 pointEC) {
158
+ czm_materialInput materialInput;
159
+
160
+ vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;
161
+ materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);
162
+ materialInput.str = pointMC / sensorRadius;
163
+
164
+ vec3 positionToEyeEC = -v_positionEC;
165
+ materialInput.positionToEyeEC = positionToEyeEC;
166
+
167
+ vec3 normalEC = normalize(v_normalEC);
168
+ materialInput.normalEC = u_normalDirection * normalEC;
169
+
170
+ czm_material material = czm_getMaterial(materialInput);
171
+
172
+ material.diffuse = u_color.rgb;
173
+ material.alpha = u_color.a;
174
+
175
+ return mix(
176
+ czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC),
177
+ vec4(material.diffuse, material.alpha), 0.4);
178
+ }
179
+
180
+ bool isOnBoundary(float value, float epsilon) {
181
+ float width = getIntersectionWidth();
182
+ float tolerance = width * epsilon;
183
+
184
+ #ifdef GL_OES_standard_derivatives
185
+ float delta = max(abs(dFdx(value)), abs(dFdy(value)));
186
+ float pixels = width * delta;
187
+ float temp = abs(value);
188
+ // There are a couple things going on here.
189
+ // First we test the value at the current fragment to see if it is within the
190
+ // tolerance. We also want to check if the value of an adjacent pixel is
191
+ // within the tolerance, but we don't want to admit points that are obviously
192
+ // not on the surface. For example, if we are looking for "value" to be close
193
+ // to 0, but value is 1 and the adjacent value is 2, then the delta would be 1
194
+ // and "temp - delta" would be "1 - 1" which is zero even though neither of
195
+ // the points is close to zero.
196
+ return temp < tolerance && temp < pixels ||
197
+ (delta < 10.0 * tolerance && temp - delta < tolerance &&
198
+ temp < pixels);
199
+ #else
200
+ return abs(value) < tolerance;
201
+ #endif
202
+ }
203
+
204
+ vec4 shade(bool isOnBoundary) {
205
+ if (u_showIntersection && isOnBoundary) {
206
+ return getIntersectionColor();
207
+ }
208
+ return getColor(u_radius, v_positionEC);
209
+ }
210
+
211
+ float ellipsoidSurfaceFunction(vec3 inverseRadii, vec3 point) {
212
+ vec3 scaled = inverseRadii * point;
213
+ return dot(scaled, scaled) - 1.0;
214
+ }
215
+
216
+ void main() {
217
+ vec3 sensorVertexWC =
218
+ czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates
219
+ vec3 sensorVertexEC =
220
+ czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates
221
+
222
+ // vec3 pixDir = normalize(v_position);
223
+ float positionX = v_position.x;
224
+ float positionY = v_position.y;
225
+ float positionZ = v_position.z;
226
+
227
+ vec3 zDir = vec3(0.0, 0.0, 1.0);
228
+ vec3 lineX = vec3(positionX, 0, positionZ);
229
+ vec3 lineY = vec3(0, positionY, positionZ);
230
+ float resX = dot(normalize(lineX), zDir);
231
+ if (resX < cos(u_xHalfAngle) - 0.0001) {
232
+ discard;
233
+ }
234
+ float resY = dot(normalize(lineY), zDir);
235
+ if (resY < cos(u_yHalfAngle) - 0.0001) {
236
+ discard;
237
+ }
238
+
239
+ // czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();
240
+ float ellipsoidValue =
241
+ ellipsoidSurfaceFunction(czm_ellipsoidInverseRadii, v_positionWC);
242
+
243
+ // Occluded by the ellipsoid?
244
+ if (!u_showThroughEllipsoid) {
245
+ // Discard if in the ellipsoid
246
+ // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done
247
+ // on the CPU first.
248
+ if (ellipsoidValue < 0.0) {
249
+ discard;
250
+ }
251
+
252
+ // Discard if in the sensor's shadow
253
+ if (inSensorShadow(sensorVertexWC, czm_ellipsoidInverseRadii,
254
+ v_positionWC)) {
255
+ discard;
256
+ }
257
+ }
258
+
259
+ // Notes: Each surface functions should have an associated tolerance based on
260
+ // the floating point error.
261
+ bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);
262
+ out_FragColor = shade(isOnEllipsoid);
263
+ }`,Ee=`in vec4 position;
264
+ in vec3 normal;
265
+
266
+ out vec3 v_position;
267
+ out vec3 v_positionWC;
268
+ out vec3 v_positionEC;
269
+ out vec3 v_normalEC;
270
+
271
+ void main() {
272
+ gl_Position = czm_modelViewProjection * position;
273
+ v_position = vec3(position);
274
+ v_positionWC = (czm_model * position).xyz;
275
+ v_positionEC = (czm_modelView * position).xyz;
276
+ v_normalEC = czm_normal * normal;
277
+ }`,pe=`uniform vec4 u_intersectionColor;
278
+ uniform float u_intersectionWidth;
279
+ uniform vec4 u_lineColor;
280
+
281
+ bool inSensorShadow(vec3 coneVertexWC, vec3 inverseRadii, vec3 pointWC) {
282
+ // Diagonal matrix from the unscaled ellipsoid space to the scaled space.
283
+ vec3 D = inverseRadii;
284
+
285
+ // Sensor vertex in the scaled ellipsoid space
286
+ vec3 q = D * coneVertexWC;
287
+ float qMagnitudeSquared = dot(q, q);
288
+ float test = qMagnitudeSquared - 1.0;
289
+
290
+ // Sensor vertex to fragment vector in the ellipsoid's scaled space
291
+ vec3 temp = D * pointWC - q;
292
+ float d = dot(temp, q);
293
+
294
+ // Behind silhouette plane and inside silhouette cone
295
+ return (d < -test) && (d / length(temp) < -sqrt(test));
296
+ }
297
+
298
+ ///////////////////////////////////////////////////////////////////////////////
299
+
300
+ vec4 getLineColor() { return u_lineColor; }
301
+
302
+ vec4 getIntersectionColor() { return u_intersectionColor; }
303
+
304
+ float getIntersectionWidth() { return u_intersectionWidth; }
305
+
306
+ vec2 sensor2dTextureCoordinates(float sensorRadius, vec3 pointMC) {
307
+ // (s, t) both in the range [0, 1]
308
+ float t = pointMC.z / sensorRadius;
309
+ float s = 1.0 + (atan(pointMC.y, pointMC.x) / czm_twoPi);
310
+ s = s - floor(s);
311
+
312
+ return vec2(s, t);
313
+ }`,Pe=`#ifdef GL_OES_standard_derivatives
314
+ #extension GL_OES_standard_derivatives : enable
315
+ #endif
316
+
317
+ uniform bool u_showIntersection;
318
+ uniform bool u_showThroughEllipsoid;
319
+
320
+ uniform float u_radius;
321
+ uniform float u_xHalfAngle;
322
+ uniform float u_yHalfAngle;
323
+ uniform float u_normalDirection;
324
+ uniform float u_type;
325
+
326
+ in vec3 v_position;
327
+ in vec3 v_positionWC;
328
+ in vec3 v_positionEC;
329
+ in vec3 v_normalEC;
330
+
331
+ vec4 getColor(float sensorRadius, vec3 pointEC) {
332
+ czm_materialInput materialInput;
333
+
334
+ vec3 pointMC = (czm_inverseModelView * vec4(pointEC, 1.0)).xyz;
335
+ materialInput.st = sensor2dTextureCoordinates(sensorRadius, pointMC);
336
+ materialInput.str = pointMC / sensorRadius;
337
+
338
+ vec3 positionToEyeEC = -v_positionEC;
339
+ materialInput.positionToEyeEC = positionToEyeEC;
340
+
341
+ vec3 normalEC = normalize(v_normalEC);
342
+ materialInput.normalEC = u_normalDirection * normalEC;
343
+
344
+ czm_material material = czm_getMaterial(materialInput);
345
+
346
+ return mix(
347
+ czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC),
348
+ vec4(material.diffuse, material.alpha), 0.4);
349
+ }
350
+
351
+ bool isOnBoundary(float value, float epsilon) {
352
+ float width = getIntersectionWidth();
353
+ float tolerance = width * epsilon;
354
+
355
+ #ifdef GL_OES_standard_derivatives
356
+ float delta = max(abs(dFdx(value)), abs(dFdy(value)));
357
+ float pixels = width * delta;
358
+ float temp = abs(value);
359
+ // There are a couple things going on here.
360
+ // First we test the value at the current fragment to see if it is within the
361
+ // tolerance. We also want to check if the value of an adjacent pixel is
362
+ // within the tolerance, but we don't want to admit points that are obviously
363
+ // not on the surface. For example, if we are looking for "value" to be close
364
+ // to 0, but value is 1 and the adjacent value is 2, then the delta would be 1
365
+ // and "temp - delta" would be "1 - 1" which is zero even though neither of
366
+ // the points is close to zero.
367
+ return temp < tolerance && temp < pixels ||
368
+ (delta < 10.0 * tolerance && temp - delta < tolerance &&
369
+ temp < pixels);
370
+ #else
371
+ return abs(value) < tolerance;
372
+ #endif
373
+ }
374
+
375
+ vec4 shade(bool isOnBoundary) {
376
+ if (u_showIntersection && isOnBoundary) {
377
+ return getIntersectionColor();
378
+ }
379
+ if (u_type == 1.0) {
380
+ return getLineColor();
381
+ }
382
+ return getColor(u_radius, v_positionEC);
383
+ }
384
+
385
+ float ellipsoidSurfaceFunction(vec3 inverseRadii, vec3 point) {
386
+ vec3 scaled = inverseRadii * point;
387
+ return dot(scaled, scaled) - 1.0;
388
+ }
389
+
390
+ void main() {
391
+ vec3 sensorVertexWC =
392
+ czm_model[3].xyz; // (0.0, 0.0, 0.0) in model coordinates
393
+ vec3 sensorVertexEC =
394
+ czm_modelView[3].xyz; // (0.0, 0.0, 0.0) in model coordinates
395
+
396
+ // vec3 pixDir = normalize(v_position);
397
+ float positionX = v_position.x;
398
+ float positionY = v_position.y;
399
+ float positionZ = v_position.z;
400
+
401
+ vec3 zDir = vec3(0.0, 0.0, 1.0);
402
+ vec3 lineX = vec3(positionX, 0, positionZ);
403
+ vec3 lineY = vec3(0, positionY, positionZ);
404
+ float resX = dot(normalize(lineX), zDir);
405
+ if (resX < cos(u_xHalfAngle) - 0.00001) {
406
+ discard;
407
+ }
408
+ float resY = dot(normalize(lineY), zDir);
409
+ if (resY < cos(u_yHalfAngle) - 0.00001) {
410
+ discard;
411
+ }
412
+
413
+ // czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();
414
+ float ellipsoidValue =
415
+ ellipsoidSurfaceFunction(czm_ellipsoidInverseRadii, v_positionWC);
416
+
417
+ // Occluded by the ellipsoid?
418
+ if (!u_showThroughEllipsoid) {
419
+ // Discard if in the ellipsoid
420
+ // PERFORMANCE_IDEA: A coarse check for ellipsoid intersection could be done
421
+ // on the CPU first.
422
+ if (ellipsoidValue < 0.0) {
423
+ discard;
424
+ }
425
+
426
+ // Discard if in the sensor's shadow
427
+ if (inSensorShadow(sensorVertexWC, czm_ellipsoidInverseRadii,
428
+ v_positionWC)) {
429
+ discard;
430
+ }
431
+ }
432
+
433
+ // Notes: Each surface functions should have an associated tolerance based on
434
+ // the floating point error.
435
+ bool isOnEllipsoid = isOnBoundary(ellipsoidValue, czm_epsilon3);
436
+ // isOnEllipsoid = false;
437
+ // if((resX >= 0.8 && resX <= 0.81)||(resY >= 0.8 && resY <= 0.81)){
438
+ /*if(false){
439
+ out_FragColor = vec4(1.0,0.0,0.0,1.0);
440
+ }else{
441
+ out_FragColor = shade(isOnEllipsoid);
442
+ }
443
+ */
444
+ out_FragColor = shade(isOnEllipsoid);
445
+ }`;var M={};function Oe(t){M=t;var o=M.BoundingSphere,d=M.Cartesian3,s=M.Color,e=M.combine,n=M.ComponentDatatype,i=M.defaultValue||M.Scene.defaultValue,a=M.defined;M.destroyObject;var y=M.DeveloperError,S=M.Matrix4,h=M.PrimitiveType,u=M.Buffer,g=M.BufferUsage,_=M.DrawCommand,x=M.Pass,D=M.RenderState,O=M.ShaderProgram,z=M.ShaderSource,b=M.VertexArray,F=M.BlendingState,P=M.CullFace,V=M.Material,f=M.SceneMode,I=M.VertexFormat,G=M.Math,L=M.Matrix3,S=M.Matrix4,B=M.JulianDate;M.BoxGeometry;M.EllipsoidGeometry;var H=Math.sin,Y=Math.cos,q=Math.tan,N=Math.atan,W={position:0,normal:1};function ee(r){var p=this;r=i(r,i.EMPTY_OBJECT),this.show=i(r.show,true),this.slice=i(r.slice,32),this.modelMatrix=S.clone(r.modelMatrix,new S),this._modelMatrix=new S,this._computedModelMatrix=new S,this._computedScanPlaneModelMatrix=new S,this.radius=i(r.radius,Number.POSITIVE_INFINITY),this._radius=void 0,this.xHalfAngle=i(r.xHalfAngle,0),this._xHalfAngle=void 0,this.yHalfAngle=i(r.yHalfAngle,0),this._yHalfAngle=void 0,this.lineColor=i(r.lineColor,s.WHITE),this.showSectorLines=i(r.showSectorLines,true),this.showSectorSegmentLines=i(r.showSectorSegmentLines,true),this.showLateralSurfaces=i(r.showLateralSurfaces,true),this.material=a(r.material)?r.material:V.fromType(V.ColorType),this._material=void 0,this._translucent=void 0,this.lateralSurfaceMaterial=a(r.lateralSurfaceMaterial)?r.lateralSurfaceMaterial:V.fromType(V.ColorType),this._lateralSurfaceMaterial=void 0,this._lateralSurfaceTranslucent=void 0,this.showDomeSurfaces=i(r.showDomeSurfaces,true),this.domeSurfaceMaterial=a(r.domeSurfaceMaterial)?r.domeSurfaceMaterial:V.fromType(V.ColorType),this._domeSurfaceMaterial=void 0,this.showDomeLines=i(r.showDomeLines,true),this.showIntersection=i(r.showIntersection,true),this.intersectionColor=i(r.intersectionColor,s.WHITE),this.intersectionWidth=i(r.intersectionWidth,5),this.showThroughEllipsoid=i(r.showThroughEllipsoid,false),this._showThroughEllipsoid=void 0,this.showScanPlane=i(r.showScanPlane,true),this.scanPlaneColor=i(r.scanPlaneColor,s.WHITE),this.scanPlaneMode=i(r.scanPlaneMode,"horizontal"),this.scanPlaneRate=i(r.scanPlaneRate,10),this._scanePlaneXHalfAngle=0,this._scanePlaneYHalfAngle=0,this._time=B.now(),this._boundingSphere=new o,this._boundingSphereWC=new o,this._sectorFrontCommand=new _({owner:this,primitiveType:h.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorBackCommand=new _({owner:this,primitiveType:h.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._sectorVA=void 0,this._sectorLineCommand=new _({owner:this,primitiveType:h.LINES,boundingVolume:this._boundingSphereWC}),this._sectorLineVA=void 0,this._sectorSegmentLineCommand=new _({owner:this,primitiveType:h.LINES,boundingVolume:this._boundingSphereWC}),this._sectorSegmentLineVA=void 0,this._domeFrontCommand=new _({owner:this,primitiveType:h.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeBackCommand=new _({owner:this,primitiveType:h.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._domeVA=void 0,this._domeLineCommand=new _({owner:this,primitiveType:h.LINES,boundingVolume:this._boundingSphereWC}),this._domeLineVA=void 0,this._scanPlaneFrontCommand=new _({owner:this,primitiveType:h.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanPlaneBackCommand=new _({owner:this,primitiveType:h.TRIANGLES,boundingVolume:this._boundingSphereWC}),this._scanRadialCommand=void 0,this._colorCommands=[],this._frontFaceRS=void 0,this._backFaceRS=void 0,this._sp=void 0,this._uniforms={u_type:function(){return 0},u_xHalfAngle:function(){return p.xHalfAngle},u_yHalfAngle:function(){return p.yHalfAngle},u_radius:function(){return p.radius},u_showThroughEllipsoid:function(){return p.showThroughEllipsoid},u_showIntersection:function(){return p.showIntersection},u_intersectionColor:function(){return p.intersectionColor},u_intersectionWidth:function(){return p.intersectionWidth},u_normalDirection:function(){return 1},u_lineColor:function(){return p.lineColor}},this._scanUniforms={u_xHalfAngle:function(){return p._scanePlaneXHalfAngle},u_yHalfAngle:function(){return p._scanePlaneYHalfAngle},u_radius:function(){return p.radius},u_color:function(){return p.scanPlaneColor},u_showThroughEllipsoid:function(){return p.showThroughEllipsoid},u_showIntersection:function(){return p.showIntersection},u_intersectionColor:function(){return p.intersectionColor},u_intersectionWidth:function(){return p.intersectionWidth},u_normalDirection:function(){return 1},u_lineColor:function(){return p.lineColor}};}ee.prototype.update=function(r){var p=r.mode;if(!(!this.show||p!==f.SCENE3D)){var C=false,v=false,w=false,T=this.xHalfAngle,j=this.yHalfAngle;if(T<0||j<0)throw new y("halfAngle must be greater than or equal to zero.");if(!(T==0||j==0)){(this._xHalfAngle!==T||this._yHalfAngle!==j)&&(this._xHalfAngle=T,this._yHalfAngle=j,C=true);var k=this.radius;if(k<0)throw new y("this.radius must be greater than or equal to zero.");var R=false;this._radius!==k&&(R=true,this._radius=k,this._boundingSphere=new o(d.ZERO,this.radius));var X=!S.equals(this.modelMatrix,this._modelMatrix);(X||R)&&(S.clone(this.modelMatrix,this._modelMatrix),S.multiplyByUniformScale(this.modelMatrix,this.radius,this._computedModelMatrix),o.transform(this._boundingSphere,this.modelMatrix,this._boundingSphereWC));var K=this.showThroughEllipsoid;this._showThroughEllipsoid!==this.showThroughEllipsoid&&(this._showThroughEllipsoid=K,v=true);var Z=this.material;this._material!==Z&&(this._material=Z,v=true,w=true);var $=Z.isTranslucent();if(this._translucent!==$&&(this._translucent=$,v=true),this.showScanPlane){var se=r.time,Ae=B.secondsDifference(se,this._time);Ae<0&&(this._time=B.clone(se,this._time));var ke=Math.max(Ae%this.scanPlaneRate/this.scanPlaneRate,0),oe;if(this.scanPlaneMode=="horizontal"){oe=2*j*ke-j;var Ke=Y(oe),Je=q(T),Qe=N(Ke*Je);this._scanePlaneXHalfAngle=Qe,this._scanePlaneYHalfAngle=oe,M.Matrix3.fromRotationX(this._scanePlaneYHalfAngle,A);}else {oe=2*T*ke-T;var $e=q(j),et=Y(oe),tt=N(et*$e);this._scanePlaneXHalfAngle=oe,this._scanePlaneYHalfAngle=tt,M.Matrix3.fromRotationY(this._scanePlaneXHalfAngle,A);}M.Matrix4.multiplyByMatrix3(this.modelMatrix,A,this._computedScanPlaneModelMatrix),S.multiplyByUniformScale(this._computedScanPlaneModelMatrix,this.radius,this._computedScanPlaneModelMatrix);}C&&je(this,r),v&&Ze(this,K,$),w&&Xe(this,r,Z),(v||w)&&qe(this,$);var nt=r.commandList,at=r.passes,De=this._colorCommands;if(at.render)for(var ve=0,rt=De.length;ve<rt;ve++){var it=De[ve];nt.push(it);}}}},ee.prototype.isDestroyed=function(){return false};var A=new L,te=new d;function re(r,p,C){for(var v=r.slice,w=Y(C),T=q(C),j=Y(p),k=q(p),R=N(j*T),X=N(w*k),K=[],Z=0;Z<v;Z++){var $=2*R*Z/(v-1)-R;K.push(new d(0,H($),Y($)));}for(var se=[],Z=0;Z<v;Z++){var $=2*X*Z/(v-1)-X;se.push(new d(H($),0,Y($)));}return {zoy:K,zox:se}}function ue(r,p){var C=r.xHalfAngle,v=r.yHalfAngle,w=p.zoy,T=p.zox,j=[],k=L.fromRotationY(C,A);j.push(w.map(function(R){return L.multiplyByVector(k,R,new M.Cartesian3)}));var k=L.fromRotationX(-v,A);j.push(T.map(function(R){return L.multiplyByVector(k,R,new M.Cartesian3)}).reverse());var k=L.fromRotationY(-C,A);j.push(w.map(function(R){return L.multiplyByVector(k,R,new M.Cartesian3)}).reverse());var k=L.fromRotationX(v,A);return j.push(T.map(function(R){return L.multiplyByVector(k,R,new M.Cartesian3)})),j}function fe(r,p){for(var C=Array.prototype.concat.apply([],p).length-p.length,v=new Float32Array(18*C),w=0,T=0,j=p.length;T<j;T++)for(var k=p[T],R=d.normalize(d.cross(k[0],k[k.length-1],te),te),X=0,C=k.length-1;X<C;X++)v[w++]=0,v[w++]=0,v[w++]=0,v[w++]=-R.x,v[w++]=-R.y,v[w++]=-R.z,v[w++]=k[X].x,v[w++]=k[X].y,v[w++]=k[X].z,v[w++]=-R.x,v[w++]=-R.y,v[w++]=-R.z,v[w++]=k[X+1].x,v[w++]=k[X+1].y,v[w++]=k[X+1].z,v[w++]=-R.x,v[w++]=-R.y,v[w++]=-R.z;var K=u.createVertexBuffer({context:r,typedArray:v,usage:g.STATIC_DRAW}),Z=6*Float32Array.BYTES_PER_ELEMENT,$=[{index:W.position,vertexBuffer:K,componentsPerAttribute:3,componentDatatype:n.FLOAT,offsetInBytes:0,strideInBytes:Z},{index:W.normal,vertexBuffer:K,componentsPerAttribute:3,componentDatatype:n.FLOAT,offsetInBytes:3*Float32Array.BYTES_PER_ELEMENT,strideInBytes:Z}];return new b({context:r,attributes:$})}function ge(r,p){for(var C=p.length,v=new Float32Array(9*C),w=0,T=0,j=p.length;T<j;T++){var k=p[T];v[w++]=0,v[w++]=0,v[w++]=0,v[w++]=k[0].x,v[w++]=k[0].y,v[w++]=k[0].z;}var R=u.createVertexBuffer({context:r,typedArray:v,usage:g.STATIC_DRAW}),X=3*Float32Array.BYTES_PER_ELEMENT,K=[{index:W.position,vertexBuffer:R,componentsPerAttribute:3,componentDatatype:n.FLOAT,offsetInBytes:0,strideInBytes:X}];return new b({context:r,attributes:K})}function He(r,p){for(var C=Array.prototype.concat.apply([],p).length-p.length,v=new Float32Array(9*C),w=0,T=0,j=p.length;T<j;T++)for(var k=p[T],R=0,C=k.length-1;R<C;R++)v[w++]=k[R].x,v[w++]=k[R].y,v[w++]=k[R].z,v[w++]=k[R+1].x,v[w++]=k[R+1].y,v[w++]=k[R+1].z;var X=u.createVertexBuffer({context:r,typedArray:v,usage:g.STATIC_DRAW}),K=3*Float32Array.BYTES_PER_ELEMENT,Z=[{index:W.position,vertexBuffer:X,componentsPerAttribute:3,componentDatatype:n.FLOAT,offsetInBytes:0,strideInBytes:K}];return new b({context:r,attributes:Z})}function Ne(r){var p=M.EllipsoidGeometry.createGeometry(new M.EllipsoidGeometry({vertexFormat:I.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),C=b.fromGeometry({context:r,geometry:p,attributeLocations:W,bufferUsage:g.STATIC_DRAW,interleave:false});return C}function We(r){var p=M.EllipsoidOutlineGeometry.createGeometry(new M.EllipsoidOutlineGeometry({vertexFormat:I.POSITION_ONLY,stackPartitions:32,slicePartitions:32})),C=b.fromGeometry({context:r,geometry:p,attributeLocations:W,bufferUsage:g.STATIC_DRAW,interleave:false});return C}function Me(r,p){for(var C=p.length-1,v=new Float32Array(9*C),w=0,T=0;T<C;T++)v[w++]=0,v[w++]=0,v[w++]=0,v[w++]=p[T].x,v[w++]=p[T].y,v[w++]=p[T].z,v[w++]=p[T+1].x,v[w++]=p[T+1].y,v[w++]=p[T+1].z;var j=u.createVertexBuffer({context:r,typedArray:v,usage:g.STATIC_DRAW}),k=3*Float32Array.BYTES_PER_ELEMENT,R=[{index:W.position,vertexBuffer:j,componentsPerAttribute:3,componentDatatype:n.FLOAT,offsetInBytes:0,strideInBytes:k}];return new b({context:r,attributes:R})}function je(r,p){var C=p.context,v=re(r,r.xHalfAngle,r.yHalfAngle),w=ue(r,v);if(r.showLateralSurfaces&&(r._sectorVA=fe(C,w)),r.showSectorLines&&(r._sectorLineVA=ge(C,w)),r.showSectorSegmentLines&&(r._sectorSegmentLineVA=He(C,w)),r.showDomeSurfaces&&(r._domeVA=Ne(C)),r.showDomeLines&&(r._domeLineVA=We(C)),r.showScanPlane)if(r.scanPlaneMode=="horizontal"){var T=re(r,G.PI_OVER_TWO,0);r._scanPlaneVA=Me(C,T.zox);}else {var T=re(r,0,G.PI_OVER_TWO);r._scanPlaneVA=Me(C,T.zoy);}}function Ye(r,p,C){var v=p.context,w=Ee,T=new z({sources:[pe,C.shaderSource,Pe]});r._sp=O.replaceCache({context:v,shaderProgram:r._sp,vertexShaderSource:w,fragmentShaderSource:T,attributeLocations:W});var j=new z({sources:[pe,C.shaderSource,Pe],pickColorQualifier:"uniform"});r._pickSP=O.replaceCache({context:v,shaderProgram:r._pickSP,vertexShaderSource:w,fragmentShaderSource:j,attributeLocations:W});}function Ue(r,p,C){var v=p.context,w=Ee,T=new z({sources:[pe,C.shaderSource,Ve]});r._scanePlaneSP=O.replaceCache({context:v,shaderProgram:r._scanePlaneSP,vertexShaderSource:w,fragmentShaderSource:T,attributeLocations:W});}function Xe(r,p,C){Ye(r,p,C),r.showScanPlane&&Ue(r,p,C);}function Ze(r,p,C){C?(r._frontFaceRS=D.fromCache({depthTest:{enabled:!p},depthMask:false,blending:F.ALPHA_BLEND,cull:{enabled:true,face:P.BACK}}),r._backFaceRS=D.fromCache({depthTest:{enabled:!p},depthMask:false,blending:F.ALPHA_BLEND,cull:{enabled:true,face:P.FRONT}}),r._pickRS=D.fromCache({depthTest:{enabled:!p},depthMask:false,blending:F.ALPHA_BLEND})):(r._frontFaceRS=D.fromCache({depthTest:{enabled:!p},depthMask:true}),r._pickRS=D.fromCache({depthTest:{enabled:true},depthMask:true}));}function ie(r,p,C,v,w,T,j,k,R,X,K,Z){X&&C&&(C.vertexArray=j,C.renderState=w,C.shaderProgram=T,C.uniformMap=e(k,r._material._uniforms),C.uniformMap.u_normalDirection=function(){return -1},C.pass=K,C.modelMatrix=R,r._colorCommands.push(C)),p.vertexArray=j,p.renderState=v,p.shaderProgram=T,p.uniformMap=e(k,r._material._uniforms),Z&&(p.uniformMap.u_type=function(){return 1}),p.pass=K,p.modelMatrix=R,r._colorCommands.push(p);}function qe(r,p){r._colorCommands.length=0;var C=p?x.TRANSLUCENT:x.OPAQUE;r.showLateralSurfaces&&ie(r,r._sectorFrontCommand,r._sectorBackCommand,r._frontFaceRS,r._backFaceRS,r._sp,r._sectorVA,r._uniforms,r._computedModelMatrix,p,C),r.showSectorLines&&ie(r,r._sectorLineCommand,void 0,r._frontFaceRS,r._backFaceRS,r._sp,r._sectorLineVA,r._uniforms,r._computedModelMatrix,p,C,true),r.showSectorSegmentLines&&ie(r,r._sectorSegmentLineCommand,void 0,r._frontFaceRS,r._backFaceRS,r._sp,r._sectorSegmentLineVA,r._uniforms,r._computedModelMatrix,p,C,true),r.showDomeSurfaces&&ie(r,r._domeFrontCommand,r._domeBackCommand,r._frontFaceRS,r._backFaceRS,r._sp,r._domeVA,r._uniforms,r._computedModelMatrix,p,C),r.showDomeLines&&ie(r,r._domeLineCommand,void 0,r._frontFaceRS,r._backFaceRS,r._sp,r._domeLineVA,r._uniforms,r._computedModelMatrix,p,C,true),r.showScanPlane&&ie(r,r._scanPlaneFrontCommand,r._scanPlaneBackCommand,r._frontFaceRS,r._backFaceRS,r._scanePlaneSP,r._scanPlaneVA,r._scanUniforms,r._computedScanPlaneModelMatrix,p,C);}return ee}var ae={};function ze(t){ae=t;var o=ae.defaultValue||ae.Scene.defaultValue,d=ae.defined,s=Object.defineProperties,e=ae.DeveloperError,n=ae.Event,i=ae.createMaterialPropertyDescriptor,a=ae.createPropertyDescriptor;function m(c){this._show=void 0,this._radius=void 0,this._xHalfAngle=void 0,this._yHalfAngle=void 0,this._lineColor=void 0,this._showSectorLines=void 0,this._showSectorSegmentLines=void 0,this._showLateralSurfaces=void 0,this._material=void 0,this._showDomeSurfaces=void 0,this._showDomeLines=void 0,this._showIntersection=void 0,this._intersectionColor=void 0,this._intersectionWidth=void 0,this._showThroughEllipsoid=void 0,this._gaze=void 0,this._showScanPlane=void 0,this._scanPlaneColor=void 0,this._scanPlaneMode=void 0,this._scanPlaneRate=void 0,this._definitionChanged=new n,this.merge(o(c,o.EMPTY_OBJECT));}return s(m.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:a("show"),radius:a("radius"),xHalfAngle:a("xHalfAngle"),yHalfAngle:a("yHalfAngle"),lineColor:a("lineColor"),showSectorLines:a("showSectorLines"),showSectorSegmentLines:a("showSectorSegmentLines"),showLateralSurfaces:a("showLateralSurfaces"),material:i("material"),showDomeSurfaces:a("showDomeSurfaces"),showDomeLines:a("showDomeLines "),showIntersection:a("showIntersection"),intersectionColor:a("intersectionColor"),intersectionWidth:a("intersectionWidth"),showThroughEllipsoid:a("showThroughEllipsoid"),gaze:a("gaze"),showScanPlane:a("showScanPlane"),scanPlaneColor:a("scanPlaneColor"),scanPlaneMode:a("scanPlaneMode"),scanPlaneRate:a("scanPlaneRate")}),m.prototype.clone=function(c){return d(c)||(c=new m),c.show=this.show,c.radius=this.radius,c.xHalfAngle=this.xHalfAngle,c.yHalfAngle=this.yHalfAngle,c.lineColor=this.lineColor,c.showSectorLines=this.showSectorLines,c.showSectorSegmentLines=this.showSectorSegmentLines,c.showLateralSurfaces=this.showLateralSurfaces,c.material=this.material,c.showDomeSurfaces=this.showDomeSurfaces,c.showDomeLines=this.showDomeLines,c.showIntersection=this.showIntersection,c.intersectionColor=this.intersectionColor,c.intersectionWidth=this.intersectionWidth,c.showThroughEllipsoid=this.showThroughEllipsoid,c.gaze=this.gaze,c.showScanPlane=this.showScanPlane,c.scanPlaneColor=this.scanPlaneColor,c.scanPlaneMode=this.scanPlaneMode,c.scanPlaneRate=this.scanPlaneRate,c},m.prototype.merge=function(c){if(!d(c))throw new e("source is required.");this.show=o(this.show,c.show),this.radius=o(this.radius,c.radius),this.xHalfAngle=o(this.xHalfAngle,c.xHalfAngle),this.yHalfAngle=o(this.yHalfAngle,c.yHalfAngle),this.lineColor=o(this.lineColor,c.lineColor),this.showSectorLines=o(this.showSectorLines,c.showSectorLines),this.showSectorSegmentLines=o(this.showSectorSegmentLines,c.showSectorSegmentLines),this.showLateralSurfaces=o(this.showLateralSurfaces,c.showLateralSurfaces),this.material=o(this.material,c.material),this.showDomeSurfaces=o(this.showDomeSurfaces,c.showDomeSurfaces),this.showDomeLines=o(this.showDomeLines,c.showDomeLines),this.showIntersection=o(this.showIntersection,c.showIntersection),this.intersectionColor=o(this.intersectionColor,c.intersectionColor),this.intersectionWidth=o(this.intersectionWidth,c.intersectionWidth),this.showThroughEllipsoid=o(this.showThroughEllipsoid,c.showThroughEllipsoid),this.gaze=o(this.gaze,c.gaze),this.showScanPlane=o(this.showScanPlane,c.showScanPlane),this.scanPlaneColor=o(this.scanPlaneColor,c.scanPlaneColor),this.scanPlaneMode=o(this.scanPlaneMode,c.scanPlaneMode),this.scanPlaneRate=o(this.scanPlaneRate,c.scanPlaneRate);},m}var J={};function Fe(t,o){if(t){let V=function(f,I,G){var L=I[f.id];if(n(L)){var S=L.primitive;G.remove(S),S&&!S.isDestroyed()&&S.destroy(),delete I[f.id];}};J=t;var d=J.AssociativeArray,s=J.Cartesian3,e=J.Color,n=J.defined,i=J.destroyObject,a=J.DeveloperError,m=J.Matrix3,c=J.Matrix4,y=J.Quaternion,h=J.MaterialProperty,u=J.Property,g=new m;new c;var x=new s,D=new s,O=new y,z=new s,b=new y,F=function(f,I){if(!n(f))throw new a("scene is required.");if(!n(I))throw new a("entityCollection is required.");I.collectionChanged.addEventListener(F.prototype._onCollectionChanged,this),this._scene=f,this._primitives=f.primitives,this._entityCollection=I,this._hash={},this._entitiesToVisualize=new d,this._onCollectionChanged(I,I.values,[],[]);};return F.prototype.update=function(f){if(!n(f))throw new a("time is required.");for(var I=this._entitiesToVisualize.values,G=this._hash,L=this._primitives,S=0,B=I.length;S<B;S++){var U=I[S],E=U._rectangularSensor,H,Y,q,N,Q,W=G[U.id],ee=U.isShowing&&U.isAvailable(f)&&u.getValueOrDefault(E._show,f,true);if(ee&&(H=u.getValueOrUndefined(U._position,f,x),Y=u.getValueOrUndefined(U._orientation,f,O),q=u.getValueOrUndefined(E._radius,f),N=u.getValueOrUndefined(E._xHalfAngle,f),Q=u.getValueOrUndefined(E._yHalfAngle,f),ee=n(H)&&n(N)&&n(Q)),!ee){n(W)&&(W.primitive.show=false);continue}var A=n(W)?W.primitive:void 0;n(A)||(A=new o,A.id=U,L.add(A),W={primitive:A,position:void 0,orientation:void 0},G[U.id]=W);var te=u.getValueOrUndefined(E._gaze,f);if(n(te)){var re=u.getValueOrUndefined(te._position,f,D);if(!n(H)||!n(re))continue;var ue=s.subtract(H,re,z),fe=s.angleBetween(J.Cartesian3.UNIT_Z,ue),ge=s.cross(J.Cartesian3.UNIT_Z,ue,z),Y=y.fromAxisAngle(ge,fe-Math.PI,b);q=s.distance(H,re),A.modelMatrix=c.fromRotationTranslation(m.fromQuaternion(Y,g),H,A.modelMatrix);}else (!s.equals(H,W.position)||!y.equals(Y,W.orientation))&&(n(Y)?(A.modelMatrix=c.fromRotationTranslation(m.fromQuaternion(Y,g),H,A.modelMatrix),W.position=s.clone(H,W.position),W.orientation=y.clone(Y,W.orientation)):(A.modelMatrix=J.Transforms.eastNorthUpToFixedFrame(H),W.position=s.clone(H,W.position)));A.show=true,A.gaze=te,A.radius=q,A.xHalfAngle=N,A.yHalfAngle=Q,A.lineColor=u.getValueOrDefault(E._lineColor,f,e.WHITE),A.showSectorLines=u.getValueOrDefault(E._showSectorLines,f,true),A.showSectorSegmentLines=u.getValueOrDefault(E._showSectorSegmentLines,f,true),A.showLateralSurfaces=u.getValueOrDefault(E._showLateralSurfaces,f,true),A.material=h.getValue(f,E._material,A.material),A.showDomeSurfaces=u.getValueOrDefault(E._showDomeSurfaces,f,true),A.showDomeLines=u.getValueOrDefault(E._showDomeLines,f,true),A.showIntersection=u.getValueOrDefault(E._showIntersection,f,true),A.intersectionColor=u.getValueOrDefault(E._intersectionColor,f,e.WHITE),A.intersectionWidth=u.getValueOrDefault(E._intersectionWidth,f,1),A.showThroughEllipsoid=u.getValueOrDefault(E._showThroughEllipsoid,f,true),A.scanPlaneMode=u.getValueOrDefault(E._scanPlaneMode,f),A.scanPlaneColor=u.getValueOrDefault(E._scanPlaneColor,f,e.WHITE),A.showScanPlane=u.getValueOrDefault(E._showScanPlane,f,true),A.scanPlaneRate=u.getValueOrDefault(E._scanPlaneRate,f,1);}return true},F.prototype.isDestroyed=function(){return false},F.prototype.destroy=function(){for(var f=this._entitiesToVisualize.values,I=this._hash,G=this._primitives,L=f.length-1;L>-1;L--)V(f[L],I,G);return i(this)},F.prototype._onCollectionChanged=function(f,I,G,L){var S,B,U=this._entitiesToVisualize,E=this._hash,H=this._primitives;for(S=I.length-1;S>-1;S--)B=I[S],n(B._rectangularSensor)&&n(B._position)&&U.set(B.id,B);for(S=L.length-1;S>-1;S--)B=L[S],n(B._rectangularSensor)&&n(B._position)?U.set(B.id,B):(V(B,E,H),U.remove(B.id));for(S=G.length-1;S>-1;S--)B=G[S],V(B,E,H),U.remove(B.id);},F}}var l=null,be=function(t,o){t&&(this.viewer=t,l=o,this._installPlugin());};be.prototype={_installPlugin:function(){this._installCounputeVertex(),this._installCylinderGeometry(),this._installRadarPrimitive();},_installCylinderGeometry:function(){function t(e){this.length=e.length,this.topRadius=e.topRadius,this.bottomRadius=e.bottomRadius,this.slices=e.slices?e.slices:64,this.zReverse=e.zReverse;}var o=new l.Cartesian2,d=new l.Cartesian3,s=new l.Ray;t._createGeometry=function(e){var n=e.length,i=e.topRadius,a=e.bottomRadius,m=e.slices,c=2*Math.PI/(m-1),y=e.zReverse,h=[],u=[],g=[],_=[],x=[a,i],D=[0,y?-n:n],O=0,z=Math.atan2(a-i,n),b=o;b.z=Math.sin(z);for(var F=Math.cos(z),P=0;P<D.length;P++){_[P]=[];for(var V=x[P],f=0;f<m;f++){_[P].push(O++);var I=c*f,G=V*Math.cos(I),L=V*Math.sin(I);h.push(G,L,D[P]),G=F*Math.cos(I),L=F*Math.sin(I),u.push(G,L,b.z),g.push(P/(D.length-1),0);}}for(var S=[],P=1;P<D.length;P++)for(var f=1;f<m;f++){var B=_[P-1][f-1],U=_[P][f-1],E=_[P][f],H=_[P-1][f];S.push(E),S.push(H),S.push(B),S.push(E),S.push(B),S.push(U),f==_[P].length-1&&(B=_[P-1][f],U=_[P][f],E=_[P][0],H=_[P-1][0],S.push(E),S.push(H),S.push(B),S.push(E),S.push(B),S.push(U));}S=new Int16Array(S),h=new Float32Array(h),u=new Float32Array(u),g=new Float32Array(g);var Y={position:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:h}),normal:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:u}),st:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:g})},q=l.BoundingSphere.fromVertices(h),N=new l.Geometry({attributes:Y,indices:S,primitiveType:l.PrimitiveType.TRIANGLES,boundingSphere:q});return h=[],S=[],g=[],N},t.createGeometry=function(e,n){if(!n)return t._createGeometry(e);l.Matrix4.multiplyByPoint(n,l.Cartesian3.ZERO,d),d.clone(s.origin);var i=e.length,a=e.topRadius,m=(e.bottomRadius,e.slices),c=2*Math.PI/(m-1),y=e.zReverse,h=[],u=[],g=[],_=[],x=[0,y?-i:i],D=0,D=0;h.push(0,0,0),u.push(1,1),D++;for(var O=new l.Cartesian3,z=a/15,b=0;b<16;b++){for(var F=z*b,P=[],V=0;V<m;V++){var f=c*V,I=F*Math.cos(f),G=F*Math.sin(f);O.x=I,O.y=G,O.z=x[1];var L=(0, l.Scene.extend2Earth)(O,n,s);L?(P.push(D),h.push(I,G,x[1]),u.push(b/15,1),D++):(L=d,P.push(-1));}_.push(P);}for(var S,B,U=[0,_.length-1],E=0;E<U.length;E++)for(var b=U[E],V=1;V<_[b].length;V++)S=_[b][V-1],B=_[b][V],S>=0&&B>=0&&g.push(0,S,B);h=new Float32Array(h),g=new Int32Array(g),u=new Float32Array(u);var H={position:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:h}),st:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:u})},Y=l.BoundingSphere.fromVertices(h),q=new l.Geometry({attributes:H,indices:g,primitiveType:l.PrimitiveType.TRIANGLES,boundingSphere:Y});return (0, l.Scene.computeVertexNormals)(q),h=[],g=[],q},t.createOutlineGeometry=function(e){var n=e.length,i=e.topRadius,a=e.bottomRadius,m=e.slices,c=2*Math.PI/(m-1),y=e.zReverse,h=[],u=[],g=[],_=[],x=[a,i],D=[0,y?-n:n],O=0,z=Math.atan2(a-i,n),b=o;b.z=Math.sin(z);for(var F=Math.cos(z),P=0;P<D.length;P++){_[P]=[];for(var V=x[P],f=0;f<m;f++){_[P].push(O++);var I=c*f,G=V*Math.cos(I),L=V*Math.sin(I);h.push(G,L,D[P]),G=F*Math.cos(I),L=F*Math.sin(I),u.push(G,L,b.z),g.push(P/(D.length-1),0);}}for(var S=[],P=1;P<D.length;P++)for(var f=1;f<m;f+=1){var B=_[P-1][f-1],U=_[P][f-1];_[P][f],_[P-1][f],f%8==1&&S.push(B,U);}S=new Int16Array(S),h=new Float32Array(h),u=new Float32Array(u),g=new Float32Array(g);var E={position:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:h}),normal:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:u}),st:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:g})},H=l.BoundingSphere.fromVertices(h),Y=new l.Geometry({attributes:E,indices:S,primitiveType:l.PrimitiveType.LINES,boundingSphere:H});return h=[],S=[],g=[],Y},t.fromAngleAndLength=function(e,n,i){return e=l.Math.toRadians(e),new t({topRadius:Math.tan(e)*n/2,bottomRadius:0,length:n,zReverse:i})},l.Scene.CylinderGeometry=t;},_installRadarPrimitive:function(){var t;function o(s,e){let n=l.defaultValue||de;e=e||{},t=s.scene.globe.ellipsoid,this._geometry=null,this._angle=e.angle,this._radius=e.radius?e.radius:5,this._position=e.position,this._rotation=e.rotation?e.rotation:{heading:0,pitch:0,roll:0},this._trackedEntity=e.trackedEntity,this.defaultColor=e.color?e.color:l.Color.YELLOW,this.defaultLineColor=e.lineColor?e.lineColor:this.defaultColor,this._show=n(e.show,true),this._outline=n(e.outline,false),this._topShow=n(e.top,true),this._topOutline=n(e.topOutline,true),this._modelMatrix=l.Matrix4.clone(l.Matrix4.IDENTITY),this._quaternion=new l.Quaternion,this._translation=new l.Cartesian3,this._scale=new l.Cartesian3(1,1,1),this._matrix=new l.Matrix4,this._inverseMatrix=new l.Matrix4,this._positionCartographic=new l.Cartographic,this._positionCartesian=null,this._drawCommands=[],this._outlinePositions=[],this.viewer=s,this.viewer.scene.primitives.add(this),this.updateGeometry(),this._groundArea=n(e.groundArea,false),this.addGroundAreaEntity(this._groundArea);}Object.defineProperties(o.prototype,{trackedEntity:{get:function(){return this._trackedEntity},set:function(s){this._trackedEntity=s;}},color:{get:function(){return this.defaultColor},set:function(s){this.defaultColor=s;}},lineColor:{get:function(){return this.defaultLineColor},set:function(s){this.defaultLineColor=s;}},show:{get:function(){return this._show},set:function(s){this._show=s;}},outline:{get:function(){return this._outline},set:function(s){this._outline=s,this.updateGeometry();}},top:{get:function(){return this._topShow},set:function(s){this._topShow=s,this.updateGeometry();}},topOutline:{get:function(){return this._topOutline},set:function(s){this._topOutline=s,this.updateGeometry();}},groundArea:{get:function(){return this._groundArea},set:function(s){this._groundArea=s,this.addGroundAreaEntity(this._groundArea);}},angle:{get:function(){return this._angle},set:function(s){this._angle=s,this.updateGroundCircleRadius(),this.updateGeometry();}},radius:{get:function(){return this._radius},set:function(s){this._radius=s,this.updateGroundCircleRadius(),this.updateGeometry();}},heading:{get:function(){return this._rotation.heading},set:function(s){this._rotation.heading=s;}},pitch:{get:function(){return this._rotation.pitch},set:function(s){this._rotation.pitch=s;}},roll:{get:function(){return this._rotation.roll},set:function(s){this._rotation.roll=s;}},position:{get:function(){return this._position},set:function(s){this._position=s;}}}),o.prototype.updateGroundCircleRadius=function(){this._ground_radius=this._radius*Math.cos(l.Math.toRadians(this._angle));},o.prototype.isDestroyed=function(){return false},o.prototype.addGroundAreaEntity=function(s){if(s&&!this.groundAreaEntity){var e=this;this.updateGroundCircleRadius(),this.groundAreaEntity=viewer.entities.add({position:this._position,ellipse:{show:this._rotation.pitch===0&&this._rotation.roll===0,semiMinorAxis:new l.CallbackProperty(function(n){return e._ground_radius},false),semiMajorAxis:new l.CallbackProperty(function(n){return e._ground_radius},false),material:this.defaultColor},polyline:{show:this._trackedEntityPosition&&(this._rotation.pitch!==0||this._rotation.roll!==0),positions:new l.CallbackProperty(function(n){return e._trackedEntityPosition?l.Cartesian3.distance(e._position,e._trackedEntityPosition)>e._radius?[]:[e._position,e._trackedEntityPosition]:[]},false),followSurface:false,material:new l.PolylineDashMaterialProperty({color:l.Color.CYAN}),width:1}});}};var d=new l.Cartesian3;o.prototype.computeMatrix=function(s,e){if(this._positionCartesian||(this._positionCartesian=new l.Cartesian3),this.position instanceof l.Cartesian3?this._positionCartesian=this.position:typeof this.position.getValue=="function"?this._positionCartesian=this.position.getValue(s):this.position._value&&this.position._value instanceof l.Cartesian3&&(this._positionCartesian=this.position._value),this._trackedEntity&&this._trackedEntity.position){this._positionCartesian;var i=l.Property.getValueOrUndefined(this._trackedEntity.position,s,d);i&&(this._trackedEntityPosition=i,this._rotation.heading=0,this._rotation.pitch=40,this._rotation.roll=0);}return this._modelMatrix=l.Transforms.eastNorthUpToFixedFrame(this._positionCartesian,t,this._modelMatrix),this._positionCartographic=l.Cartographic.fromCartesian(this._positionCartesian,t,this._positionCartographic),l.Transforms.eastNorthUpToFixedFrame(this._positionCartesian,t,this._modelMatrix),l.Quaternion.fromHeadingPitchRoll(this._rotation,this._quaternion),this._matrix=l.Matrix4.fromTranslationQuaternionRotationScale(this._translation,this._quaternion,this._scale,this._matrix),l.Matrix4.multiplyTransformation(this._modelMatrix,this._matrix,this._matrix),l.Matrix4.inverseTransformation(this._matrix,this._inverseMatrix),this._matrix},o.prototype.getTopGeometry=function(){for(var s=this.radius,e=[],n=[],i=[],a=[],m=90-parseInt(this.angle),c=m<1?m/8:1,y=2*Math.PI/127,h=0,u=this.angle;u<91;u+=c){var g=l.Math.toRadians(u<90?u:90);g=Math.cos(g)*s;for(var _=[],x=0;x<128;x++){var D=y*x,O=g*Math.cos(D),z=g*Math.sin(D),b=Math.sqrt(s*s-O*O-z*z);e.push(O,z,b),n.push(1,1),_.push(h++);}a.push(_);}for(var u=1;u<a.length;u++)for(var x=1;x<a[u].length;x++){var F=a[u-1][x-1],P=a[u][x-1],V=a[u][x],f=a[u-1][x];i.push(F,P,V),i.push(F,V,f);}e=new Float32Array(e),i=new Int32Array(i),n=new Float32Array(n);var I={position:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}),st:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:n})},G=l.BoundingSphere.fromVertices(e),L=new l.Geometry({attributes:I,indices:i,primitiveType:l.PrimitiveType.TRIANGLES,boundingSphere:G});return (0, l.Scene.computeVertexNormals)(L),L},o.prototype.getTopOutlineGeometry=function(){for(var s=this.radius,e=[],n=[],i=[],a=[],m=90-parseInt(this.angle),c=m<1?m/8:1,y=2*Math.PI/127,h=0,u=this.angle;u<91;u+=c){var g=l.Math.toRadians(u<90?u:90);g=Math.cos(g)*s;for(var _=[],x=0;x<128;x++){var D=y*x,O=g*Math.cos(D),z=g*Math.sin(D),b=Math.sqrt(s*s-O*O-z*z);e.push(O,z,b),n.push(1,1),_.push(h++);}a.push(_);}for(var u=1;u<a.length;u++)for(var x=1;x<a[u].length;x++){var F=a[u-1][x-1],P=a[u][x-1],V=a[u][x];a[u-1][x],x%8==1&&i.push(F,P),u%8==1&&i.push(P,V);}e=new Float32Array(e),i=new Int32Array(i),n=new Float32Array(n);var f={position:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:e}),st:new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:n})},I=l.BoundingSphere.fromVertices(e),G=new l.Geometry({attributes:f,indices:i,primitiveType:l.PrimitiveType.LINES,boundingSphere:I});return (0, l.Scene.computeVertexNormals)(G),G},o.prototype.updateGeometry=function(){this._geometry=l.Scene.CylinderGeometry.createGeometry(new l.Scene.CylinderGeometry({topRadius:this._radius*Math.cos(l.Math.toRadians(this.angle)),bottomRadius:0,length:this._radius*Math.sin(l.Math.toRadians(this.angle))})),this._topGeometry=this.getTopGeometry(),this._topOutlineGeometry=this.getTopOutlineGeometry(),this._outlineGeometry=l.Scene.CylinderGeometry.createOutlineGeometry(new l.Scene.CylinderGeometry({topRadius:this._radius*Math.cos(l.Math.toRadians(this.angle)),bottomRadius:0,slices:128,length:this._radius*Math.sin(l.Math.toRadians(this.angle))})),this._positions=new Float32Array(this._geometry.attributes.position.values.length);for(var s=0;s<this._positions.length;s++)this._positions[s]=this._geometry.attributes.position.values[s];this._drawCommands&&this._drawCommands.length&&(this._drawCommands.forEach(function(e){e.vertexArray=e.vertexArray&&e.vertexArray.destroy();}),this._drawCommands.splice(0,this._drawCommands.length));},o.prototype.update=function(s){this._show&&(this.computeMatrix(s.time),s.mode===l.SceneMode.SCENE3D?(this._geometry.boundingSphere=l.BoundingSphere.fromVertices(this._geometry.attributes.position.values),this._drawCommands&&this._drawCommands.length||(this._drawCommands.push(this.createDrawCommand(this._geometry,s)),this._outline&&this._drawCommands.push(this.createDrawCommand(this._outlineGeometry,s)),this._topShow&&(this._drawCommands.push(this.createDrawCommand(this._topGeometry,s)),this._topOutline&&this._drawCommands.push(this.createDrawCommand(this._topOutlineGeometry,s)))),this._drawCommands.forEach(function(e){s.commandList.push(e);}),this.groundAreaEntity&&(this.groundAreaEntity.ellipse.show=this._groundArea&&this._rotation.pitch===0&&this._rotation.roll===0,this.groundAreaEntity.polyline.show=false)):(this.groundAreaEntity||this.addGroundAreaEntity(true),this.groundAreaEntity.ellipse.show=this._rotation.pitch===0&&this._rotation.roll===0,this.groundAreaEntity.polyline.show=this._trackedEntityPosition&&(this._rotation.pitch!==0||this._rotation.roll!==0)));},o.prototype.getFragmentShaderSource=function(s){return `#version 300 es
446
+ in vec3 v_position;
447
+ in vec3 v_normal;
448
+ uniform float picked;
449
+ uniform vec4 pickedColor;
450
+ uniform vec4 defaultColor;
451
+ uniform float specular;
452
+ uniform float shininess;
453
+ uniform vec3 emission;
454
+ in vec2 v_st;
455
+ uniform bool isLine;
456
+ uniform float glowPower;
457
+ void main() {
458
+ vec3 positionToEyeEC = -v_position;
459
+ vec3 normalEC = normalize(v_normal);
460
+ vec4 color = defaultColor;
461
+ if (picked != 0.0) {
462
+ color = pickedColor;
463
+ }
464
+ czm_material material;
465
+ material.specular = specular;
466
+ material.shininess = shininess;
467
+ material.normal = normalEC;
468
+ material.emission = emission;//vec3(0.2,0.2,0.2);
469
+ material.diffuse = color.rgb ;
470
+ if(isLine){
471
+ material.alpha = 1.0;
472
+ }
473
+ else{
474
+ material.alpha = color.a;
475
+ }
476
+ if(v_st.x==0.0){
477
+ out_FragColor =color ;
478
+ }else {
479
+ out_FragColor = czm_phong(normalize(positionToEyeEC), material,czm_lightDirectionEC) ;
480
+ }
481
+ }`},o.prototype.getVertexShaderSource=function(s){return `#version 300 es
482
+ #ifdef GL_ES
483
+ precision highp float;
484
+ #endif
485
+
486
+ in vec3 position;
487
+ in vec2 st;
488
+ in vec3 normal;
489
+ uniform mat4 modelViewMatrix;
490
+ uniform mat3 normalMatrix;
491
+ uniform mat4 projectionMatrix;
492
+ out vec3 v_position;
493
+ out vec3 v_normal;
494
+ out vec2 v_st;
495
+
496
+ out vec3 v_light0Direction;
497
+
498
+ void main(void)
499
+ {
500
+ vec4 pos = modelViewMatrix * vec4( position,1.0);
501
+ v_normal = normalMatrix * normal;
502
+ v_st = st;
503
+ v_position = pos.xyz;
504
+ v_light0Direction = mat3( modelViewMatrix) * vec3(1.0,1.0,1.0);
505
+ gl_Position = projectionMatrix * pos;
506
+ }`},o.prototype.createDrawCommand=function(s,e,n){var i=e.context,a=new l.Cartesian3;l.Matrix4.multiplyByPoint(this._matrix,s.boundingSphere.center,a);var m=new l.BoundingSphere(a,s.boundingSphere.radius),c=new l.DrawCommand({modelMatrix:n||this._matrix,owner:this,primitiveType:s.primitiveType,pass:l.Pass.TRANSLUCENT,boundingVolume:m}),y=this,h=l.GeometryPipeline.createAttributeLocations(s);return c.vertexArray=l.VertexArray.fromGeometry({context:i,geometry:s,attributeLocations:h,bufferUsage:l.BufferUsage.STATIC_DRAW}),c.vertexArray._attributeLocations=h,c.shaderProgram=l.ShaderProgram.replaceCache({context:i,vertexShaderSource:this.getVertexShaderSource(s),fragmentShaderSource:this.getFragmentShaderSource(s),attributeLocations:h}),c.renderState=l.RenderState.fromCache({blending:l.BlendingState.ALPHA_BLEND,depthTest:{enabled:true,func:l.DepthFunction.LESS},cull:{enabled:false,face:l.CullFace.BACK}}),c.uniformMap={},c.uniformMap.projectionMatrix=function(){return e.context.uniformState.projection},c.uniformMap.modelViewMatrix=function(){return e.context.uniformState.modelView},c.uniformMap.shininess=function(){return y.shininess||(y.shininess=0),y.shininess},c.uniformMap.emission=function(){return y.emission||(y.emission=new l.Cartesian3(.2,.2,.2)),y.emission},c.uniformMap.specular=function(){return y.specular||(y.specular=0),y.specular},c.uniformMap.isLine=function(){return s.primitiveType==l.PrimitiveType.LINES||s.primitiveType==l.PrimitiveType.LINE_STRIP},c.uniformMap.defaultColor=function(){return s.primitiveType==l.PrimitiveType.LINES||s.primitiveType==l.PrimitiveType.LINE_STRIP?(y.defaultLineColor||(y.defaultLineColor=new l.Color(1,1,0,1)),y.defaultLineColor):(y.defaultColor||(y.defaultColor=new l.Color(1,0,0,1)),y.defaultColor)},c.uniformMap.picked=function(){return y.picked||(y.picked=0),y.picked},c.uniformMap.pickedColor=function(){return y.pickedColor||(y.pickedColor=new l.Color(1,1,0,1)),y.pickedColor},c.uniformMap.normalMatrix=function(){return e.context.uniformState.normal},c.uniformMap.glowPower=function(){return .25},c},o.prototype.remove=function(){this.viewer.scene.primitives.remove(this),this.groundAreaEntity&&this.viewer.entities.remove(this.groundAreaEntity);},o.prototype.addToScene=function(){this.viewer.scene.primitives.add(this),this.groundAreaEntity&&this.viewer.entities.add(this.groundAreaEntity);},o.prototype.destroy=function(s){s&&(this.viewer.scene.primitives.remove(this),this.groundAreaEntity&&this.viewer.entities.remove(this.groundAreaEntity),this._drawCommands.forEach(function(e){e.vertexArray=e.vertexArray&&e.vertexArray.destroy();}),this._drawCommands=[]);},l.Scene.ConeSensorPrimitive=o;},_installCounputeVertex:function(){function t(n){var i=n.indices,a=n.attributes,m=i.length;if(a.position){var c=a.position.values;if(a.normal===void 0)a.normal=new l.GeometryAttribute({componentDatatype:l.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(c.length)});else for(var y=a.normal.values,h=0;h<m;h++)y[h]=0;for(var u,g,_,x=a.normal.values,D=new l.Cartesian3,O=new l.Cartesian3,z=new l.Cartesian3,b=new l.Cartesian3,F=new l.Cartesian3,h=0;h<m;h+=3)u=3*i[h+0],g=3*i[h+1],_=3*i[h+2],l.Cartesian3.fromArray(c,u,D),l.Cartesian3.fromArray(c,g,O),l.Cartesian3.fromArray(c,_,z),l.Cartesian3.subtract(z,O,b),l.Cartesian3.subtract(D,O,F),l.Cartesian3.cross(b,F,b),x[u]+=b.x,x[u+1]+=b.y,x[u+2]+=b.z,x[g]+=b.x,x[g+1]+=b.y,x[g+2]+=b.z,x[_]+=b.x,x[_+1]+=b.y,x[_+2]+=b.z;o(n),a.normal.needsUpdate=true;}return n}function o(n){for(var i,a,m,c,y=n.attributes.normal.values,h=0;h<y.length;h+=3)i=y[h],a=y[h+1],m=y[h+2],c=1/Math.sqrt(i*i+a*a+m*m),y[h]=i*c,y[h+1]=a*c,y[h+2]=m*c;}function d(n,i,a,m){m=m||l.Ellipsoid.WGS84,l.Matrix4.multiplyByPoint(i,n,s),l.Cartesian3.subtract(s,a.origin,a.direction),l.Cartesian3.normalize(a.direction,a.direction);var c=l.IntersectionTests.rayEllipsoid(a,m),y=null;if(c&&(y=l.Ray.getPoint(a,c.start)),y)try{l.Cartographic.fromCartesian(y,null,e);}catch{return null}return y}var s=new l.Cartesian3,e=(new l.Ray,new l.Cartographic);l.Scene.computeVertexNormals=t,l.Scene.extend2Earth=d;}};function Ge(t,o){if(o){new be(t,o);let e=new Oe(o),n=new ze(o),i=new Fe(o,e);o.Scene.RectangularSensorPrimitive=e,o.Scene.RectangularSensorGraphics=n,o.Scene.RectangularSensorVisualizer=i;var d=o.DataSourceDisplay,s=d.defaultVisualizersCallback;d.defaultVisualizersCallback=function(a,m,c){var y=c.entities,h=s(a,m,c);return h.concat([new i(a,y)])};}}function ht(){let t=null,o=function(d,s){d&&(this._viewer=d,t=s,this._customPluginLayer=new t.CustomDataSource("_customPluginLayer"),new Ge(d,s),d&&d.dataSources.add(this._customPluginLayer));};return o.prototype={createRectangularSensorGraphics:function(d){if(this._customPluginLayer&&d){let s=new t.HeadingPitchRoll(t.Math.toRadians(d.heading||90),t.Math.toRadians(d.pitch||0),t.Math.toRadians(d.roll||0)),e=d.position;return this._customPluginLayer.entities.add({position:e,orientation:t.Transforms.headingPitchRollQuaternion(e,s),rectangularSensor:new t.Scene.RectangularSensorGraphics({radius:d.radius||1e5,xHalfAngle:t.Math.toRadians(d.xHalfAngle||45),yHalfAngle:t.Math.toRadians(d.yHalfAngle||45),material:d.material||new t.Color(1,0,1,.4),lineColor:d.lineColor||new t.Color(1,0,1,1),showScanPlane:this._objHasOwnProperty(d,"showScanPlane",true),showSectorLines:this._objHasOwnProperty(d,"showSectorLines",true),showLateralSurfaces:this._objHasOwnProperty(d,"showLateralSurfaces",true),modelMatrix:d.modelMatrix||new t.Matrix4,scanPlaneColor:d.scanPlaneColor||new t.Color(1,0,1,1),scanPlaneMode:d.scanPlaneMode||"vertical",scanPlaneRate:d.scanPlaneRate||3,showThroughEllipsoid:this._objHasOwnProperty(d,"showThroughEllipsoid",false),show:this._objHasOwnProperty(d,"show",true)})})}},_objHasOwnProperty(d,s,e){return d.hasOwnProperty(s)?d.field:e},createSatelliteCoverageSimulationGraphics:function(d){if(d)return new t.Scene.SatelliteCoverageSimulation(this._viewer,{position:d.position,angle1:d.angle1||30,angle2:d.angle2||45,areaType:d.areaType||2,rotation:{heading:t.Math.toRadians(d.heading||0),pitch:t.Math.toRadians(d.pitch||0),roll:t.Math.toRadians(d.roll||0)},color:d.color||{red:.43137254901960786,green:.9607843137254902,blue:0,alpha:.8}})},createRadarPrimitive:function(d){if(d)return new t.Scene.ConeSensorPrimitive(this._viewer,{position:d.position,angle:d.angle||80,radius:d.radius||7e5,rotation:{heading:t.Math.toRadians(d.heading||0),pitch:t.Math.toRadians(d.pitch||40),roll:t.Math.toRadians(d.roll||0)},color:d.color||{red:1,green:0,blue:0,alpha:.4},lineColor:d.lineColor||{red:1,green:1,blue:1,alpha:.9}})}},o}var Te=we(ht);var Yt=Le(xe,Te,"customCesiumPlugin");exports.CustomCesiumPlugin=Yt;//# sourceMappingURL=custom-cesium-plugin.cjs.map
507
+ //# sourceMappingURL=custom-cesium-plugin.cjs.map