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/CHANGELOG.md +47 -2
- package/README.md +12 -6
- package/README.zh-CN.md +11 -6
- package/dist/control.cjs +2 -2
- package/dist/control.mjs +2 -2
- package/dist/custom-cesium-plugin.cjs +5 -5
- package/dist/custom-cesium-plugin.mjs +5 -5
- package/dist/graphics.cjs +2 -2
- package/dist/graphics.mjs +2 -2
- package/dist/index.cjs +117 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +505 -2
- package/dist/index.d.ts +505 -2
- package/dist/index.mjs +117 -35
- package/dist/index.mjs.map +1 -1
- package/dist/pass-effect.cjs +5 -5
- package/dist/pass-effect.mjs +5 -5
- package/dist/plugin.cjs +2 -2
- package/dist/plugin.mjs +2 -2
- package/dist/primitive.cjs +6 -6
- package/dist/primitive.cjs.map +1 -1
- package/dist/primitive.mjs +6 -6
- package/dist/primitive.mjs.map +1 -1
- package/dist/three.cjs +2 -2
- package/dist/three.cjs.map +1 -1
- package/dist/three.mjs +2 -2
- package/dist/three.mjs.map +1 -1
- package/package.json +5 -4
package/dist/pass-effect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var D=class extends Error{constructor(c,s,p={}){super(`[cesium_dev_kit:${c}] ${s}`),this.name="CesiumDevKitError",this.code=c,this.details=p.details,this.cause=p.cause,Object.setPrototypeOf(this,new.target.prototype);}};function ee(t){return t instanceof D?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function L(t,c){let s=c!=null&&c.scope?`[cesium_dev_kit:${c.scope}]`:"[cesium_dev_kit]";console.warn(s,t,c!=null?c:"");}var H=class{constructor(c){this.viewer=null;this.Cesium=c,this.init_data();}init_data(){this.viewer=null;}init({containerId:c,viewerConfig:s,extraConfig:p,MapImageryList:e,imageryProvider:r,viewer:a}){let n=c,i={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},m=this.findCesiumProvider(r),o=p==null?void 0:p.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),i=Object.assign(i,s);let l=a||new this.Cesium.Viewer(n,{...i,...m});if(p&&!p.logo){let u=l.cesiumWidget.creditContainer;u.style.display="none";}if(p&&p.depthTest&&(l.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(l,e[u].type,e[u].option||e[u].classConfig);if(!a){let u=typeof document=="undefined"?null:n&&n.nodeType===1?n:document.getElementById(n);this.bindContainerResize(l,u);}return this.viewer=l,l}bindContainerResize(c,s){if(typeof ResizeObserver=="undefined"||!s)return;let p=()=>{try{(typeof c.isDestroyed!="function"||!c.isDestroyed())&&c.resize();}catch(a){L(a,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(p);e.observe(s),typeof requestAnimationFrame=="function"&&requestAnimationFrame(p);let r=c.destroy.bind(c);c.destroy=function(){try{e.disconnect();}catch(a){L(a,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(c,s,p){c.imageryLayers.addImageryProvider(this.createCesiumProvider({type:s,option:p}));}findCesiumProvider(c){let s={};if(!c)return s;for(let p in c){let e=c[p];if(e&&e.type){s[p]=this.createCesiumProvider(e);continue}s[p]=c[p];}return s}createCesiumProvider(c){switch(c.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[c.type](c.option);case "UrlTemplateImageryProvider":return new this.Cesium[c.type](c.option);case "TileMapServiceImageryProvider":return new this.Cesium[c.type](c.option)}}};function te(t,c){if(!c)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(c)||c.startsWith("data:")||c.startsWith("/"))return c;let s=(t||"").replace(/\/+$/,"");return s?s+"/"+c.replace(/^\/+/,""):c}function z(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var me=Object.assign((t,c)=>t!=null?t:c,{EMPTY_OBJECT:Object.freeze({})}),re=me;function A(t){function c(...s){let p=t();return new p(...s)}return c.prototype=t().prototype,Object.defineProperty(c,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),c}function Y(t){let c=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof c=="function"?c():t}function ae(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(c){console.warn("[cesium_dev_kit] failed to dispose viewer:",c);}}var M=new WeakMap;function T(t,c){if(!t||typeof c!="function")return;let s=M.get(t);s?s.push(c):M.set(t,[c]);}function Z(t,c){if(!t||!c||t===c)return;let s=M.get(t);if(!s||s.length===0)return;M.delete(t);let p=M.get(c);p?p.push(...s):M.set(c,s);}function j(t){if(!t||typeof t!="object"&&typeof t!="function")return;let c=M.get(t);if(c){M.delete(t);for(let s=c.length-1;s>=0;s--)try{c[s]();}catch(p){console.warn("[cesium_dev_kit] cleanup failed:",p);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){j(this);},enumerable:false,configurable:true,writable:true});}function ne(t,c){Object.getOwnPropertyNames(c.prototype).forEach(s=>{s!=="constructor"&&(t.prototype[s]=c.prototype[s]);});}function ue(){let t={},c;class s{constructor(e,r,a){if(e){this._viewer=e,t=r,c=a||z(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let n=this._drawLayer;N(this),T(this,()=>{this._viewer&&n&&(this._viewer.dataSources.remove(n,true),this._drawLayer===n&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,a){return e.hasOwnProperty(r)?e[r]:a}getDfSt(e){if(!c)return;let r=c,a=e.reduce((n,i)=>n?n[i]:r[i],void 0);if(a!=null)return typeof a!="string"?a:te(r.baseService,a)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
|
|
1
|
+
var D=class extends Error{constructor(c,s,p={}){super(`[cesium_dev_kit:${c}] ${s}`),this.name="CesiumDevKitError",this.code=c,this.details=p.details,this.cause=p.cause,Object.setPrototypeOf(this,new.target.prototype);}};function ee(t){return t instanceof D?true:!!t&&typeof t=="object"&&t.name==="CesiumDevKitError"&&typeof t.code=="string"}function L(t,c){let s=c!=null&&c.scope?`[cesium_dev_kit:${c.scope}]`:"[cesium_dev_kit]";console.warn(s,t,c!=null?c:"");}var H=class{constructor(c){this.viewer=null;this.Cesium=c,this.init_data();}init_data(){this.viewer=null;}init({containerId:c,viewerConfig:s,extraConfig:p,MapImageryList:e,imageryProvider:r,viewer:a}){let n=c,i={contextOptions:{webgl:{alpha:false}},animation:false,timeline:false,fullscreenButton:false,geocoder:false,homeButton:false,selectionIndicator:false,shadow:true,sceneMode:this.Cesium.SceneMode.SCENE3D,infoBox:false,sceneModePicker:false,navigationHelpButton:false,projectionPicker:false,baseLayerPicker:false,shouldAnimate:true,navigation:false,showRenderLoopErrors:true},m=this.findCesiumProvider(r),o=p==null?void 0:p.AccessToken;o&&(this.Cesium.Ion.defaultAccessToken=o),i=Object.assign(i,s);let l=a||new this.Cesium.Viewer(n,{...i,...m});if(p&&!p.logo){let u=l.cesiumWidget.creditContainer;u.style.display="none";}if(p&&p.depthTest&&(l.scene.globe.depthTestAgainstTerrain=true),e&&e.length>0)for(let u=0;u<e.length;u++)this.addImageryProvider(l,e[u].type,e[u].option||e[u].classConfig);if(!a){let u=typeof document=="undefined"?null:n&&n.nodeType===1?n:document.getElementById(n);this.bindContainerResize(l,u);}return this.viewer=l,l}bindContainerResize(c,s){if(typeof ResizeObserver=="undefined"||!s)return;let p=()=>{try{(typeof c.isDestroyed!="function"||!c.isDestroyed())&&c.resize();}catch(a){L(a,{scope:"Controller.bindContainerResize"});}},e=new ResizeObserver(p);e.observe(s),typeof requestAnimationFrame=="function"&&requestAnimationFrame(p);let r=c.destroy.bind(c);c.destroy=function(){try{e.disconnect();}catch(a){L(a,{scope:"Controller.bindContainerResize.disconnect"});}return r()};}addImageryProvider(c,s,p){c.imageryLayers.addImageryProvider(this.createCesiumProvider({type:s,option:p}));}findCesiumProvider(c){let s={};if(!c)return s;for(let p in c){let e=c[p];if(e&&e.type){s[p]=this.createCesiumProvider(e);continue}s[p]=c[p];}return s}createCesiumProvider(c){switch(c.type){case "WebMapTileServiceImageryProvider":return new this.Cesium[c.type](c.option);case "UrlTemplateImageryProvider":return new this.Cesium[c.type](c.option);case "TileMapServiceImageryProvider":return new this.Cesium[c.type](c.option)}}};function te(t,c){if(!c)return "";if(/^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(c)||c.startsWith("data:")||c.startsWith("/"))return c;let s=(t||"").replace(/\/+$/,"");return s?s+"/"+c.replace(/^\/+/,""):c}function z(t=""){return {baseService:t,skyBox:{one:{positiveX:"static/data/images/SkyBox/00h+00.jpg",negativeX:"static/data/images/SkyBox/12h+00.jpg",positiveY:"static/data/images/SkyBox/06h+00.jpg",negativeY:"static/data/images/SkyBox/18h+00.jpg",positiveZ:"static/data/images/SkyBox/06h+90.jpg",negativeZ:"static/data/images/SkyBox/06h-90.jpg"},two:{positiveX:"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:"static/data/images/SkyBox/Version2_dark_mz.jpg"},three:{positiveX:"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"},nearOne:{positiveX:"static/data/images/SkyBox/rightav9.jpg",negativeX:"static/data/images/SkyBox/leftav9.jpg",positiveY:"static/data/images/SkyBox/frontav9.jpg",negativeY:"static/data/images/SkyBox/backav9.jpg",positiveZ:"static/data/images/SkyBox/topav9.jpg",negativeZ:"static/data/images/SkyBox/bottomav9.jpg"},nearTwo:{positiveX:"static/data/images/SkyBox/SunSetRight.png",negativeX:"static/data/images/SkyBox/SunSetLeft.png",positiveY:"static/data/images/SkyBox/SunSetFront.png",negativeY:"static/data/images/SkyBox/SunSetBack.png",positiveZ:"static/data/images/SkyBox/SunSetUp.png",negativeZ:"static/data/images/SkyBox/SunSetDown.png"},nearThree:{positiveX:"static/data/images/SkyBox/Right.jpg",negativeX:"static/data/images/SkyBox/Left.jpg",positiveY:"static/data/images/SkyBox/Front.jpg",negativeY:"static/data/images/SkyBox/Back.jpg",positiveZ:"static/data/images/SkyBox/Up.jpg",negativeZ:"static/data/images/SkyBox/Down.jpg"}},drawPointGraphics:"static/data/images/file/location4.png",graphic:{craeteRotateCylinderGraphics:"static/data/images/file/cc2.png",craeteDynamicCricleGraphics:"static/data/images/Textures/circle_bg.png",craeteDynamicShadeWallGraphics:"static/data/images/Textures/fence.png",createCustomDefBillboardGraphics:"static/data/images/file/div1.png"},material:{PolylineCityLinkMaterialProperty:"static/data/images/Textures/meteor_01.png",WarnLinkMaterialProperty:"static/data/images/Textures/jsx2.png"},plugin:{Css3Renderer_one:"static/data/images/Textures/circle2.png",Css3Renderer_two:"static/data/images/Textures/circle1.png"},primitive:{TetrahedronPrimitive:"static/data/images/Textures/fence.png",WaterPrimitive:"static/data/images/Textures/river.png"},passEffect:{satellite:"static/data/images/file/satellite.svg"},amalysis:{createClipPlanAnalysis_wallImg:"static/data/images/file/excavate_side_min.jpg",createClipPlanAnalysis_bottomImg:"static/data/images/file/excavate_bottom_min.jpg",createSubmergedAnalysis:"static/data/images/file/water.png"}}}var me=Object.assign((t,c)=>t!=null?t:c,{EMPTY_OBJECT:Object.freeze({})}),re=me;function A(t){function c(...s){let p=t();return new p(...s)}return c.prototype=t().prototype,Object.defineProperty(c,"__cesiumDevKitCreateModule",{value:t,enumerable:false,configurable:false,writable:false}),c}function Y(t){let c=t==null?void 0:t.__cesiumDevKitCreateModule;return typeof c=="function"?c():t}function ae(t){if(t)try{if(typeof t.isDestroyed=="function"&&t.isDestroyed())return;typeof t.destroy=="function"&&t.destroy();}catch(c){console.warn("[cesium_dev_kit] failed to dispose viewer:",c);}}var M=new WeakMap;function G(t,c){if(!t||typeof c!="function")return;let s=M.get(t);s?s.push(c):M.set(t,[c]);}function Z(t,c){if(!t||!c||t===c)return;let s=M.get(t);if(!s||s.length===0)return;M.delete(t);let p=M.get(c);p?p.push(...s):M.set(c,s);}function j(t){if(!t||typeof t!="object"&&typeof t!="function")return;let c=M.get(t);if(c){M.delete(t);for(let s=c.length-1;s>=0;s--)try{c[s]();}catch(p){console.warn("[cesium_dev_kit] cleanup failed:",p);}}}function N(t){t&&typeof t.destroy!="function"&&Object.defineProperty(t,"destroy",{value:function(){j(this);},enumerable:false,configurable:true,writable:true});}function ne(t,c){Object.getOwnPropertyNames(c.prototype).forEach(s=>{s!=="constructor"&&(t.prototype[s]=c.prototype[s]);});}function ue(){let t={},c;class s{constructor(e,r,a){if(e){this._viewer=e,t=r,c=a||z(),this._drawLayer=new t.CustomDataSource("drawLayer"),e&&e.dataSources.add(this._drawLayer);let n=this._drawLayer;N(this),G(this,()=>{this._viewer&&n&&(this._viewer.dataSources.remove(n,true),this._drawLayer===n&&(this._drawLayer=void 0));}),this.type="base",this.id="base",this.myname="BASE",this._installBaiduImageryProvider(),this._installGoogleImageryProvider(),this._installAmapImageryProvider(),this._installTencentImageryProvider(),this._installTdtImageryProvider(),this._installGroundSkyBox();}}createGraphics(){return new t.Entity}_objHasOwnProperty(e,r,a){return e.hasOwnProperty(r)?e[r]:a}getDfSt(e){if(!c)return;let r=c,a=e.reduce((n,i)=>n?n[i]:r[i],void 0);if(a!=null)return typeof a!="string"?a:te(r.baseService,a)}setOneSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","one","positiveX"])||"static/data/images/SkyBox/00h+00.jpg",negativeX:this.getDfSt(["skyBox","one","negativeX"])||"static/data/images/SkyBox/12h+00.jpg",positiveY:this.getDfSt(["skyBox","one","positiveY"])||"static/data/images/SkyBox/06h+00.jpg",negativeY:this.getDfSt(["skyBox","one","negativeY"])||"static/data/images/SkyBox/18h+00.jpg",positiveZ:this.getDfSt(["skyBox","one","positiveZ"])||"static/data/images/SkyBox/06h+90.jpg",negativeZ:this.getDfSt(["skyBox","one","negativeZ"])||"static/data/images/SkyBox/06h-90.jpg"}})}setTwoSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_px.jpg",negativeX:this.getDfSt(["skyBox","two","negativeX"])||"static/data/images/SkyBox/Version2_dark_mx.jpg",positiveY:this.getDfSt(["skyBox","two","positiveY"])||"static/data/images/SkyBox/Version2_dark_py.jpg",negativeY:this.getDfSt(["skyBox","two","negativeY"])||"static/data/images/SkyBox/Version2_dark_my.jpg",positiveZ:this.getDfSt(["skyBox","two","positiveZ"])||"static/data/images/SkyBox/Version2_dark_pz.jpg",negativeZ:this.getDfSt(["skyBox","two","negativeZ"])||"static/data/images/SkyBox/Version2_dark_mz.jpg"}})}setThreeSkyBox(){return new t.SkyBox({sources:{positiveX:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_pxs.jpg",negativeX:this.getDfSt(["skyBox","three","negativeX"])||"static/data/images/SkyBox/tycho2t3_80_mxs.jpg",positiveY:this.getDfSt(["skyBox","three","positiveY"])||"static/data/images/SkyBox/tycho2t3_80_pys.jpg",negativeY:this.getDfSt(["skyBox","three","negativeY"])||"static/data/images/SkyBox/tycho2t3_80_mys.jpg",positiveZ:this.getDfSt(["skyBox","three","positiveZ"])||"static/data/images/SkyBox/tycho2t3_80_pzs.jpg",negativeZ:this.getDfSt(["skyBox","three","negativeZ"])||"static/data/images/SkyBox/tycho2t3_80_mzs.jpg"}})}setOneGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearOne","positiveX"])||"static/data/images/SkyBox/rightav9.jpg",negativeX:this.getDfSt(["skyBox","nearOne","negativeX"])||"static/data/images/SkyBox/leftav9.jpg",positiveY:this.getDfSt(["skyBox","nearOne","positiveY"])||"static/data/images/SkyBox/frontav9.jpg",negativeY:this.getDfSt(["skyBox","nearOne","negativeY"])||"static/data/images/SkyBox/backav9.jpg",positiveZ:this.getDfSt(["skyBox","nearOne","positiveZ"])||"static/data/images/SkyBox/topav9.jpg",negativeZ:this.getDfSt(["skyBox","nearOne","negativeZ"])||"static/data/images/SkyBox/bottomav9.jpg"}})}setTwoGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearTwo","positiveX"])||"static/data/images/SkyBox/SunSetRight.png",negativeX:this.getDfSt(["skyBox","nearTwo","negativeX"])||"static/data/images/SkyBox/SunSetLeft.png",positiveY:this.getDfSt(["skyBox","nearTwo","positiveY"])||"static/data/images/SkyBox/SunSetFront.png",negativeY:this.getDfSt(["skyBox","nearTwo","negativeY"])||"static/data/images/SkyBox/SunSetBack.png",positiveZ:this.getDfSt(["skyBox","nearTwo","positiveZ"])||"static/data/images/SkyBox/SunSetUp.png",negativeZ:this.getDfSt(["skyBox","nearTwo","negativeZ"])||"static/data/images/SkyBox/SunSetDown.png"}})}setThreeGroundSkyBox(){return new t.Scene.GroundSkyBox({sources:{positiveX:this.getDfSt(["skyBox","nearThree","positiveX"])||"static/data/images/SkyBox/Right.jpg",negativeX:this.getDfSt(["skyBox","nearThree","negativeX"])||"static/data/images/SkyBox/Left.jpg",positiveY:this.getDfSt(["skyBox","nearThree","positiveY"])||"static/data/images/SkyBox/Front.jpg",negativeY:this.getDfSt(["skyBox","nearThree","negativeY"])||"static/data/images/SkyBox/Back.jpg",positiveZ:this.getDfSt(["skyBox","nearThree","positiveZ"])||"static/data/images/SkyBox/Up.jpg",negativeZ:this.getDfSt(["skyBox","nearThree","negativeZ"])||"static/data/images/SkyBox/Down.jpg"}})}setDarkEffect(e){e=e||{};var r=`uniform sampler2D colorTexture;
|
|
2
2
|
in vec2 v_textureCoordinates;
|
|
3
3
|
uniform float scale;
|
|
4
4
|
uniform vec3 offset;
|
|
@@ -120,7 +120,7 @@ void main(void)
|
|
|
120
120
|
vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount);
|
|
121
121
|
out_FragColor = alphaBlend(finalFogColor, sceneColor);
|
|
122
122
|
}
|
|
123
|
-
`;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({fragmentShader:e,uniforms:{fogByDistance:new t.Cartesian4(10,0,200,.3),fogColor:t.Color.AZURE}}))}}setDefSceneConfig(){this._viewer&&(this._viewer.scene.sun.show=false,this._viewer.scene.moon.show=false,this._viewer.scene.fxaa=true,this._viewer.scene.globe.depthTestAgainstTerrain=true,this._viewer.scene.undergroundMode=false,this._viewer.scene.terrainProvider.isCreateSkirt=false,this._viewer.scene.skyAtmosphere.show=false,this._viewer.scene.globe.showGroundAtmosphere=false,this._viewer.scene.globe.enableLighting=true,this._viewer.scene.fog.enabled=false,this._viewer.cesiumWidget.creditContainer.style.display="none");}setBloomLightScene(){this._viewer&&(this._viewer.scene.postProcessStages.bloom.enabled=true,this._viewer.scene.postProcessStages.bloom.uniforms.contrast=119,this._viewer.scene.postProcessStages.bloom.uniforms.brightness=-0.4,this._viewer.scene.postProcessStages.bloom.uniforms.glowOnly=false,this._viewer.scene.postProcessStages.bloom.uniforms.delta=.9,this._viewer.scene.postProcessStages.bloom.uniforms.sigma=3.78,this._viewer.scene.postProcessStages.bloom.uniforms.stepSize=5,this._viewer.scene.postProcessStages.bloom.uniforms.isSelected=false);}removePostProcessStage(e){e&&(Array.isArray(e)?e.forEach(r=>{this._viewer.scene.postProcessStages.contains(r)&&this._viewer.scene.postProcessStages.remove(r);}):this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e));}setView(e){if(this._viewer&&e&&e.position){if(e.distance){var r=new t.Cartesian3(0,e.distance,window.opt.distance);e.position=t.Cartesian3.add(e.position,r,new t.Cartesian3);}this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)}});}}flyTo(e){if(this._viewer&&e&&e.position){if(e.distance){var r=new t.Cartesian3(0,e.distance,0);e.position=t.Cartesian3.add(e.position,r,new t.Cartesian3);}this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)},easingFunction:e.easingFunction||t.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback});}}transformCartesianToWGS84(e){var r,a,n;if(this._viewer&&e){if(e.x===void 0&&(e.lng!==void 0||e.lon!==void 0))return {lng:Number((r=e.lng)!=null?r:e.lon),lat:Number(e.lat),alt:Number((n=(a=e.alt)!=null?a:e.height)!=null?n:0)};let i=t.Cartographic.fromCartesian(e);return {lng:t.Math.toDegrees(i.longitude),lat:t.Math.toDegrees(i.latitude),alt:i.height}}}transformWGS84ArrayToCartesianArray(e,r){if(this._viewer&&e){var a=this;return e?e.map(function(n){return a.transformWGS84ToCartesian(n,r)}):[]}}transformWGS84ToCartesian(e,r){if(this._viewer)return e?t.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=r||e.alt,t.Ellipsoid.WGS84):t.Cartesian3.ZERO}transformCartesianArrayToWGS84Array(e){if(this._viewer){var r=this;return e?e.map(function(a){return r.transformCartesianToWGS84(a)}).filter(function(a){return !!a}):[]}}transformWGS84ToCartographic(e){return e?t.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):t.Cartographic.ZERO}lnglatArrayToCartesians(e){if(!e||e.length<1)return [];let r=[];for(let a=0;a<e.length;a++){let n=t.Cartesian3.fromDegrees(Number(e[a][0]),Number(e[a][1]),Number(e[a][2]||0));r.push(n);}return r}setCameraEotateHeading(e){if(e){let r=this._viewer,a=t.Cartesian3.fromDegrees(e.lng,e.lat,e.height),n=t.Math.toRadians(-30),i=360/30,m=5e3,o=t.JulianDate.fromDate(new Date);r.clock.startTime=o.clone(),r.clock.currentTime=o.clone(),r.clock.clockRange=t.ClockRange.CLAMPED,r.clock.clockStep=t.ClockStep.SYSTEM_CLOCK;let l=r.camera.heading,u=function(){let g=t.JulianDate.secondsDifference(r.clock.currentTime,r.clock.startTime),f=t.Math.toRadians(g*i)+l;r.scene.camera.setView({destination:a,orientation:{heading:f,pitch:n}}),r.scene.camera.moveBackward(m),t.JulianDate.compare(r.clock.currentTime,r.clock.stopTime)>=0&&r.clock.onTick.removeEventListener(u);};r.clock.onTick.addEventListener(u),T(this,()=>{r.clock.onTick.removeEventListener(u);});}}getCatesian3FromPX(e){if(this._viewer&&e){var r=this._viewer.scene.pick(e),a=null,n=false,i=false;if(r instanceof t.Cesium3DTileFeature&&(n=true),n&&(a=this._viewer.scene.pickPosition(e),a)){let o=t.Cartographic.fromCartesian(a);o.height<0&&(o.height=0);let l=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),d=o.height;a=this.transformWGS84ToCartesian({lng:l,lat:u,alt:d});}if(!r){var m=this._viewer.scene.camera.getPickRay(e);if(!m)return null;a=this._viewer.scene.globe.pick(m,this._viewer.scene),i=true;}if(r&&!n&&(a=this._viewer.scene.pickPosition(e),a)){let o=t.Cartographic.fromCartesian(a);o.height<0&&(o.height=0);let l=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),d=o.height;a=this.transformWGS84ToCartesian({lng:l,lat:u,alt:d});}if(!n&&!i&&!r&&(a=this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid)),a){let o=this.transformCartesianToWGS84(a);return o.alt<0&&(a=this.transformWGS84ToCartesian(o,.1)),a}return false}}getCameraPosition(){if(this._viewer){var e=this._viewer.scene.camera.pickEllipsoid(new t.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(e){var r=t.Ellipsoid.WGS84.cartesianToCartographic(e),a=r.longitude*180/Math.PI,n=r.latitude*180/Math.PI,i=this._viewer.camera._direction,m=t.Math.toDegrees(i.x),o=t.Math.toDegrees(i.y),l=t.Math.toDegrees(i.z),u=this._viewer.camera.positionCartographic.height,d=t.Math.toDegrees(this._viewer.camera.heading),g=t.Math.toDegrees(this._viewer.camera.pitch),f=t.Math.toDegrees(this._viewer.camera.roll),h=this._viewer.camera.computeViewRectangle(),v=h.west/Math.PI*180,w=h.north/Math.PI*180,_=h.east/Math.PI*180,y=h.south/Math.PI*180,k=(v+_)/2,E=(w+y)/2;return {lon:a,lat:n,height:u,heading:d,pitch:g,roll:f,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:k,y:E},direction:new t.Cartesian3(m,o,l)}}}}pickUpPosition(e){return this.getCatesian3FromPX(e.position)}getHandlerClickPosition(e){if(this._viewer){let r=this._viewer.scene,a=this._viewer,n=r.camera.pickEllipsoid(e.position,r.globe.elliposid),i={cameraPosistion:a.camera.position,heading:a.camera.heading,pitch:a.camera.pitch,roll:a.camera.roll},m=t.Cartographic.fromCartesian(n);m.height<0&&(m.height=0);let o={alt:m.height,lat:t.Math.toDegrees(m.latitude),lon:t.Math.toDegrees(m.longitude)},l=r.pickPosition(e.position),u=t.Cartographic.fromCartesian(l),d={height:u.height,latitude:t.Math.toDegrees(u.latitude),longitude:t.Math.toDegrees(u.longitude)};return {wgs84Coor:o,graphicCoor:d,cameraPosition:i}}}updateCameraState(e){this._viewer.scene._screenSpaceCameraController.enableRotate=e,this._viewer.scene._screenSpaceCameraController.enableTranslate=e,this._viewer.scene._screenSpaceCameraController.enableZoom=e,this._viewer.scene._screenSpaceCameraController.enableTilt=e,this._viewer.scene._screenSpaceCameraController.enableLook=e;}bindHandleEvent({leftClick:e,mouseMove:r,doubleClick:a,leftDown:n,mouseWheel:i,leftUp:m}){if(this._viewer){var o=new t.ScreenSpaceEventHandler(this._viewer.canvas);T(this,()=>{o&&!o.isDestroyed()&&o.destroy();}),e&&o.setInputAction(function(l){e(l,o);},t.ScreenSpaceEventType.LEFT_CLICK),r&&o.setInputAction(function(l){r(l,o);},t.ScreenSpaceEventType.MOUSE_MOVE),a&&o.setInputAction(function(l){a(l,o);},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),n&&o.setInputAction(function(l){n(l,o);},t.ScreenSpaceEventType.LEFT_DOWN),i&&o.setInputAction(function(l){i(l,o);},t.ScreenSpaceEventType.WHEEL),m&&o.setInputAction(function(l){m(l,o);},t.ScreenSpaceEventType.LEFT_UP);}}bindHandelEvent(e){return this.bindHandleEvent(e)}getHandlePosition(e){if(this._viewer){var r=new t.ScreenSpaceEventHandler(this._viewer.scene.canvas),a=this;T(this,()=>{r&&!r.isDestroyed()&&r.destroy();}),r.setInputAction(function(n){var i=a._viewer.scene.camera.pickEllipsoid(n.endPosition,a._viewer.scene.globe.ellipsoid);typeof e=="function"&&e(a.transformCartesianToWGS84(i),r);},t.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(e){return this.getHandlePosition(e)}saveSceneImages(){if(this._viewer){let m=function(o){for(var l=o.split(","),u=l[0].match(/:(.*?);/)[1],d=atob(l[1]),g=d.length,f=new Uint8Array(g);g--;)f[g]=d.charCodeAt(g);return new Blob([f],{type:u})};var e=this._viewer.scene.canvas,r=e.toDataURL("image/png").replace("image/png","image/octet-stream"),a=document.createElement("a"),n=m(r),i=URL.createObjectURL(n);a.download="scene.png",a.href=i,a.click();}}_installAmapImageryProvider(){let e="https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",r="https://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";function a(n){return n.url=n.style==="img"?e:r,n.subdomains||(n.subdomains=["01","02","03","04"]),new t.UrlTemplateImageryProvider(n)}t.Scene.AmapImageryProvider=a;}_installTdtImageryProvider(){let e="https://{s}.tianditu.gov.cn/{layer}_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER={layer}&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk={key}";function r(a){return new t.WebMapTileServiceImageryProvider({url:e.replace(/\{layer\}/g,a.style||"vec").replace(/\{key\}/g,a.key||""),layer:a.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}t.Scene.TdtImageryProvider=r;}_installTencentImageryProvider(){let e="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229",r="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1";function a(n){return n.layer==="img"?(n.url||(n.url=e),n.subdomains||(n.subdomains=["0","1","2"]),n.customTags={sx(i,m,o,l){return m>>4},sy(i,m,o,l){return (1<<l)-o>>4}}):n.url||(n.url=r),new t.UrlTemplateImageryProvider(n)}t.Scene.TencentImageryProvider=a;}_installGoogleImageryProvider(){let e="https://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",r="https://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali",a="https://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile";function n(i){return i.url=i.style==="img"?r:i.style==="ter"?a:e,i.subdomains||(i.subdomains=["1","2","3","4","5"]),new t.UrlTemplateImageryProvider(i)}t.Scene.GoogleImageryProvider=n;}_installGooGleImageryProvider(){return this._installGoogleImageryProvider()}_installBaiduImageryProvider(){var e="https://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function r(n){e=n.url||e,this._url=e,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1,this._tilingScheme=new t.WebMercatorTilingScheme({rectangleSouthwestInMeters:new t.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new t.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=n.style||"normal",this._ready=true;}Object.defineProperties(r.prototype,{url:{get(){return this._url}},token:{get(){return this._token}},tileWidth:{get(){if(!this.ready)throw new t.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get(){if(!this.ready)throw new t.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get(){if(!this.ready)throw new t.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},minimumLevel:{get(){if(!this.ready)throw new t.DeveloperError("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get(){if(!this.ready)throw new t.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get(){if(!this.ready)throw new t.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},ready:{get(){return !!this._url}},credit:{get(){return this._credit}},readyPromise:{get(){return this._readyPromise.promise}},usingPrecachedTiles:{get(){return this._useTiles}},hasAlphaChannel:{get(){return true}},layers:{get(){return this._layers}}});function a(n,i,m,o,l){var u=n._url+"&x={x}&y={y}&z={z}&customid={style}",d=n._tilingScheme.getNumberOfXTilesAtLevel(o),g=n._tilingScheme.getNumberOfYTilesAtLevel(o);return u=u.replace("{x}",String(i-d/2)).replace("{y}",String(g/2-m-1)).replace("{z}",String(o)).replace("{style}",l),u}r.prototype.getTileCredits=function(n,i,m){},r.prototype.requestImage=function(n,i,m){if(!this.ready)throw new t.DeveloperError("requestImage must not be called before the imagery provider is ready.");var o=a(this,n,i,m,this._style);return t.ImageryProvider.loadImage(this,o)},t.Scene.BaiduImageryProvider=r;}_installGroundSkyBox(){var e=t.BoxGeometry,r=t.Cartesian3,a=t.defaultValue||re,n=t.defined,i=t.destroyObject,m=t.DeveloperError,o=t.GeometryPipeline,l=t.Matrix3,u=t.Matrix4,d=t.Transforms,g=t.VertexFormat,f=t.BufferUsage,h=t.CubeMap,v=t.DrawCommand,w=t.loadCubeMap,_=t.RenderState,y=t.VertexArray,k=t.BlendingState,E=t.SceneMode,B=t.ShaderProgram,S=t.ShaderSource,G=`uniform samplerCube u_cubeMap;
|
|
123
|
+
`;return this._viewer.scene.postProcessStages.add(new t.PostProcessStage({fragmentShader:e,uniforms:{fogByDistance:new t.Cartesian4(10,0,200,.3),fogColor:t.Color.AZURE}}))}}setDefSceneConfig(){this._viewer&&(this._viewer.scene.sun.show=false,this._viewer.scene.moon.show=false,this._viewer.scene.fxaa=true,this._viewer.scene.globe.depthTestAgainstTerrain=true,this._viewer.scene.undergroundMode=false,this._viewer.scene.terrainProvider.isCreateSkirt=false,this._viewer.scene.skyAtmosphere.show=false,this._viewer.scene.globe.showGroundAtmosphere=false,this._viewer.scene.globe.enableLighting=true,this._viewer.scene.fog.enabled=false,this._viewer.cesiumWidget.creditContainer.style.display="none");}setBloomLightScene(){this._viewer&&(this._viewer.scene.postProcessStages.bloom.enabled=true,this._viewer.scene.postProcessStages.bloom.uniforms.contrast=119,this._viewer.scene.postProcessStages.bloom.uniforms.brightness=-0.4,this._viewer.scene.postProcessStages.bloom.uniforms.glowOnly=false,this._viewer.scene.postProcessStages.bloom.uniforms.delta=.9,this._viewer.scene.postProcessStages.bloom.uniforms.sigma=3.78,this._viewer.scene.postProcessStages.bloom.uniforms.stepSize=5,this._viewer.scene.postProcessStages.bloom.uniforms.isSelected=false);}removePostProcessStage(e){e&&(Array.isArray(e)?e.forEach(r=>{this._viewer.scene.postProcessStages.contains(r)&&this._viewer.scene.postProcessStages.remove(r);}):this._viewer.scene.postProcessStages.contains(e)&&this._viewer.scene.postProcessStages.remove(e));}setView(e){if(this._viewer&&e&&e.position){if(e.distance){var r=new t.Cartesian3(0,e.distance,window.opt.distance);e.position=t.Cartesian3.add(e.position,r,new t.Cartesian3);}this._viewer.scene.camera.setView({destination:e.position,orientation:e.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)}});}}flyTo(e){if(this._viewer&&e&&e.position){if(e.distance){var r=new t.Cartesian3(0,e.distance,0);e.position=t.Cartesian3.add(e.position,r,new t.Cartesian3);}this._viewer.scene.camera.flyTo({destination:e.position,orientation:e.orientation||{heading:t.Math.toRadians(90),pitch:t.Math.toRadians(90),roll:t.Math.toRadians(0)},easingFunction:e.easingFunction||t.EasingFunction.LINEAR_NONE,duration:e.duration||3,complete:e.callback});}}transformCartesianToWGS84(e){var r,a,n;if(this._viewer&&e){if(e.x===void 0&&(e.lng!==void 0||e.lon!==void 0))return {lng:Number((r=e.lng)!=null?r:e.lon),lat:Number(e.lat),alt:Number((n=(a=e.alt)!=null?a:e.height)!=null?n:0)};let i=t.Cartographic.fromCartesian(e);return {lng:t.Math.toDegrees(i.longitude),lat:t.Math.toDegrees(i.latitude),alt:i.height}}}transformWGS84ArrayToCartesianArray(e,r){if(this._viewer&&e){var a=this;return e?e.map(function(n){return a.transformWGS84ToCartesian(n,r)}):[]}}transformWGS84ToCartesian(e,r){if(this._viewer)return e?t.Cartesian3.fromDegrees(e.lng||e.lon,e.lat,e.alt=r||e.alt,t.Ellipsoid.WGS84):t.Cartesian3.ZERO}transformCartesianArrayToWGS84Array(e){if(this._viewer){var r=this;return e?e.map(function(a){return r.transformCartesianToWGS84(a)}).filter(function(a){return !!a}):[]}}transformWGS84ToCartographic(e){return e?t.Cartographic.fromDegrees(e.lng||e.lon,e.lat,e.alt):t.Cartographic.ZERO}lnglatArrayToCartesians(e){if(!e||e.length<1)return [];let r=[];for(let a=0;a<e.length;a++){let n=t.Cartesian3.fromDegrees(Number(e[a][0]),Number(e[a][1]),Number(e[a][2]||0));r.push(n);}return r}setCameraEotateHeading(e){if(e){let r=this._viewer,a=t.Cartesian3.fromDegrees(e.lng,e.lat,e.height),n=t.Math.toRadians(-30),i=360/30,m=5e3,o=t.JulianDate.fromDate(new Date);r.clock.startTime=o.clone(),r.clock.currentTime=o.clone(),r.clock.clockRange=t.ClockRange.CLAMPED,r.clock.clockStep=t.ClockStep.SYSTEM_CLOCK;let l=r.camera.heading,u=function(){let g=t.JulianDate.secondsDifference(r.clock.currentTime,r.clock.startTime),f=t.Math.toRadians(g*i)+l;r.scene.camera.setView({destination:a,orientation:{heading:f,pitch:n}}),r.scene.camera.moveBackward(m),t.JulianDate.compare(r.clock.currentTime,r.clock.stopTime)>=0&&r.clock.onTick.removeEventListener(u);};r.clock.onTick.addEventListener(u),G(this,()=>{r.clock.onTick.removeEventListener(u);});}}getCatesian3FromPX(e){if(this._viewer&&e){var r=this._viewer.scene.pick(e),a=null,n=false,i=false;if(r instanceof t.Cesium3DTileFeature&&(n=true),n&&(a=this._viewer.scene.pickPosition(e),a)){let o=t.Cartographic.fromCartesian(a);o.height<0&&(o.height=0);let l=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),d=o.height;a=this.transformWGS84ToCartesian({lng:l,lat:u,alt:d});}if(!r){var m=this._viewer.scene.camera.getPickRay(e);if(!m)return null;a=this._viewer.scene.globe.pick(m,this._viewer.scene),i=true;}if(r&&!n&&(a=this._viewer.scene.pickPosition(e),a)){let o=t.Cartographic.fromCartesian(a);o.height<0&&(o.height=0);let l=t.Math.toDegrees(o.longitude),u=t.Math.toDegrees(o.latitude),d=o.height;a=this.transformWGS84ToCartesian({lng:l,lat:u,alt:d});}if(!n&&!i&&!r&&(a=this._viewer.scene.camera.pickEllipsoid(e,this._viewer.scene.globe.ellipsoid)),a){let o=this.transformCartesianToWGS84(a);return o.alt<0&&(a=this.transformWGS84ToCartesian(o,.1)),a}return false}}getCameraPosition(){if(this._viewer){var e=this._viewer.scene.camera.pickEllipsoid(new t.Cartesian2(this._viewer.canvas.clientWidth/2,this._viewer.canvas.clientHeight/2));if(e){var r=t.Ellipsoid.WGS84.cartesianToCartographic(e),a=r.longitude*180/Math.PI,n=r.latitude*180/Math.PI,i=this._viewer.camera._direction,m=t.Math.toDegrees(i.x),o=t.Math.toDegrees(i.y),l=t.Math.toDegrees(i.z),u=this._viewer.camera.positionCartographic.height,d=t.Math.toDegrees(this._viewer.camera.heading),g=t.Math.toDegrees(this._viewer.camera.pitch),f=t.Math.toDegrees(this._viewer.camera.roll),h=this._viewer.camera.computeViewRectangle(),v=h.west/Math.PI*180,w=h.north/Math.PI*180,_=h.east/Math.PI*180,y=h.south/Math.PI*180,k=(v+_)/2,E=(w+y)/2;return {lon:a,lat:n,height:u,heading:d,pitch:g,roll:f,position:this._viewer.camera.position,cameraHeading:this._viewer.camera.heading,cameraPitch:this._viewer.camera.pitch,cameraRoll:this._viewer.camera.roll,center:{x:k,y:E},direction:new t.Cartesian3(m,o,l)}}}}pickUpPosition(e){return this.getCatesian3FromPX(e.position)}getHandlerClickPosition(e){if(this._viewer){let r=this._viewer.scene,a=this._viewer,n=r.camera.pickEllipsoid(e.position,r.globe.elliposid),i={cameraPosistion:a.camera.position,heading:a.camera.heading,pitch:a.camera.pitch,roll:a.camera.roll},m=t.Cartographic.fromCartesian(n);m.height<0&&(m.height=0);let o={alt:m.height,lat:t.Math.toDegrees(m.latitude),lon:t.Math.toDegrees(m.longitude)},l=r.pickPosition(e.position),u=t.Cartographic.fromCartesian(l),d={height:u.height,latitude:t.Math.toDegrees(u.latitude),longitude:t.Math.toDegrees(u.longitude)};return {wgs84Coor:o,graphicCoor:d,cameraPosition:i}}}updateCameraState(e){this._viewer.scene._screenSpaceCameraController.enableRotate=e,this._viewer.scene._screenSpaceCameraController.enableTranslate=e,this._viewer.scene._screenSpaceCameraController.enableZoom=e,this._viewer.scene._screenSpaceCameraController.enableTilt=e,this._viewer.scene._screenSpaceCameraController.enableLook=e;}bindHandleEvent({leftClick:e,mouseMove:r,doubleClick:a,leftDown:n,mouseWheel:i,leftUp:m}){if(this._viewer){var o=new t.ScreenSpaceEventHandler(this._viewer.canvas);G(this,()=>{o&&!o.isDestroyed()&&o.destroy();}),e&&o.setInputAction(function(l){e(l,o);},t.ScreenSpaceEventType.LEFT_CLICK),r&&o.setInputAction(function(l){r(l,o);},t.ScreenSpaceEventType.MOUSE_MOVE),a&&o.setInputAction(function(l){a(l,o);},t.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),n&&o.setInputAction(function(l){n(l,o);},t.ScreenSpaceEventType.LEFT_DOWN),i&&o.setInputAction(function(l){i(l,o);},t.ScreenSpaceEventType.WHEEL),m&&o.setInputAction(function(l){m(l,o);},t.ScreenSpaceEventType.LEFT_UP);}}bindHandelEvent(e){return this.bindHandleEvent(e)}getHandlePosition(e){if(this._viewer){var r=new t.ScreenSpaceEventHandler(this._viewer.scene.canvas),a=this;G(this,()=>{r&&!r.isDestroyed()&&r.destroy();}),r.setInputAction(function(n){var i=a._viewer.scene.camera.pickEllipsoid(n.endPosition,a._viewer.scene.globe.ellipsoid);typeof e=="function"&&e(a.transformCartesianToWGS84(i),r);},t.ScreenSpaceEventType.MOUSE_MOVE);}}getHandelPosition(e){return this.getHandlePosition(e)}saveSceneImages(){if(this._viewer){let m=function(o){for(var l=o.split(","),u=l[0].match(/:(.*?);/)[1],d=atob(l[1]),g=d.length,f=new Uint8Array(g);g--;)f[g]=d.charCodeAt(g);return new Blob([f],{type:u})};var e=this._viewer.scene.canvas,r=e.toDataURL("image/png").replace("image/png","image/octet-stream"),a=document.createElement("a"),n=m(r),i=URL.createObjectURL(n);a.download="scene.png",a.href=i,a.click();}}_installAmapImageryProvider(){let e="https://webst{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",r="https://webrd{s}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=7&x={x}&y={y}&z={z}";function a(n){return n.url=n.style==="img"?e:r,n.subdomains||(n.subdomains=["01","02","03","04"]),new t.UrlTemplateImageryProvider(n)}t.Scene.AmapImageryProvider=a;}_installTdtImageryProvider(){let e="https://{s}.tianditu.gov.cn/{layer}_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER={layer}&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk={key}";function r(a){return new t.WebMapTileServiceImageryProvider({url:e.replace(/\{layer\}/g,a.style||"vec").replace(/\{key\}/g,a.key||""),layer:a.style+"_w",style:"default",format:"tiles",tileMatrixSetID:"GoogleMapsCompatible",subdomains:["t0","t1","t2","t3","t4","t5","t6","t7"],minimumLevel:0,maximumLevel:18})}t.Scene.TdtImageryProvider=r;}_installTencentImageryProvider(){let e="https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=229",r="https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&type=vector&styleid=1";function a(n){return n.layer==="img"?(n.url||(n.url=e),n.subdomains||(n.subdomains=["0","1","2"]),n.customTags={sx(i,m,o,l){return m>>4},sy(i,m,o,l){return (1<<l)-o>>4}}):n.url||(n.url=r),new t.UrlTemplateImageryProvider(n)}t.Scene.TencentImageryProvider=a;}_installGoogleImageryProvider(){let e="https://mt{s}.google.cn/vt/lyrs=m@207000000&hl=zh-CN&gl=CN&src=app&x={x}&y={y}&z={z}&s=Galile",r="https://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali",a="https://mt{s}.google.cn/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}&s=Galile";function n(i){return i.url=i.style==="img"?r:i.style==="ter"?a:e,i.subdomains||(i.subdomains=["1","2","3","4","5"]),new t.UrlTemplateImageryProvider(i)}t.Scene.GoogleImageryProvider=n;}_installGooGleImageryProvider(){return this._installGoogleImageryProvider()}_installBaiduImageryProvider(){var e="https://api{s}.map.bdimg.com/customimage/tile?&x={x}&y={y}&z={z}&scale=1&customid={style}";function r(n){e=n.url||e,this._url=e,this._tileWidth=256,this._tileHeight=256,this._maximumLevel=18,this._minimumLevel=1,this._tilingScheme=new t.WebMercatorTilingScheme({rectangleSouthwestInMeters:new t.Cartesian2(-33554054,-33746824),rectangleNortheastInMeters:new t.Cartesian2(33554054,33746824)}),this._rectangle=this._tilingScheme.rectangle,this._credit=void 0,this._style=n.style||"normal",this._ready=true;}Object.defineProperties(r.prototype,{url:{get(){return this._url}},token:{get(){return this._token}},tileWidth:{get(){if(!this.ready)throw new t.DeveloperError("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get(){if(!this.ready)throw new t.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get(){if(!this.ready)throw new t.DeveloperError("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},minimumLevel:{get(){if(!this.ready)throw new t.DeveloperError("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get(){if(!this.ready)throw new t.DeveloperError("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get(){if(!this.ready)throw new t.DeveloperError("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},ready:{get(){return !!this._url}},credit:{get(){return this._credit}},readyPromise:{get(){return this._readyPromise.promise}},usingPrecachedTiles:{get(){return this._useTiles}},hasAlphaChannel:{get(){return true}},layers:{get(){return this._layers}}});function a(n,i,m,o,l){var u=n._url+"&x={x}&y={y}&z={z}&customid={style}",d=n._tilingScheme.getNumberOfXTilesAtLevel(o),g=n._tilingScheme.getNumberOfYTilesAtLevel(o);return u=u.replace("{x}",String(i-d/2)).replace("{y}",String(g/2-m-1)).replace("{z}",String(o)).replace("{style}",l),u}r.prototype.getTileCredits=function(n,i,m){},r.prototype.requestImage=function(n,i,m){if(!this.ready)throw new t.DeveloperError("requestImage must not be called before the imagery provider is ready.");var o=a(this,n,i,m,this._style);return t.ImageryProvider.loadImage(this,o)},t.Scene.BaiduImageryProvider=r;}_installGroundSkyBox(){var e=t.BoxGeometry,r=t.Cartesian3,a=t.defaultValue||re,n=t.defined,i=t.destroyObject,m=t.DeveloperError,o=t.GeometryPipeline,l=t.Matrix3,u=t.Matrix4,d=t.Transforms,g=t.VertexFormat,f=t.BufferUsage,h=t.CubeMap,v=t.DrawCommand,w=t.loadCubeMap,_=t.RenderState,y=t.VertexArray,k=t.BlendingState,E=t.SceneMode,B=t.ShaderProgram,S=t.ShaderSource,T=`uniform samplerCube u_cubeMap;
|
|
124
124
|
in vec3 v_texCoord;
|
|
125
125
|
void main()
|
|
126
126
|
{
|
|
@@ -136,7 +136,7 @@ void main(void)
|
|
|
136
136
|
gl_Position = czm_projection * vec4(p, 1.0);
|
|
137
137
|
v_texCoord = position.xyz;
|
|
138
138
|
}
|
|
139
|
-
`,b=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function P(x){this.sources=x.sources,this._sources=void 0,this.show=a(x.show,true),this._command=new v({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var O=new l;P.prototype.update=function(x,X){var R=this;if(this.show&&!(x.mode!==E.SCENE3D&&x.mode!==E.MORPHING)&&x.passes.render){var F=x.context;if(this._sources!==this.sources){this._sources=this.sources;var C=this.sources;if(!n(C.positiveX)||!n(C.negativeX)||!n(C.positiveY)||!n(C.negativeY)||!n(C.positiveZ)||!n(C.negativeZ))throw new m("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof C.positiveX!=typeof C.negativeX||typeof C.positiveX!=typeof C.positiveY||typeof C.positiveX!=typeof C.negativeY||typeof C.positiveX!=typeof C.positiveZ||typeof C.positiveX!=typeof C.negativeZ)throw new m("this.sources properties must all be the same type.");typeof C.positiveX=="string"?w(F,this._sources).then(function(le){R._cubeMap=R._cubeMap&&R._cubeMap.destroy(),R._cubeMap=le;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new h({context:F,source:C}));}var I=this._command;if(I.modelMatrix=d.eastNorthUpToFixedFrame(x.camera._positionWC),!n(I.vertexArray)){I.uniformMap={u_cubeMap(){return R._cubeMap},u_rotateMatrix(){return b(I.modelMatrix,O)}};var Q=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:g.POSITION_ONLY})),se=this._attributeLocations=o.createAttributeLocations(Q);I.vertexArray=y.fromGeometry({context:F,geometry:Q,attributeLocations:se,bufferUsage:f._DRAW}),I.renderState=_.fromCache({blending:k.ALPHA_BLEND});}if(!n(I.shaderProgram)||this._useHdr!==X){var ce=new S({defines:[X?"HDR":""],sources:[G]});I.shaderProgram=B.fromCache({context:F,vertexShaderSource:V,fragmentShaderSource:ce,attributeLocations:this._attributeLocations}),this._useHdr=X;}if(n(this._cubeMap))return I}},P.prototype.isDestroyed=function(){return false},P.prototype.destroy=function(){var x=this._command;return x.vertexArray=x.vertexArray&&x.vertexArray.destroy(),x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),i(this)},t.Scene.GroundSkyBox=P;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return s}var W=A(ue);function pe(t,c,s,p){function e(r,a){let n={},i=Y(a),m=[];if(Array.isArray(r))r.forEach(l=>{let u=Y(l),d=new u(t,c,s,p);o(u,i),m.push(d);}),n=new i(t,c,s,p),m.forEach(l=>Object.assign(n,l)),m.forEach(l=>Z(l,n));else {let l=Y(r),u=new l(t,c,s,p);o(l,i),n=new i(t,c,s,p),Object.assign(n,u),Z(u,n);}function o(l,u){let d=Object.getOwnPropertyNames(l.prototype);for(let g=0,f=d.length;g<f;g++)d[g]!=="constructor"&&(u.prototype[d[g]]=l.prototype[d[g]]);}return n}return e}function de({cesiumGlobal:t,threeGlobal:c,containerId:s,threeContainerId:p,viewerConfig:e={},extraConfig:r={},MapImageryList:a=[],defaultStatic:n,baseExtendsCom:i=[],extendsCom:m,extendsComName:o,viewer:l}){if(!t)throw new D("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!s&&!l)throw new D("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let d=new H(t).init({containerId:s,viewerConfig:e,extraConfig:r,MapImageryList:a,viewer:l}),g=!l,v=pe(d,t,n,c?{threeGlobal:c,containerId:s,threeContainerId:p}:"")(i,m),w=false;return {viewer:d,[o]:v,dispose:()=>{if(!w){w=true;try{typeof v.destroy=="function"?v.destroy():j(v);}catch(_){L(_,{scope:"singleImport.dispose"});}g&&ae(d);}}}}function ie(t,c,s){function p(e){return de({...e,baseExtendsCom:t,extendsCom:c,extendsComName:s})}return p}var K=null;function ge(t){return t&&typeof t=="object"&&t.default?t.default:t}function fe(t,c){return c().then(ge).catch(s=>{throw ee(s)?s:new D("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:s,details:{package:t}})})}function oe(){return K||(K=fe("libgif",()=>import('libgif'))),K}function he(){let t=null;class s{constructor(e,r,a){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let n=this._graphicsLayer;N(this),T(this,()=>{this._viewer&&n&&(this._viewer.dataSources.remove(n,true),this._graphicsLayer===n&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let a in e.positions){let n=e.positions[a],i=this.createGraphics();i.name=e.name||"",i.oid=e.oid||"point",i.position=n,e.point&&(i.point=this.getPointGraphics()),e.billboard&&(i.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(i.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(i));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:a,height:n,width:i,material:m,...o}=e;var r=this.createGraphics();return n=n===void 0?6:n,i=i===void 0?15:i,r.corridor={positions:a,height:n,width:i,...o,material:m||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var a=e.entity,n=e.cylinder,i=this;return r.cylinder=this.getCylinderGraphics(n),r.position=new t.CallbackProperty(function(){var m=a.position.getValue(i._viewer.clock.currentTime),o=i._viewer.scene.globe.ellipsoid.cartesianToCartographic(m),l=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,l,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var m=a.position.getValue(i._viewer.clock.currentTime),o=i._viewer.scene.globe.ellipsoid.cartesianToCartographic(m);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),a=e.alp||1,n=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return n?(a=a-.05,a<=0&&(n=false)):(a=a+.05,a>=1&&(n=true)),t.Color.RED.withAlpha(a)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var y,k;if(e&&e.center){var r=this.createGraphics(),a=this,n=e.center,i=e.radius||800,m=e.rotateAmount||.05,o=0,l=e.height||1,u=0,d=0,g=0,f=(y=e.scale)!=null?y:0,h=(k=e.scale2)!=null?k:0,v=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return a.transformWGS84ToCartesian(n)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(a.transformWGS84ToCartesian(n),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(d),t.Math.toRadians(g)))},false);let E=i,B=false;var w=()=>{(i>=f||i<=E)&&(B=!B),B?i+=2:i-=2;},_=()=>{h>=i?i+=2:i=E;};return r.ellipse={material:v,height:l,semiMajorAxis:new t.CallbackProperty(function(){return i},false),semiMinorAxis:new t.CallbackProperty(function(){return i},false),stRotation:new t.CallbackProperty(function(){return m>0&&(o+=m,o>=360&&(o=0)),f&&w(),h&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,a=e.num||20,n=e.color||t.Color.RED,i=e.speed||.003,m=this.createGraphics();return m.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return a%2===0?r-=i:r+=i,(r<=.1||r>=1)&&a++,n.withAlpha(r)},false)})},this._graphicsLayer.entities.add(m)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,a=document.createElement("img");a.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let n=function(i){if(i.image){var m=document.createElement("canvas");m.width=i.width||150,m.height=i.height||80;var o=m.getContext("2d");o.drawImage(i.image,0,0);var l=i.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(l,55,36),m}};a.onload=function(){e.image=a;var i=r._graphicsLayer.entities.add({position:e.position,billboard:{image:n(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(i);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),a=0,n=e.positions,i=n[0];return r.position=new t.CallbackProperty(function(){return a==0?(i=n[0],a+=1):a<n.length-1?(i=n[a],a+=1):a==n.length-1&&(i=n[a],a=0),i},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await oe();if(e&&e.position){var a=[],n=e.url,i=0,m=6;return function(l,u){var d=document.createElement("img");d.src=l,d.setAttribute("rel:animated_src",l),d.setAttribute("rel:auto_play","0"),document.body.appendChild(d);var g=new r({gif:d});return new Promise(f=>{g.load(()=>{for(let h=1;h<=g.get_length();h++)g.move_to(h),u.push(g.get_canvas().toDataURL());f(u);});})}(n,a),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return a.length?(i<m*(a.length-1)?i++:i=0,a[Math.floor(i/m)]):n},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,a=e.rotateAmount,n=e.position,i=this;n.heading=0,n.pitch=0,n.roll=0,r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(n)},false),r.orientation=new t.CallbackProperty(function(){return a>0&&(n.heading+=a,n.heading===360&&(n.heading=0)),t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(n),new t.HeadingPitchRoll(t.Math.toRadians(n.heading),t.Math.toRadians(n.pitch),t.Math.toRadians(n.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,a=e.minHeiht||5,n=e.maxHeiht||100,i=e.cartesians,m=e.speed||.06,o=this,l=a,u=!1;i.length?r.positions=new t.CallbackProperty(function(){var d=o.transformCartesianArrayToWGS84Array(i);for(var g in d){var f=d[g];(a>=n||a<=l)&&(u=!u),u?a+=m:a-=m,f.alt=a;}return o.transformWGS84ArrayToCartesianArray(d,0)},!1):r.position=new t.CallbackProperty(function(){var d=o.transformCartesianToWGS84(i);return (a>=n||a<=l)&&(u=!u),u?a+=m:a-=m,d.alt=a,o.transformWGS84ToCartesian(d)},!1);}catch(d){console.log(d);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var a=0,n=document.createElement("canvas"),i=n.getContext("2d"),m=new Image;m.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(i.clearRect(0,0,o,e.cheight||0),a<=o)i.drawImage(m,a,0);else return a=0,a+=3,n};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:a,alt:n,custMaterial:i,speed:m=0,direction:o="+"}){if(e){var l=this.createGraphics(),u=0,d=this._calcPoints(r,a,n,u);l.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(d),false),material:i||t.Color.AQUAMARINE.withAlpha(.5)};let g=()=>{m>0&&(u+=m,d=this._calcPoints(r,a,n,Number(o+u)));};return e.clock.onTick.addEventListener(g),T(this,()=>{e.clock.onTick.removeEventListener(g);}),this._graphicsLayer.entities.add(l)}}_computeCirclularFlight(e,r,a,n,i,m){let o=[];o.push(e),o.push(r),o.push(0);var l=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(a,n));for(let u=i;u<=i+m;u++){let d=l*Math.sin(u*Math.PI/180),g=Math.cos(u*Math.PI/180),f=(a-e)*g+e,h=(n-r)*g+r;o.push(f),o.push(h),o.push(d);}return o}_objHasOwnProperty(e,r,a){let n=e;return n&&n.hasOwnProperty(r)?n[r]:a}_calcPoints(e,r,a,n){var i=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),m=a*Math.cos(n*Math.PI/180),o=a*Math.sin(n*Math.PI/180),l=t.Cartesian3.fromElements(m,o,0),u=t.Matrix4.multiplyByPoint(i,l,new t.Cartesian3),d=t.Cartographic.fromCartesian(u),g=t.Math.toDegrees(d.longitude),f=t.Math.toDegrees(d.latitude);return this._computeCirclularFlight(e,r,g,f,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return s}var J=A(he);var U=function(){};U.prototype={_getFlowLineShader:function(){return `uniform vec4 color;
|
|
139
|
+
`,b=typeof u.getRotation=="function"?u.getRotation.bind(u):u.getMatrix3.bind(u);function P(x){this.sources=x.sources,this._sources=void 0,this.show=a(x.show,true),this._command=new v({modelMatrix:u.clone(u.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0;}var O=new l;P.prototype.update=function(x,X){var R=this;if(this.show&&!(x.mode!==E.SCENE3D&&x.mode!==E.MORPHING)&&x.passes.render){var F=x.context;if(this._sources!==this.sources){this._sources=this.sources;var C=this.sources;if(!n(C.positiveX)||!n(C.negativeX)||!n(C.positiveY)||!n(C.negativeY)||!n(C.positiveZ)||!n(C.negativeZ))throw new m("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof C.positiveX!=typeof C.negativeX||typeof C.positiveX!=typeof C.positiveY||typeof C.positiveX!=typeof C.negativeY||typeof C.positiveX!=typeof C.positiveZ||typeof C.positiveX!=typeof C.negativeZ)throw new m("this.sources properties must all be the same type.");typeof C.positiveX=="string"?w(F,this._sources).then(function(le){R._cubeMap=R._cubeMap&&R._cubeMap.destroy(),R._cubeMap=le;}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new h({context:F,source:C}));}var I=this._command;if(I.modelMatrix=d.eastNorthUpToFixedFrame(x.camera._positionWC),!n(I.vertexArray)){I.uniformMap={u_cubeMap(){return R._cubeMap},u_rotateMatrix(){return b(I.modelMatrix,O)}};var Q=e.createGeometry(e.fromDimensions({dimensions:new r(2,2,2),vertexFormat:g.POSITION_ONLY})),se=this._attributeLocations=o.createAttributeLocations(Q);I.vertexArray=y.fromGeometry({context:F,geometry:Q,attributeLocations:se,bufferUsage:f._DRAW}),I.renderState=_.fromCache({blending:k.ALPHA_BLEND});}if(!n(I.shaderProgram)||this._useHdr!==X){var ce=new S({defines:[X?"HDR":""],sources:[T]});I.shaderProgram=B.fromCache({context:F,vertexShaderSource:V,fragmentShaderSource:ce,attributeLocations:this._attributeLocations}),this._useHdr=X;}if(n(this._cubeMap))return I}},P.prototype.isDestroyed=function(){return false},P.prototype.destroy=function(){var x=this._command;return x.vertexArray=x.vertexArray&&x.vertexArray.destroy(),x.shaderProgram=x.shaderProgram&&x.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),i(this)},t.Scene.GroundSkyBox=P;}removeHandlerByName(e=[]){e.forEach(r=>{this._viewer.screenSpaceEventHandler.removeInputAction(t.ScreenSpaceEventType[r]);});}}return s}var W=A(ue);function pe(t,c,s,p){function e(r,a){let n={},i=Y(a),m=[];if(Array.isArray(r))r.forEach(l=>{let u=Y(l),d=new u(t,c,s,p);o(u,i),m.push(d);}),n=new i(t,c,s,p),m.forEach(l=>Object.assign(n,l)),m.forEach(l=>Z(l,n));else {let l=Y(r),u=new l(t,c,s,p);o(l,i),n=new i(t,c,s,p),Object.assign(n,u),Z(u,n);}function o(l,u){let d=Object.getOwnPropertyNames(l.prototype);for(let g=0,f=d.length;g<f;g++)d[g]!=="constructor"&&(u.prototype[d[g]]=l.prototype[d[g]]);}return n}return e}function de({cesiumGlobal:t,threeGlobal:c,containerId:s,threeContainerId:p,viewerConfig:e={},extraConfig:r={},MapImageryList:a=[],defaultStatic:n,baseExtendsCom:i=[],extendsCom:m,extendsComName:o,viewer:l}){if(!t)throw new D("MISSING_CESIUM","\u7F3A\u5C11 Cesium \u5168\u5C40\u5BF9\u8C61\uFF0C\u8BF7\u4F20\u5165 cesiumGlobal\uFF08\u6216\u522B\u540D Cesium\uFF09\u3002");if(!s&&!l)throw new D("MISSING_VIEWER","\u7F3A\u5C11 containerId \u6216 viewer\uFF1A\u8BF7\u4F20\u5165\u6302\u8F7D\u5BB9\u5668 id\uFF0C\u6216\u76F4\u63A5\u4F20\u5165\u5DF2\u521B\u5EFA\u7684 viewer\u3002");let d=new H(t).init({containerId:s,viewerConfig:e,extraConfig:r,MapImageryList:a,viewer:l}),g=!l,v=pe(d,t,n,c?{threeGlobal:c,containerId:s,threeContainerId:p}:"")(i,m),w=false;return {viewer:d,[o]:v,dispose:()=>{if(!w){w=true;try{typeof v.destroy=="function"?v.destroy():j(v);}catch(_){L(_,{scope:"singleImport.dispose"});}g&&ae(d);}}}}function ie(t,c,s){function p(e){return de({...e,baseExtendsCom:t,extendsCom:c,extendsComName:s})}return p}var K=null;function ge(t){return t&&typeof t=="object"&&t.default?t.default:t}function fe(t,c){return c().then(ge).catch(s=>{throw ee(s)?s:new D("OPTIONAL_DEPENDENCY_MISSING",`\u8BE5\u529F\u80FD\u9700\u8981\u53EF\u9009\u4F9D\u8D56 "${t}"\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1Anpm i ${t}`,{cause:s,details:{package:t}})})}function oe(){return K||(K=fe("libgif",()=>import('libgif'))),K}function he(){let t=null;class s{constructor(e,r,a){if(e){t=r,this._viewer=e,this._graphicsLayer=new t.CustomDataSource("graphicsLayer"),this._drawLayer=this._graphicsLayer,e&&e.dataSources.add(this._graphicsLayer);let n=this._graphicsLayer;N(this),G(this,()=>{this._viewer&&n&&(this._viewer.dataSources.remove(n,true),this._graphicsLayer===n&&(this._graphicsLayer=void 0));});}}getPointGraphics(e){if(e=e||{},e)return new t.PointGraphics({color:e.color||t.Color.GREEN,pixelSize:e.pixelSize||5,outlineColor:e.outlineColor||t.Color.WHITE,outlineWidth:e.outlineWidth||1})}getLineGraphics(e){if(e=e||{},e&&e.positions)return new t.PolylineGraphics({show:true,positions:e.positions,material:e.material||t.Color.YELLOW,width:e.width||1,arcType:t.ArcType.GEODESIC,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)})}getPolygonGraphics(e){if(e=e||{},e&&e.positions)return new t.PolygonGraphics({hierarchy:{positions:e.positions},material:e.material||t.Color.RED.withAlpha(.2),clampToGround:e.clampToGround||false})}getLabelGraphics(e){if(e=e||{},e&&e.l_text)return new t.LabelGraphics({text:e.l_text,font:e.l_font||"14px sans-serif",fillColor:e.l_fillColor||t.Color.GOLD,style:e.l_style||t.LabelStyle.FILL_AND_OUTLINE,outlineColor:e.l_outlineColor||t.Color.GOLD,outlineWidth:e.l_outlineWidth||2,showBackground:e.l_showBackground||false,backgroundColor:e.l_backgroundColor||new t.Color(.165,.165,.165,.8),verticalOrigin:e.l_verticalOrigin||t.VerticalOrigin.BOTTOM,pixelOffset:e.l_pixelOffset||new t.Cartesian2(0,-30),heightReference:e.l_heightReference!=null?e.l_heightReference:t.HeightReference.NONE})}getBillboardGraphics(e){if(e=e||{},e&&e.b_img)return new t.BillboardGraphics({image:e.b_img,width:e.b_width||35,height:e.b_height||35,clampToGround:e.b_clampToGround||true,scale:e.b_scale||1,eyeOffset:e.b_eyeOffset!=null?e.b_eyeOffset:t.Cartesian3.ZERO,pixelOffset:e.b_pixelOffset||new t.Cartesian2(0,-20),scaleByDistance:e.b_scaleByDistance||void 0,heightReference:e.b_heightReference!=null?e.b_heightReference:t.HeightReference.NONE})}getPathGraphics(e){if(e=e||{},e)return new t.PathGraphics({resolution:e.resolution||1,material:new t.PolylineGlowMaterialProperty({glowPower:e.glowPower||.1,color:e.color||t.Color.YELLOW}),width:e.width||30})}getModelGraphics(e){if(e=e||{},e)return new t.ModelGraphics({uri:e.m_url||e.url,scale:e.m_scale||e.scale||10,clampAnimations:true})}getEllipseGraphics(e){if(e=e||{},e)return new t.EllipseGraphics({semiMajorAxis:e.e_semiMajorAxis||1e6,semiMinorAxis:e.e_semiMinorAxis||1e6,metarial:e.e_metarial||t.Color.RED.withAlpha(.5),outline:this._objHasOwnProperty(e,"e_outline",true)})}getEllipsoidGraphics(e){if(e=e||{},e){var r=e.radii||1e6;return new t.EllipsoidGraphics({radii:new t.Cartesian3(r,r,r),innerRadii:this._objHasOwnProperty(e,"innerRadii",new t.Cartesian3(r/1.5,r/1.5,r/1.5)),maximumCone:e.maximumCone||t.Math.PI_OVER_TWO,stackPartitions:e.stackPartitions||56,slicePartitions:e.slicePartitions||56,outlineWidth:e.outlineWidth||2,outlineColor:e.outlineColor||t.Color.YELLOW,outline:this._objHasOwnProperty(e,"outline",true),fill:this._objHasOwnProperty(e,"fill",true),material:e.material||t.Color.RED.withAlpha(.1)})}}getBoxGraphics(e){if(e=e||{},e)return new t.BoxGraphics({show:this._objHasOwnProperty(e,"show",true),fill:this._objHasOwnProperty(e,"fill",true),dimensions:e.dimensions||new t.Cartesian3(0,0,0),material:e.material,outline:this._objHasOwnProperty(e,"outline",true),outlineColor:e.outlineColor||t.Color.BLACK,distanceDisplayCondition:e.distanceDisplayCondition||void 0})}getPlaneGraphics(e){if(e=e||{},e)return new t.PlaneGraphics({plane:e.plane||new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(170,130),material:e.material||t.Color.BLUE})}getCylinderGraphics(e){if(e=e||{},e)return new t.CylinderGraphics({HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500/2,topRadius:e.topRadius||0,bottomRadius:e.bottomRadius||0,material:e.material||new t.Color(0,1,1,.4),slices:e.slices||128})}createPointsGraphics(e){if(e&&e.positions){let r=[];for(let a in e.positions){let n=e.positions[a],i=this.createGraphics();i.name=e.name||"",i.oid=e.oid||"point",i.position=n,e.point&&(i.point=this.getPointGraphics()),e.billboard&&(i.billboard=this.getBillboardGraphics(e.billboard)),e.label&&(i.label=this.getLabelGraphics(e.label)),r.push(this._graphicsLayer.entities.add(i));}return r}}createLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.name=e.name||"",r.oid=e.oid||"line",r.position=e.positions,r.polyline=this.getLineGraphics(e),this._graphicsLayer.entities.add(r)}}createPolygonGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.polygon=this.getPolygonGraphics(e),r.clampToS3M=this._objHasOwnProperty(e,"clampToS3M",false),this._graphicsLayer.entities.add(r)}}createBoxGraphics(e){if(e=e||{},e){var r=this.createGraphics();return r.position=e.position,r.name=e.name||"box_graphic",r.box=this.getBoxGraphics(e.box),this._graphicsLayer.entities.add(r)}}createModelGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.model=this.getModelGraphics(e),r.position=e.position,this._graphicsLayer.entities.add(r)}}craeteCorridorGraphics(e){if(e&&e.positions){let{positions:a,height:n,width:i,material:m,...o}=e;var r=this.createGraphics();return n=n===void 0?6:n,i=i===void 0?15:i,r.corridor={positions:a,height:n,width:i,...o,material:m||new t.Scene.WarnLinkMaterialProperty({freely:"cross",color:t.Color.YELLOW,duration:1e3,count:1,direction:"+"})},this._graphicsLayer.entities.add(r)}}craeteDynamicPolyLineGraphics(e){if(e&&e.positions){var r=this.createGraphics();return r.polyline={show:true,positions:[],material:e.material||t.Color.CHARTREUSE,width:e.width||5,clampToGround:this._objHasOwnProperty(e,"clampToGround",false)},r.polyline.positions=new t.CallbackProperty(function(){return e.positions},false),this._graphicsLayer.entities.add(r)}}craeteDynamicCylinderGraphics(e){var r={};if(e&&e.cylinder){var a=e.entity,n=e.cylinder,i=this;return r.cylinder=this.getCylinderGraphics(n),r.position=new t.CallbackProperty(function(){var m=a.position.getValue(i._viewer.clock.currentTime),o=i._viewer.scene.globe.ellipsoid.cartesianToCartographic(m),l=t.Math.toDegrees(o.latitude),u=t.Math.toDegrees(o.longitude);return t.Cartesian3.fromDegrees(u,l,0)},false),r.cylinder.length=new t.CallbackProperty(function(){var m=a.position.getValue(i._viewer.clock.currentTime),o=i._viewer.scene.globe.ellipsoid.cartesianToCartographic(m);return o.height*2},false),r}}createFadeCylinderGraphics(e){if(e=e||{},e&&e.position){let r=this.createGraphics();return r.position=e.position,e.material=new t.Scene.CircleFadeMaterialProperty({color:e.color||t.Color.fromCssColorString("#02ff00"),duration:e.duration||2e3}),r.cylinder=this.getCylinderGraphics(e),this._drawLayer.entities.add(r)}}craeteRotateCylinderGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.cylinder={HeightReference:t.HeightReference.RELATIVE_TO_GROUND,length:e.length||500,topRadius:e.topRadius||500,bottomRadius:e.bottomRadius||500,material:e.material||new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteRotateCylinderGraphics"])||"static/data/images/file/cc2.png",transparent:true,repeat:{x:1,y:-1}}),slices:e.slices||128},r.position=e.position,this.setGraphicsRotate({entity:r,position:this.transformCartesianToWGS84(e.position),rotateAmount:4}),this._graphicsLayer.entities.add(r)}}craeteDynamicBlinkCircleGraphics(e){if(e&&e.position){var r=this.createGraphics(),a=e.alp||1,n=this._objHasOwnProperty(e,"flog",true);return r.position=e.position,r.ellipse={semiMinorAxis:e.semiMinorAxis||2e3,semiMajorAxis:e.semiMajorAxis||2e3,height:e.height||10,material:new t.ColorMaterialProperty(new t.CallbackProperty(function(){return n?(a=a-.05,a<=0&&(n=false)):(a=a+.05,a>=1&&(n=true)),t.Color.RED.withAlpha(a)},false))},this._graphicsLayer.entities.add(r)}}craeteDynamicCricleGraphics(e){var y,k;if(e&&e.center){var r=this.createGraphics(),a=this,n=e.center,i=e.radius||800,m=e.rotateAmount||.05,o=0,l=e.height||1,u=0,d=0,g=0,f=(y=e.scale)!=null?y:0,h=(k=e.scale2)!=null?k:0,v=e.material||new t.ImageMaterialProperty({image:e.imge||this.getDfSt(["graphic","craeteDynamicCricleGraphics"])||"static/data/images/Textures/circle_bg.png",transparent:true});r.position=new t.CallbackProperty(function(){return a.transformWGS84ToCartesian(n)},false),r.orientation=new t.CallbackProperty(function(){return t.Transforms.headingPitchRollQuaternion(a.transformWGS84ToCartesian(n),new t.HeadingPitchRoll(t.Math.toRadians(u),t.Math.toRadians(d),t.Math.toRadians(g)))},false);let E=i,B=false;var w=()=>{(i>=f||i<=E)&&(B=!B),B?i+=2:i-=2;},_=()=>{h>=i?i+=2:i=E;};return r.ellipse={material:v,height:l,semiMajorAxis:new t.CallbackProperty(function(){return i},false),semiMinorAxis:new t.CallbackProperty(function(){return i},false),stRotation:new t.CallbackProperty(function(){return m>0&&(o+=m,o>=360&&(o=0)),f&&w(),h&&_(),o},false)},this._graphicsLayer.entities.add(r)}}craeteDynamicShadeWallGraphics(e){if(e&&e.positions){var r=e.alp||1,a=e.num||20,n=e.color||t.Color.RED,i=e.speed||.003,m=this.createGraphics();return m.wall={positions:e.positions,material:new t.ImageMaterialProperty({image:e.img||this.getDfSt(["graphic","craeteDynamicShadeWallGraphics"])||"static/data/images/Textures/fence.png",transparent:true,color:new t.CallbackProperty(function(){return a%2===0?r-=i:r+=i,(r<=.1||r>=1)&&a++,n.withAlpha(r)},false)})},this._graphicsLayer.entities.add(m)}}createCustomDefBillboardGraphics(e){if(e&&e.position){var r=this,a=document.createElement("img");a.src=e.image||this.getDfSt(["graphic","createCustomDefBillboardGraphics"])||"static/data/images/file/div1.png";let n=function(i){if(i.image){var m=document.createElement("canvas");m.width=i.width||150,m.height=i.height||80;var o=m.getContext("2d");o.drawImage(i.image,0,0);var l=i.text;return o.font="15px bold \u5B8B\u4F53",o.fillStyle="#f4fff0",o.fillText(l,55,36),m}};a.onload=function(){e.image=a;var i=r._graphicsLayer.entities.add({position:e.position,billboard:{image:n(e),scaleByDistance:new t.NearFarScalar(150,.7,15e6,.5),verticalOrigin:t.VerticalOrigin.BOTTOM,pixelOffset:e.b_pixelOffset||new t.Cartesian2(80,-35),width:140,height:100,scale:e.b_scale||1.5,disableDepthTestDistance:Number.POSITIVE_INFINITY,imageSubRegion:{x:0,y:0,width:200,height:150}}});typeof e.callback=="function"&&e.callback(i);};}}craeteRotatePlaneGraphics(e){if(e&&e.center&&e.positions){var r=this.createGraphics(),a=0,n=e.positions,i=n[0];return r.position=new t.CallbackProperty(function(){return a==0?(i=n[0],a+=1):a<n.length-1?(i=n[a],a+=1):a==n.length-1&&(i=n[a],a=0),i},false),r.plane={plane:new t.Plane(t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.image})},this._graphicsLayer.entities.add(r)}}createVideoPlaneGraphics(e){if(e&&e.position){var r=this.createGraphics();return r.position=e.position,r.plane={plane:new t.Plane(e.normal||t.Cartesian3.UNIT_Y,0),dimensions:e.dimensions||new t.Cartesian2(200,150),material:new t.ImageMaterialProperty({image:e.videoElement})},this._graphicsLayer.entities.add(r)}}async createGifBillboardGraphics(e){let r=await oe();if(e&&e.position){var a=[],n=e.url,i=0,m=6;return function(l,u){var d=document.createElement("img");d.src=l,d.setAttribute("rel:animated_src",l),d.setAttribute("rel:auto_play","0"),document.body.appendChild(d);var g=new r({gif:d});return new Promise(f=>{g.load(()=>{for(let h=1;h<=g.get_length();h++)g.move_to(h),u.push(g.get_canvas().toDataURL());f(u);});})}(n,a),this._graphicsLayer.entities.add({position:e.position,billboard:{verticalOrigin:t.VerticalOrigin.BASELINE,image:new t.CallbackProperty(function(){return a.length?(i<m*(a.length-1)?i++:i=0,a[Math.floor(i/m)]):n},false),scale:.2}})}}setGraphicsRotate(e){if(e&&e.entity&&e.rotateAmount){var r=e.entity,a=e.rotateAmount,n=e.position,i=this;n.heading=0,n.pitch=0,n.roll=0,r.position=new t.CallbackProperty(function(){return i.transformWGS84ToCartesian(n)},false),r.orientation=new t.CallbackProperty(function(){return a>0&&(n.heading+=a,n.heading===360&&(n.heading=0)),t.Transforms.headingPitchRollQuaternion(i.transformWGS84ToCartesian(n),new t.HeadingPitchRoll(t.Math.toRadians(n.heading),t.Math.toRadians(n.pitch),t.Math.toRadians(n.roll)))},false);}}setGraphicsFloat(e){if(e&&e.entity&&e.maxHeiht)try{var r=e.entity,a=e.minHeiht||5,n=e.maxHeiht||100,i=e.cartesians,m=e.speed||.06,o=this,l=a,u=!1;i.length?r.positions=new t.CallbackProperty(function(){var d=o.transformCartesianArrayToWGS84Array(i);for(var g in d){var f=d[g];(a>=n||a<=l)&&(u=!u),u?a+=m:a-=m,f.alt=a;}return o.transformWGS84ArrayToCartesianArray(d,0)},!1):r.position=new t.CallbackProperty(function(){var d=o.transformCartesianToWGS84(i);return (a>=n||a<=l)&&(u=!u),u?a+=m:a-=m,d.alt=a,o.transformWGS84ToCartesian(d)},!1);}catch(d){console.log(d);}}createCanvasGraphics(e){if(e&&e.positions){let r=function(){var a=0,n=document.createElement("canvas"),i=n.getContext("2d"),m=new Image;m.src=e.img||"../../images/ysCesium/logo.png";let o=e.cwidth||0;if(i.clearRect(0,0,o,e.cheight||0),a<=o)i.drawImage(m,a,0);else return a=0,a+=3,n};this._graphicsLayer.entities.add({rectangle:{coordinates:e.positions,material:new t.ImageMaterialProperty({image:new t.CallbackProperty(r,false),transparent:true})}}),typeof e.callback=="function"&&e.callback();}}createFanShape({viewer:e,longitude:r,latitude:a,alt:n,custMaterial:i,speed:m=0,direction:o="+"}){if(e){var l=this.createGraphics(),u=0,d=this._calcPoints(r,a,n,u);l.wall={positions:new t.CallbackProperty(()=>t.Cartesian3.fromDegreesArrayHeights(d),false),material:i||t.Color.AQUAMARINE.withAlpha(.5)};let g=()=>{m>0&&(u+=m,d=this._calcPoints(r,a,n,Number(o+u)));};return e.clock.onTick.addEventListener(g),G(this,()=>{e.clock.onTick.removeEventListener(g);}),this._graphicsLayer.entities.add(l)}}_computeCirclularFlight(e,r,a,n,i,m){let o=[];o.push(e),o.push(r),o.push(0);var l=t.Cartesian3.distance(t.Cartesian3.fromDegrees(e,r),t.Cartesian3.fromDegrees(a,n));for(let u=i;u<=i+m;u++){let d=l*Math.sin(u*Math.PI/180),g=Math.cos(u*Math.PI/180),f=(a-e)*g+e,h=(n-r)*g+r;o.push(f),o.push(h),o.push(d);}return o}_objHasOwnProperty(e,r,a){let n=e;return n&&n.hasOwnProperty(r)?n[r]:a}_calcPoints(e,r,a,n){var i=t.Transforms.eastNorthUpToFixedFrame(t.Cartesian3.fromDegrees(e,r)),m=a*Math.cos(n*Math.PI/180),o=a*Math.sin(n*Math.PI/180),l=t.Cartesian3.fromElements(m,o,0),u=t.Matrix4.multiplyByPoint(i,l,new t.Cartesian3),d=t.Cartographic.fromCartesian(u),g=t.Math.toDegrees(d.longitude),f=t.Math.toDegrees(d.latitude);return this._computeCirclularFlight(e,r,g,f,0,90)}createCorridorGraphics(e){return this.craeteCorridorGraphics(e)}createDynamicPolyLineGraphics(e){return this.craeteDynamicPolyLineGraphics(e)}createDynamicCylinderGraphics(e){return this.craeteDynamicCylinderGraphics(e)}createRotateCylinderGraphics(e){return this.craeteRotateCylinderGraphics(e)}createDynamicBlinkCircleGraphics(e){return this.craeteDynamicBlinkCircleGraphics(e)}createDynamicCircleGraphics(e){return this.craeteDynamicCricleGraphics(e)}createDynamicShadeWallGraphics(e){return this.craeteDynamicShadeWallGraphics(e)}createRotatePlaneGraphics(e){return this.craeteRotatePlaneGraphics(e)}createGraphics(){return new t.Entity}}return s}var J=A(he);var U=function(){};U.prototype={_getFlowLineShader:function(){return `uniform vec4 color;
|
|
140
140
|
uniform float duration;
|
|
141
141
|
|
|
142
142
|
czm_material czm_getMaterial(czm_materialInput materialInput){
|
|
@@ -375,7 +375,7 @@ void main(void)
|
|
|
375
375
|
out_FragColor = mix(out_FragColor, u_scanColor, f);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
|
-
`}};function ye(){let t=null,c=function(s,p){if(s){this._viewer=s,ne(J,W),this.$graphics=new J(s,p),t=p;let e=this.$graphics;N(this),
|
|
378
|
+
`}};function ye(){let t=null,c=function(s,p){if(s){this._viewer=s,ne(J,W),this.$graphics=new J(s,p),t=p;let e=this.$graphics;N(this),G(this,()=>{j(e);});}};return c.prototype={setCircleScanEffect:function(s){if(s&&s.position){var p=s.id||"CircleScan"+parseInt(Math.random()*1e3),e=s.position,r=s.radius,a=s.color||t.Color.RED,n=s.duration||1500,i=this,m=s.circleMode||"CircleScan",o=s.border||4,l=e,u=new t.Cartesian4(l.x,l.y,l.z,1),d=this.transformCartesianToWGS84(e),g=this.transformWGS84ToCartesian({lng:d.lng,lat:d.lat,alt:d.alt+500}),f=new t.Cartesian4(g.x,g.y,g.z,1),h=new Date().getTime(),v=new t.PostProcessStage({name:p,fragmentShader:this._getCircleScanShader({get:true,border:o}),uniforms:{u_scanCenterEC:function(){return t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,new t.Cartesian4)},u_scanPlaneNormalEC:function(){var w=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,new t.Cartesian4),_=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,f,new t.Cartesian4),y=new t.Cartesian3;return y.x=_.x-w.x,y.y=_.y-w.y,y.z=_.z-w.z,t.Cartesian3.normalize(y,y),y},u_radius:function(){return m=="CircleScan"?r*((new Date().getTime()-h)%n)/n:r},u_scanColor:a}});return this._viewer.scene.postProcessStages.add(v),v}},setRadarScanEffect:function(s){if(s&&s.position){var p=s.id||"radarScan"+parseInt(Math.random()*1e3),e=s.position,r=s.radius,a=s.color||t.Color.RED,n=s.duration||1500,i=this,m=s.border||1,o=s.width||3,l=e,u=new t.Cartesian4(l.x,l.y,l.z,1),d=this.transformCartesianToWGS84(e),g=this.transformWGS84ToCartesian({lng:d.lng,lat:d.lat,alt:d.alt+500}),f=new t.Cartesian4(g.x,g.y,g.z,1),h=this.transformWGS84ToCartesian({lng:d.lng+.001,lat:d.lat,alt:d.alt}),v=new t.Cartesian4(h.x,h.y,h.z,1),w=new Date().getTime(),_=new t.Quaternion,y=new t.Matrix3,k=new t.Cartesian4,E=new t.Cartesian4,B=new t.Cartesian4,S=new t.Cartesian3,T=new t.Cartesian3,V=new t.PostProcessStage({name:p,fragmentShader:this._getRadarScanShader({border:m,width:o,get:true}),uniforms:{u_scanCenterEC:function(){return t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,k)},u_scanPlaneNormalEC:function(){var b=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,k),P=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,f,E);return S.x=P.x-b.x,S.y=P.y-b.y,S.z=P.z-b.z,t.Cartesian3.normalize(S,S),S},u_scanLineNormalEC:function(){var b=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,u,k),P=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,f,E),O=t.Matrix4.multiplyByVector(i._viewer.camera._viewMatrix,v,B);S.x=P.x-b.x,S.y=P.y-b.y,S.z=P.z-b.z,t.Cartesian3.normalize(S,S),T.x=O.x-b.x,T.y=O.y-b.y,T.z=O.z-b.z;var x=(new Date().getTime()-w)%n/n;return t.Quaternion.fromAxisAngle(S,x*t.Math.PI*2,_),t.Matrix3.fromQuaternion(_,y),t.Matrix3.multiplyByVector(y,T,T),t.Cartesian3.normalize(T,T),T},u_radius:r,u_scanColor:a}});return this._viewer.scene.postProcessStages.add(V),V}},satelliteScan:function(s){if(s&&s.position){var p=t.Cartesian3,e=t.GeometryInstance,r=t.Primitive,o=t.MaterialAppearance,a=t.Material,n=t.Color,i=t.Matrix4,m=t.Transforms,o=t.MaterialAppearance,l=t.CylinderGeometry;let v=s.position||[116.39,39.9],w=s.length||4e4;var u=p.fromDegrees(v[0],v[1]),d=i.multiplyByTranslation(m.eastNorthUpToFixedFrame(u),new p(0,0,w*.5),new i),g=new l({length:w,topRadius:0,bottomRadius:w*.5,vertexFormat:o.MaterialSupport.TEXTURED.vertexFormat}),f=new e({geometry:g,modelMatrix:d}),h=this._viewer.scene.primitives.add(new r({geometryInstances:f,appearance:new o({material:new a({fabric:{uniforms:{color:s.color||new n(.2,1,0,1),repeat:s.repeat||30,offset:0,thickness:s.thickness||.2},source:`
|
|
379
379
|
uniform vec4 color;
|
|
380
380
|
uniform float repeat;
|
|
381
381
|
uniform float offset;
|
|
@@ -412,5 +412,5 @@ void main(void)
|
|
|
412
412
|
v_normalEC = normal; // normal in world coordinates
|
|
413
413
|
v_st = st;
|
|
414
414
|
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
|
415
|
-
}`})}));let _=function(){var y=h.appearance.material.uniforms.offset;y-=.001,y>1&&(y=0),h.appearance.material.uniforms.offset=y;};return this._viewer.scene.preUpdate.addEventListener(_),
|
|
415
|
+
}`})}));let _=function(){var y=h.appearance.material.uniforms.offset;y-=.001,y>1&&(y=0),h.appearance.material.uniforms.offset=y;};return this._viewer.scene.preUpdate.addEventListener(_),G(this,()=>{this._viewer.scene.preUpdate.removeEventListener(_);}),h}},lighitCentrumScanEffect:function(s){let p=this.createLightScan_getCirclePoints(s.circle[0],s.circle[1],s.circle[2],s.circle[3]),e=this.createLightScan_entityCList(this._viewer,p,s);for(let r=0;r<e.length;r++)r!==e.length-1?this.createLightScan_changeOnePosition(s,e[r],[p[r].x,p[r].y,p[r+1].x,p[r+1].y]):this.createLightScan_changeOnePosition(s,e[r],[p[r].x,p[r].y,p[0].x,p[0].y]);return e},createLightScan_getCirclePoints:function(s,p,e,r){let a=[],n=Math.PI/180*Math.round(360/r),i=0;for(;i<r;i++){let m=p+s*Math.sin(n*i),o=e+s*Math.cos(n*i);a.unshift({x:m,y:o});}return a},createLightScan_changeOnePosition:function(s,p,e){let r=s.positionList,a,n,i,m,o,l,u=0,d=0;function g(f){a=r[f+1][0]-r[f][0],n=r[f+1][1]-r[f][1],i=a/s.number,m=n/s.number,d=0;}g(u),p.polygon.hierarchy=new t.CallbackProperty(function(){return Math.abs(o)>=Math.abs(a)&&Math.abs(l)>=Math.abs(n)&&(u=u+1,u===r.length-1&&(u=0),e[0]=e[0]+o,e[1]=e[1]+l,e[2]=e[2]+o,e[3]=e[3]+l,g(u)),o=d*i,l=d*m,d++,new t.PolygonHierarchy(t.Cartesian3.fromDegreesArrayHeights([s.observer[0],s.observer[1],s.observer[2],e[0]+o,e[1]+l,0,e[2]+o,e[3]+l,0]))},false);},createLightScan_entityCList:function(s,p,e){let r=e.observer[0],a=e.observer[1],n=e.observer[2],i=[];for(let m=0;m<p.length;m++){let o;m===p.length-1?o=new t.PolygonHierarchy(t.Cartesian3.fromDegreesArrayHeights([r,a,n,p[m].x,p[m].y,0,p[0].x,p[0].y,0])):o=new t.PolygonHierarchy(t.Cartesian3.fromDegreesArrayHeights([r,a,n,p[m].x,p[m].y,0,p[m+1].x,p[m+1].y,0]));let l=s.entities.add({name:"\u4E09\u89D2\u5F62",polygon:{hierarchy:o,outline:false,perPositionHeight:true,material:e.material}});i.push(l);}return i},createFireParticleSystem(s){if(s&&s.position){let p=Object.assign({},{fireImage:"static/data/images/file/fire.png",startScale:3,endScale:1.5,minimumParticleLife:1.5,maximumParticleLife:1.8,minimumSpeed:7,maximumSpeed:9,particleSize:2,emissionRate:200,startColor:new t.Color(1,1,1,1),endColor:new t.Color(.5,0,0,0),emitter:new t.ConeEmitter(t.Math.toRadians(45))},s),{fireImage:e,startScale:r,endScale:a,minimumParticleLife:n,maximumParticleLife:i,minimumSpeed:m,maximumSpeed:o,particleSize:l,emissionRate:u,position:d,startColor:g,endColor:f,emitter:h}=p;return new t.ParticleSystem({image:e,startScale:r,endScale:a,minimumParticleLife:n,maximumParticleLife:i,minimumSpeed:m,maximumSpeed:o,emissionRate:u,startColor:g,endColor:f,emitter:h,imageSize:new t.Cartesian2(l,l),lifetime:16,loop:true,sizeInMeters:true,modelMatrix:t.Transforms.eastNorthUpToFixedFrame(d)})}}},c}var q=A(ye);var Ze=ie([W,U],q,"passEffect");export{Ze as PassEffect};//# sourceMappingURL=pass-effect.mjs.map
|
|
416
416
|
//# sourceMappingURL=pass-effect.mjs.map
|