cesium_dev_kit 1.1.23 → 1.2.0

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.
package/dist/graphics.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var S=class extends Error{constructor(s,m,h={}){super(`[cesium_dev_kit:${s}] ${m}`),this.name="CesiumDevKitError",this.code=s,this.details=h.details,this.cause=h.cause,Object.setPrototypeOf(this,new.target.prototype);}};function Z(t){return t instanceof S?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function E(t,s){let m=s!=null&&s.scope?`[cesium_dev_kit:${s.scope}]`:"[cesium_dev_kit]";console.warn(m,t,s!=null?s:"");}var O=class{constructor(s){this.viewer=null;this.Cesium=s,this.init_data();}init_data(){this.viewer=null;}init({containerId:s,viewerConfig:m,extraConfig:h,MapImageryList:e,imageryProvider:r,viewer:i}){let a=s,n={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},l=this.findCesiumProvider(r),o=h==null?void 0:h.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),n=Object.assign(n,m);let c=i||new this.Cesium.Viewer(a,{...n,...l});if(h&&!h.logo){let u=c.cesiumWidget.creditContainer;u.style.display="none";}if(h&&h.depthTest&&(c.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(c,e[u].type,e[u].option||e[u].classConfig);if(!i){let u=typeof document=="undefined"?null:a&&a.nodeType===1?a:document.getElementById(a);this.bindContainerResize(c,u);}return this.viewer=c,c}bindContainerResize(s,m){if(typeof ResizeObserver=="undefined"||!m)return;let h=()=>{try{(typeof s.isDestroyed!="function"||!s.isDestroyed())&&s.resize();}catch(i){E(i,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(h);e.observe(m),typeof requestAnimationFrame=="function"&&requestAnimationFrame(h);let r=s.destroy.bind(s);s.destroy=function(){try{e.disconnect();}catch(i){E(i,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(s,m,h){s.imageryLayers.addImageryProvider(this.createCesiumProvider({type:m,option:h}));}findCesiumProvider(s){let m={};if(!s)return m;for(let h in s){let e=s[h];if(e&&e.type){m[h]=this.createCesiumProvider(e);continue}m[h]=s[h];}return m}createCesiumProvider(s){switch(s.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[s.type](s.option);case "UrlTemplateImageryProvider":return new this.Cesium[s.type](s.option);case "TileMapServiceImageryProvider":return new this.Cesium[s.type](s.option)}}};function X(t,s){if(!s)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(s)||s.startsWith("data:")||s.startsWith("/"))return s;let m=(t||"").replace(/\/+$/,"");return m?m+"/"+s.replace(/^\/+/,""):s}function M(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var se=Object.assign((t,s)=>t!=null?t:s,{EMPTY_OBJECT:Object.freeze({})}),K=se;function j(t){function s(...m){let h=t();return new h(...m)}return s.prototype=t().prototype,Object.defineProperty(s,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),s}function L(t){let s=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof s=="function"?s():t}function J(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(s){console.warn("[cesium_dev_kit] failed to dispose viewer:",s);}}var x=new WeakMap;function G(t,s){if(!t||typeof s!="function")return;let m=x.get(t);m?m.push(s):x.set(t,[s]);}function W(t,s){if(!t||!s||t===s)return;let m=x.get(t);if(!m||m.length===0)return;x.delete(t);let h=x.get(s);h?h.push(...m):x.set(s,m);}function V(t){if(!t||typeof t!="object"&&typeof t!="function")return;let s=x.get(t);if(s){x.delete(t);for(let m=s.length-1;m>=0;m--)try{s[m]();}catch(h){console.warn("[cesium_dev_kit] cleanup failed:",h);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){V(this);},enumerable:false,configurable:true,writable:true});}function ce(){let t={},s;class m{constructor(e,r,i){if(e){this._viewer=e,t=r,s=i||M(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let a=this._drawLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._drawLayer===a&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,i){return e.hasOwnProperty(r)?e[r]:i}getDfSt(e){if(!s)return;let r=s,i=e.reduce((a,n)=>a?a[n]:r[n],void 0);if(i!=null)return typeof i!="string"?i:X(r.baseService,i)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
1
+ 'use strict';var S=class extends Error{constructor(s,m,h={}){super(`[cesium_dev_kit:${s}] ${m}`),this.name="CesiumDevKitError",this.code=s,this.details=h.details,this.cause=h.cause,Object.setPrototypeOf(this,new.target.prototype);}};function Z(t){return t instanceof S?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function B(t,s){let m=s!=null&&s.scope?`[cesium_dev_kit:${s.scope}]`:"[cesium_dev_kit]";console.warn(m,t,s!=null?s:"");}var O=class{constructor(s){this.viewer=null;this.Cesium=s,this.init_data();}init_data(){this.viewer=null;}init({containerId:s,viewerConfig:m,extraConfig:h,MapImageryList:e,imageryProvider:r,viewer:i}){let a=s,n={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},l=this.findCesiumProvider(r),o=h==null?void 0:h.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),n=Object.assign(n,m);let c=i||new this.Cesium.Viewer(a,{...n,...l});if(h&&!h.logo){let u=c.cesiumWidget.creditContainer;u.style.display="none";}if(h&&h.depthTest&&(c.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(c,e[u].type,e[u].option||e[u].classConfig);if(!i){let u=typeof document=="undefined"?null:a&&a.nodeType===1?a:document.getElementById(a);this.bindContainerResize(c,u);}return this.viewer=c,c}bindContainerResize(s,m){if(typeof ResizeObserver=="undefined"||!m)return;let h=()=>{try{(typeof s.isDestroyed!="function"||!s.isDestroyed())&&s.resize();}catch(i){B(i,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(h);e.observe(m),typeof requestAnimationFrame=="function"&&requestAnimationFrame(h);let r=s.destroy.bind(s);s.destroy=function(){try{e.disconnect();}catch(i){B(i,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(s,m,h){s.imageryLayers.addImageryProvider(this.createCesiumProvider({type:m,option:h}));}findCesiumProvider(s){let m={};if(!s)return m;for(let h in s){let e=s[h];if(e&&e.type){m[h]=this.createCesiumProvider(e);continue}m[h]=s[h];}return m}createCesiumProvider(s){switch(s.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[s.type](s.option);case "UrlTemplateImageryProvider":return new this.Cesium[s.type](s.option);case "TileMapServiceImageryProvider":return new this.Cesium[s.type](s.option)}}};function X(t,s){if(!s)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(s)||s.startsWith("data:")||s.startsWith("/"))return s;let m=(t||"").replace(/\/+$/,"");return m?m+"/"+s.replace(/^\/+/,""):s}function M(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var se=Object.assign((t,s)=>t!=null?t:s,{EMPTY_OBJECT:Object.freeze({})}),K=se;function j(t){function s(...m){let h=t();return new h(...m)}return s.prototype=t().prototype,Object.defineProperty(s,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),s}function L(t){let s=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof s=="function"?s():t}function J(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(s){console.warn("[cesium_dev_kit] failed to dispose viewer:",s);}}var x=new WeakMap;function G(t,s){if(!t||typeof s!="function")return;let m=x.get(t);m?m.push(s):x.set(t,[s]);}function W(t,s){if(!t||!s||t===s)return;let m=x.get(t);if(!m||m.length===0)return;x.delete(t);let h=x.get(s);h?h.push(...m):x.set(s,m);}function V(t){if(!t||typeof t!="object"&&typeof t!="function")return;let s=x.get(t);if(s){x.delete(t);for(let m=s.length-1;m>=0;m--)try{s[m]();}catch(h){console.warn("[cesium_dev_kit] cleanup failed:",h);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){V(this);},enumerable:false,configurable:true,writable:true});}function ce(){let t={},s;class m{constructor(e,r,i){if(e){this._viewer=e,t=r,s=i||M(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let a=this._drawLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._drawLayer===a&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,i){return e.hasOwnProperty(r)?e[r]:i}getDfSt(e){if(!s)return;let r=s,i=e.reduce((a,n)=>a?a[n]:r[n],void 0);if(i!=null)return typeof i!="string"?i:X(r.baseService,i)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
2
2
  in vec2 v_textureCoordinates;
3
3
  uniform float scale;
4
4
  uniform vec3 offset;
@@ -136,5 +136,5 @@ void main(void)
136
136
  gl_Position = czm_projection * vec4(p, 1.0);
137
137
  v_texCoord = position.xyz;
138
138
  }
139
- `,re=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function I(v){this.sources=v.sources,this._sources=void 0,this.show=i(v.show,true),this._command=new w({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var ie=new c;I.prototype.update=function(v,A){var B=this;if(this.show&&!(v.mode!==k.SCENE3D&&v.mode!==k.MORPHING)&&v.passes.render){var R=v.context;if(this._sources!==this.sources){this._sources=this.sources;var y=this.sources;if(!a(y.positiveX)||!a(y.negativeX)||!a(y.positiveY)||!a(y.negativeY)||!a(y.positiveZ)||!a(y.negativeZ))throw new l("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof y.positiveX!=typeof y.negativeX||typeof y.positiveX!=typeof y.positiveY||typeof y.positiveX!=typeof y.negativeY||typeof y.positiveX!=typeof y.positiveZ||typeof y.positiveX!=typeof y.negativeZ)throw new l("this.sources properties must all be the same type.");typeof y.positiveX=="string"?b(R,this._sources).then(function(oe){B._cubeMap=B._cubeMap&&B._cubeMap.destroy(),B._cubeMap=oe;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:R,source:y}));}var C=this._command;if(C.modelMatrix=p.eastNorthUpToFixedFrame(v.camera._positionWC),!a(C.vertexArray)){C.uniformMap={u_cubeMap(){return B._cubeMap},u_rotateMatrix(){return re(C.modelMatrix,ie)}};var Y=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:d.POSITION_ONLY})),ae=this._attributeLocations=o.createAttributeLocations(Y);C.vertexArray=P.fromGeometry({context:R,geometry:Y,attributeLocations:ae,bufferUsage:g._DRAW}),C.renderState=_.fromCache({blending:T.ALPHA_BLEND});}if(!a(C.shaderProgram)||this._useHdr!==A){var ne=new $({defines:[A?"HDR":""],sources:[ee]});C.shaderProgram=D.fromCache({context:R,vertexShaderSource:te,fragmentShaderSource:ne,attributeLocations:this._attributeLocations}),this._useHdr=A;}if(a(this._cubeMap))return C}},I.prototype.isDestroyed=function(){return false},I.prototype.destroy=function(){var v=this._command;return v.vertexArray=v.vertexArray&&v.vertexArray.destroy(),v.shaderProgram=v.shaderProgram&&v.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),n(this)},t.Scene.GroundSkyBox=I;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return m}var F=j(ce);function le(t,s,m,h){function e(r,i){let a={},n=L(i),l=[];if(Array.isArray(r))r.forEach(c=>{let u=L(c),p=new u(t,s,m,h);o(u,n),l.push(p);}),a=new n(t,s,m,h),l.forEach(c=>Object.assign(a,c)),l.forEach(c=>W(c,a));else {let c=L(r),u=new c(t,s,m,h);o(c,n),a=new n(t,s,m,h),Object.assign(a,u),W(u,a);}function o(c,u){let p=Object.getOwnPropertyNames(c.prototype);for(let d=0,g=p.length;d<g;d++)p[d]!=="constructor"&&(u.prototype[p[d]]=c.prototype[p[d]]);}return a}return e}function ue({cesiumGlobal:t,threeGlobal:s,containerId:m,threeContainerId:h,viewerConfig:e={},extraConfig:r={},MapImageryList:i=[],defaultStatic:a,baseExtendsCom:n=[],extendsCom:l,extendsComName:o,viewer:c}){if(!t)throw new S("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!m&&!c)throw new S("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let p=new O(t).init({containerId:m,viewerConfig:e,extraConfig:r,MapImageryList:i,viewer:c}),d=!c,w=le(p,t,a,s?{threeGlobal:s,containerId:m,threeContainerId:h}:"")(n,l),b=false;return {viewer:p,[o]:w,dispose:()=>{if(!b){b=true;try{typeof w.destroy=="function"?w.destroy():V(w);}catch(_){E(_,{scope:"singleImport.dispose"});}d&&J(p);}}}}function q(t,s,m){function h(e){return ue({...e,baseExtendsCom:t,extendsCom:s,extendsComName:m})}return h}var H=null;function me(t){return t&&typeof t=="object"&&t.default?t.default:t}function pe(t,s){return s().then(me).catch(m=>{throw Z(m)?m:new S("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:m,details:{package:t}})})}function Q(){return H||(H=pe("libgif",()=>import('libgif'))),H}function he(){let t=null;class m{constructor(e,r,i){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let a=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._graphicsLayer===a&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let i in e.positions){let a=e.positions[i],n=this.createGraphics();n.name=e.name||"",n.oid=e.oid||"point",n.position=a,e.point&&(n.point=this.getPointGraphics()),e.billboard&&(n.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(n.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(n));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:i,height:a,width:n,material:l,...o}=e;var r=this.createGraphics();return a=a===void 0?6:a,n=n===void 0?15:n,r.corridor={positions:i,height:a,width:n,...o,material:l||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var i=e.entity,a=e.cylinder,n=this;return r.cylinder=this.getCylinderGraphics(a),r.position=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l),c=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,c,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),i=e.alp||1,a=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return a?(i=i-.05,i<=0&&(a=false)):(i=i+.05,i>=1&&(a=true)),t.Color.RED.withAlpha(i)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var P,T;if(e&&e.center){var r=this.createGraphics(),i=this,a=e.center,n=e.radius||800,l=e.rotateAmount||.05,o=0,c=e.height||1,u=0,p=0,d=0,g=(P=e.scale)!=null?P:0,f=(T=e.scale2)!=null?T:0,w=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(p),t.Math.toRadians(d)))},false);let k=n,D=false;var b=()=>{(n>=g||n<=k)&&(D=!D),D?n+=2:n-=2;},_=()=>{f>=n?n+=2:n=k;};return r.ellipse={material:w,height:c,semiMajorAxis:new t.CallbackProperty(function(){return n},false),semiMinorAxis:new t.CallbackProperty(function(){return n},false),stRotation:new t.CallbackProperty(function(){return l>0&&(o+=l,o>=360&&(o=0)),g&&b(),f&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,i=e.num||20,a=e.color||t.Color.RED,n=e.speed||.003,l=this.createGraphics();return l.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return i%2===0?r-=n:r+=n,(r<=.1||r>=1)&&i++,a.withAlpha(r)},false)})},this._graphicsLayer.entities.add(l)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,i=document.createElement("img");i.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let a=function(n){if(n.image){var l=document.createElement("canvas");l.width=n.width||150,l.height=n.height||80;var o=l.getContext("2d");o.drawImage(n.image,0,0);var c=n.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(c,55,36),l}};i.onload=function(){e.image=i;var n=r._graphicsLayer.entities.add({position:e.position,billboard:{image:a(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(n);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),i=0,a=e.positions,n=a[0];return r.position=new t.CallbackProperty(function(){return i==0?(n=a[0],i+=1):i<a.length-1?(n=a[i],i+=1):i==a.length-1&&(n=a[i],i=0),n},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await Q();if(e&&e.position){var i=[],a=e.url,n=0,l=6;return function(c,u){var p=document.createElement("img");p.src=c,p.setAttribute("rel:animated_src",c),p.setAttribute("rel:auto_play","0"),document.body.appendChild(p);var d=new r({gif:p});return new Promise(g=>{d.load(()=>{for(let f=1;f<=d.get_length();f++)d.move_to(f),u.push(d.get_canvas().toDataURL());g(u);});})}(a,i),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return i.length?(n<l*(i.length-1)?n++:n=0,i[Math.floor(n/l)]):a},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,i=e.rotateAmount,a=e.position,n=this;a.heading=0,a.pitch=0,a.roll=0,r.position=new t.CallbackProperty(function(){return n.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return i>0&&(a.heading+=i,a.heading===360&&(a.heading=0)),t.Transforms.headingPitchRollQuaternion(n.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(a.heading),t.Math.toRadians(a.pitch),t.Math.toRadians(a.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,i=e.minHeiht||5,a=e.maxHeiht||100,n=e.cartesians,l=e.speed||.06,o=this,c=i,u=!1;n.length?r.positions=new t.CallbackProperty(function(){var p=o.transformCartesianArrayToWGS84Array(n);for(var d in p){var g=p[d];(i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,g.alt=i;}return o.transformWGS84ArrayToCartesianArray(p,0)},!1):r.position=new t.CallbackProperty(function(){var p=o.transformCartesianToWGS84(n);return (i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,p.alt=i,o.transformWGS84ToCartesian(p)},!1);}catch(p){console.log(p);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var i=0,a=document.createElement("canvas"),n=a.getContext("2d"),l=new Image;l.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(n.clearRect(0,0,o,e.cheight||0),i<=o)n.drawImage(l,i,0);else return i=0,i+=3,a};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:i,alt:a,custMaterial:n,speed:l=0,direction:o="+"}){if(e){var c=this.createGraphics(),u=0,p=this._calcPoints(r,i,a,u);c.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(p),false),material:n||t.Color.AQUAMARINE.withAlpha(.5)};let d=()=>{l>0&&(u+=l,p=this._calcPoints(r,i,a,Number(o+u)));};return e.clock.onTick.addEventListener(d),G(this,()=>{e.clock.onTick.removeEventListener(d);}),this._graphicsLayer.entities.add(c)}}_computeCirclularFlight(e,r,i,a,n,l){let o=[];o.push(e),o.push(r),o.push(0);var c=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(i,a));for(let u=n;u<=n+l;u++){let p=c*Math.sin(u*Math.PI/180),d=Math.cos(u*Math.PI/180),g=(i-e)*d+e,f=(a-r)*d+r;o.push(g),o.push(f),o.push(p);}return o}_objHasOwnProperty(e,r,i){let a=e;return a&&a.hasOwnProperty(r)?a[r]:i}_calcPoints(e,r,i,a){var n=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),l=i*Math.cos(a*Math.PI/180),o=i*Math.sin(a*Math.PI/180),c=t.Cartesian3.fromElements(l,o,0),u=t.Matrix4.multiplyByPoint(n,c,new t.Cartesian3),p=t.Cartographic.fromCartesian(u),d=t.Math.toDegrees(p.longitude),g=t.Math.toDegrees(p.latitude);return this._computeCirclularFlight(e,r,d,g,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return m}var z=j(he);var je=q([F],z,"graphics");exports.Graphics=je;//# sourceMappingURL=graphics.cjs.map
139
+ `,re=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function I(v){this.sources=v.sources,this._sources=void 0,this.show=i(v.show,true),this._command=new w({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var ie=new c;I.prototype.update=function(v,A){var E=this;if(this.show&&!(v.mode!==k.SCENE3D&&v.mode!==k.MORPHING)&&v.passes.render){var R=v.context;if(this._sources!==this.sources){this._sources=this.sources;var y=this.sources;if(!a(y.positiveX)||!a(y.negativeX)||!a(y.positiveY)||!a(y.negativeY)||!a(y.positiveZ)||!a(y.negativeZ))throw new l("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof y.positiveX!=typeof y.negativeX||typeof y.positiveX!=typeof y.positiveY||typeof y.positiveX!=typeof y.negativeY||typeof y.positiveX!=typeof y.positiveZ||typeof y.positiveX!=typeof y.negativeZ)throw new l("this.sources properties must all be the same type.");typeof y.positiveX=="string"?b(R,this._sources).then(function(oe){E._cubeMap=E._cubeMap&&E._cubeMap.destroy(),E._cubeMap=oe;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:R,source:y}));}var C=this._command;if(C.modelMatrix=p.eastNorthUpToFixedFrame(v.camera._positionWC),!a(C.vertexArray)){C.uniformMap={u_cubeMap(){return E._cubeMap},u_rotateMatrix(){return re(C.modelMatrix,ie)}};var Y=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:d.POSITION_ONLY})),ae=this._attributeLocations=o.createAttributeLocations(Y);C.vertexArray=P.fromGeometry({context:R,geometry:Y,attributeLocations:ae,bufferUsage:g._DRAW}),C.renderState=_.fromCache({blending:T.ALPHA_BLEND});}if(!a(C.shaderProgram)||this._useHdr!==A){var ne=new $({defines:[A?"HDR":""],sources:[ee]});C.shaderProgram=D.fromCache({context:R,vertexShaderSource:te,fragmentShaderSource:ne,attributeLocations:this._attributeLocations}),this._useHdr=A;}if(a(this._cubeMap))return C}},I.prototype.isDestroyed=function(){return false},I.prototype.destroy=function(){var v=this._command;return v.vertexArray=v.vertexArray&&v.vertexArray.destroy(),v.shaderProgram=v.shaderProgram&&v.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),n(this)},t.Scene.GroundSkyBox=I;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return m}var F=j(ce);function le(t,s,m,h){function e(r,i){let a={},n=L(i),l=[];if(Array.isArray(r))r.forEach(c=>{let u=L(c),p=new u(t,s,m,h);o(u,n),l.push(p);}),a=new n(t,s,m,h),l.forEach(c=>Object.assign(a,c)),l.forEach(c=>W(c,a));else {let c=L(r),u=new c(t,s,m,h);o(c,n),a=new n(t,s,m,h),Object.assign(a,u),W(u,a);}function o(c,u){let p=Object.getOwnPropertyNames(c.prototype);for(let d=0,g=p.length;d<g;d++)p[d]!=="constructor"&&(u.prototype[p[d]]=c.prototype[p[d]]);}return a}return e}function ue({cesiumGlobal:t,threeGlobal:s,containerId:m,threeContainerId:h,viewerConfig:e={},extraConfig:r={},MapImageryList:i=[],defaultStatic:a,baseExtendsCom:n=[],extendsCom:l,extendsComName:o,viewer:c}){if(!t)throw new S("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!m&&!c)throw new S("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let p=new O(t).init({containerId:m,viewerConfig:e,extraConfig:r,MapImageryList:i,viewer:c}),d=!c,w=le(p,t,a,s?{threeGlobal:s,containerId:m,threeContainerId:h}:"")(n,l),b=false;return {viewer:p,[o]:w,dispose:()=>{if(!b){b=true;try{typeof w.destroy=="function"?w.destroy():V(w);}catch(_){B(_,{scope:"singleImport.dispose"});}d&&J(p);}}}}function q(t,s,m){function h(e){return ue({...e,baseExtendsCom:t,extendsCom:s,extendsComName:m})}return h}var H=null;function me(t){return t&&typeof t=="object"&&t.default?t.default:t}function pe(t,s){return s().then(me).catch(m=>{throw Z(m)?m:new S("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:m,details:{package:t}})})}function Q(){return H||(H=pe("libgif",()=>import('libgif'))),H}function he(){let t=null;class m{constructor(e,r,i){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let a=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._graphicsLayer===a&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let i in e.positions){let a=e.positions[i],n=this.createGraphics();n.name=e.name||"",n.oid=e.oid||"point",n.position=a,e.point&&(n.point=this.getPointGraphics()),e.billboard&&(n.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(n.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(n));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:i,height:a,width:n,material:l,...o}=e;var r=this.createGraphics();return a=a===void 0?6:a,n=n===void 0?15:n,r.corridor={positions:i,height:a,width:n,...o,material:l||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var i=e.entity,a=e.cylinder,n=this;return r.cylinder=this.getCylinderGraphics(a),r.position=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l),c=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,c,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),i=e.alp||1,a=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return a?(i=i-.05,i<=0&&(a=false)):(i=i+.05,i>=1&&(a=true)),t.Color.RED.withAlpha(i)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var P,T;if(e&&e.center){var r=this.createGraphics(),i=this,a=e.center,n=e.radius||800,l=e.rotateAmount||.05,o=0,c=e.height||1,u=0,p=0,d=0,g=(P=e.scale)!=null?P:0,f=(T=e.scale2)!=null?T:0,w=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(p),t.Math.toRadians(d)))},false);let k=n,D=false;var b=()=>{(n>=g||n<=k)&&(D=!D),D?n+=2:n-=2;},_=()=>{f>=n?n+=2:n=k;};return r.ellipse={material:w,height:c,semiMajorAxis:new t.CallbackProperty(function(){return n},false),semiMinorAxis:new t.CallbackProperty(function(){return n},false),stRotation:new t.CallbackProperty(function(){return l>0&&(o+=l,o>=360&&(o=0)),g&&b(),f&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,i=e.num||20,a=e.color||t.Color.RED,n=e.speed||.003,l=this.createGraphics();return l.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return i%2===0?r-=n:r+=n,(r<=.1||r>=1)&&i++,a.withAlpha(r)},false)})},this._graphicsLayer.entities.add(l)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,i=document.createElement("img");i.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let a=function(n){if(n.image){var l=document.createElement("canvas");l.width=n.width||150,l.height=n.height||80;var o=l.getContext("2d");o.drawImage(n.image,0,0);var c=n.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(c,55,36),l}};i.onload=function(){e.image=i;var n=r._graphicsLayer.entities.add({position:e.position,billboard:{image:a(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(n);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),i=0,a=e.positions,n=a[0];return r.position=new t.CallbackProperty(function(){return i==0?(n=a[0],i+=1):i<a.length-1?(n=a[i],i+=1):i==a.length-1&&(n=a[i],i=0),n},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await Q();if(e&&e.position){var i=[],a=e.url,n=0,l=6;return function(c,u){var p=document.createElement("img");p.src=c,p.setAttribute("rel:animated_src",c),p.setAttribute("rel:auto_play","0"),document.body.appendChild(p);var d=new r({gif:p});return new Promise(g=>{d.load(()=>{for(let f=1;f<=d.get_length();f++)d.move_to(f),u.push(d.get_canvas().toDataURL());g(u);});})}(a,i),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return i.length?(n<l*(i.length-1)?n++:n=0,i[Math.floor(n/l)]):a},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,i=e.rotateAmount,a=e.position,n=this;a.heading=0,a.pitch=0,a.roll=0,r.position=new t.CallbackProperty(function(){return n.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return i>0&&(a.heading+=i,a.heading===360&&(a.heading=0)),t.Transforms.headingPitchRollQuaternion(n.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(a.heading),t.Math.toRadians(a.pitch),t.Math.toRadians(a.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,i=e.minHeiht||5,a=e.maxHeiht||100,n=e.cartesians,l=e.speed||.06,o=this,c=i,u=!1;n.length?r.positions=new t.CallbackProperty(function(){var p=o.transformCartesianArrayToWGS84Array(n);for(var d in p){var g=p[d];(i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,g.alt=i;}return o.transformWGS84ArrayToCartesianArray(p,0)},!1):r.position=new t.CallbackProperty(function(){var p=o.transformCartesianToWGS84(n);return (i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,p.alt=i,o.transformWGS84ToCartesian(p)},!1);}catch(p){console.log(p);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var i=0,a=document.createElement("canvas"),n=a.getContext("2d"),l=new Image;l.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(n.clearRect(0,0,o,e.cheight||0),i<=o)n.drawImage(l,i,0);else return i=0,i+=3,a};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:i,alt:a,custMaterial:n,speed:l=0,direction:o="+"}){if(e){var c=this.createGraphics(),u=0,p=this._calcPoints(r,i,a,u);c.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(p),false),material:n||t.Color.AQUAMARINE.withAlpha(.5)};let d=()=>{l>0&&(u+=l,p=this._calcPoints(r,i,a,Number(o+u)));};return e.clock.onTick.addEventListener(d),G(this,()=>{e.clock.onTick.removeEventListener(d);}),this._graphicsLayer.entities.add(c)}}_computeCirclularFlight(e,r,i,a,n,l){let o=[];o.push(e),o.push(r),o.push(0);var c=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(i,a));for(let u=n;u<=n+l;u++){let p=c*Math.sin(u*Math.PI/180),d=Math.cos(u*Math.PI/180),g=(i-e)*d+e,f=(a-r)*d+r;o.push(g),o.push(f),o.push(p);}return o}_objHasOwnProperty(e,r,i){let a=e;return a&&a.hasOwnProperty(r)?a[r]:i}_calcPoints(e,r,i,a){var n=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),l=i*Math.cos(a*Math.PI/180),o=i*Math.sin(a*Math.PI/180),c=t.Cartesian3.fromElements(l,o,0),u=t.Matrix4.multiplyByPoint(n,c,new t.Cartesian3),p=t.Cartographic.fromCartesian(u),d=t.Math.toDegrees(p.longitude),g=t.Math.toDegrees(p.latitude);return this._computeCirclularFlight(e,r,d,g,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return m}var z=j(he);var je=q([F],z,"graphics");exports.Graphics=je;//# sourceMappingURL=graphics.cjs.map
140
140
  //# sourceMappingURL=graphics.cjs.map
package/dist/graphics.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var S=class extends Error{constructor(s,m,h={}){super(`[cesium_dev_kit:${s}] ${m}`),this.name="CesiumDevKitError",this.code=s,this.details=h.details,this.cause=h.cause,Object.setPrototypeOf(this,new.target.prototype);}};function Z(t){return t instanceof S?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function E(t,s){let m=s!=null&&s.scope?`[cesium_dev_kit:${s.scope}]`:"[cesium_dev_kit]";console.warn(m,t,s!=null?s:"");}var O=class{constructor(s){this.viewer=null;this.Cesium=s,this.init_data();}init_data(){this.viewer=null;}init({containerId:s,viewerConfig:m,extraConfig:h,MapImageryList:e,imageryProvider:r,viewer:i}){let a=s,n={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},l=this.findCesiumProvider(r),o=h==null?void 0:h.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),n=Object.assign(n,m);let c=i||new this.Cesium.Viewer(a,{...n,...l});if(h&&!h.logo){let u=c.cesiumWidget.creditContainer;u.style.display="none";}if(h&&h.depthTest&&(c.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(c,e[u].type,e[u].option||e[u].classConfig);if(!i){let u=typeof document=="undefined"?null:a&&a.nodeType===1?a:document.getElementById(a);this.bindContainerResize(c,u);}return this.viewer=c,c}bindContainerResize(s,m){if(typeof ResizeObserver=="undefined"||!m)return;let h=()=>{try{(typeof s.isDestroyed!="function"||!s.isDestroyed())&&s.resize();}catch(i){E(i,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(h);e.observe(m),typeof requestAnimationFrame=="function"&&requestAnimationFrame(h);let r=s.destroy.bind(s);s.destroy=function(){try{e.disconnect();}catch(i){E(i,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(s,m,h){s.imageryLayers.addImageryProvider(this.createCesiumProvider({type:m,option:h}));}findCesiumProvider(s){let m={};if(!s)return m;for(let h in s){let e=s[h];if(e&&e.type){m[h]=this.createCesiumProvider(e);continue}m[h]=s[h];}return m}createCesiumProvider(s){switch(s.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[s.type](s.option);case "UrlTemplateImageryProvider":return new this.Cesium[s.type](s.option);case "TileMapServiceImageryProvider":return new this.Cesium[s.type](s.option)}}};function X(t,s){if(!s)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(s)||s.startsWith("data:")||s.startsWith("/"))return s;let m=(t||"").replace(/\/+$/,"");return m?m+"/"+s.replace(/^\/+/,""):s}function M(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var se=Object.assign((t,s)=>t!=null?t:s,{EMPTY_OBJECT:Object.freeze({})}),K=se;function j(t){function s(...m){let h=t();return new h(...m)}return s.prototype=t().prototype,Object.defineProperty(s,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),s}function L(t){let s=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof s=="function"?s():t}function J(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(s){console.warn("[cesium_dev_kit] failed to dispose viewer:",s);}}var x=new WeakMap;function G(t,s){if(!t||typeof s!="function")return;let m=x.get(t);m?m.push(s):x.set(t,[s]);}function W(t,s){if(!t||!s||t===s)return;let m=x.get(t);if(!m||m.length===0)return;x.delete(t);let h=x.get(s);h?h.push(...m):x.set(s,m);}function V(t){if(!t||typeof t!="object"&&typeof t!="function")return;let s=x.get(t);if(s){x.delete(t);for(let m=s.length-1;m>=0;m--)try{s[m]();}catch(h){console.warn("[cesium_dev_kit] cleanup failed:",h);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){V(this);},enumerable:false,configurable:true,writable:true});}function ce(){let t={},s;class m{constructor(e,r,i){if(e){this._viewer=e,t=r,s=i||M(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let a=this._drawLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._drawLayer===a&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,i){return e.hasOwnProperty(r)?e[r]:i}getDfSt(e){if(!s)return;let r=s,i=e.reduce((a,n)=>a?a[n]:r[n],void 0);if(i!=null)return typeof i!="string"?i:X(r.baseService,i)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
1
+ var S=class extends Error{constructor(s,m,h={}){super(`[cesium_dev_kit:${s}] ${m}`),this.name="CesiumDevKitError",this.code=s,this.details=h.details,this.cause=h.cause,Object.setPrototypeOf(this,new.target.prototype);}};function Z(t){return t instanceof S?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function B(t,s){let m=s!=null&&s.scope?`[cesium_dev_kit:${s.scope}]`:"[cesium_dev_kit]";console.warn(m,t,s!=null?s:"");}var O=class{constructor(s){this.viewer=null;this.Cesium=s,this.init_data();}init_data(){this.viewer=null;}init({containerId:s,viewerConfig:m,extraConfig:h,MapImageryList:e,imageryProvider:r,viewer:i}){let a=s,n={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},l=this.findCesiumProvider(r),o=h==null?void 0:h.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),n=Object.assign(n,m);let c=i||new this.Cesium.Viewer(a,{...n,...l});if(h&&!h.logo){let u=c.cesiumWidget.creditContainer;u.style.display="none";}if(h&&h.depthTest&&(c.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(c,e[u].type,e[u].option||e[u].classConfig);if(!i){let u=typeof document=="undefined"?null:a&&a.nodeType===1?a:document.getElementById(a);this.bindContainerResize(c,u);}return this.viewer=c,c}bindContainerResize(s,m){if(typeof ResizeObserver=="undefined"||!m)return;let h=()=>{try{(typeof s.isDestroyed!="function"||!s.isDestroyed())&&s.resize();}catch(i){B(i,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(h);e.observe(m),typeof requestAnimationFrame=="function"&&requestAnimationFrame(h);let r=s.destroy.bind(s);s.destroy=function(){try{e.disconnect();}catch(i){B(i,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(s,m,h){s.imageryLayers.addImageryProvider(this.createCesiumProvider({type:m,option:h}));}findCesiumProvider(s){let m={};if(!s)return m;for(let h in s){let e=s[h];if(e&&e.type){m[h]=this.createCesiumProvider(e);continue}m[h]=s[h];}return m}createCesiumProvider(s){switch(s.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[s.type](s.option);case "UrlTemplateImageryProvider":return new this.Cesium[s.type](s.option);case "TileMapServiceImageryProvider":return new this.Cesium[s.type](s.option)}}};function X(t,s){if(!s)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(s)||s.startsWith("data:")||s.startsWith("/"))return s;let m=(t||"").replace(/\/+$/,"");return m?m+"/"+s.replace(/^\/+/,""):s}function M(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var se=Object.assign((t,s)=>t!=null?t:s,{EMPTY_OBJECT:Object.freeze({})}),K=se;function j(t){function s(...m){let h=t();return new h(...m)}return s.prototype=t().prototype,Object.defineProperty(s,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),s}function L(t){let s=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof s=="function"?s():t}function J(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(s){console.warn("[cesium_dev_kit] failed to dispose viewer:",s);}}var x=new WeakMap;function G(t,s){if(!t||typeof s!="function")return;let m=x.get(t);m?m.push(s):x.set(t,[s]);}function W(t,s){if(!t||!s||t===s)return;let m=x.get(t);if(!m||m.length===0)return;x.delete(t);let h=x.get(s);h?h.push(...m):x.set(s,m);}function V(t){if(!t||typeof t!="object"&&typeof t!="function")return;let s=x.get(t);if(s){x.delete(t);for(let m=s.length-1;m>=0;m--)try{s[m]();}catch(h){console.warn("[cesium_dev_kit] cleanup failed:",h);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){V(this);},enumerable:false,configurable:true,writable:true});}function ce(){let t={},s;class m{constructor(e,r,i){if(e){this._viewer=e,t=r,s=i||M(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let a=this._drawLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._drawLayer===a&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,i){return e.hasOwnProperty(r)?e[r]:i}getDfSt(e){if(!s)return;let r=s,i=e.reduce((a,n)=>a?a[n]:r[n],void 0);if(i!=null)return typeof i!="string"?i:X(r.baseService,i)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
2
2
  in vec2 v_textureCoordinates;
3
3
  uniform float scale;
4
4
  uniform vec3 offset;
@@ -136,5 +136,5 @@ void main(void)
136
136
  gl_Position = czm_projection * vec4(p, 1.0);
137
137
  v_texCoord = position.xyz;
138
138
  }
139
- `,re=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function I(v){this.sources=v.sources,this._sources=void 0,this.show=i(v.show,true),this._command=new w({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var ie=new c;I.prototype.update=function(v,A){var B=this;if(this.show&&!(v.mode!==k.SCENE3D&&v.mode!==k.MORPHING)&&v.passes.render){var R=v.context;if(this._sources!==this.sources){this._sources=this.sources;var y=this.sources;if(!a(y.positiveX)||!a(y.negativeX)||!a(y.positiveY)||!a(y.negativeY)||!a(y.positiveZ)||!a(y.negativeZ))throw new l("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof y.positiveX!=typeof y.negativeX||typeof y.positiveX!=typeof y.positiveY||typeof y.positiveX!=typeof y.negativeY||typeof y.positiveX!=typeof y.positiveZ||typeof y.positiveX!=typeof y.negativeZ)throw new l("this.sources properties must all be the same type.");typeof y.positiveX=="string"?b(R,this._sources).then(function(oe){B._cubeMap=B._cubeMap&&B._cubeMap.destroy(),B._cubeMap=oe;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:R,source:y}));}var C=this._command;if(C.modelMatrix=p.eastNorthUpToFixedFrame(v.camera._positionWC),!a(C.vertexArray)){C.uniformMap={u_cubeMap(){return B._cubeMap},u_rotateMatrix(){return re(C.modelMatrix,ie)}};var Y=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:d.POSITION_ONLY})),ae=this._attributeLocations=o.createAttributeLocations(Y);C.vertexArray=P.fromGeometry({context:R,geometry:Y,attributeLocations:ae,bufferUsage:g._DRAW}),C.renderState=_.fromCache({blending:T.ALPHA_BLEND});}if(!a(C.shaderProgram)||this._useHdr!==A){var ne=new $({defines:[A?"HDR":""],sources:[ee]});C.shaderProgram=D.fromCache({context:R,vertexShaderSource:te,fragmentShaderSource:ne,attributeLocations:this._attributeLocations}),this._useHdr=A;}if(a(this._cubeMap))return C}},I.prototype.isDestroyed=function(){return false},I.prototype.destroy=function(){var v=this._command;return v.vertexArray=v.vertexArray&&v.vertexArray.destroy(),v.shaderProgram=v.shaderProgram&&v.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),n(this)},t.Scene.GroundSkyBox=I;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return m}var F=j(ce);function le(t,s,m,h){function e(r,i){let a={},n=L(i),l=[];if(Array.isArray(r))r.forEach(c=>{let u=L(c),p=new u(t,s,m,h);o(u,n),l.push(p);}),a=new n(t,s,m,h),l.forEach(c=>Object.assign(a,c)),l.forEach(c=>W(c,a));else {let c=L(r),u=new c(t,s,m,h);o(c,n),a=new n(t,s,m,h),Object.assign(a,u),W(u,a);}function o(c,u){let p=Object.getOwnPropertyNames(c.prototype);for(let d=0,g=p.length;d<g;d++)p[d]!=="constructor"&&(u.prototype[p[d]]=c.prototype[p[d]]);}return a}return e}function ue({cesiumGlobal:t,threeGlobal:s,containerId:m,threeContainerId:h,viewerConfig:e={},extraConfig:r={},MapImageryList:i=[],defaultStatic:a,baseExtendsCom:n=[],extendsCom:l,extendsComName:o,viewer:c}){if(!t)throw new S("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!m&&!c)throw new S("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let p=new O(t).init({containerId:m,viewerConfig:e,extraConfig:r,MapImageryList:i,viewer:c}),d=!c,w=le(p,t,a,s?{threeGlobal:s,containerId:m,threeContainerId:h}:"")(n,l),b=false;return {viewer:p,[o]:w,dispose:()=>{if(!b){b=true;try{typeof w.destroy=="function"?w.destroy():V(w);}catch(_){E(_,{scope:"singleImport.dispose"});}d&&J(p);}}}}function q(t,s,m){function h(e){return ue({...e,baseExtendsCom:t,extendsCom:s,extendsComName:m})}return h}var H=null;function me(t){return t&&typeof t=="object"&&t.default?t.default:t}function pe(t,s){return s().then(me).catch(m=>{throw Z(m)?m:new S("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:m,details:{package:t}})})}function Q(){return H||(H=pe("libgif",()=>import('libgif'))),H}function he(){let t=null;class m{constructor(e,r,i){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let a=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._graphicsLayer===a&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let i in e.positions){let a=e.positions[i],n=this.createGraphics();n.name=e.name||"",n.oid=e.oid||"point",n.position=a,e.point&&(n.point=this.getPointGraphics()),e.billboard&&(n.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(n.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(n));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:i,height:a,width:n,material:l,...o}=e;var r=this.createGraphics();return a=a===void 0?6:a,n=n===void 0?15:n,r.corridor={positions:i,height:a,width:n,...o,material:l||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var i=e.entity,a=e.cylinder,n=this;return r.cylinder=this.getCylinderGraphics(a),r.position=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l),c=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,c,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),i=e.alp||1,a=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return a?(i=i-.05,i<=0&&(a=false)):(i=i+.05,i>=1&&(a=true)),t.Color.RED.withAlpha(i)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var P,T;if(e&&e.center){var r=this.createGraphics(),i=this,a=e.center,n=e.radius||800,l=e.rotateAmount||.05,o=0,c=e.height||1,u=0,p=0,d=0,g=(P=e.scale)!=null?P:0,f=(T=e.scale2)!=null?T:0,w=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(p),t.Math.toRadians(d)))},false);let k=n,D=false;var b=()=>{(n>=g||n<=k)&&(D=!D),D?n+=2:n-=2;},_=()=>{f>=n?n+=2:n=k;};return r.ellipse={material:w,height:c,semiMajorAxis:new t.CallbackProperty(function(){return n},false),semiMinorAxis:new t.CallbackProperty(function(){return n},false),stRotation:new t.CallbackProperty(function(){return l>0&&(o+=l,o>=360&&(o=0)),g&&b(),f&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,i=e.num||20,a=e.color||t.Color.RED,n=e.speed||.003,l=this.createGraphics();return l.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return i%2===0?r-=n:r+=n,(r<=.1||r>=1)&&i++,a.withAlpha(r)},false)})},this._graphicsLayer.entities.add(l)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,i=document.createElement("img");i.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let a=function(n){if(n.image){var l=document.createElement("canvas");l.width=n.width||150,l.height=n.height||80;var o=l.getContext("2d");o.drawImage(n.image,0,0);var c=n.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(c,55,36),l}};i.onload=function(){e.image=i;var n=r._graphicsLayer.entities.add({position:e.position,billboard:{image:a(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(n);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),i=0,a=e.positions,n=a[0];return r.position=new t.CallbackProperty(function(){return i==0?(n=a[0],i+=1):i<a.length-1?(n=a[i],i+=1):i==a.length-1&&(n=a[i],i=0),n},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await Q();if(e&&e.position){var i=[],a=e.url,n=0,l=6;return function(c,u){var p=document.createElement("img");p.src=c,p.setAttribute("rel:animated_src",c),p.setAttribute("rel:auto_play","0"),document.body.appendChild(p);var d=new r({gif:p});return new Promise(g=>{d.load(()=>{for(let f=1;f<=d.get_length();f++)d.move_to(f),u.push(d.get_canvas().toDataURL());g(u);});})}(a,i),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return i.length?(n<l*(i.length-1)?n++:n=0,i[Math.floor(n/l)]):a},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,i=e.rotateAmount,a=e.position,n=this;a.heading=0,a.pitch=0,a.roll=0,r.position=new t.CallbackProperty(function(){return n.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return i>0&&(a.heading+=i,a.heading===360&&(a.heading=0)),t.Transforms.headingPitchRollQuaternion(n.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(a.heading),t.Math.toRadians(a.pitch),t.Math.toRadians(a.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,i=e.minHeiht||5,a=e.maxHeiht||100,n=e.cartesians,l=e.speed||.06,o=this,c=i,u=!1;n.length?r.positions=new t.CallbackProperty(function(){var p=o.transformCartesianArrayToWGS84Array(n);for(var d in p){var g=p[d];(i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,g.alt=i;}return o.transformWGS84ArrayToCartesianArray(p,0)},!1):r.position=new t.CallbackProperty(function(){var p=o.transformCartesianToWGS84(n);return (i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,p.alt=i,o.transformWGS84ToCartesian(p)},!1);}catch(p){console.log(p);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var i=0,a=document.createElement("canvas"),n=a.getContext("2d"),l=new Image;l.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(n.clearRect(0,0,o,e.cheight||0),i<=o)n.drawImage(l,i,0);else return i=0,i+=3,a};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:i,alt:a,custMaterial:n,speed:l=0,direction:o="+"}){if(e){var c=this.createGraphics(),u=0,p=this._calcPoints(r,i,a,u);c.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(p),false),material:n||t.Color.AQUAMARINE.withAlpha(.5)};let d=()=>{l>0&&(u+=l,p=this._calcPoints(r,i,a,Number(o+u)));};return e.clock.onTick.addEventListener(d),G(this,()=>{e.clock.onTick.removeEventListener(d);}),this._graphicsLayer.entities.add(c)}}_computeCirclularFlight(e,r,i,a,n,l){let o=[];o.push(e),o.push(r),o.push(0);var c=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(i,a));for(let u=n;u<=n+l;u++){let p=c*Math.sin(u*Math.PI/180),d=Math.cos(u*Math.PI/180),g=(i-e)*d+e,f=(a-r)*d+r;o.push(g),o.push(f),o.push(p);}return o}_objHasOwnProperty(e,r,i){let a=e;return a&&a.hasOwnProperty(r)?a[r]:i}_calcPoints(e,r,i,a){var n=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),l=i*Math.cos(a*Math.PI/180),o=i*Math.sin(a*Math.PI/180),c=t.Cartesian3.fromElements(l,o,0),u=t.Matrix4.multiplyByPoint(n,c,new t.Cartesian3),p=t.Cartographic.fromCartesian(u),d=t.Math.toDegrees(p.longitude),g=t.Math.toDegrees(p.latitude);return this._computeCirclularFlight(e,r,d,g,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return m}var z=j(he);var je=q([F],z,"graphics");export{je as Graphics};//# sourceMappingURL=graphics.mjs.map
139
+ `,re=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function I(v){this.sources=v.sources,this._sources=void 0,this.show=i(v.show,true),this._command=new w({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var ie=new c;I.prototype.update=function(v,A){var E=this;if(this.show&&!(v.mode!==k.SCENE3D&&v.mode!==k.MORPHING)&&v.passes.render){var R=v.context;if(this._sources!==this.sources){this._sources=this.sources;var y=this.sources;if(!a(y.positiveX)||!a(y.negativeX)||!a(y.positiveY)||!a(y.negativeY)||!a(y.positiveZ)||!a(y.negativeZ))throw new l("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof y.positiveX!=typeof y.negativeX||typeof y.positiveX!=typeof y.positiveY||typeof y.positiveX!=typeof y.negativeY||typeof y.positiveX!=typeof y.positiveZ||typeof y.positiveX!=typeof y.negativeZ)throw new l("this.sources properties must all be the same type.");typeof y.positiveX=="string"?b(R,this._sources).then(function(oe){E._cubeMap=E._cubeMap&&E._cubeMap.destroy(),E._cubeMap=oe;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new f({context:R,source:y}));}var C=this._command;if(C.modelMatrix=p.eastNorthUpToFixedFrame(v.camera._positionWC),!a(C.vertexArray)){C.uniformMap={u_cubeMap(){return E._cubeMap},u_rotateMatrix(){return re(C.modelMatrix,ie)}};var Y=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:d.POSITION_ONLY})),ae=this._attributeLocations=o.createAttributeLocations(Y);C.vertexArray=P.fromGeometry({context:R,geometry:Y,attributeLocations:ae,bufferUsage:g._DRAW}),C.renderState=_.fromCache({blending:T.ALPHA_BLEND});}if(!a(C.shaderProgram)||this._useHdr!==A){var ne=new $({defines:[A?"HDR":""],sources:[ee]});C.shaderProgram=D.fromCache({context:R,vertexShaderSource:te,fragmentShaderSource:ne,attributeLocations:this._attributeLocations}),this._useHdr=A;}if(a(this._cubeMap))return C}},I.prototype.isDestroyed=function(){return false},I.prototype.destroy=function(){var v=this._command;return v.vertexArray=v.vertexArray&&v.vertexArray.destroy(),v.shaderProgram=v.shaderProgram&&v.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),n(this)},t.Scene.GroundSkyBox=I;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return m}var F=j(ce);function le(t,s,m,h){function e(r,i){let a={},n=L(i),l=[];if(Array.isArray(r))r.forEach(c=>{let u=L(c),p=new u(t,s,m,h);o(u,n),l.push(p);}),a=new n(t,s,m,h),l.forEach(c=>Object.assign(a,c)),l.forEach(c=>W(c,a));else {let c=L(r),u=new c(t,s,m,h);o(c,n),a=new n(t,s,m,h),Object.assign(a,u),W(u,a);}function o(c,u){let p=Object.getOwnPropertyNames(c.prototype);for(let d=0,g=p.length;d<g;d++)p[d]!=="constructor"&&(u.prototype[p[d]]=c.prototype[p[d]]);}return a}return e}function ue({cesiumGlobal:t,threeGlobal:s,containerId:m,threeContainerId:h,viewerConfig:e={},extraConfig:r={},MapImageryList:i=[],defaultStatic:a,baseExtendsCom:n=[],extendsCom:l,extendsComName:o,viewer:c}){if(!t)throw new S("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!m&&!c)throw new S("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let p=new O(t).init({containerId:m,viewerConfig:e,extraConfig:r,MapImageryList:i,viewer:c}),d=!c,w=le(p,t,a,s?{threeGlobal:s,containerId:m,threeContainerId:h}:"")(n,l),b=false;return {viewer:p,[o]:w,dispose:()=>{if(!b){b=true;try{typeof w.destroy=="function"?w.destroy():V(w);}catch(_){B(_,{scope:"singleImport.dispose"});}d&&J(p);}}}}function q(t,s,m){function h(e){return ue({...e,baseExtendsCom:t,extendsCom:s,extendsComName:m})}return h}var H=null;function me(t){return t&&typeof t=="object"&&t.default?t.default:t}function pe(t,s){return s().then(me).catch(m=>{throw Z(m)?m:new S("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:m,details:{package:t}})})}function Q(){return H||(H=pe("libgif",()=>import('libgif'))),H}function he(){let t=null;class m{constructor(e,r,i){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let a=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&a&&(this._viewer.dataSources.remove(a,true),this._graphicsLayer===a&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let i in e.positions){let a=e.positions[i],n=this.createGraphics();n.name=e.name||"",n.oid=e.oid||"point",n.position=a,e.point&&(n.point=this.getPointGraphics()),e.billboard&&(n.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(n.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(n));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:i,height:a,width:n,material:l,...o}=e;var r=this.createGraphics();return a=a===void 0?6:a,n=n===void 0?15:n,r.corridor={positions:i,height:a,width:n,...o,material:l||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var i=e.entity,a=e.cylinder,n=this;return r.cylinder=this.getCylinderGraphics(a),r.position=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l),c=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,c,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var l=i.position.getValue(n._viewer.clock.currentTime),o=n._viewer.scene.globe.ellipsoid.cartesianToCartographic(l);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),i=e.alp||1,a=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return a?(i=i-.05,i<=0&&(a=false)):(i=i+.05,i>=1&&(a=true)),t.Color.RED.withAlpha(i)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var P,T;if(e&&e.center){var r=this.createGraphics(),i=this,a=e.center,n=e.radius||800,l=e.rotateAmount||.05,o=0,c=e.height||1,u=0,p=0,d=0,g=(P=e.scale)!=null?P:0,f=(T=e.scale2)!=null?T:0,w=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(p),t.Math.toRadians(d)))},false);let k=n,D=false;var b=()=>{(n>=g||n<=k)&&(D=!D),D?n+=2:n-=2;},_=()=>{f>=n?n+=2:n=k;};return r.ellipse={material:w,height:c,semiMajorAxis:new t.CallbackProperty(function(){return n},false),semiMinorAxis:new t.CallbackProperty(function(){return n},false),stRotation:new t.CallbackProperty(function(){return l>0&&(o+=l,o>=360&&(o=0)),g&&b(),f&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,i=e.num||20,a=e.color||t.Color.RED,n=e.speed||.003,l=this.createGraphics();return l.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return i%2===0?r-=n:r+=n,(r<=.1||r>=1)&&i++,a.withAlpha(r)},false)})},this._graphicsLayer.entities.add(l)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,i=document.createElement("img");i.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let a=function(n){if(n.image){var l=document.createElement("canvas");l.width=n.width||150,l.height=n.height||80;var o=l.getContext("2d");o.drawImage(n.image,0,0);var c=n.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(c,55,36),l}};i.onload=function(){e.image=i;var n=r._graphicsLayer.entities.add({position:e.position,billboard:{image:a(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(n);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),i=0,a=e.positions,n=a[0];return r.position=new t.CallbackProperty(function(){return i==0?(n=a[0],i+=1):i<a.length-1?(n=a[i],i+=1):i==a.length-1&&(n=a[i],i=0),n},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await Q();if(e&&e.position){var i=[],a=e.url,n=0,l=6;return function(c,u){var p=document.createElement("img");p.src=c,p.setAttribute("rel:animated_src",c),p.setAttribute("rel:auto_play","0"),document.body.appendChild(p);var d=new r({gif:p});return new Promise(g=>{d.load(()=>{for(let f=1;f<=d.get_length();f++)d.move_to(f),u.push(d.get_canvas().toDataURL());g(u);});})}(a,i),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return i.length?(n<l*(i.length-1)?n++:n=0,i[Math.floor(n/l)]):a},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,i=e.rotateAmount,a=e.position,n=this;a.heading=0,a.pitch=0,a.roll=0,r.position=new t.CallbackProperty(function(){return n.transformWGS84ToCartesian(a)},false),r.orientation=new t.CallbackProperty(function(){return i>0&&(a.heading+=i,a.heading===360&&(a.heading=0)),t.Transforms.headingPitchRollQuaternion(n.transformWGS84ToCartesian(a),new t.HeadingPitchRoll(t.Math.toRadians(a.heading),t.Math.toRadians(a.pitch),t.Math.toRadians(a.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,i=e.minHeiht||5,a=e.maxHeiht||100,n=e.cartesians,l=e.speed||.06,o=this,c=i,u=!1;n.length?r.positions=new t.CallbackProperty(function(){var p=o.transformCartesianArrayToWGS84Array(n);for(var d in p){var g=p[d];(i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,g.alt=i;}return o.transformWGS84ArrayToCartesianArray(p,0)},!1):r.position=new t.CallbackProperty(function(){var p=o.transformCartesianToWGS84(n);return (i>=a||i<=c)&&(u=!u),u?i+=l:i-=l,p.alt=i,o.transformWGS84ToCartesian(p)},!1);}catch(p){console.log(p);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var i=0,a=document.createElement("canvas"),n=a.getContext("2d"),l=new Image;l.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(n.clearRect(0,0,o,e.cheight||0),i<=o)n.drawImage(l,i,0);else return i=0,i+=3,a};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:i,alt:a,custMaterial:n,speed:l=0,direction:o="+"}){if(e){var c=this.createGraphics(),u=0,p=this._calcPoints(r,i,a,u);c.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(p),false),material:n||t.Color.AQUAMARINE.withAlpha(.5)};let d=()=>{l>0&&(u+=l,p=this._calcPoints(r,i,a,Number(o+u)));};return e.clock.onTick.addEventListener(d),G(this,()=>{e.clock.onTick.removeEventListener(d);}),this._graphicsLayer.entities.add(c)}}_computeCirclularFlight(e,r,i,a,n,l){let o=[];o.push(e),o.push(r),o.push(0);var c=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(i,a));for(let u=n;u<=n+l;u++){let p=c*Math.sin(u*Math.PI/180),d=Math.cos(u*Math.PI/180),g=(i-e)*d+e,f=(a-r)*d+r;o.push(g),o.push(f),o.push(p);}return o}_objHasOwnProperty(e,r,i){let a=e;return a&&a.hasOwnProperty(r)?a[r]:i}_calcPoints(e,r,i,a){var n=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),l=i*Math.cos(a*Math.PI/180),o=i*Math.sin(a*Math.PI/180),c=t.Cartesian3.fromElements(l,o,0),u=t.Matrix4.multiplyByPoint(n,c,new t.Cartesian3),p=t.Cartographic.fromCartesian(u),d=t.Math.toDegrees(p.longitude),g=t.Math.toDegrees(p.latitude);return this._computeCirclularFlight(e,r,d,g,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return m}var z=j(he);var je=q([F],z,"graphics");export{je as Graphics};//# sourceMappingURL=graphics.mjs.map
140
140
  //# sourceMappingURL=graphics.mjs.map