earthsdk3-cesium 3.6.2 → 3.6.3
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.
|
@@ -3843,7 +3843,7 @@ return material;
|
|
|
3843
3843
|
material.alpha = fragColor.a;
|
|
3844
3844
|
|
|
3845
3845
|
return material;
|
|
3846
|
-
}`},translucent:!0});function IH(){Object.defineProperties(w.Billboard.prototype,{_positionFromParent:{get(){return!1},set(t){}}})}OV(),LV(),zV(),NV(),HV(),GV(),WV(),UV(),nN(),iN(),oN(),PN(),IH(),w.Camera.DEFAULT_VIEW_RECTANGLE=w.Rectangle.fromDegrees(70,5,140,55);function FH(){return new Promise((t,n)=>w.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class MH extends c.Destroyable{constructor(n,e,i,o){super();const r=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=Mt(a);if(l&&(l.destroy(),Uv(a,void 0)),w.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let u=a.scene.context._originalGLContext;u.canvas.width=u.canvas.height=1,u.getExtension("WEBGL_lose_context").loseContext(),u=null}a.destroy(),i(void 0)}};this.d(r);const s=this.dv(c.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const u=RV;await a.promise(FH());const A=await a.promise(c.createCancelablePromise(u(l,o)));A.scene._xbsjOriginSkyAtmosphere=A.scene.skyAtmosphere,A.scene._xbsjOriginSkyBox=A.scene.skyBox,A.scene.renderError.removeEventListener(A.cesiumWidget._onRenderError),A.clockViewModel.currentTime=w.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const h=w.JulianDate.fromDate(new Date(e.currentTime));w.JulianDate.equals(h,A.clockViewModel.currentTime)||(A.clockViewModel.currentTime=h)})),this.dispose(mi(A.clockViewModel,"currentTime",h=>{const f=w.JulianDate.toDate(A.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const h=new lE(A,e);Uv(A,h)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),i(A)}));s.start(n),s.errorEvent.don(a=>{console.error(a),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const DH=new w.EllipsoidTerrainProvider;class YS extends c.Destroyable{constructor(e){super();O(this,"_terrainMap",new Map);O(this,"_nextAnimateFrame",this.dv(c.createNextAnimateFrame()));O(this,"selectedTerrain");this._viewer=e;const i=this._viewer,o=i.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{o&&o()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let r=Number.MIN_SAFE_INTEGER;for(let s of this._terrainMap.keys())s.sceneObject.activate=!1,(s.sceneObject.show??!0)&&s.sceneObject.zIndex>=r&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${s.sceneObject.name}(${s.sceneObject.id})`),r=s.sceneObject.zIndex,this.selectedTerrain=s);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),i.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??DH}))}_makeDirty(){this._nextAnimateFrame.restartIfNotRunning()}get _changed(){return this._nextAnimateFrame.completeEvent}add(e){if(this._terrainMap.has(e)){console.warn("this._terrainMap.has(imagery)");return}const i=new c.Destroyable;i.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),i.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>i.destroy()),this._makeDirty();const o=this.ad(c.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged));this.d(o.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const i=this._terrainMap.get(e);if(!i){console.error("!disposeFunc");return}i(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class JS extends c.Destroyable{constructor(e){super();O(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const i=e instanceof bt?"div":"canvas";if(this._labelMap[i].has(e)){console.warn(`this._labelMap[${i}].has(poi)`,e);return}const o=new c.Destroyable;{const r=o.dv(c.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));o.dispose(r.don(()=>{this._updateZOrder()}))}this._labelMap[i].set(e,()=>o.destroy()),this._updateZOrder()}delete(e){const i=e instanceof bt?"div":"canvas";if(!this._labelMap[i].has(e)){console.warn(`!this._labelMap[${i}].has(poi)`,e);return}const o=this._labelMap[i].get(e);if(!o){console.error("!disposeFunc");return}o(),this._labelMap[i].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,i){const o={};for(const a of e.keys())o[a.zOrder]||(o[a.zOrder]=new Map),o[a.zOrder].set(a,a instanceof bt?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const r=Object.keys(o).sort((a,l)=>i=="div"?Number(l)-Number(a):Number(a)-Number(l));let s=e.size;for(let a=0;a<r.length;a++)new Map([...o[r[a]]].sort((u,A)=>Number(A[1])-Number(u[1]))).forEach((u,A)=>{A instanceof bt&&A.czmDivPoi&&(A.czmDivPoi.zOrder=s),A instanceof ji&&A.canvasObj&&(A.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class RH extends c.Destroyable{constructor(e){super();O(this,"_czmImageryLayerWrappers",new Set);O(this,"_zIndexChangedEvent",this.dv(new c.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const i=[...this.czmImageryLayerWrappers.values()];i.sort((o,r)=>{const s=o.czmImageryWrapper.imagery.zIndex??c.ESImageryLayer.defaults.zIndex,a=r.czmImageryWrapper.imagery.zIndex??c.ESImageryLayer.defaults.zIndex;return s-a});for(const o of i)this.viewer.imageryLayers.raiseToTop(o.imageryLayer)}))}get viewer(){return this._viewer}get czmImageryLayerWrappers(){return this._czmImageryLayerWrappers}add(e){this._czmImageryLayerWrappers.add(e),this.viewer.imageryLayers.add(e.imageryLayer),this.zIndexChange()}delete(e){this.viewer.imageryLayers.remove(e.imageryLayer,!1),this._czmImageryLayerWrappers.delete(e)}zIndexChange(){this._zIndexChangedEvent.emit()}}class UH extends c.Destroyable{constructor(e){super();O(this,"_imageryLayer");if(this._czmImageryWrapper=e,!this._czmImageryWrapper.imagery.layer)throw new Error("this._czmCzmImageryWrapper.imagery.czmImagery");this._imageryLayer=this._czmImageryWrapper.imagery.layer;const{czmImageryWrapper:i}=this,o=i.manager.czmImageriesManager;o.add(this),this.d(()=>o.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>o.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class OH extends c.Destroyable{constructor(e){super();O(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new c.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new UH(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class LH extends c.Destroyable{constructor(e,i){super();O(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=i,this._czmImageryLayerWrapperObjResetting=this.dv(new c.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new OH(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class eE extends c.Destroyable{constructor(e){super();O(this,"_czmImageryWrappers",new Set);O(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new RH(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let i of this.czmImageryWrappers)if(i.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new LH(e,this))}has(e){for(let i of this.czmImageryWrappers)if(i.imagery===e)return!0;return!1}delete(e){for(const i of this.czmImageryWrappers)if(i.imagery===e){this.czmImageryWrappers.delete(i);return}console.warn("imageriesManager delete error!",e)}}class tE extends c.Destroyable{constructor(e){super();O(this,"_pause",this.disposeVar(c.react(!1)));O(this,"_pickPositionTasks",[]);O(this,"_pickTasks",[]);O(this,"pickHeightMustGreaterThanZero",!0);O(this,"objectsToExclude",[]);const i=e.viewer;{this.dispose(()=>{this._pickPositionTasks.length>0&&(this._pickPositionTasks.forEach(a=>a[3]("CzmViewer销毁,任务不再执行!")),this._pickPositionTasks.length=0),this._pickTasks.length>0&&(this._pickTasks.forEach(a=>a[4]("CzmViewer销毁,任务不再执行!")),this._pickTasks.length=0)});const o=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let u of a){const[A,h,f,p]=u;try{(async()=>{const{scene:d,camera:g}=i,v=Ze(A),y=g.getPickRay(v);if(y){let E;if(h?E=await d.pickFromRayMostDetailed(y,this.objectsToExclude):E=d.pickFromRay(y,this.objectsToExclude),E&&E.position){const B=De(E.position);return B?f(B):p(new Error("positionFromCartesian failed"))}if(!(d.terrainProvider instanceof w.EllipsoidTerrainProvider)){const B=d.globe.pick(y,d);if(!B)return p(new Error("scene.globe.pick failed"));const P=De(B);return P?(this.pickHeightMustGreaterThanZero&&P[2]<0&&(P[2]=0),f(P)):p(new Error("positionFromCartesian failed"))}}const m=d.terrainProvider instanceof w.EllipsoidTerrainProvider?d.terrainProvider.tilingScheme.ellipsoid:i.scene.globe.ellipsoid,_=i.camera.pickEllipsoid(Ze(A),m);if(!_)return p(new Error("Pick failed"));const x=De(_);return x?f(x):p(new Error("positionFromCartesian failed"))})()}catch(d){p(d)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let u of l){const[A,h,f,p,d]=u;e.pickCustomAttachedInfo=f;try{(async()=>{var E,B,P,I;let g=i.scene.pick(Ze(A),h&&h[0],h&&h[1]);!g&&w.defined(i.scene.globe)&&(g=await zH(i,Ze(A)));let v;if(g&&g instanceof w.Cesium3DTileFeature){v={};try{g&&g.getPropertyIds().forEach(F=>{v&&(v[F]=g.getProperty(F))})}catch(D){console.warn(D)}}if(!g){const{left:D,top:F}=e.container.getBoundingClientRect();g=(E=document.elementFromPoint(A[0]+D,A[1]+F))==null?void 0:E.closest("[data-es-scene-object-id]")}let y;g&&(g.id&&g.id instanceof w.Entity&&g.id.ESSceneObjectID?y=g.id.ESSceneObjectID:g.primitive&&g.primitive.ESSceneObjectID?y=g.primitive.ESSceneObjectID:g.collection&&g.collection.ESSceneObjectID?y=g.collection.ESSceneObjectID:Array.isArray(g)&&g[0]instanceof w.ImageryLayerFeatureInfo?y=g[0].imageryLayer.ESSceneObjectID:g instanceof HTMLElement&&(y=g.dataset.esSceneObjectId));let m=y?c.ESSceneObject.getSceneObject(y):void 0;m&&m.parentID&&(m=c.ESSceneObject.getSceneObject(m.parentID));let _={};if(m&&Reflect.has(m,"allowPicking")&&Reflect.has(m,"pickedEvent")&&(m.allowPicking??!1)){if(m instanceof c.ESEntityCluster){const D=new w.JulianDate;_=g.id instanceof w.Entity?{name:g.id.label.text.getValue(D),properties:(B=g.id.properties)==null?void 0:B.getValue(D),coordinates:Ya(g.id.position.getValue(D))}:(P=g.id)==null?void 0:P.map(F=>{var S;return{name:F.id,properties:(S=F.properties)==null?void 0:S.getValue(D),coordinates:Ya(F.position.getValue(D))}})}else if(m instanceof c.ESGeoJson){const D=new w.JulianDate;let F,S,T;g.id.entityCollection?(F=g.id.polygon?"Polygon":g.id.polyline?"LineString":"Point",T=((I=g.id.properties)==null?void 0:I.getValue(D))??{},S=F=="Point"?De(g.id.position.getValue(D)):F=="LineString"?g.id.polyline.positions.getValue(D).map(b=>De(b)):bp(g.id.polygon.hierarchy.getValue(D))):(g.primitive instanceof w.Billboard||g.primitive instanceof w.Label)&&(F="Point",typeof g.id=="object"&&(T=g.id),S=De(g.primitive.position)),_=m.pickedInfoType=="FeatureCollection"||m.pickedInfoType=="Feature"?{type:"Feature",geometry:{type:F,coordinates:S},properties:T}:{type:F,coordinates:S,properties:T}}else if(m instanceof c.ESGltfModel){let D;Reflect.has(g,"featureId")?D=g.featureId:Reflect.has(g,"instanceId")&&(D=g.instanceId),D&&(g.id=g.primitive.structuralMetadata.getPropertyTable(0).getProperty(g.instanceId,"id"))}m.pickedEvent.emit(new c.ESJPickedResult(g,m,v,_,f,A))}m&&Reflect.has(m,"allowPicking")&&!m.allowPicking&&p(new c.ESJPickedResult);const x=new c.ESJPickedResult(g,m,v,_,f,A);p(x)})()}catch(g){d(g)}}};let r=i.scene.postRender.addEventListener(o);const s=()=>{r&&r(),r=void 0};this.ad(s),this.ad(this.pauseChanged.don(a=>{a?s():r=i.scene.postRender.addEventListener(o)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((i,o)=>{this._pickPositionTasks.push([e,!0,i,o])})}quickPickPosition(e){return new Promise((i,o)=>{this._pickPositionTasks.push([e,!1,i,o])})}pick(e,i,o){return new Promise((r,s)=>{this._pickTasks.push([e,i,o,r,s])})}}function zH(t,n){const e=t.scene,i=e.camera.getPickRay(n);if(!i)return;const o=e.imageryLayers.pickImageryLayerFeatures(i,e);if(w.defined(o))return o}class kH extends c.Destroyable{constructor(e){super();O(this,"_enabled",this.disposeVar(c.react(!1)));O(this,"_cursorPosition",c.react(void 0));O(this,"quickPickPosition",!0);let i=new c.Destroyable;const o=()=>{i&&(i.destroy(),i=void 0)};this.dispose(o);const r=()=>{if(o(),!this._enabled.value||!e)return;const s=Mt(e);if(!s)return;i=new c.Destroyable;const a=i.disposeVar(c.react(void 0)),l=i.disposeVar(c.createNextAnimateFrameEvent(a.changed));i.dispose(s.czmViewer.pointerMoveEvent.disposableOn(A=>{A.pointerEvent&&(a.value=c.getDomEventCurrentTargetPos(A.pointerEvent))}));const u=i.disposeVar(c.createProcessingFromAsyncFunc(async A=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const h=await A.promise(c.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=h}else{const h=await A.promise(c.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=h}}));i.dispose(l.disposableOn(()=>{u.restart()}))};r(),this.dispose(this._enabled.changed.disposableOn(r))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class QH extends c.Destroyable{constructor(){super();O(this,"cache",new Map);O(this,"maxSize",300);O(this,"_deleteTileEvent",this.disposeVar(new c.Event))}get deleteTileEvent(){return this._deleteTileEvent}deleteTile(e,i){this._deleteTileEvent.emit(e,i)}has(e,i){const o=this.cache.get(e);return i?(o==null?void 0:o.has(i))??!1:!!o}get(e,i){const o=this.cache.get(e);if(!o)return;if(!i)return o;const r=o.get(i);return r&&(o.delete(i),o.set(i,r)),r}set(e,i,o){let r=this.get(e);if(r||(r=new Map,this.cache.set(e,r)),r.set(i,o),r.size>=this.maxSize){const s=r.keys().next().value;s&&this.remove(e,s)}}remove(e,i){const o=e instanceof Cf?e.sceneObject.id:e;let r=this.get(o);r&&(i?(r.delete(i),r.size===0&&this.cache.delete(o)):this.cache.delete(o),this.deleteTile(o,i))}}class nE extends c.Destroyable{constructor(e){super();O(this,"x");O(this,"y");O(this,"z");O(this,"tileKey");O(this,"parent",null);O(this,"children",new Set);O(this,"data",new Map);O(this,"state",Qa.UNLOADED);this.tileKey=e,[this.z,this.x,this.y]=e.split("-").map(Number)}fillParentAndChildren(e){var o;const i=`${this.z-1}-${Math.floor(this.x/2)}-${Math.floor(this.y/2)}`;this.parent=e.get(i)??null,(o=this.parent)==null||o.children.add(this)}}class VH extends c.Destroyable{constructor(e,i,o){super();O(this,"workers",[]);O(this,"queue",[]);O(this,"destroyed",!1);const r=navigator.hardwareConcurrency||4;let s;i?i>r?(console.warn(`创建线程超过CPU核心数,已限制为${r-1}`),s=r-1):s=i:s=Math.max(1,r-1);for(let a=0;a<s;a++)this.workers.push(new Worker(e,o));this.ad(()=>{this.destroyed=!0;for(const a of this.queue)a(null);this.queue.length=0;for(const a of this.workers)a.terminate();this.workers.length=0})}acquire(){return this.destroyed?Promise.reject("WorkerPool destroyed"):new Promise(e=>{this.workers.length>0?e(this.workers.pop()):this.queue.push(e)})}release(e){this.destroyed||(this.queue.length>0?this.queue.shift()(e):this.workers.push(e))}}function Ar(t,n){if(typeof t=="string"){const e=[...t.matchAll(/\{([^}]+)\}/g)].map(i=>i[1]);return e.length===0?null:e.length===1?e[0]:e}if(t&&typeof t=="object"&&Array.isArray(t.stops)){let e=t.stops[0][1];for(const[i,o]of t.stops)n>=i&&(e=o);return Ar(e,n)}if(Array.isArray(t))switch(t[0]){case"get":{const i=t[1];return typeof i=="string"?i:null}case"step":{let i=t[2];for(let o=3;o<t.length;o+=2){const r=t[o],s=t[o+1];n>=r&&(i=s)}return Ar(i,n)}case"case":{for(let i=2;i<t.length;i+=2){if(i===t.length-1)return Ar(t[i],n);const o=t[i],r=Ar(o,n);if(r)return r}return null}case"match":{const i=new Set;for(let o=3;o<t.length;o+=2){const r=t[o],s=Ar(r,n);s&&(Array.isArray(s)?s.forEach(a=>i.add(a)):i.add(s))}return i.size?[...i]:null}case"concat":{const i=new Set;for(let o=1;o<t.length;o++){const r=Ar(t[o],n);r&&(Array.isArray(r)?r.forEach(s=>i.add(s)):i.add(r))}return i.size?[...i]:null}case"format":{const i=new Set;for(let o=1;o<t.length;o+=2){const r=Ar(t[o],n);r&&(Array.isArray(r)?r.forEach(s=>i.add(s)):i.add(r))}return i.size?[...i]:null}}return null}function NH(t){const n=new Map;for(const e in t){const i=t[e],o=new Set,r=i.points,s=i.pointProps;for(let p=0;p<r.length;p+=3){const d=p/3;o.add({type:"Feature",geometry:{type:"Point",coordinates:[r[p],r[p+1]]},properties:s[d]||{}})}const a=i.lines,l=i.lineOffsets,u=i.lineProps;for(let p=0;p<l.length;p++){const d=l[p]*3,g=p+1<l.length?l[p+1]*3:a.length,v=[];for(let y=d;y<g;y+=3)v.push([a[y],a[y+1]]);o.add({type:"Feature",geometry:{type:"LineString",coordinates:v},properties:u[p]||{}})}const A=i.polygons,h=i.polygonOffsets,f=i.polygonProps;for(let p=0;p<h.length;p++){const d=h[p]*3,g=p+1<h.length?h[p+1]*3:A.length,v=[];for(let y=d;y<g;y+=3)v.push([A[y],A[y+1]]);o.add({type:"Feature",geometry:{type:"Polygon",coordinates:[v]},properties:f[p]||{}})}n.set(e,o)}return n}class HH extends c.Destroyable{constructor(e){super();O(this,"pendingRequests",new Map);O(this,"sourcesMap",new Map);O(this,"workerPool");O(this,"tileSchemes",new Map);this.tilesCache=e,this.workerPool=new VH(new URL("data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJXZWJXb3JrZXIiIC8+DQppbXBvcnQgUGJmIGZyb20gInBiZiI7DQppbXBvcnQgeyBWZWN0b3JUaWxlIH0gZnJvbSAiQG1hcGJveC92ZWN0b3ItdGlsZSI7DQoNCnNlbGYub25tZXNzYWdlID0gYXN5bmMgKGUpID0+IHsNCiAgICBjb25zdCB7IHR5cGUsIHVybCwgeCwgeSwgeiB9ID0gZS5kYXRhOw0KICAgIGlmICh0eXBlICE9PSAiZmV0Y2giKSByZXR1cm47DQoNCiAgICB0cnkgew0KICAgICAgICBjb25zdCBidWZmZXIgPSBhd2FpdCAoYXdhaXQgZmV0Y2godXJsKSkuYXJyYXlCdWZmZXIoKTsNCiAgICAgICAgY29uc3QgdGlsZSA9IG5ldyBWZWN0b3JUaWxlKG5ldyBQYmYoYnVmZmVyKSk7DQoNCiAgICAgICAgY29uc3QgdGlsZURhdGE6IFJlY29yZDxzdHJpbmcsIGFueT4gPSB7fTsNCg0KICAgICAgICBmb3IgKGNvbnN0IGxheWVyTmFtZSBpbiB0aWxlLmxheWVycykgew0KICAgICAgICAgICAgY29uc3QgbGF5ZXIgPSB0aWxlLmxheWVyc1tsYXllck5hbWVdOw0KICAgICAgICAgICAgY29uc3QgZXh0ZW50ID0gbGF5ZXIuZXh0ZW50IHx8IDQwOTY7DQoNCiAgICAgICAgICAgIGNvbnN0IHBvaW50czogbnVtYmVyW10gPSBbXTsNCiAgICAgICAgICAgIGNvbnN0IHBvaW50UHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IGxpbmVzOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgbGluZU9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBsaW5lUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IHBvbHlnb25zOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgcG9seWdvbk9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBwb2x5Z29uUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGF5ZXIubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgICAgICAgICBjb25zdCBmID0gbGF5ZXIuZmVhdHVyZShpKTsNCiAgICAgICAgICAgICAgICBjb25zdCBnZW9tID0gZi5sb2FkR2VvbWV0cnkoKTsNCiAgICAgICAgICAgICAgICBjb25zdCB0ID0gZi50eXBlOw0KICAgICAgICAgICAgICAgIGNvbnN0IHByb3BlcnRpZXMgPSBmLnByb3BlcnRpZXMgfHwge307DQoNCiAgICAgICAgICAgICAgICBpZiAodCA9PT0gMSkgeyAvLyBQb2ludA0KICAgICAgICAgICAgICAgICAgICBsZXQgc3ggPSAwLCBzeSA9IDAsIGNudCA9IDA7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsgc3ggKz0gcC54OyBzeSArPSBwLnk7IGNudCsrOyB9DQogICAgICAgICAgICAgICAgICAgIGlmIChjbnQgPT09IDApIGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgICAgIHBvaW50cy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgcG9pbnRQcm9wcy5wdXNoKHByb3BlcnRpZXMpOw0KDQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0ID09PSAyKSB7IC8vIExpbmUNCiAgICAgICAgICAgICAgICAgICAgbGluZU9mZnNldHMucHVzaChsaW5lcy5sZW5ndGggLyAzKTsNCiAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbG9uLCBsYXQgfSA9IHRpbGVQaXhlbFRvTG9uTGF0KHAueCwgcC55LCBleHRlbnQsIHgsIHksIHopOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzLnB1c2gobG9uLCBsYXQsIDApOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBsaW5lUHJvcHMucHVzaChwcm9wZXJ0aWVzKTsNCg0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodCA9PT0gMykgeyAvLyBQb2x5Z29uDQogICAgICAgICAgICAgICAgICAgIHBvbHlnb25PZmZzZXRzLnB1c2gocG9seWdvbnMubGVuZ3RoIC8gMyk7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChwLngsIHAueSwgZXh0ZW50LCB4LCB5LCB6KTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2x5Z29ucy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgcG9seWdvblByb3BzLnB1c2gocHJvcGVydGllcyk7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICB0aWxlRGF0YVtsYXllck5hbWVdID0gew0KICAgICAgICAgICAgICAgIHBvaW50czogbmV3IEZsb2F0MzJBcnJheShwb2ludHMpLA0KICAgICAgICAgICAgICAgIHBvaW50UHJvcHMsDQogICAgICAgICAgICAgICAgbGluZXM6IG5ldyBGbG9hdDMyQXJyYXkobGluZXMpLA0KICAgICAgICAgICAgICAgIGxpbmVPZmZzZXRzOiBuZXcgVWludDMyQXJyYXkobGluZU9mZnNldHMpLA0KICAgICAgICAgICAgICAgIGxpbmVQcm9wcywNCiAgICAgICAgICAgICAgICBwb2x5Z29uczogbmV3IEZsb2F0MzJBcnJheShwb2x5Z29ucyksDQogICAgICAgICAgICAgICAgcG9seWdvbk9mZnNldHM6IG5ldyBVaW50MzJBcnJheShwb2x5Z29uT2Zmc2V0cyksDQogICAgICAgICAgICAgICAgcG9seWdvblByb3BzDQogICAgICAgICAgICB9Ow0KICAgICAgICB9DQoNCiAgICAgICAgLy8g5pS26ZuGIGJ1ZmZlciB0cmFuc2ZlcmFibGUNCiAgICAgICAgY29uc3QgdHJhbnNmZXJzOiBBcnJheUJ1ZmZlcltdID0gW107DQogICAgICAgIGZvciAoY29uc3QgbGF5ZXJOYW1lIGluIHRpbGVEYXRhKSB7DQogICAgICAgICAgICBjb25zdCBsYXllciA9IHRpbGVEYXRhW2xheWVyTmFtZV07DQogICAgICAgICAgICB0cmFuc2ZlcnMucHVzaChsYXllci5wb2ludHMuYnVmZmVyLCBsYXllci5saW5lcy5idWZmZXIsIGxheWVyLmxpbmVPZmZzZXRzLmJ1ZmZlciwNCiAgICAgICAgICAgICAgICBsYXllci5wb2x5Z29ucy5idWZmZXIsIGxheWVyLnBvbHlnb25PZmZzZXRzLmJ1ZmZlcik7DQogICAgICAgIH0NCg0KICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdXJsLCB0aWxlRGF0YSB9LCB0cmFuc2ZlcnMpOw0KDQogICAgfSBjYXRjaCAoZXJyKSB7DQogICAgICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB1cmwsIGVycm9yOiAoZXJyIGFzIEVycm9yKS5tZXNzYWdlIH0pOw0KICAgIH0NCn07DQovLyAtLS0tLS0tLS0tLS0tLS0tLS0g5Yeg5L2V5LyY5YyWIC0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpmdW5jdGlvbiBzaW1wbGlmeVJpbmcocmluZzogYW55W10pIHsNCiAgICBjb25zdCBvdXQ6IGFueSA9IFtdOw0KICAgIGNvbnN0IG4gPSByaW5nLmxlbmd0aDsNCiAgICBpZiAobiA8PSAyKSByZXR1cm4gcmluZzsNCg0KICAgIG91dC5wdXNoKHJpbmdbMF0pOw0KDQogICAgZm9yIChsZXQgaSA9IDE7IGkgPCBuIC0gMTsgaSsrKSB7DQogICAgICAgIGNvbnN0IEEgPSBvdXRbb3V0Lmxlbmd0aCAtIDFdOw0KICAgICAgICBjb25zdCBCID0gcmluZ1tpXTsNCiAgICAgICAgY29uc3QgQyA9IHJpbmdbaSArIDFdOw0KDQogICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgY29udGludWU7DQogICAgICAgIGlmIChpc0NvbGluZWFyKEEueCwgQS55LCBCLngsIEIueSwgQy54LCBDLnkpKSBjb250aW51ZTsNCg0KICAgICAgICBvdXQucHVzaChCKTsNCiAgICB9DQoNCiAgICBvdXQucHVzaChyaW5nW24gLSAxXSk7DQogICAgcmV0dXJuIG91dDsNCn0NCg0KZnVuY3Rpb24gY2xlYW5Qb2x5Z29uKHJpbmdzOiBhbnlbXSkgew0KICAgIHJldHVybiByaW5ncy5tYXAocmluZyA9PiB7DQogICAgICAgIGlmIChyaW5nLmxlbmd0aCA+IDIpIHsNCiAgICAgICAgICAgIGNvbnN0IEEgPSByaW5nWzBdOw0KICAgICAgICAgICAgY29uc3QgQiA9IHJpbmdbcmluZy5sZW5ndGggLSAxXTsNCiAgICAgICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgcmluZyA9IHJpbmcuc2xpY2UoMCwgLTEpOw0KICAgICAgICB9DQogICAgICAgIHJldHVybiBzaW1wbGlmeVJpbmcocmluZyk7DQogICAgfSk7DQp9DQoNCmZ1bmN0aW9uIGlzQ29saW5lYXIoYXgsIGF5LCBieCwgYnksIGN4LCBjeSkgew0KICAgIHJldHVybiAoYnggLSBheCkgKiAoY3kgLSBieSkgPT09IChieSAtIGF5KSAqIChjeCAtIGJ4KTsNCn0NCg0KLy8gLS0tLS0tLS0tLS0tLS0tLS0tIOe7j+e6rOW6pui9rOaNoiAtLS0tLS0tLS0tLS0tLS0tLS0NCg0KZnVuY3Rpb24gY29udmVydFRvTG9uTGF0KGdlb20sIHQsIGV4dGVudCwgeCwgeSwgeikgew0KICAgIGlmICh0ID09PSAxKSB7DQogICAgICAgIGxldCBzeCA9IDAsIHN5ID0gMCwgY250ID0gMDsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgeyBzeCArPSBwLng7IHN5ICs9IHAueTsgY250Kys7IH0NCiAgICAgICAgY29uc3QgbGwgPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgIHJldHVybiBbbGwubG9uLCBsbC5sYXRdOw0KICAgIH0NCg0KICAgIGlmICh0ID09PSAyKSB7DQogICAgICAgIGNvbnN0IGFycjogYW55W10gPSBbXTsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgYXJyLnB1c2goW2xsLmxvbiwgbGwubGF0XSk7DQogICAgICAgICAgICB9DQogICAgICAgIHJldHVybiBhcnI7DQogICAgfQ0KDQogICAgaWYgKHQgPT09IDMpIHsNCiAgICAgICAgcmV0dXJuIGdlb20ubWFwKHJpbmcgPT4NCiAgICAgICAgICAgIHJpbmcubWFwKHAgPT4gew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgcmV0dXJuIFtsbC5sb24sIGxsLmxhdF07DQogICAgICAgICAgICB9KQ0KICAgICAgICApOw0KICAgIH0NCn0NCg0KZnVuY3Rpb24gdGlsZVBpeGVsVG9Mb25MYXQocHgsIHB5LCBleHRlbnQsIHRpbGVYLCB0aWxlWSwgeikgew0KICAgIGNvbnN0IG4gPSBNYXRoLnBvdygyLCB6KTsNCiAgICBjb25zdCB4Tm9ybSA9ICh0aWxlWCArIHB4IC8gZXh0ZW50KSAvIG47DQogICAgY29uc3QgeU5vcm0gPSAodGlsZVkgKyBweSAvIGV4dGVudCkgLyBuOw0KICAgIGNvbnN0IGxvbiA9IHhOb3JtICogMzYwIC0gMTgwOw0KICAgIGNvbnN0IGxhdCA9IE1hdGguYXRhbihNYXRoLnNpbmgoTWF0aC5QSSAqICgxIC0gMiAqIHlOb3JtKSkpICogMTgwIC8gTWF0aC5QSTsNCiAgICByZXR1cm4geyBsb24sIGxhdCB9Ow0KfQ==",Ni&&Ni.tagName.toUpperCase()==="SCRIPT"&&Ni.src||new URL("earthsdk3-cesium.iife.js",document.baseURI).href),10,{type:"module"})}add(e){const i=e.sceneObject.id,o=e.mvtLayerJson.mainJson,r=e.sceneObject.scheme??"xyz";let s=this.sourcesMap.get(i),a=this.tileSchemes.get(i);if(s||(s=new Map,this.sourcesMap.set(i,s)),(!a||r!=a)&&this.tileSchemes.set(i,r),typeof o=="string")s.set("customSource",{tiles:[o],type:"vector"});else if(typeof o=="object"){const l=o.sources;for(const u in l){const A=l[u];A.type==="vector"&&Reflect.has(A,"tiles")&&s.set(u,A)}}}remove(e){const i=e.sceneObject.id;this.sourcesMap.delete(i),this.tileSchemes.delete(i),this.pendingRequests.delete(i)}async fetchTile(e,i){return new Promise(async o=>{var p,d,g,v;if((p=this.pendingRequests.get(e))!=null&&p.has(i))return o(void 0);(d=this.pendingRequests.get(e))==null||d.add(i);const[r,s,a]=i.split("-").map(Number),u=this.tileSchemes.get(e)==="tms"?Math.pow(2,r)-a-1:a,A=this.tilesCache.get(e,i)??new nE(i),h=this.sourcesMap.get(e);if(!h)return A.state=Qa.FAILED,o(A);const f=Array.from(h.keys()).pop();for(const[y,m]of h.entries()){A.state=Qa.LOADING;const _=Array.isArray(m.tiles)?m.tiles:[m.tiles];for(const x of _){if(A.state=Qa.PROCESSING,!x.includes("{z}")||m.maxzoom&&r>m.maxzoom||m.minzoom&&r<m.minzoom)continue;const E=x.replace("{z}",r.toString()).replace("{x}",s.toString()).replace("{y}",u.toString());try{const B=await this.fetchUrl(E,s,a,r);if(A.data.set(y,B),y===f)return(g=this.pendingRequests.get(e))==null||g.delete(i),((v=this.pendingRequests.get(e))==null?void 0:v.size)===0&&this.pendingRequests.delete(e),A.state=Qa.READY,o(A)}catch(B){console.error(`Failed to load tile ${i}:`,B)}}}})}fetchUrl(e,i,o,r){return new TextDecoder,new Promise((s,a)=>{this.workerPool.acquire().then(l=>{const u=A=>{const h=A.data;if(h.url!==e)return;if(l.removeEventListener("message",u),this.workerPool.release(l),h.error)return a(new Error(h.error));const f=NH(h.tileData);s(f)};l.addEventListener("message",u),l.postMessage({type:"fetch",url:e,x:i,y:o,z:r})})})}}class GH extends c.Destroyable{constructor(e,i){super();O(this,"renderedTiles",new Map);this.screenManager=e,this.styleManager=i}renderTile(e,i){var a;const o=new Set,r=this.styleManager.getStyle(e);if(!r)return;for(const l of r){const u=Number.parseInt(i.tileKey.split("-")[0]);if(!((l.maxzoom||l.minzoom)&&(l.maxzoom&&u>l.maxzoom||l.minzoom&&u<l.minzoom)))for(const A of((a=i.data.get(l.source))==null?void 0:a.get(l["source-layer"]??""))||[]){let h=A.geometry.coordinates;A.geometry.type.includes("Point")||(h=Lz(A.geometry).geometry.coordinates);let f,p;if(l.labelStyle){const d=Ar(l.labelStyle.text,u);f=this.screenManager.addLabel(e,"VectorTile",l.labelStyle,{position:h,name:typeof d=="string"?A.properties[d]:Array.isArray(d)?d.map(v=>A.properties[v]).join(""):"",index:l.id+A.properties.osm_id}).screenObjectId}if(l.billboardStyle){const d=Ar(l.billboardStyle.text,u);p=this.screenManager.addImage(e,"VectorTile",l.billboardStyle,{position:h,name:typeof d=="string"?A.properties[d]:Array.isArray(d)?d.map(v=>A.properties[v]).join(""):"",index:l.id+A.properties.osm_id}).screenObjectId}f&&!o.has(f)&&o.add(f),p&&!o.has(p)&&o.add(p)}}let s=this.renderedTiles.get(e);s||(s=new Map,this.renderedTiles.set(e,s)),s.set(i.tileKey,o)}update(e,i,o){var r;if(typeof i=="string"){const s=(r=this.renderedTiles.get(e))==null?void 0:r.get(i);s&&this.screenManager.update("VectorTile",e,s,{all:{show:o}})}else this.screenManager.update("VectorTile",e,i,{all:{show:o}})}remove(e,i){const o=this.renderedTiles.get(e);if(i){const r=o==null?void 0:o.get(i);r&&(this.screenManager.remove("VectorTile",e,r),o==null||o.delete(i),(o==null?void 0:o.size)===0&&this.renderedTiles.delete(e))}else{const r=o==null?void 0:o.values();if(r){const s=new Set([...r].flatMap(a=>[...a]));this.screenManager.remove("VectorTile",e,s,!0),this.renderedTiles.delete(e)}}}removeAll(){const e=this.renderedTiles.keys();for(const i of e)this.remove(i)}}const WH=new w.Cartesian2;class jH extends c.Destroyable{constructor(){super();O(this,"defaultStyle",new Map);O(this,"defaultSprite",new Map)}async add(e){var o;if(typeof e.mvtLayerJson.mainJson!="string"&&((o=e.mvtLayerJson.mainJson)!=null&&o.sprite)){const r=e.mvtLayerJson.mainJson.sprite;let s=await w.Resource.fetchJson({url:r+".json"});s=await KH(r+".png",s),s&&this.defaultSprite.set(e.sceneObject.id,[r+".png",s])}const i=e.mvtLayerJson.pointJson;for(const r of i)this.setDefaultStyle(e.sceneObject.id,this.getStyleFromMVTLayers(e.sceneObject.id,r))}remove(e){this.defaultStyle.delete(e.sceneObject.id)}setDefaultStyle(e,i){let o=this.defaultStyle.get(e);o||(o=new Set,this.defaultStyle.set(e,o)),o.add(i)}getStyle(e){return this.defaultStyle.get(e)??new Set}getStyleFromMVTLayers(e,i){const o={id:i.id,type:i.type,source:i.source,"source-layer":i["source-layer"],labelStyle:void 0,billboardStyle:void 0,polygonStyle:void 0,polylineStyle:void 0};if(Reflect.has(i,"minzoom")&&(o.minzoom=i.minzoom),Reflect.has(i,"maxzoom")&&(o.maxzoom=i.maxzoom),Reflect.has(i,"type")&&i.type==="symbol"&&Reflect.has(i,"layout")){const r=i.layout;if(Reflect.has(r,"icon-image")){const s=o.billboardStyle={},a=this.defaultSprite.get(e);a&&a[1][r["icon-image"]]?(s.image=a[0],s.imageSubRegion=new w.BoundingRectangle(a[1][r["icon-image"]].x,a[1][r["icon-image"]].y,a[1][r["icon-image"]].width,a[1][r["icon-image"]].height)):s.image=r["icon-image"];const{horizontalOrigin:l,verticalOrigin:u}=iE(r["icon-anchor"]??"center");if(s.horizontalOrigin=l,s.verticalOrigin=u,Reflect.has(i,"paint")){const A=i.paint;s.color=w.Color.fromCssColorString(A["icon-color"]??"#000000").withAlpha(A["icon-opacity"]??1)}s.rotation=w.Math.toRadians(r["icon-rotate"]??0),s.scale=r["icon-size"]??1,s.pixelOffset=w.Cartesian2.multiplyByScalar(w.Cartesian2.fromArray(r["icon-offset"]??[0,0]),s.scale,WH),s.show=(r.visibility??"visible")==="visible"}if(Reflect.has(r,"text-field")){const s=o.labelStyle={};s.text=r["text-field"];const{horizontalOrigin:a,verticalOrigin:l}=iE(r["text-anchor"]??"center");if(s.horizontalOrigin=a,s.verticalOrigin=l,Reflect.has(i,"paint")){const A=i.paint;s.fillColor=w.Color.fromCssColorString(A["text-color"]??"#000000").withAlpha(A["text-opacity"]??1),A["text-halo-color"]&&(s.outlineColor=w.Color.fromCssColorString(A["text-halo-color"])),A["text-halo-width"]&&(s.outlineWidth=A["text-halo-width"]),(A["text-halo-color"]||A["text-halo-width"])&&(s.style=w.LabelStyle.FILL_AND_OUTLINE)}const u=r["text-font"]?typeof r["text-font"]=="string"?[r["text-font"]]:r["text-font"]:["Open Sans Regular","Arial Unicode MS Regular"];s.font=`${r["text-size"]??16}px `+u.map(A=>`"${A}"`).join(", "),s.pixelOffset=qH(r),s.show=(r.visibility??"visible")==="visible"}}return o}}function iE(t){let n=w.HorizontalOrigin.CENTER,e=w.VerticalOrigin.CENTER;switch(t){case"center":break;case"left":n=w.HorizontalOrigin.LEFT;break;case"right":n=w.HorizontalOrigin.RIGHT;break;case"top":e=w.VerticalOrigin.TOP;break;case"bottom":e=w.VerticalOrigin.BOTTOM;break;case"top-left":n=w.HorizontalOrigin.LEFT,e=w.VerticalOrigin.TOP;break;case"top-right":n=w.HorizontalOrigin.RIGHT,e=w.VerticalOrigin.TOP;break;case"bottom-left":n=w.HorizontalOrigin.LEFT,e=w.VerticalOrigin.BOTTOM;break;case"bottom-right":n=w.HorizontalOrigin.RIGHT,e=w.VerticalOrigin.BOTTOM;break}return{horizontalOrigin:n,verticalOrigin:e}}async function KH(t,n){const{width:e,height:i}=await Pr(t,!1),o={};for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const s=n[r];o[r]={width:s.width,height:s.height,x:s.x,y:i-s.y-s.height,pixelRatio:s.pixelRatio}}return o}function qH(t){const n=t["text-offset"]||[0,0],e=t["text-size"]||16;return new w.Cartesian2(n[0]*e,n[1]*e)}class ZH extends c.Destroyable{constructor(){super();O(this,"callbacks",new Map)}registerEvent(e,i,o){var s;const r=`${e}-${i}`;this.callbacks.has(r)||this.callbacks.set(r,new Set),(s=this.callbacks.get(r))==null||s.add(o)}dispatchEvent(e){var o;const i=`${e.tileKey}-${e.type}`;(o=this.callbacks.get(i))==null||o.forEach(r=>r(e.data))}}var Qa=(t=>(t[t.UNLOADED=0]="UNLOADED",t[t.LOADING=1]="LOADING",t[t.PROCESSING=2]="PROCESSING",t[t.READY=3]="READY",t[t.EXPIRED=4]="EXPIRED",t[t.FAILED=5]="FAILED",t))(Qa||{});class XH extends c.Destroyable{constructor(e){super();O(this,"czmESMVTLayers",new Map);O(this,"tilesCache",new QH);O(this,"tileLoader",new HH(this.tilesCache));O(this,"tileRenderer");O(this,"styleManager",new jH);O(this,"eventManager",new ZH);O(this,"lastImageryTileMap",new Map);this.viewer=e;const i=Mt(e);i&&(this.tileRenderer=new GH(i.screenManager,this.styleManager)),this.ad(this.tilesCache.deleteTileEvent.don((s,a)=>{this.tileRenderer.remove(s,a)}));let o=performance.now();const r=e.scene.preUpdate.addEventListener(()=>{const s=performance.now();s-o>60&&(o=s,this.czmESMVTLayers.size>0&&this.refreshVisibleTiles())});this.ad(()=>r&&r())}async add(e){if(this.czmESMVTLayers.has(e.sceneObject.id)){console.log(`ESMVTLayer${e.sceneObject.id}已经添加过,跳过本次添加`);return}this.czmESMVTLayers.set(e.sceneObject.id,e),this.tileLoader.add(e),await this.styleManager.add(e),this.refreshVisibleTiles(!0)}remove(e){this.czmESMVTLayers.delete(e.sceneObject.id),this.tileLoader.remove(e),this.styleManager.remove(e),this.tilesCache.remove(e)}refreshVisibleTiles(e){const i=this.viewer;if(!i)return;const o=new Map;for(const[r,s]of this.czmESMVTLayers.entries()){if(!s)continue;const a={tilingScheme:{type:"WebMercatorTilingScheme"},rectangle:s.sceneObject.rectangle,tileHeight:s.sceneObject.tileSize,tileWidth:s.sceneObject.tileSize,maximumLevel:s.sceneObject.maximumLevel,minimumLevel:s.sceneObject.minimumLevel},l=new Set;_0(i.scene.globe._surface._tilesToRender,i.scene.terrainProvider,a).forEach(u=>l.add(`${u.level}-${u.x}-${u.y}`)),!o.has(r)&&o.set(r,l)}this.updateTiles(o,e)}updateTiles(e,i){var o,r;for(const s of this.czmESMVTLayers.keys()){const a=e.get(s)??new Set,l=this.lastImageryTileMap.get(s);if(l&&$H(a,l)&&!i)continue;this.lastImageryTileMap.set(s,a);const u=new Set(((o=this.tilesCache.get(s))==null?void 0:o.keys())??[]),A=new Set,h=new Set;for(const f of u){const p=(r=this.tileRenderer.renderedTiles.get(s))==null?void 0:r.get(f);if(!(!p||p.size==0))if(a.has(f))for(const d of p)A.add(d);else for(const d of p)h.add(d)}for(const f of A)h.delete(f);this.tileRenderer.update(s,h,!1),this.tileRenderer.update(s,A,!0);for(const f of a)u.has(f)||(this.tilesCache.set(s,f,new nE(f)),this.tileLoader.fetchTile(s,f).then(p=>{!p||!this.tilesCache.has(s,f)||(this.tilesCache.set(s,f,p),p.fillParentAndChildren(this.tilesCache.get(s)??new Map),this.tileRenderer.renderTile(s,p))}))}}}function $H(t,n){if(t.size!==n.size)return!1;for(const e of t)if(!n.has(e))return!1;return!0}new w.WebMercatorTilingScheme;const rE=["label","billboard","rectangle"];class YH extends c.Destroyable{constructor(e,i){super();O(this,"id",c.createGuid());O(this,"position",w.Cartesian3.ZERO);O(this,"label");O(this,"billboard");O(this,"rectangle");O(this,"zOrder");O(this,"labelRefCount",1);O(this,"billboardRefCount",1);O(this,"rectangleRefCount",1);O(this,"_showEvent",this.disposeVar(new c.Event));this.id=e,this.position=i,this.ad(this.showEvent.don(o=>{this.updateShow(o)}))}get showEvent(){return this._showEvent}show(e){this._showEvent.emit(e)}updateShow(e){this.label&&(this.label.show=e),this.billboard&&(this.billboard.show=e)}}class JH extends c.Destroyable{constructor(e){super();O(this,"objects",new Map);O(this,"screenManager");O(this,"czmViewer");O(this,"viewer");this.screenManager=e,this.czmViewer=e.czmViewer,this.viewer=e.viewer,this.ad(()=>{this.objects.clear()})}layerIsEffective(){return this.objects.size>0}addLabel(e,i,o){const r=this.makeScreenObjectId(e,o.index??c.createGuid()),s=Ye(o.position),a=this.getOrCreateObject(r,s);if(this.screenManager.avoidanceManager.enable&&(i.show=!1),a.label)return a.labelRefCount++,a.label.show=i.show??!0,r;const l=this.screenManager.labelCollection.get({...i,position:s,id:o.properties??r,text:o.name});return l.ESSceneObjectID=e,a.label=l,a.zOrder=o.zOrder,r}addImage(e,i,o){const r=this.makeScreenObjectId(e,o.index??c.createGuid()),s=Ye(o.position),a=this.getOrCreateObject(r,s);if(this.screenManager.avoidanceManager.enable&&(i.show=!1),a.billboard)return a.billboardRefCount++,a.billboard.show=i.show??!0,r;const l=this.screenManager.billboardCollection.get({...i,position:s,id:o.properties??r});return l.ESSceneObjectID=e,a.billboard=l,a.zOrder=o.zOrder,r}addRectangle(e,i,o,r){const s=this.makeScreenObjectId(e,o.index??c.createGuid()),a=Ye(o.position),l=this.getOrCreateObject(s,a);if(this.screenManager.avoidanceManager.enable&&(i.show=!1),l.rectangle)return l.rectangleRefCount++,s;const u=this.screenManager.rectangleCollection.add({...c.getElementBounds(i.element),...i,id:o.properties??s,position:a,callback:r});return r(!0),l.rectangle=u,l.zOrder=o.zOrder,s}update(e,i){const o=Object.keys(i).length==1&&i.all&&Object.keys(i.all).length==1&&Reflect.has(i.all,"show"),r=new Map;for(const l of rE)r.set(l,Object.assign({},i[l],(i==null?void 0:i.all)??{}));const s=this.screenManager.avoidanceManager.enable,a=e instanceof Set?e:new Set([e]);for(const[l,u]of r)for(const A of a){const h=this.objects.get(A);if(!h)continue;const f=h[l];if(f){if(o){if(s&&u.show||f.show==u.show)continue;f.show=u.show;continue}for(const p in u)if(p!=="position"&&p!=="id"){if(s&&p=="show"&&u[p]||f[p]==u[p])continue;f[p]=u[p]}}}return!0}remove(e,i=!1){const o=e instanceof Set?e:typeof e=="string"?new Set([e]):e;if(o instanceof Set){for(const r of o){const s=this.objects.get(r);s&&(s.label&&(s.labelRefCount>1&&!i?s.labelRefCount--:(this.screenManager.labelCollection.release(s.label),s.label=void 0)),s.billboard&&(s.billboardRefCount>1&&!i?s.billboardRefCount--:(this.screenManager.billboardCollection.release(s.billboard),s.billboard=void 0)),s.rectangle&&(s.rectangleRefCount>1&&!i?s.rectangleRefCount--:(this.screenManager.rectangleCollection.remove(s.rectangle),s.rectangle=void 0)),this.tryDeleteEmpty(r))}return!0}else{for(const r of Object.keys(o)){const s=o[r]instanceof Set?o[r]:new Set([o[r]]);for(const a of s){if(!a)continue;const l=this.objects.get(a);if(l){if(l[`${r}RefCount`]>1&&!i)l[`${r}RefCount`]--;else{const u=l[r];u&&(this.screenManager.collectionMap[r].remove(u),l[r]=void 0)}this.tryDeleteEmpty(a)}}}return!0}}makeScreenObjectId(e,i){return`${e}_${i}`}getOrCreateObject(e,i){let o=this.objects.get(e);return o||(o=new YH(e,i),this.objects.set(e,o)),o}tryDeleteEmpty(e){const i=this.objects.get(e);i&&!i.label&&!i.billboard&&!i.rectangle&&this.objects.delete(e)}}function e3(t,n){const e=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER];for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&rE.includes(i)){const o=n[i];if(!o)continue;let r,s,a,l;if(o instanceof w.Label||o instanceof w.Billboard){const u=o.computeScreenSpacePosition(t.scene);({x:r,y:s,width:a,height:l}=w[o instanceof w.Label?"Label":"Billboard"].getScreenSpaceBoundingBox(o,u))}else({x:r,y:s,width:a,height:l}=o);if(isNaN(r)||isNaN(s)||isNaN(a)||isNaN(l))continue;e[0]=Math.min(e[0],r),e[1]=Math.min(e[1],s),e[2]=Math.max(e[2],r+a),e[3]=Math.max(e[3],s+l)}return new w.Rectangle(...e)}class t3 extends c.Destroyable{constructor(e){super();O(this,"rectangleCollisionCheck",new w.RectangleCollisionChecker);O(this,"screenManager");O(this,"enable",!1);O(this,"forceRebuildNext",!1);O(this,"avoidanceLayers",[]);O(this,"_processingQueue",[]);O(this,"_isProcessing",!1);O(this,"BATCH_SIZE",1e3);O(this,"_cache",new Map);O(this,"_lastCameraState",{});O(this,"CAMERA_MOVE_THRESHOLD",5e-4);this.screenManager=e,this.ad(()=>{this.rectangleCollisionCheck._tree.clear(),this._cache.clear(),this._processingQueue.length=0})}update(){if(this.avoidanceLayers.length==0)return;const e=this._shouldForceRebuild();this._buildProcessingQueue(e),this._isProcessing||(this._isProcessing=!0,requestAnimationFrame(()=>this._processBatch()))}setAvoidanceLayer(){for(let e=0;e<this.avoidanceLayers.length;e++){const i=this.screenManager.getLayer(this.avoidanceLayers[e]);i.layerIsEffective()&&i.objects.forEach((o,r)=>{o.show(!this.enable)})}this.forceRebuildNext=!0}updateAvoidanceLayer(e,i){this.enable=(e==null?void 0:e.enabled)??!1,i?e!=null&&e.enabled?this.avoidanceLayers.includes(i)||this.avoidanceLayers.push(i):this.avoidanceLayers=this.avoidanceLayers.filter(o=>o!=i):e!=null&&e.enabled?this.avoidanceLayers=Array.from(this.screenManager.layers.keys()):(this.setAvoidanceLayer(),this.avoidanceLayers=[]),this.setAvoidanceLayer()}_shouldForceRebuild(){if(this.forceRebuildNext)return this.forceRebuildNext=!1,this._updateLastCameraState(),!0;const e=this.screenManager.viewer.camera,i=e.positionWC,o=e.directionWC,r=this._lastCameraState.position,s=this._lastCameraState.direction;if(!r||!s)return this._updateLastCameraState(),!0;const a=w.Cartesian3.distanceSquared(i,r),l=w.Cartesian3.distanceSquared(o,s);return a>this.CAMERA_MOVE_THRESHOLD||l>this.CAMERA_MOVE_THRESHOLD?(this._updateLastCameraState(),!0):!1}_updateLastCameraState(){const e=this.screenManager.viewer.camera;this._lastCameraState.position=w.Cartesian3.clone(e.positionWC),this._lastCameraState.direction=w.Cartesian3.clone(e.directionWC)}_buildProcessingQueue(e){e&&(this.rectangleCollisionCheck._tree.clear(),this._cache.clear()),this._processingQueue.length=0;for(let i=0;i<this.avoidanceLayers.length;i++){const o=this.screenManager.getLayer(this.avoidanceLayers[i]);o.layerIsEffective()&&o.objects.forEach((r,s)=>{this._processingQueue.push(r)})}this._processingQueue.sort((i,o)=>(o.zOrder||0)-(i.zOrder||0))}_processBatch(){performance.now();const e=this._processingQueue,i=this.BATCH_SIZE;let o=0;for(;e.length>0&&o<i;){const r=e.shift();this._updateSingleObject(r),o++}e.length>0?requestAnimationFrame(()=>this._processBatch()):this._isProcessing=!1}_updateSingleObject(e){try{if(!this.screenManager.czmViewer.isPointVisible(e.position)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}const i=e.id.toString(),o=this._cache.get(i),r=w.Cartesian3.clone(e.position);let s;if(o&&w.Cartesian3.equalsEpsilon(o.worldPos,r,1e-6))s=o.rect,this.rectangleCollisionCheck.remove(i,s);else{if(s=e3(this.screenManager.viewer,e),isNaN(s.width)||isNaN(s.height)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}this._cache.set(i,{rect:s,worldPos:r,lastFrame:Date.now()})}this.rectangleCollisionCheck.collides(s)?e.show(!1):(e.show(!0),this.rectangleCollisionCheck.insert(e.id.toString(),s))}catch(i){console.error("ScreenManager update object error",i)}}}class oE extends c.Destroyable{constructor(){super();O(this,"_collection",[]);this.ad(()=>this._collection=[])}get length(){return this._collection.length}add(e){return this._collection.push(e),e._index=this._collection.length,e}remove(e){this._collection[e._index]=void 0}}class sE extends c.Destroyable{constructor(e,i=500,o={minPoolRatio:.1}){super();O(this,"_pool",[]);O(this,"_minPoolRatio");O(this,"_initialSize");this._collection=e,this._initialSize=i,this._minPoolRatio=o.minPoolRatio??.1;for(let r=0;r<i;r++){const s=this._collection.add({show:!1,position:new w.Cartesian3(0,0,0)});this._pool.push(s)}this.ad(()=>{for(const r of this._pool)this.removeFromCollection(r);this._pool.length=0})}get(e,i){if(typeof e=="number"){const o=e,r=i,s=[];for(let a=0;a<o;a++){const l=this._getOne();this.update(l,r),s.push(l)}return s}else{const o=this._getOne();return this.update(o,e),o}}release(e){if(Array.isArray(e))for(const i of e)i.show=!1,this._pool.push(i);else e.show=!1,this._pool.push(e);this._dynamicRecycle()}update(e,i){if(i){Object.assign(e,i);for(const o in i)if(Object.prototype.hasOwnProperty.call(i,o)){const r=i[o];Reflect.has(e,o)&&(e[o]=r)}Reflect.has(e,"imageSubRegion")&&e.setImageSubRegion(i.image,i.imageSubRegion)}}get available(){return this._pool.length}removeFromCollection(e){this._collection instanceof w.LabelCollection?this._collection.remove(e):this._collection instanceof w.BillboardCollection&&this._collection.remove(e)}_getOne(){if(this._pool.length>0)return this._pool.pop();{const e=this._collection.add({show:!1,position:new w.Cartesian3(0,0,0)});return this._dynamicRecycle(),e}}_dynamicRecycle(){const e=this._collection.length,i=Math.max(this._initialSize,Math.floor(e*this._minPoolRatio));for(;this._pool.length>i;){const o=this._pool.pop();this.removeFromCollection(o)}}}class aE extends c.Destroyable{constructor(e){super();O(this,"layers",new Map);O(this,"czmViewer");O(this,"viewer");O(this,"avoidanceManager");O(this,"labelCollection");O(this,"billboardCollection");O(this,"rectangleCollection",this.ad(new oE));O(this,"canvasCollection",this.ad(new oE));O(this,"collectionMap");O(this,"_refreshEvent",this.ad(new c.Event));this.czmViewer=e,this.viewer=e.viewer,this.avoidanceManager=this.ad(new t3(this));const i=new w.LabelCollection({scene:this.viewer.scene}),o=new w.BillboardCollection({scene:this.viewer.scene});this.labelCollection=new sE(i,500),this.billboardCollection=new sE(o,500),this.viewer.scene.primitives.add(i),this.viewer.scene.primitives.add(o),this.collectionMap={label:i,billboard:o,rectangle:this.rectangleCollection},this.ad(c.createEventsCallFunc([this.czmViewer.cameraChanged,this.refreshEvent],()=>{this.avoidanceManager.update()},{immediate:!0})),this.ad(()=>{this.layers.forEach(r=>r.destroy()),this.layers.clear(),i.removeAll(),o.removeAll(),this.viewer.scene.primitives.remove(i),this.viewer.scene.primitives.remove(o)})}get refreshEvent(){return this._refreshEvent}refresh(){this._refreshEvent.emit()}getLayer(e){let i=this.layers.get(e);return i||(i=new JH(this),this.layers.set(e,i),this.avoidanceManager.enable&&this.avoidanceManager.updateAvoidanceLayer({enabled:!0})),i}addLabel(e,i,o,r){const a=this.getLayer(i).addLabel(e,o,r);return this.refresh(),{layer:i,id:e,screenObjectId:a}}addImage(e,i,o,r){const a=this.getLayer(i).addImage(e,o,r);return this.refresh(),{layer:i,id:e,screenObjectId:a}}addRectangle(e,i,o,r,s){const l=this.getLayer(i).addRectangle(e,o,r,s);return this.refresh(),{layer:i,id:e,screenObjectId:l}}update(e,i,o,r){const s=this.getLayer(e);return o instanceof Set&&o.size===0?!1:(s.update(o,r),this.refresh(),!0)}remove(e,i,o,r=!1){const s=this.getLayer(e);if(!s.remove(o,r)){console.warn(`屏幕管理器,删除${i}下的内容失败!`);return}!s.layerIsEffective()&&!s.isDestroyed()&&(s.destroy(),this.layers.delete(e)),this.refresh()}setRules(e,i){Reflect.has(e,"avoidance")&&this.avoidanceManager.updateAvoidanceLayer(e.avoidance,i),this.refresh()}}function Mt(t){return c.getExtProp(t,"_viewerExtensions")}function Uv(t,n){c.setExtProp(t,"_viewerExtensions",n)}class lE extends c.Destroyable{constructor(e,i){super();O(this,"_imageriesManager");O(this,"_terrainManager");O(this,"_labelManager");O(this,"_pickingManager");O(this,"_poiContext");O(this,"_cursorPositionInfo");O(this,"_screenManager");O(this,"_vectorTIlesManager");this._viewer=e,this._czmViewer=i,this._imageriesManager=this.dv(new eE(this.viewer)),this._terrainManager=this.dv(new YS(this.viewer)),this._labelManager=this.dv(new JS(this.viewer)),this._poiContext=this.disposeVar(new z0(this._viewer)),this._cursorPositionInfo=this.disposeVar(new kH(this._viewer)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new tE(i)),this._screenManager=this.ad(new aE(i)),this._vectorTIlesManager=this.ad(new XH(i.viewer)),this.ad(c.createEventsCallFunc(this.czmViewer.textAvoidanceChanged,()=>{this.screenManager.setRules({avoidance:{enabled:this.czmViewer.textAvoidance}})},{immediate:!0}))}))}get viewer(){return this._viewer}get czmViewer(){return this._czmViewer}get imageriesManager(){return this._imageriesManager}get terrainManager(){return this._terrainManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}get screenManager(){return this._screenManager}get vectorTIlesManager(){return this._vectorTIlesManager}}var uE=new w.Cartesian3,cE=new w.Cartesian3;function hE(t,n,e){let i=w.Matrix4.clone(t.transform);t.lookAtTransform(w.Matrix4.IDENTITY);var o=t.positionCartographic.height,r=t.positionWC,s=w.Cartesian3.normalize(r,uE),a=w.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var l=w.Cartesian3.cross(t.direction,s,cE);else var l=w.Cartesian3.cross(t.up,s,cE);var u=l;if(e){var A=w.Cartesian3.cross(s,l,uE);u=A}var h=w.Cartesian3.magnitude(r);t.rotate(u,n/h);var f=t.positionCartographic,p=f.longitude,d=f.latitude;w.Cartesian3.fromRadians(p,d,o,void 0,t.position),t.lookAtTransform(i)}function AE(t,n){hE(t,n,!1)}function fE(t,n){hE(t,-n,!0)}class n3 extends c.Destroyable{constructor(e){super();O(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:i}=this,{viewer:o}=i.firstPersonController,{camera:r}=o;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:a[s.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:s}=this;let a=Date.now();const l=()=>{const u=Date.now(),A=u-a;a=u;const h=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&r.moveForward(A*h),s.MoveBackword&&r.moveBackward(A*h),s.MoveLeft&&r.moveLeft(A*h),s.MoveRight&&r.moveRight(A*h)):(s.MoveForward&&AE(r,A*h),s.MoveBackword&&AE(r,-A*h),s.MoveLeft&&fE(r,-A*h),s.MoveRight&&fE(r,A*h));{const{rotateSpeed:f}=this.controller,p=w.Math.toRadians(f*A);s.RotateRight?r.lookRight(p):s.RotateLeft?r.lookRight(-p):s.RotateUp?r.lookDown(-p):s.RotateDown&&r.lookDown(p)}};o.scene.preUpdate.addEventListener(l),this.dispose(()=>o.scene.preUpdate.removeEventListener(l))}}get running(){return this._running}get controller(){return this.running.keyboardCameraController}get actions(){return this._actions}_resetActions(){const e=Object.keys(this._actions);for(let i of e)this._actions[i]=!1}_updateActions(){const{running:e}=this,{keyStatus:i}=e,{actions:o}=this;this._resetActions();const{keyStatusMap:r}=this.running.keyboardCameraController;for(let s of i.currentKeyIds)o[r[s]]=!0}}class Xf extends c.Destroyable{constructor(e){super();O(this,"_currentKeyIds",new Set);O(this,"_currentKeyIdsChanged",this.dv(new c.Event));O(this,"_debug",this.dv(c.react(!1)));O(this,"_debugResetting",this.dv(new c.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends c.Destroyable{constructor(e){super();const i=()=>{console.log([...e.currentKeyIds].join(`
|
|
3846
|
+
}`},translucent:!0});function IH(){Object.defineProperties(w.Billboard.prototype,{_positionFromParent:{get(){return!1},set(t){}}})}OV(),LV(),zV(),NV(),HV(),GV(),WV(),UV(),nN(),iN(),oN(),PN(),IH(),w.Camera.DEFAULT_VIEW_RECTANGLE=w.Rectangle.fromDegrees(70,5,140,55);function FH(){return new Promise((t,n)=>w.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class MH extends c.Destroyable{constructor(n,e,i,o){super();const r=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=Mt(a);if(l&&(l.destroy(),Uv(a,void 0)),w.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let u=a.scene.context._originalGLContext;u.canvas.width=u.canvas.height=1,u.getExtension("WEBGL_lose_context").loseContext(),u=null}a.destroy(),i(void 0)}};this.d(r);const s=this.dv(c.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const u=RV;await a.promise(FH());const A=await a.promise(c.createCancelablePromise(u(l,o)));A.scene._xbsjOriginSkyAtmosphere=A.scene.skyAtmosphere,A.scene._xbsjOriginSkyBox=A.scene.skyBox,A.scene.renderError.removeEventListener(A.cesiumWidget._onRenderError),A.clockViewModel.currentTime=w.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const h=w.JulianDate.fromDate(new Date(e.currentTime));w.JulianDate.equals(h,A.clockViewModel.currentTime)||(A.clockViewModel.currentTime=h)})),this.dispose(mi(A.clockViewModel,"currentTime",h=>{const f=w.JulianDate.toDate(A.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const h=new lE(A,e);Uv(A,h)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),i(A)}));s.start(n),s.errorEvent.don(a=>{console.error(a),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const DH=new w.EllipsoidTerrainProvider;class YS extends c.Destroyable{constructor(e){super();O(this,"_terrainMap",new Map);O(this,"_nextAnimateFrame",this.dv(c.createNextAnimateFrame()));O(this,"selectedTerrain");this._viewer=e;const i=this._viewer,o=i.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{o&&o()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let r=Number.MIN_SAFE_INTEGER;for(let s of this._terrainMap.keys())s.sceneObject.activate=!1,(s.sceneObject.show??!0)&&s.sceneObject.zIndex>=r&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${s.sceneObject.name}(${s.sceneObject.id})`),r=s.sceneObject.zIndex,this.selectedTerrain=s);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),i.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??DH}))}_makeDirty(){this._nextAnimateFrame.restartIfNotRunning()}get _changed(){return this._nextAnimateFrame.completeEvent}add(e){if(this._terrainMap.has(e)){console.warn("this._terrainMap.has(imagery)");return}const i=new c.Destroyable;i.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),i.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>i.destroy()),this._makeDirty();const o=this.ad(c.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged));this.d(o.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const i=this._terrainMap.get(e);if(!i){console.error("!disposeFunc");return}i(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class JS extends c.Destroyable{constructor(e){super();O(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const i=e instanceof bt?"div":"canvas";if(this._labelMap[i].has(e)){console.warn(`this._labelMap[${i}].has(poi)`,e);return}const o=new c.Destroyable;{const r=o.dv(c.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));o.dispose(r.don(()=>{this._updateZOrder()}))}this._labelMap[i].set(e,()=>o.destroy()),this._updateZOrder()}delete(e){const i=e instanceof bt?"div":"canvas";if(!this._labelMap[i].has(e)){console.warn(`!this._labelMap[${i}].has(poi)`,e);return}const o=this._labelMap[i].get(e);if(!o){console.error("!disposeFunc");return}o(),this._labelMap[i].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,i){const o={};for(const a of e.keys())o[a.zOrder]||(o[a.zOrder]=new Map),o[a.zOrder].set(a,a instanceof bt?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const r=Object.keys(o).sort((a,l)=>i=="div"?Number(l)-Number(a):Number(a)-Number(l));let s=e.size;for(let a=0;a<r.length;a++)new Map([...o[r[a]]].sort((u,A)=>Number(A[1])-Number(u[1]))).forEach((u,A)=>{A instanceof bt&&A.czmDivPoi&&(A.czmDivPoi.zOrder=s),A instanceof ji&&A.canvasObj&&(A.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class RH extends c.Destroyable{constructor(e){super();O(this,"_czmImageryLayerWrappers",new Set);O(this,"_zIndexChangedEvent",this.dv(new c.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const i=[...this.czmImageryLayerWrappers.values()];i.sort((o,r)=>{const s=o.czmImageryWrapper.imagery.zIndex??c.ESImageryLayer.defaults.zIndex,a=r.czmImageryWrapper.imagery.zIndex??c.ESImageryLayer.defaults.zIndex;return s-a});for(const o of i)this.viewer.imageryLayers.raiseToTop(o.imageryLayer)}))}get viewer(){return this._viewer}get czmImageryLayerWrappers(){return this._czmImageryLayerWrappers}add(e){this._czmImageryLayerWrappers.add(e),this.viewer.imageryLayers.add(e.imageryLayer),this.zIndexChange()}delete(e){this.viewer.imageryLayers.remove(e.imageryLayer,!1),this._czmImageryLayerWrappers.delete(e)}zIndexChange(){this._zIndexChangedEvent.emit()}}class UH extends c.Destroyable{constructor(e){super();O(this,"_imageryLayer");if(this._czmImageryWrapper=e,!this._czmImageryWrapper.imagery.layer)throw new Error("this._czmCzmImageryWrapper.imagery.czmImagery");this._imageryLayer=this._czmImageryWrapper.imagery.layer;const{czmImageryWrapper:i}=this,o=i.manager.czmImageriesManager;o.add(this),this.d(()=>o.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>o.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class OH extends c.Destroyable{constructor(e){super();O(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new c.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new UH(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class LH extends c.Destroyable{constructor(e,i){super();O(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=i,this._czmImageryLayerWrapperObjResetting=this.dv(new c.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new OH(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class eE extends c.Destroyable{constructor(e){super();O(this,"_czmImageryWrappers",new Set);O(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new RH(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let i of this.czmImageryWrappers)if(i.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new LH(e,this))}has(e){for(let i of this.czmImageryWrappers)if(i.imagery===e)return!0;return!1}delete(e){for(const i of this.czmImageryWrappers)if(i.imagery===e){this.czmImageryWrappers.delete(i);return}console.warn("imageriesManager delete error!",e)}}class tE extends c.Destroyable{constructor(e){super();O(this,"_pause",this.disposeVar(c.react(!1)));O(this,"_pickPositionTasks",[]);O(this,"_pickTasks",[]);O(this,"pickHeightMustGreaterThanZero",!0);O(this,"objectsToExclude",[]);const i=e.viewer;{this.dispose(()=>{this._pickPositionTasks.length>0&&(this._pickPositionTasks.forEach(a=>a[3]("CzmViewer销毁,任务不再执行!")),this._pickPositionTasks.length=0),this._pickTasks.length>0&&(this._pickTasks.forEach(a=>a[4]("CzmViewer销毁,任务不再执行!")),this._pickTasks.length=0)});const o=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let u of a){const[A,h,f,p]=u;try{(async()=>{const{scene:d,camera:g}=i,v=Ze(A),y=g.getPickRay(v);if(y){let E;if(h?E=await d.pickFromRayMostDetailed(y,this.objectsToExclude):E=d.pickFromRay(y,this.objectsToExclude),E&&E.position){const B=De(E.position);return B?f(B):p(new Error("positionFromCartesian failed"))}if(!(d.terrainProvider instanceof w.EllipsoidTerrainProvider)){const B=d.globe.pick(y,d);if(!B)return p(new Error("scene.globe.pick failed"));const P=De(B);return P?(this.pickHeightMustGreaterThanZero&&P[2]<0&&(P[2]=0),f(P)):p(new Error("positionFromCartesian failed"))}}const m=d.terrainProvider instanceof w.EllipsoidTerrainProvider?d.terrainProvider.tilingScheme.ellipsoid:i.scene.globe.ellipsoid,_=i.camera.pickEllipsoid(Ze(A),m);if(!_)return p(new Error("Pick failed"));const x=De(_);return x?f(x):p(new Error("positionFromCartesian failed"))})()}catch(d){p(d)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let u of l){const[A,h,f,p,d]=u;e.pickCustomAttachedInfo=f;try{(async()=>{var E,B,P,I;let g=i.scene.pick(Ze(A),h&&h[0],h&&h[1]);!g&&w.defined(i.scene.globe)&&(g=await zH(i,Ze(A)));let v;if(g&&g instanceof w.Cesium3DTileFeature){v={};try{g&&g.getPropertyIds().forEach(F=>{v&&(v[F]=g.getProperty(F))})}catch(D){console.warn(D)}}if(!g){const{left:D,top:F}=e.container.getBoundingClientRect();g=(E=document.elementFromPoint(A[0]+D,A[1]+F))==null?void 0:E.closest("[data-es-scene-object-id]")}let y;g&&(g.id&&g.id instanceof w.Entity&&g.id.ESSceneObjectID?y=g.id.ESSceneObjectID:g.primitive&&g.primitive.ESSceneObjectID?y=g.primitive.ESSceneObjectID:g.collection&&g.collection.ESSceneObjectID?y=g.collection.ESSceneObjectID:Array.isArray(g)&&g[0]instanceof w.ImageryLayerFeatureInfo?y=g[0].imageryLayer.ESSceneObjectID:g instanceof HTMLElement&&(y=g.dataset.esSceneObjectId));let m=y?c.ESSceneObject.getSceneObject(y):void 0;m&&m.parentID&&(m=c.ESSceneObject.getSceneObject(m.parentID));let _={};if(m&&Reflect.has(m,"allowPicking")&&Reflect.has(m,"pickedEvent")&&(m.allowPicking??!1)){if(m instanceof c.ESEntityCluster){const D=new w.JulianDate;_=g.id instanceof w.Entity?{name:g.id.label.text.getValue(D),properties:(B=g.id.properties)==null?void 0:B.getValue(D),coordinates:Ya(g.id.position.getValue(D))}:(P=g.id)==null?void 0:P.map(F=>{var S;return{name:F.id,properties:(S=F.properties)==null?void 0:S.getValue(D),coordinates:Ya(F.position.getValue(D))}})}else if(m instanceof c.ESGeoJson){const D=new w.JulianDate;let F,S,T;g.id.entityCollection?(F=g.id.polygon?"Polygon":g.id.polyline?"LineString":"Point",T=((I=g.id.properties)==null?void 0:I.getValue(D))??{},S=F=="Point"?De(g.id.position.getValue(D)):F=="LineString"?g.id.polyline.positions.getValue(D).map(b=>De(b)):bp(g.id.polygon.hierarchy.getValue(D))):(g.primitive instanceof w.Billboard||g.primitive instanceof w.Label)&&(F="Point",typeof g.id=="object"&&(T=g.id),S=De(g.primitive.position)),_=m.pickedInfoType=="FeatureCollection"||m.pickedInfoType=="Feature"?{type:"Feature",geometry:{type:F,coordinates:S},properties:T}:{type:F,coordinates:S,properties:T}}else if(m instanceof c.ESGltfModel){let D;Reflect.has(g,"featureId")?D=g.featureId:Reflect.has(g,"instanceId")&&(D=g.instanceId),D&&(g.id=g.primitive.structuralMetadata.getPropertyTable(0).getProperty(g.instanceId,"id"))}m.pickedEvent.emit(new c.ESJPickedResult(g,m,v,_,f,A))}m&&Reflect.has(m,"allowPicking")&&!m.allowPicking&&p(new c.ESJPickedResult);const x=new c.ESJPickedResult(g,m,v,_,f,A);p(x)})()}catch(g){d(g)}}};let r=i.scene.postRender.addEventListener(o);const s=()=>{r&&r(),r=void 0};this.ad(s),this.ad(this.pauseChanged.don(a=>{a?s():r=i.scene.postRender.addEventListener(o)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((i,o)=>{this._pickPositionTasks.push([e,!0,i,o])})}quickPickPosition(e){return new Promise((i,o)=>{this._pickPositionTasks.push([e,!1,i,o])})}pick(e,i,o){return new Promise((r,s)=>{this._pickTasks.push([e,i,o,r,s])})}}function zH(t,n){const e=t.scene,i=e.camera.getPickRay(n);if(!i)return;const o=e.imageryLayers.pickImageryLayerFeatures(i,e);if(w.defined(o))return o}class kH extends c.Destroyable{constructor(e){super();O(this,"_enabled",this.disposeVar(c.react(!1)));O(this,"_cursorPosition",c.react(void 0));O(this,"quickPickPosition",!0);let i=new c.Destroyable;const o=()=>{i&&(i.destroy(),i=void 0)};this.dispose(o);const r=()=>{if(o(),!this._enabled.value||!e)return;const s=Mt(e);if(!s)return;i=new c.Destroyable;const a=i.disposeVar(c.react(void 0)),l=i.disposeVar(c.createNextAnimateFrameEvent(a.changed));i.dispose(s.czmViewer.pointerMoveEvent.disposableOn(A=>{A.pointerEvent&&(a.value=c.getDomEventCurrentTargetPos(A.pointerEvent))}));const u=i.disposeVar(c.createProcessingFromAsyncFunc(async A=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const h=await A.promise(c.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=h}else{const h=await A.promise(c.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=h}}));i.dispose(l.disposableOn(()=>{u.restart()}))};r(),this.dispose(this._enabled.changed.disposableOn(r))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class QH extends c.Destroyable{constructor(){super();O(this,"cache",new Map);O(this,"maxSize",300);O(this,"_deleteTileEvent",this.disposeVar(new c.Event))}get deleteTileEvent(){return this._deleteTileEvent}deleteTile(e,i){this._deleteTileEvent.emit(e,i)}has(e,i){const o=this.cache.get(e);return i?(o==null?void 0:o.has(i))??!1:!!o}get(e,i){const o=this.cache.get(e);if(!o)return;if(!i)return o;const r=o.get(i);return r&&(o.delete(i),o.set(i,r)),r}set(e,i,o){let r=this.get(e);if(r||(r=new Map,this.cache.set(e,r)),r.set(i,o),r.size>=this.maxSize){const s=r.keys().next().value;s&&this.remove(e,s)}}remove(e,i){const o=e instanceof Cf?e.sceneObject.id:e;let r=this.get(o);r&&(i?(r.delete(i),r.size===0&&this.cache.delete(o)):this.cache.delete(o),this.deleteTile(o,i))}}class nE extends c.Destroyable{constructor(e){super();O(this,"x");O(this,"y");O(this,"z");O(this,"tileKey");O(this,"parent",null);O(this,"children",new Set);O(this,"data",new Map);O(this,"state",Qa.UNLOADED);this.tileKey=e,[this.z,this.x,this.y]=e.split("-").map(Number)}fillParentAndChildren(e){var o;const i=`${this.z-1}-${Math.floor(this.x/2)}-${Math.floor(this.y/2)}`;this.parent=e.get(i)??null,(o=this.parent)==null||o.children.add(this)}}class VH extends c.Destroyable{constructor(e,i,o){super();O(this,"workers",[]);O(this,"queue",[]);O(this,"destroyed",!1);const r=navigator.hardwareConcurrency||4;let s;i?i>r?(console.warn(`创建线程超过CPU核心数,已限制为${r-1}`),s=r-1):s=i:s=Math.max(1,r-1);for(let a=0;a<s;a++)this.workers.push(new Worker(e,o));this.ad(()=>{this.destroyed=!0;for(const a of this.queue)a(null);this.queue.length=0;for(const a of this.workers)a.terminate();this.workers.length=0})}acquire(){return this.destroyed?Promise.reject("WorkerPool destroyed"):new Promise(e=>{this.workers.length>0?e(this.workers.pop()):this.queue.push(e)})}release(e){this.destroyed||(this.queue.length>0?this.queue.shift()(e):this.workers.push(e))}}function Ar(t,n){if(typeof t=="string"){const e=[...t.matchAll(/\{([^}]+)\}/g)].map(i=>i[1]);return e.length===0?null:e.length===1?e[0]:e}if(t&&typeof t=="object"&&Array.isArray(t.stops)){let e=t.stops[0][1];for(const[i,o]of t.stops)n>=i&&(e=o);return Ar(e,n)}if(Array.isArray(t))switch(t[0]){case"get":{const i=t[1];return typeof i=="string"?i:null}case"step":{let i=t[2];for(let o=3;o<t.length;o+=2){const r=t[o],s=t[o+1];n>=r&&(i=s)}return Ar(i,n)}case"case":{for(let i=2;i<t.length;i+=2){if(i===t.length-1)return Ar(t[i],n);const o=t[i],r=Ar(o,n);if(r)return r}return null}case"match":{const i=new Set;for(let o=3;o<t.length;o+=2){const r=t[o],s=Ar(r,n);s&&(Array.isArray(s)?s.forEach(a=>i.add(a)):i.add(s))}return i.size?[...i]:null}case"concat":{const i=new Set;for(let o=1;o<t.length;o++){const r=Ar(t[o],n);r&&(Array.isArray(r)?r.forEach(s=>i.add(s)):i.add(r))}return i.size?[...i]:null}case"format":{const i=new Set;for(let o=1;o<t.length;o+=2){const r=Ar(t[o],n);r&&(Array.isArray(r)?r.forEach(s=>i.add(s)):i.add(r))}return i.size?[...i]:null}}return null}function NH(t){const n=new Map;for(const e in t){const i=t[e],o=new Set,r=i.points,s=i.pointProps;for(let p=0;p<r.length;p+=3){const d=p/3;o.add({type:"Feature",geometry:{type:"Point",coordinates:[r[p],r[p+1]]},properties:s[d]||{}})}const a=i.lines,l=i.lineOffsets,u=i.lineProps;for(let p=0;p<l.length;p++){const d=l[p]*3,g=p+1<l.length?l[p+1]*3:a.length,v=[];for(let y=d;y<g;y+=3)v.push([a[y],a[y+1]]);o.add({type:"Feature",geometry:{type:"LineString",coordinates:v},properties:u[p]||{}})}const A=i.polygons,h=i.polygonOffsets,f=i.polygonProps;for(let p=0;p<h.length;p++){const d=h[p]*3,g=p+1<h.length?h[p+1]*3:A.length,v=[];for(let y=d;y<g;y+=3)v.push([A[y],A[y+1]]);o.add({type:"Feature",geometry:{type:"Polygon",coordinates:[v]},properties:f[p]||{}})}n.set(e,o)}return n}class HH extends c.Destroyable{constructor(e){super();O(this,"pendingRequests",new Map);O(this,"sourcesMap",new Map);O(this,"workerPool");O(this,"tileSchemes",new Map);this.tilesCache=e,this.workerPool=new VH(new URL("data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJXZWJXb3JrZXIiIC8+DQppbXBvcnQgUGJmIGZyb20gInBiZiI7DQppbXBvcnQgeyBWZWN0b3JUaWxlIH0gZnJvbSAiQG1hcGJveC92ZWN0b3ItdGlsZSI7DQoNCnNlbGYub25tZXNzYWdlID0gYXN5bmMgKGUpID0+IHsNCiAgICBjb25zdCB7IHR5cGUsIHVybCwgeCwgeSwgeiB9ID0gZS5kYXRhOw0KICAgIGlmICh0eXBlICE9PSAiZmV0Y2giKSByZXR1cm47DQoNCiAgICB0cnkgew0KICAgICAgICBjb25zdCBidWZmZXIgPSBhd2FpdCAoYXdhaXQgZmV0Y2godXJsKSkuYXJyYXlCdWZmZXIoKTsNCiAgICAgICAgY29uc3QgdGlsZSA9IG5ldyBWZWN0b3JUaWxlKG5ldyBQYmYoYnVmZmVyKSk7DQoNCiAgICAgICAgY29uc3QgdGlsZURhdGE6IFJlY29yZDxzdHJpbmcsIGFueT4gPSB7fTsNCg0KICAgICAgICBmb3IgKGNvbnN0IGxheWVyTmFtZSBpbiB0aWxlLmxheWVycykgew0KICAgICAgICAgICAgY29uc3QgbGF5ZXIgPSB0aWxlLmxheWVyc1tsYXllck5hbWVdOw0KICAgICAgICAgICAgY29uc3QgZXh0ZW50ID0gbGF5ZXIuZXh0ZW50IHx8IDQwOTY7DQoNCiAgICAgICAgICAgIGNvbnN0IHBvaW50czogbnVtYmVyW10gPSBbXTsNCiAgICAgICAgICAgIGNvbnN0IHBvaW50UHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IGxpbmVzOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgbGluZU9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBsaW5lUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IHBvbHlnb25zOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgcG9seWdvbk9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBwb2x5Z29uUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGF5ZXIubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgICAgICAgICBjb25zdCBmID0gbGF5ZXIuZmVhdHVyZShpKTsNCiAgICAgICAgICAgICAgICBjb25zdCBnZW9tID0gZi5sb2FkR2VvbWV0cnkoKTsNCiAgICAgICAgICAgICAgICBjb25zdCB0ID0gZi50eXBlOw0KICAgICAgICAgICAgICAgIGNvbnN0IHByb3BlcnRpZXMgPSBmLnByb3BlcnRpZXMgfHwge307DQoNCiAgICAgICAgICAgICAgICBpZiAodCA9PT0gMSkgeyAvLyBQb2ludA0KICAgICAgICAgICAgICAgICAgICBsZXQgc3ggPSAwLCBzeSA9IDAsIGNudCA9IDA7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsgc3ggKz0gcC54OyBzeSArPSBwLnk7IGNudCsrOyB9DQogICAgICAgICAgICAgICAgICAgIGlmIChjbnQgPT09IDApIGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgICAgIHBvaW50cy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgcG9pbnRQcm9wcy5wdXNoKHByb3BlcnRpZXMpOw0KDQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0ID09PSAyKSB7IC8vIExpbmUNCiAgICAgICAgICAgICAgICAgICAgbGluZU9mZnNldHMucHVzaChsaW5lcy5sZW5ndGggLyAzKTsNCiAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbG9uLCBsYXQgfSA9IHRpbGVQaXhlbFRvTG9uTGF0KHAueCwgcC55LCBleHRlbnQsIHgsIHksIHopOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzLnB1c2gobG9uLCBsYXQsIDApOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBsaW5lUHJvcHMucHVzaChwcm9wZXJ0aWVzKTsNCg0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodCA9PT0gMykgeyAvLyBQb2x5Z29uDQogICAgICAgICAgICAgICAgICAgIHBvbHlnb25PZmZzZXRzLnB1c2gocG9seWdvbnMubGVuZ3RoIC8gMyk7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChwLngsIHAueSwgZXh0ZW50LCB4LCB5LCB6KTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2x5Z29ucy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgcG9seWdvblByb3BzLnB1c2gocHJvcGVydGllcyk7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICB0aWxlRGF0YVtsYXllck5hbWVdID0gew0KICAgICAgICAgICAgICAgIHBvaW50czogbmV3IEZsb2F0MzJBcnJheShwb2ludHMpLA0KICAgICAgICAgICAgICAgIHBvaW50UHJvcHMsDQogICAgICAgICAgICAgICAgbGluZXM6IG5ldyBGbG9hdDMyQXJyYXkobGluZXMpLA0KICAgICAgICAgICAgICAgIGxpbmVPZmZzZXRzOiBuZXcgVWludDMyQXJyYXkobGluZU9mZnNldHMpLA0KICAgICAgICAgICAgICAgIGxpbmVQcm9wcywNCiAgICAgICAgICAgICAgICBwb2x5Z29uczogbmV3IEZsb2F0MzJBcnJheShwb2x5Z29ucyksDQogICAgICAgICAgICAgICAgcG9seWdvbk9mZnNldHM6IG5ldyBVaW50MzJBcnJheShwb2x5Z29uT2Zmc2V0cyksDQogICAgICAgICAgICAgICAgcG9seWdvblByb3BzDQogICAgICAgICAgICB9Ow0KICAgICAgICB9DQoNCiAgICAgICAgLy8g5pS26ZuGIGJ1ZmZlciB0cmFuc2ZlcmFibGUNCiAgICAgICAgY29uc3QgdHJhbnNmZXJzOiBBcnJheUJ1ZmZlcltdID0gW107DQogICAgICAgIGZvciAoY29uc3QgbGF5ZXJOYW1lIGluIHRpbGVEYXRhKSB7DQogICAgICAgICAgICBjb25zdCBsYXllciA9IHRpbGVEYXRhW2xheWVyTmFtZV07DQogICAgICAgICAgICB0cmFuc2ZlcnMucHVzaChsYXllci5wb2ludHMuYnVmZmVyLCBsYXllci5saW5lcy5idWZmZXIsIGxheWVyLmxpbmVPZmZzZXRzLmJ1ZmZlciwNCiAgICAgICAgICAgICAgICBsYXllci5wb2x5Z29ucy5idWZmZXIsIGxheWVyLnBvbHlnb25PZmZzZXRzLmJ1ZmZlcik7DQogICAgICAgIH0NCg0KICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdXJsLCB0aWxlRGF0YSB9LCB0cmFuc2ZlcnMpOw0KDQogICAgfSBjYXRjaCAoZXJyKSB7DQogICAgICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB1cmwsIGVycm9yOiAoZXJyIGFzIEVycm9yKS5tZXNzYWdlIH0pOw0KICAgIH0NCn07DQovLyAtLS0tLS0tLS0tLS0tLS0tLS0g5Yeg5L2V5LyY5YyWIC0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpmdW5jdGlvbiBzaW1wbGlmeVJpbmcocmluZzogYW55W10pIHsNCiAgICBjb25zdCBvdXQ6IGFueSA9IFtdOw0KICAgIGNvbnN0IG4gPSByaW5nLmxlbmd0aDsNCiAgICBpZiAobiA8PSAyKSByZXR1cm4gcmluZzsNCg0KICAgIG91dC5wdXNoKHJpbmdbMF0pOw0KDQogICAgZm9yIChsZXQgaSA9IDE7IGkgPCBuIC0gMTsgaSsrKSB7DQogICAgICAgIGNvbnN0IEEgPSBvdXRbb3V0Lmxlbmd0aCAtIDFdOw0KICAgICAgICBjb25zdCBCID0gcmluZ1tpXTsNCiAgICAgICAgY29uc3QgQyA9IHJpbmdbaSArIDFdOw0KDQogICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgY29udGludWU7DQogICAgICAgIGlmIChpc0NvbGluZWFyKEEueCwgQS55LCBCLngsIEIueSwgQy54LCBDLnkpKSBjb250aW51ZTsNCg0KICAgICAgICBvdXQucHVzaChCKTsNCiAgICB9DQoNCiAgICBvdXQucHVzaChyaW5nW24gLSAxXSk7DQogICAgcmV0dXJuIG91dDsNCn0NCg0KZnVuY3Rpb24gY2xlYW5Qb2x5Z29uKHJpbmdzOiBhbnlbXSkgew0KICAgIHJldHVybiByaW5ncy5tYXAocmluZyA9PiB7DQogICAgICAgIGlmIChyaW5nLmxlbmd0aCA+IDIpIHsNCiAgICAgICAgICAgIGNvbnN0IEEgPSByaW5nWzBdOw0KICAgICAgICAgICAgY29uc3QgQiA9IHJpbmdbcmluZy5sZW5ndGggLSAxXTsNCiAgICAgICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgcmluZyA9IHJpbmcuc2xpY2UoMCwgLTEpOw0KICAgICAgICB9DQogICAgICAgIHJldHVybiBzaW1wbGlmeVJpbmcocmluZyk7DQogICAgfSk7DQp9DQoNCmZ1bmN0aW9uIGlzQ29saW5lYXIoYXgsIGF5LCBieCwgYnksIGN4LCBjeSkgew0KICAgIHJldHVybiAoYnggLSBheCkgKiAoY3kgLSBieSkgPT09IChieSAtIGF5KSAqIChjeCAtIGJ4KTsNCn0NCg0KLy8gLS0tLS0tLS0tLS0tLS0tLS0tIOe7j+e6rOW6pui9rOaNoiAtLS0tLS0tLS0tLS0tLS0tLS0NCg0KZnVuY3Rpb24gY29udmVydFRvTG9uTGF0KGdlb20sIHQsIGV4dGVudCwgeCwgeSwgeikgew0KICAgIGlmICh0ID09PSAxKSB7DQogICAgICAgIGxldCBzeCA9IDAsIHN5ID0gMCwgY250ID0gMDsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgeyBzeCArPSBwLng7IHN5ICs9IHAueTsgY250Kys7IH0NCiAgICAgICAgY29uc3QgbGwgPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgIHJldHVybiBbbGwubG9uLCBsbC5sYXRdOw0KICAgIH0NCg0KICAgIGlmICh0ID09PSAyKSB7DQogICAgICAgIGNvbnN0IGFycjogYW55W10gPSBbXTsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgYXJyLnB1c2goW2xsLmxvbiwgbGwubGF0XSk7DQogICAgICAgICAgICB9DQogICAgICAgIHJldHVybiBhcnI7DQogICAgfQ0KDQogICAgaWYgKHQgPT09IDMpIHsNCiAgICAgICAgcmV0dXJuIGdlb20ubWFwKHJpbmcgPT4NCiAgICAgICAgICAgIHJpbmcubWFwKHAgPT4gew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgcmV0dXJuIFtsbC5sb24sIGxsLmxhdF07DQogICAgICAgICAgICB9KQ0KICAgICAgICApOw0KICAgIH0NCn0NCg0KZnVuY3Rpb24gdGlsZVBpeGVsVG9Mb25MYXQocHgsIHB5LCBleHRlbnQsIHRpbGVYLCB0aWxlWSwgeikgew0KICAgIGNvbnN0IG4gPSBNYXRoLnBvdygyLCB6KTsNCiAgICBjb25zdCB4Tm9ybSA9ICh0aWxlWCArIHB4IC8gZXh0ZW50KSAvIG47DQogICAgY29uc3QgeU5vcm0gPSAodGlsZVkgKyBweSAvIGV4dGVudCkgLyBuOw0KICAgIGNvbnN0IGxvbiA9IHhOb3JtICogMzYwIC0gMTgwOw0KICAgIGNvbnN0IGxhdCA9IE1hdGguYXRhbihNYXRoLnNpbmgoTWF0aC5QSSAqICgxIC0gMiAqIHlOb3JtKSkpICogMTgwIC8gTWF0aC5QSTsNCiAgICByZXR1cm4geyBsb24sIGxhdCB9Ow0KfQ==",Ni&&Ni.tagName.toUpperCase()==="SCRIPT"&&Ni.src||new URL("earthsdk3-cesium.iife.js",document.baseURI).href),10,{type:"module"})}add(e){const i=e.sceneObject.id,o=e.mvtLayerJson.mainJson,r=e.sceneObject.scheme??"xyz";let s=this.sourcesMap.get(i),a=this.tileSchemes.get(i);if(s||(s=new Map,this.sourcesMap.set(i,s)),(!a||r!=a)&&this.tileSchemes.set(i,r),typeof o=="string")s.set("customSource",{tiles:[o],type:"vector"});else if(typeof o=="object"){const l=o.sources;for(const u in l){const A=l[u];A.type==="vector"&&Reflect.has(A,"tiles")&&s.set(u,A)}}}remove(e){const i=e.sceneObject.id;this.sourcesMap.delete(i),this.tileSchemes.delete(i),this.pendingRequests.delete(i)}async fetchTile(e,i){return new Promise(async o=>{var p,d,g,v;if((p=this.pendingRequests.get(e))!=null&&p.has(i))return o(void 0);(d=this.pendingRequests.get(e))==null||d.add(i);const[r,s,a]=i.split("-").map(Number),u=this.tileSchemes.get(e)==="tms"?Math.pow(2,r)-a-1:a,A=this.tilesCache.get(e,i)??new nE(i),h=this.sourcesMap.get(e);if(!h)return A.state=Qa.FAILED,o(A);const f=Array.from(h.keys()).pop();for(const[y,m]of h.entries()){A.state=Qa.LOADING;const _=Array.isArray(m.tiles)?m.tiles:[m.tiles];for(const x of _){if(A.state=Qa.PROCESSING,!x.includes("{z}")||m.maxzoom&&r>m.maxzoom||m.minzoom&&r<m.minzoom)continue;const E=x.replace("{z}",r.toString()).replace("{x}",s.toString()).replace("{y}",u.toString());try{const B=await this.fetchUrl(E,s,a,r);if(A.data.set(y,B),y===f)return(g=this.pendingRequests.get(e))==null||g.delete(i),((v=this.pendingRequests.get(e))==null?void 0:v.size)===0&&this.pendingRequests.delete(e),A.state=Qa.READY,o(A)}catch(B){console.error(`Failed to load tile ${i}:`,B)}}}})}fetchUrl(e,i,o,r){return new TextDecoder,new Promise((s,a)=>{this.workerPool.acquire().then(l=>{const u=A=>{const h=A.data;if(h.url!==e)return;if(l.removeEventListener("message",u),this.workerPool.release(l),h.error)return a(new Error(h.error));const f=NH(h.tileData);s(f)};l.addEventListener("message",u),l.postMessage({type:"fetch",url:e,x:i,y:o,z:r})})})}}class GH extends c.Destroyable{constructor(e,i){super();O(this,"renderedTiles",new Map);this.screenManager=e,this.styleManager=i}renderTile(e,i){var a;const o=new Set,r=this.styleManager.getStyle(e);if(!r)return;for(const l of r){const u=Number.parseInt(i.tileKey.split("-")[0]);if(!((l.maxzoom||l.minzoom)&&(l.maxzoom&&u>l.maxzoom||l.minzoom&&u<l.minzoom)))for(const A of((a=i.data.get(l.source))==null?void 0:a.get(l["source-layer"]??""))||[]){let h=A.geometry.coordinates;A.geometry.type.includes("Point")||(h=Lz(A.geometry).geometry.coordinates);let f,p;if(l.labelStyle){const d=Ar(l.labelStyle.text,u);f=this.screenManager.addLabel(e,"VectorTile",l.labelStyle,{position:h,name:typeof d=="string"?A.properties[d]:Array.isArray(d)?d.map(v=>A.properties[v]).join(""):"",index:l.id+A.properties.osm_id}).screenObjectId}if(l.billboardStyle){const d=Ar(l.billboardStyle.text,u);p=this.screenManager.addImage(e,"VectorTile",l.billboardStyle,{position:h,name:typeof d=="string"?A.properties[d]:Array.isArray(d)?d.map(v=>A.properties[v]).join(""):"",index:l.id+A.properties.osm_id}).screenObjectId}f&&!o.has(f)&&o.add(f),p&&!o.has(p)&&o.add(p)}}let s=this.renderedTiles.get(e);s||(s=new Map,this.renderedTiles.set(e,s)),s.set(i.tileKey,o)}update(e,i,o){var r;if(typeof i=="string"){const s=(r=this.renderedTiles.get(e))==null?void 0:r.get(i);s&&this.screenManager.update("VectorTile",e,s,{all:{show:o}})}else this.screenManager.update("VectorTile",e,i,{all:{show:o}})}remove(e,i){const o=this.renderedTiles.get(e);if(i){const r=o==null?void 0:o.get(i);r&&(this.screenManager.remove("VectorTile",e,r),o==null||o.delete(i),(o==null?void 0:o.size)===0&&this.renderedTiles.delete(e))}else{const r=o==null?void 0:o.values();if(r){const s=new Set([...r].flatMap(a=>[...a]));this.screenManager.remove("VectorTile",e,s,!0),this.renderedTiles.delete(e)}}}removeAll(){const e=this.renderedTiles.keys();for(const i of e)this.remove(i)}}const WH=new w.Cartesian2;class jH extends c.Destroyable{constructor(){super();O(this,"defaultStyle",new Map);O(this,"defaultSprite",new Map)}async add(e){var o;if(typeof e.mvtLayerJson.mainJson!="string"&&((o=e.mvtLayerJson.mainJson)!=null&&o.sprite)){const r=e.mvtLayerJson.mainJson.sprite;let s=await w.Resource.fetchJson({url:r+".json"});s=await KH(r+".png",s),s&&this.defaultSprite.set(e.sceneObject.id,[r+".png",s])}const i=e.mvtLayerJson.pointJson;for(const r of i)this.setDefaultStyle(e.sceneObject.id,this.getStyleFromMVTLayers(e.sceneObject.id,r))}remove(e){this.defaultStyle.delete(e.sceneObject.id)}setDefaultStyle(e,i){let o=this.defaultStyle.get(e);o||(o=new Set,this.defaultStyle.set(e,o)),o.add(i)}getStyle(e){return this.defaultStyle.get(e)??new Set}getStyleFromMVTLayers(e,i){const o={id:i.id,type:i.type,source:i.source,"source-layer":i["source-layer"],labelStyle:void 0,billboardStyle:void 0,polygonStyle:void 0,polylineStyle:void 0};if(Reflect.has(i,"minzoom")&&(o.minzoom=i.minzoom),Reflect.has(i,"maxzoom")&&(o.maxzoom=i.maxzoom),Reflect.has(i,"type")&&i.type==="symbol"&&Reflect.has(i,"layout")){const r=i.layout;if(Reflect.has(r,"icon-image")){const s=o.billboardStyle={},a=this.defaultSprite.get(e);a&&a[1][r["icon-image"]]?(s.image=a[0],s.imageSubRegion=new w.BoundingRectangle(a[1][r["icon-image"]].x,a[1][r["icon-image"]].y,a[1][r["icon-image"]].width,a[1][r["icon-image"]].height)):s.image=r["icon-image"];const{horizontalOrigin:l,verticalOrigin:u}=iE(r["icon-anchor"]??"center");if(s.horizontalOrigin=l,s.verticalOrigin=u,Reflect.has(i,"paint")){const A=i.paint;s.color=w.Color.fromCssColorString(A["icon-color"]??"#000000").withAlpha(A["icon-opacity"]??1)}s.rotation=w.Math.toRadians(r["icon-rotate"]??0),s.scale=r["icon-size"]??1,s.pixelOffset=w.Cartesian2.multiplyByScalar(w.Cartesian2.fromArray(r["icon-offset"]??[0,0]),s.scale,WH),s.show=(r.visibility??"visible")==="visible"}if(Reflect.has(r,"text-field")){const s=o.labelStyle={};s.text=r["text-field"];const{horizontalOrigin:a,verticalOrigin:l}=iE(r["text-anchor"]??"center");if(s.horizontalOrigin=a,s.verticalOrigin=l,Reflect.has(i,"paint")){const A=i.paint;s.fillColor=w.Color.fromCssColorString(A["text-color"]??"#000000").withAlpha(A["text-opacity"]??1),A["text-halo-color"]&&(s.outlineColor=w.Color.fromCssColorString(A["text-halo-color"])),A["text-halo-width"]&&(s.outlineWidth=A["text-halo-width"]),(A["text-halo-color"]||A["text-halo-width"])&&(s.style=w.LabelStyle.FILL_AND_OUTLINE)}const u=r["text-font"]?typeof r["text-font"]=="string"?[r["text-font"]]:r["text-font"]:["Open Sans Regular","Arial Unicode MS Regular"];s.font=`${r["text-size"]??16}px `+u.map(A=>`"${A}"`).join(", "),s.pixelOffset=qH(r),s.show=(r.visibility??"visible")==="visible"}}return o}}function iE(t){let n=w.HorizontalOrigin.CENTER,e=w.VerticalOrigin.CENTER;switch(t){case"center":break;case"left":n=w.HorizontalOrigin.LEFT;break;case"right":n=w.HorizontalOrigin.RIGHT;break;case"top":e=w.VerticalOrigin.TOP;break;case"bottom":e=w.VerticalOrigin.BOTTOM;break;case"top-left":n=w.HorizontalOrigin.LEFT,e=w.VerticalOrigin.TOP;break;case"top-right":n=w.HorizontalOrigin.RIGHT,e=w.VerticalOrigin.TOP;break;case"bottom-left":n=w.HorizontalOrigin.LEFT,e=w.VerticalOrigin.BOTTOM;break;case"bottom-right":n=w.HorizontalOrigin.RIGHT,e=w.VerticalOrigin.BOTTOM;break}return{horizontalOrigin:n,verticalOrigin:e}}async function KH(t,n){const{width:e,height:i}=await Pr(t,!1),o={};for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const s=n[r];o[r]={width:s.width,height:s.height,x:s.x,y:i-s.y-s.height,pixelRatio:s.pixelRatio}}return o}function qH(t){const n=t["text-offset"]||[0,0],e=t["text-size"]||16;return new w.Cartesian2(n[0]*e,n[1]*e)}class ZH extends c.Destroyable{constructor(){super();O(this,"callbacks",new Map)}registerEvent(e,i,o){var s;const r=`${e}-${i}`;this.callbacks.has(r)||this.callbacks.set(r,new Set),(s=this.callbacks.get(r))==null||s.add(o)}dispatchEvent(e){var o;const i=`${e.tileKey}-${e.type}`;(o=this.callbacks.get(i))==null||o.forEach(r=>r(e.data))}}var Qa=(t=>(t[t.UNLOADED=0]="UNLOADED",t[t.LOADING=1]="LOADING",t[t.PROCESSING=2]="PROCESSING",t[t.READY=3]="READY",t[t.EXPIRED=4]="EXPIRED",t[t.FAILED=5]="FAILED",t))(Qa||{});class XH extends c.Destroyable{constructor(e){super();O(this,"czmESMVTLayers",new Map);O(this,"tilesCache",new QH);O(this,"tileLoader",new HH(this.tilesCache));O(this,"tileRenderer");O(this,"styleManager",new jH);O(this,"eventManager",new ZH);O(this,"lastImageryTileMap",new Map);this.viewer=e;const i=Mt(e);i&&(this.tileRenderer=new GH(i.screenManager,this.styleManager)),this.ad(this.tilesCache.deleteTileEvent.don((s,a)=>{this.tileRenderer.remove(s,a)}));let o=performance.now();const r=e.scene.preUpdate.addEventListener(()=>{const s=performance.now();s-o>60&&(o=s,this.czmESMVTLayers.size>0&&this.refreshVisibleTiles())});this.ad(()=>r&&r())}async add(e){if(this.czmESMVTLayers.has(e.sceneObject.id)){console.log(`ESMVTLayer${e.sceneObject.id}已经添加过,跳过本次添加`);return}this.czmESMVTLayers.set(e.sceneObject.id,e),this.tileLoader.add(e),await this.styleManager.add(e),this.refreshVisibleTiles(!0)}remove(e){this.czmESMVTLayers.delete(e.sceneObject.id),this.tileLoader.remove(e),this.styleManager.remove(e),this.tilesCache.remove(e)}refreshVisibleTiles(e){const i=this.viewer;if(!i)return;const o=new Map;for(const[r,s]of this.czmESMVTLayers.entries()){if(!s)continue;const a={tilingScheme:{type:"WebMercatorTilingScheme"},rectangle:s.sceneObject.rectangle,tileHeight:s.sceneObject.tileSize,tileWidth:s.sceneObject.tileSize,maximumLevel:s.sceneObject.maximumLevel,minimumLevel:s.sceneObject.minimumLevel},l=new Set;_0(i.scene.globe._surface._tilesToRender,i.scene.terrainProvider,a).forEach(u=>l.add(`${u.level}-${u.x}-${u.y}`)),!o.has(r)&&o.set(r,l)}this.updateTiles(o,e)}updateTiles(e,i){var o,r;for(const s of this.czmESMVTLayers.keys()){const a=e.get(s)??new Set,l=this.lastImageryTileMap.get(s);if(l&&$H(a,l)&&!i)continue;this.lastImageryTileMap.set(s,a);const u=new Set(((o=this.tilesCache.get(s))==null?void 0:o.keys())??[]),A=new Set,h=new Set;for(const f of u){const p=(r=this.tileRenderer.renderedTiles.get(s))==null?void 0:r.get(f);if(!(!p||p.size==0))if(a.has(f))for(const d of p)A.add(d);else for(const d of p)h.add(d)}for(const f of A)h.delete(f);this.tileRenderer.update(s,h,!1),this.tileRenderer.update(s,A,!0);for(const f of a)u.has(f)||(this.tilesCache.set(s,f,new nE(f)),this.tileLoader.fetchTile(s,f).then(p=>{!p||!this.tilesCache.has(s,f)||(this.tilesCache.set(s,f,p),p.fillParentAndChildren(this.tilesCache.get(s)??new Map),this.tileRenderer.renderTile(s,p))}))}}}function $H(t,n){if(t.size!==n.size)return!1;for(const e of t)if(!n.has(e))return!1;return!0}new w.WebMercatorTilingScheme;const rE=["label","billboard","rectangle"];class YH extends c.Destroyable{constructor(e,i){super();O(this,"id",c.createGuid());O(this,"position",w.Cartesian3.ZERO);O(this,"label");O(this,"billboard");O(this,"rectangle");O(this,"zOrder");O(this,"labelRefCount",1);O(this,"billboardRefCount",1);O(this,"rectangleRefCount",1);O(this,"_showEvent",this.disposeVar(new c.Event));this.id=e,this.position=i,this.ad(this.showEvent.don(o=>{this.updateShow(o)}))}get showEvent(){return this._showEvent}show(e){this._showEvent.emit(e)}updateShow(e){this.label&&(this.label.show=e),this.billboard&&(this.billboard.show=e)}}class JH extends c.Destroyable{constructor(e){super();O(this,"objects",new Map);O(this,"screenManager");O(this,"czmViewer");O(this,"viewer");this.screenManager=e,this.czmViewer=e.czmViewer,this.viewer=e.viewer,this.ad(()=>{this.objects.clear()})}layerIsEffective(){return this.objects.size>0}addLabel(e,i,o){const r=this.makeScreenObjectId(e,o.index??c.createGuid()),s=Ye(o.position),a=this.getOrCreateObject(r,s);if(this.screenManager.avoidanceManager.enable&&(i.show=!1),a.label)return a.labelRefCount++,a.label.show=i.show??!0,r;const l=this.screenManager.labelCollection.get({...i,position:s,id:o.properties??r,text:o.name});return l.ESSceneObjectID=e,a.label=l,a.zOrder=o.zOrder,r}addImage(e,i,o){const r=this.makeScreenObjectId(e,o.index??c.createGuid()),s=Ye(o.position),a=this.getOrCreateObject(r,s);if(this.screenManager.avoidanceManager.enable&&(i.show=!1),a.billboard)return a.billboardRefCount++,a.billboard.show=i.show??!0,r;const l=this.screenManager.billboardCollection.get({...i,position:s,id:o.properties??r});return l.ESSceneObjectID=e,a.billboard=l,a.zOrder=o.zOrder,r}addRectangle(e,i,o,r){const s=this.makeScreenObjectId(e,o.index??c.createGuid()),a=Ye(o.position),l=this.getOrCreateObject(s,a);if(this.screenManager.avoidanceManager.enable&&(i.show=!1),l.rectangle)return l.rectangleRefCount++,s;const u=this.screenManager.rectangleCollection.add({...c.getElementBounds(i.element),...i,id:o.properties??s,position:a,callback:r});return r(!0),l.rectangle=u,l.zOrder=o.zOrder,s}update(e,i){const o=Object.keys(i).length==1&&i.all&&Object.keys(i.all).length==1&&Reflect.has(i.all,"show"),r=new Map;for(const l of rE)r.set(l,Object.assign({},i[l],(i==null?void 0:i.all)??{}));const s=this.screenManager.avoidanceManager.enable,a=e instanceof Set?e:new Set([e]);for(const[l,u]of r)for(const A of a){const h=this.objects.get(A);if(!h)continue;const f=h[l];if(f){if(o){if(s&&u.show||f.show==u.show)continue;f.show=u.show;continue}for(const p in u)if(p!=="position"&&p!=="id"){if(s&&p=="show"&&u[p]||f[p]==u[p])continue;f[p]=u[p]}}}return!0}remove(e,i=!1){const o=e instanceof Set?e:typeof e=="string"?new Set([e]):e;if(o instanceof Set){for(const r of o){const s=this.objects.get(r);s&&(s.label&&(s.labelRefCount>1&&!i?s.labelRefCount--:(this.screenManager.labelCollection.release(s.label),s.label=void 0)),s.billboard&&(s.billboardRefCount>1&&!i?s.billboardRefCount--:(this.screenManager.billboardCollection.release(s.billboard),s.billboard=void 0)),s.rectangle&&(s.rectangleRefCount>1&&!i?s.rectangleRefCount--:(this.screenManager.rectangleCollection.remove(s.rectangle),s.rectangle=void 0)),this.tryDeleteEmpty(r))}return!0}else{for(const r of Object.keys(o)){const s=o[r]instanceof Set?o[r]:new Set([o[r]]);for(const a of s){if(!a)continue;const l=this.objects.get(a);if(l){if(l[`${r}RefCount`]>1&&!i)l[`${r}RefCount`]--;else{const u=l[r];u&&(this.screenManager.collectionMap[r].remove(u),l[r]=void 0)}this.tryDeleteEmpty(a)}}}return!0}}makeScreenObjectId(e,i){return`${e}_${i}`}getOrCreateObject(e,i){let o=this.objects.get(e);return o||(o=new YH(e,i),this.objects.set(e,o)),o}tryDeleteEmpty(e){const i=this.objects.get(e);i&&!i.label&&!i.billboard&&!i.rectangle&&this.objects.delete(e)}}function e3(t,n){const e=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER];for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&rE.includes(i)){const o=n[i];if(!o)continue;let r,s,a,l;if(o instanceof w.Label||o instanceof w.Billboard){const u=o.computeScreenSpacePosition(t.scene);({x:r,y:s,width:a,height:l}=w[o instanceof w.Label?"Label":"Billboard"].getScreenSpaceBoundingBox(o,u))}else({x:r,y:s,width:a,height:l}=o);if(isNaN(r)||isNaN(s)||isNaN(a)||isNaN(l))continue;e[0]=Math.min(e[0],r),e[1]=Math.min(e[1],s),e[2]=Math.max(e[2],r+a),e[3]=Math.max(e[3],s+l)}return new w.Rectangle(...e)}class t3 extends c.Destroyable{constructor(e){super();O(this,"rectangleCollisionCheck",new w.RectangleCollisionChecker);O(this,"screenManager");O(this,"enable",!1);O(this,"forceRebuildNext",!1);O(this,"avoidanceLayers",[]);O(this,"_processingQueue",[]);O(this,"_isProcessing",!1);O(this,"BATCH_SIZE",1e3);O(this,"_cache",new Map);O(this,"_lastCameraState",{});O(this,"CAMERA_MOVE_THRESHOLD",5e-4);this.screenManager=e,this.ad(()=>{this.rectangleCollisionCheck._tree.clear(),this._cache.clear(),this._processingQueue.length=0})}update(){if(this.avoidanceLayers.length==0)return;const e=this._shouldForceRebuild();this._buildProcessingQueue(e),this._isProcessing||(this._isProcessing=!0,requestAnimationFrame(()=>this._processBatch()))}setAvoidanceLayer(){for(let e=0;e<this.avoidanceLayers.length;e++){const i=this.screenManager.getLayer(this.avoidanceLayers[e]);i.layerIsEffective()&&i.objects.forEach((o,r)=>{o.show(!this.enable)})}this.forceRebuildNext=!0}updateAvoidanceLayer(e,i){this.enable=(e==null?void 0:e.enabled)??!1,i?e!=null&&e.enabled?this.avoidanceLayers.includes(i)||this.avoidanceLayers.push(i):this.avoidanceLayers=this.avoidanceLayers.filter(o=>o!=i):e!=null&&e.enabled?this.avoidanceLayers=Array.from(this.screenManager.layers.keys()):(this.setAvoidanceLayer(),this.avoidanceLayers=[]),this.setAvoidanceLayer()}_shouldForceRebuild(){if(this.forceRebuildNext)return this.forceRebuildNext=!1,this._updateLastCameraState(),!0;const e=this.screenManager.viewer.camera,i=e.positionWC,o=e.directionWC,r=this._lastCameraState.position,s=this._lastCameraState.direction;if(!r||!s)return this._updateLastCameraState(),!0;const a=w.Cartesian3.distanceSquared(i,r),l=w.Cartesian3.distanceSquared(o,s);return a>this.CAMERA_MOVE_THRESHOLD||l>this.CAMERA_MOVE_THRESHOLD?(this._updateLastCameraState(),!0):!1}_updateLastCameraState(){const e=this.screenManager.viewer.camera;this._lastCameraState.position=w.Cartesian3.clone(e.positionWC),this._lastCameraState.direction=w.Cartesian3.clone(e.directionWC)}_buildProcessingQueue(e){e&&(this.rectangleCollisionCheck._tree.clear(),this._cache.clear()),this._processingQueue.length=0;for(let i=0;i<this.avoidanceLayers.length;i++){const o=this.screenManager.getLayer(this.avoidanceLayers[i]);o.layerIsEffective()&&o.objects.forEach((r,s)=>{this._processingQueue.push(r)})}this._processingQueue.sort((i,o)=>(o.zOrder||0)-(i.zOrder||0))}_processBatch(){performance.now();const e=this._processingQueue,i=this.BATCH_SIZE;let o=0;for(;e.length>0&&o<i;){const r=e.shift();this._updateSingleObject(r),o++}e.length>0?requestAnimationFrame(()=>this._processBatch()):this._isProcessing=!1}_updateSingleObject(e){try{if(!this.screenManager.czmViewer.isPointVisible(e.position)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}const i=e.id.toString(),o=this._cache.get(i),r=w.Cartesian3.clone(e.position);let s;if(o&&w.Cartesian3.equalsEpsilon(o.worldPos,r,1e-6))s=o.rect,this.rectangleCollisionCheck.remove(i,s);else{if(s=e3(this.screenManager.viewer,e),isNaN(s.width)||isNaN(s.height)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}this._cache.set(i,{rect:s,worldPos:r,lastFrame:Date.now()})}this.rectangleCollisionCheck.collides(s)?e.show(!1):(e.show(!0),this.rectangleCollisionCheck.insert(e.id.toString(),s))}catch(i){console.error("ScreenManager update object error",i)}}}class oE extends c.Destroyable{constructor(){super();O(this,"_collection",[]);this.ad(()=>this._collection=[])}get length(){return this._collection.length}add(e){return this._collection.push(e),e._index=this._collection.length,e}remove(e){this._collection[e._index]=void 0}}class sE extends c.Destroyable{constructor(e,i=500,o={minPoolRatio:.1}){super();O(this,"_pool",[]);O(this,"_minPoolRatio");O(this,"_initialSize");this._collection=e,this._initialSize=i,this._minPoolRatio=o.minPoolRatio??.1;for(let r=0;r<i;r++){const s=this._collection.add({show:!1,position:new w.Cartesian3(0,0,0)});this._pool.push(s)}this.ad(()=>{for(const r of this._pool)this.removeFromCollection(r);this._pool.length=0})}get(e,i){if(typeof e=="number"){const o=e,r=i,s=[];for(let a=0;a<o;a++){const l=this._getOne();this.update(l,r),s.push(l)}return s}else{const o=this._getOne();return this.update(o,e),o}}release(e){if(Array.isArray(e))for(const i of e)i.show=!1,this._pool.push(i);else e.show=!1,this._pool.push(e);this._dynamicRecycle()}update(e,i){if(i){Object.assign(e,i);for(const o in i)if(Object.prototype.hasOwnProperty.call(i,o)){const r=i[o];Reflect.has(e,o)&&(e[o]=r)}Reflect.has(e,"imageSubRegion")&&e.setImageSubRegion(i.image,i.imageSubRegion)}}get available(){return this._pool.length}removeFromCollection(e){this._collection instanceof w.LabelCollection?this._collection.remove(e):this._collection instanceof w.BillboardCollection&&this._collection.remove(e)}_getOne(){if(this._pool.length>0)return this._pool.pop();{const e=this._collection.add({show:!1,position:new w.Cartesian3(0,0,0)});return this._dynamicRecycle(),e}}_dynamicRecycle(){const e=this._collection.length,i=Math.max(this._initialSize,Math.floor(e*this._minPoolRatio));for(;this._pool.length>i;){const o=this._pool.pop();this.removeFromCollection(o)}}}class aE extends c.Destroyable{constructor(e){super();O(this,"layers",new Map);O(this,"czmViewer");O(this,"viewer");O(this,"avoidanceManager");O(this,"labelCollection");O(this,"billboardCollection");O(this,"rectangleCollection",this.ad(new oE));O(this,"canvasCollection",this.ad(new oE));O(this,"collectionMap");O(this,"_refreshEvent",this.ad(new c.Event));this.czmViewer=e,this.viewer=e.viewer,this.avoidanceManager=this.ad(new t3(this));const i=new w.LabelCollection({scene:this.viewer.scene}),o=new w.BillboardCollection({scene:this.viewer.scene});this.labelCollection=new sE(i,500),this.billboardCollection=new sE(o,500),this.viewer.scene.primitives.add(i),this.viewer.scene.primitives.add(o),this.collectionMap={label:i,billboard:o,rectangle:this.rectangleCollection},this.ad(c.createEventsCallFunc([this.czmViewer.cameraChanged,this.refreshEvent],()=>{this.avoidanceManager.update()},{immediate:!0})),this.ad(()=>{this.layers.forEach(r=>r.destroy()),this.layers.clear(),i.removeAll(),o.removeAll(),this.viewer.scene.primitives.remove(i),this.viewer.scene.primitives.remove(o)})}get refreshEvent(){return this._refreshEvent}refresh(){this._refreshEvent.emit()}getLayer(e){let i=this.layers.get(e);return i||(i=new JH(this),this.layers.set(e,i),this.avoidanceManager.enable&&this.avoidanceManager.updateAvoidanceLayer({enabled:!0})),i}addLabel(e,i,o,r){const a=this.getLayer(i).addLabel(e,o,r);return this.refresh(),{layer:i,id:e,screenObjectId:a}}addImage(e,i,o,r){const a=this.getLayer(i).addImage(e,o,r);return this.refresh(),{layer:i,id:e,screenObjectId:a}}addRectangle(e,i,o,r,s){const l=this.getLayer(i).addRectangle(e,o,r,s);return this.refresh(),{layer:i,id:e,screenObjectId:l}}update(e,i,o,r){const s=this.getLayer(e);return o instanceof Set&&o.size===0?!1:(s.update(o,r),this.refresh(),!0)}remove(e,i,o,r=!1){const s=this.getLayer(e);if(!s.remove(o,r)){console.warn(`屏幕管理器,删除${i}下的内容失败!`);return}!s.layerIsEffective()&&!s.isDestroyed()&&(s.destroy(),this.layers.delete(e)),this.refresh()}setRules(e,i){Reflect.has(e,"avoidance")&&this.avoidanceManager.updateAvoidanceLayer(e.avoidance,i),this.refresh()}}function Mt(t){return c.getExtProp(t,"_viewerExtensions")}function Uv(t,n){c.setExtProp(t,"_viewerExtensions",n)}class lE extends c.Destroyable{constructor(e,i){super();O(this,"_imageriesManager");O(this,"_terrainManager");O(this,"_labelManager");O(this,"_pickingManager");O(this,"_poiContext");O(this,"_cursorPositionInfo");O(this,"_screenManager");O(this,"_vectorTIlesManager");this._viewer=e,this._czmViewer=i,this._imageriesManager=this.dv(new eE(this.viewer)),this._terrainManager=this.dv(new YS(this.viewer)),this._labelManager=this.dv(new JS(this.viewer)),this._poiContext=this.disposeVar(new z0(this._viewer)),this._cursorPositionInfo=this.disposeVar(new kH(this._viewer)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new tE(i)),this._screenManager=this.ad(new aE(i)),this._vectorTIlesManager=this.ad(new XH(i.viewer)),this.ad(c.createEventsCallFunc(this.czmViewer.textAvoidanceChanged,()=>{this.screenManager.setRules({avoidance:{enabled:this.czmViewer.textAvoidance}})},{immediate:!0}))},void 0,!0))}get viewer(){return this._viewer}get czmViewer(){return this._czmViewer}get imageriesManager(){return this._imageriesManager}get terrainManager(){return this._terrainManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}get screenManager(){return this._screenManager}get vectorTIlesManager(){return this._vectorTIlesManager}}var uE=new w.Cartesian3,cE=new w.Cartesian3;function hE(t,n,e){let i=w.Matrix4.clone(t.transform);t.lookAtTransform(w.Matrix4.IDENTITY);var o=t.positionCartographic.height,r=t.positionWC,s=w.Cartesian3.normalize(r,uE),a=w.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var l=w.Cartesian3.cross(t.direction,s,cE);else var l=w.Cartesian3.cross(t.up,s,cE);var u=l;if(e){var A=w.Cartesian3.cross(s,l,uE);u=A}var h=w.Cartesian3.magnitude(r);t.rotate(u,n/h);var f=t.positionCartographic,p=f.longitude,d=f.latitude;w.Cartesian3.fromRadians(p,d,o,void 0,t.position),t.lookAtTransform(i)}function AE(t,n){hE(t,n,!1)}function fE(t,n){hE(t,-n,!0)}class n3 extends c.Destroyable{constructor(e){super();O(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:i}=this,{viewer:o}=i.firstPersonController,{camera:r}=o;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:a[s.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:s}=this;let a=Date.now();const l=()=>{const u=Date.now(),A=u-a;a=u;const h=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&r.moveForward(A*h),s.MoveBackword&&r.moveBackward(A*h),s.MoveLeft&&r.moveLeft(A*h),s.MoveRight&&r.moveRight(A*h)):(s.MoveForward&&AE(r,A*h),s.MoveBackword&&AE(r,-A*h),s.MoveLeft&&fE(r,-A*h),s.MoveRight&&fE(r,A*h));{const{rotateSpeed:f}=this.controller,p=w.Math.toRadians(f*A);s.RotateRight?r.lookRight(p):s.RotateLeft?r.lookRight(-p):s.RotateUp?r.lookDown(-p):s.RotateDown&&r.lookDown(p)}};o.scene.preUpdate.addEventListener(l),this.dispose(()=>o.scene.preUpdate.removeEventListener(l))}}get running(){return this._running}get controller(){return this.running.keyboardCameraController}get actions(){return this._actions}_resetActions(){const e=Object.keys(this._actions);for(let i of e)this._actions[i]=!1}_updateActions(){const{running:e}=this,{keyStatus:i}=e,{actions:o}=this;this._resetActions();const{keyStatusMap:r}=this.running.keyboardCameraController;for(let s of i.currentKeyIds)o[r[s]]=!0}}class Xf extends c.Destroyable{constructor(e){super();O(this,"_currentKeyIds",new Set);O(this,"_currentKeyIdsChanged",this.dv(new c.Event));O(this,"_debug",this.dv(c.react(!1)));O(this,"_debugResetting",this.dv(new c.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends c.Destroyable{constructor(e){super();const i=()=>{console.log([...e.currentKeyIds].join(`
|
|
3847
3847
|
`))};i(),this.d(e.currentKeyIdsChanged.don(i))}}(this)})));this._keyboardCameraControllerRunning=e;const{keyboardCameraController:i}=this._keyboardCameraControllerRunning;{const o=r=>{const s=Xf.getKeyId(r);this._currentKeyIds.has(s)||(this._currentKeyIds.add(s),this._currentKeyIdsChanged.emit())};this.d(i.keyDownEvent.don(o))}{const o=r=>{const s=Xf.getKeyId(r);this._currentKeyIds.has(s)&&(this._currentKeyIds.delete(s),this._currentKeyIdsChanged.emit())};this.d(i.keyUpEvent.don(o))}{const o=()=>{this._currentKeyIds.clear(),this._currentKeyIdsChanged.emit()};this.d(i.abortEvent.don(o))}}static getKeyId(e){return e.code}get currentKeyIds(){return this._currentKeyIds}get currentKeyIdsChanged(){return this._currentKeyIdsChanged}get debug(){return this._debug.value}set debug(e){this._debug.value=e}get debugChanged(){return this._debug.changed}}class i3 extends c.Destroyable{constructor(e){super();O(this,"_keyStatus");O(this,"_cameraOp");this._keyboardCameraController=e,this._keyStatus=this.dv(new Xf(this)),this._cameraOp=this.dv(new n3(this))}get keyboardCameraController(){return this._keyboardCameraController}get keyStatus(){return this._keyStatus}get cameraOp(){return this._cameraOp}}const ip=class ip extends c.Destroyable{constructor(e){super();O(this,"_enabled",this.dv(c.react(!1)));O(this,"_keyStatusMap",this.dv(c.react(ip.defaultKeyStatusMap)));O(this,"_speed",this.dv(c.react(1)));O(this,"_rotateSpeed",this.dv(c.react(.01)));O(this,"_alwaysWithCamera",this.dv(c.react(!1)));O(this,"_keyDownEvent",this.dv(new c.Event));O(this,"_keyUpEvent",this.dv(new c.Event));O(this,"_abortEvent",this.dv(new c.Event));this._firstPersonController=e,this.dv(new c.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new i3(this)}))}get firstPersonController(){return this._firstPersonController}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get keyStatusMap(){return this._keyStatusMap.value}set keyStatusMap(e){this._keyStatusMap.value=e}get keyStatusMapChanged(){return this._keyStatusMap.changed}get speed(){return this._speed.value}set speed(e){this._speed.value=e}get speedChanged(){return this._speed.changed}get rotateSpeed(){return this._rotateSpeed.value}set rotateSpeed(e){this._rotateSpeed.value=e}get rotateSpeedChanged(){return this._rotateSpeed.changed}get alwaysWithCamera(){return this._alwaysWithCamera.value}set alwaysWithCamera(e){this._alwaysWithCamera.value=e}get alwaysWithCameraChanged(){return this._alwaysWithCamera.changed}get keyDownEvent(){return this._keyDownEvent}keyDown(e){this._keyDownEvent.emit(e)}get keyUpEvent(){return this._keyUpEvent}keyUp(e){this._keyUpEvent.emit(e)}get abortEvent(){return this._abortEvent}abort(){this._abortEvent.emit()}};O(ip,"defaultKeyStatusMap",{ShiftLeft:"WithCamera",ShiftRight:"WithCamera",KeyW:"MoveForward",KeyS:"MoveBackword",KeyA:"MoveLeft",KeyD:"MoveRight",ArrowUp:"MoveForward",ArrowDown:"MoveBackword",ArrowLeft:"MoveLeft",ArrowRight:"MoveRight",KeyR:"SpeedUp",KeyF:"SpeedDown",KeyQ:"SwitchAlwaysWithCamera"});let $f=ip;function r3(t,n){t.lookRight(w.Math.toRadians(n.movementX)*.1),t.lookDown(w.Math.toRadians(n.movementY)*.1);const e=t.pitch,i=w.Math.clamp(e,-w.Math.PI_OVER_TWO,w.Math.PI_OVER_TWO);i!==e&&t.setView({destination:t.positionWC,orientation:{heading:t.heading,pitch:i,roll:t.roll}})}class o3 extends c.Destroyable{constructor(n,e){super(),this._firstPersonController=n,this._mouseCameraController=e;const{canvas:i}=this._firstPersonController.viewer;{const o=r=>{const{camera:s}=this._firstPersonController.viewer.scene;r3(s,r)};i.addEventListener("pointermove",o),this.dispose(()=>i.removeEventListener("pointermove",o))}}}const rp=class rp extends c.Destroyable{constructor(e){super();O(this,"_mouseMoving",this.dv(new o3(this.firstPersonController,this.mouseCameraController)));this._mouseCameraController=e;const{viewer:i}=this.firstPersonController;this.mouseCameraController.enableViewerOriginInputs(!1),this.dispose(()=>this.mouseCameraController.enableViewerOriginInputs(!0)),Element.prototype.setPointerCapture=()=>{},this.dispose(()=>Element.prototype.setPointerCapture=rp.origin_setPointerCapture);const o=i.canvas;o.requestPointerLock(),this.dispose(()=>document.exitPointerLock());{const r=()=>{document.pointerLockElement!==o&&(this.firstPersonController.mouseEnabled=!1)};document.addEventListener("pointerlockchange",r,!1),this.dispose(()=>document.removeEventListener("pointerlockchange",r,!1))}{const r=()=>{this.firstPersonController.mouseEnabled=!1,console.log("Error locking pointer")};document.addEventListener("pointerlockerror",r)}}get mouseCameraController(){return this._mouseCameraController}get firstPersonController(){return this.mouseCameraController.firstPersonController}get mouseMoving(){return this._mouseMoving}};O(rp,"origin_setPointerCapture",Element.prototype.setPointerCapture);let Ov=rp;class s3 extends c.Destroyable{constructor(e){super();O(this,"_enabled",this.dv(c.react(!1)));O(this,"enableViewerOriginInputs",e=>{e?this.firstPersonController.czmViewer.incrementDisabledInputStack():this.firstPersonController.czmViewer.decrementDisabledInputStack()});O(this,"_mouseResetting",this.dv(new c.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Ov(this)})));this._firstPersonController=e}get firstPersonController(){return this._firstPersonController}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get mouseResetting(){return this._mouseResetting}}class a3 extends c.Destroyable{constructor(e){super();O(this,"viewer");O(this,"_mouseCameraController",this.dv(new s3(this)));O(this,"_keyboardCameraController",this.dv(new $f(this)));if(this._viewer=e,!this._viewer.viewer)throw new Error("Cesium.Viewer不存在!");this.viewer=this._viewer.viewer}get czmViewer(){return this._viewer}get mouseCameraController(){return this._mouseCameraController}get mouseEnabled(){return this.mouseCameraController.enabled}set mouseEnabled(e){this.mouseCameraController.enabled=e}get mouseEnabledChanged(){return this.mouseCameraController.enabledChanged}get keyboardCameraController(){return this._keyboardCameraController}get keyboardEnabled(){return this.keyboardCameraController.enabled}set keyboardEnabled(e){this.keyboardCameraController.enabled=e}get keyboardEnabledChanged(){return this.keyboardCameraController.enabledChanged}}function pE(t){t.removeInputAction(w.ScreenSpaceEventType.LEFT_DOWN),t.removeInputAction(w.ScreenSpaceEventType.RIGHT_DOWN),t.removeInputAction(w.ScreenSpaceEventType.MIDDLE_DOWN),t.removeInputAction(w.ScreenSpaceEventType.MOUSE_MOVE),t.removeInputAction(w.ScreenSpaceEventType.LEFT_UP),t.removeInputAction(w.ScreenSpaceEventType.RIGHT_UP),t.removeInputAction(w.ScreenSpaceEventType.MIDDLE_UP)}function Lv(t,n,e,i=void 0){const r=t.camera,s=new w.Cartesian2;s.x=n.startPosition.x,s.y=0;const a=new w.Cartesian2;a.x=n.endPosition.x,a.y=0;let l=r.getPickRay(s,new w.Ray),u=r.getPickRay(a,new w.Ray),A=0,h,f;if(!l||!u)return;r.frustum instanceof w.OrthographicFrustum?(h=l.origin,f=u.origin,w.Cartesian3.add(r.direction,h,h),w.Cartesian3.add(r.direction,f,f),w.Cartesian3.subtract(h,r.position,h),w.Cartesian3.subtract(f,r.position,f),w.Cartesian3.normalize(h,h),w.Cartesian3.normalize(f,f)):(h=l.direction,f=u.direction);let p=w.Cartesian3.dot(h,f);p<1&&(A=Math.acos(p)),A=n.startPosition.x>n.endPosition.x?A:-A;const d=e._horizontalRotationAxis;if(w.defined(i)?r.look(i,-A):w.defined(d)?r.look(d,-A):r.lookLeft(A),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=r.getPickRay(s,new w.Ray),u=r.getPickRay(a,new w.Ray),A=0,!(!l||!u))if(r.frustum instanceof w.OrthographicFrustum?(h=l.origin,f=u.origin,w.Cartesian3.add(r.direction,h,h),w.Cartesian3.add(r.direction,f,f),w.Cartesian3.subtract(h,r.position,h),w.Cartesian3.subtract(f,r.position,f),w.Cartesian3.normalize(h,h),w.Cartesian3.normalize(f,f)):(h=l.direction,f=u.direction),p=w.Cartesian3.dot(h,f),p<1&&(A=Math.acos(p)),A=n.startPosition.y>n.endPosition.y?A:-A,i=i??d,w.defined(i)){const g=r.direction,v=w.Cartesian3.negate(i,new w.Cartesian3),y=w.Cartesian3.equalsEpsilon(g,i,w.Math.EPSILON2),m=w.Cartesian3.equalsEpsilon(g,v,w.Math.EPSILON2);if(!y&&!m){p=w.Cartesian3.dot(g,i);let _=w.Math.acosClamped(p);A>0&&A>_&&(A=_-w.Math.EPSILON4),p=w.Cartesian3.dot(g,v),_=w.Math.acosClamped(p),A<0&&-A>_&&(A=-_+w.Math.EPSILON4);const x=w.Cartesian3.cross(i,g,new w.Cartesian3);r.look(x,A)}else(y&&A<0||m&&A>0)&&r.look(r.right,-A)}else r.lookUp(A)}class l3 extends c.Destroyable{constructor(n,e){super();const i=e.viewer;if(!i)throw new Error("viewer is undefined");let o=!0;this.d(n.positionChanged.don(()=>o=!0)),this.d(n.rotationChanged.don(()=>o=!0)),this.d(n.offsetHeightChanged.don(()=>o=!0)),this.d(n.viewDistanceChanged.don(()=>o=!0)),this.d(n.offsetRotationChanged.don(()=>o=!0)),this.d(n.relativeRotationChanged.don(()=>o=!0));const r=[0,0,0],s=[0,0,0];this.d(i.clock.onTick.addEventListener(()=>{if(!o)return;if(o=!1,!n.position){console.warn("相机控制器未能设置位置,无法启用!");return}if(n.viewDistance===void 0){console.warn("相机控制器未能设置视距,将自动设置视距!");const h=Ye(n.position),f=i.camera.positionWC,p=w.Cartesian3.distance(h,f);n.viewDistance=p}c.Vector.clone(n.position,s),n.offsetHeight&&(s[2]+=n.offsetHeight);const{rotation:a,offsetRotation:l=zi.defaults.offsetRotation}=n,u=[...l];c.Vector.set(r,0,0,0),a&&(n.relativeRotation??zi.defaults.relativeRotation)&&(c.Vector.add(a,r,r),u[0]+=90),c.Vector.add(u,r,r);const A={distance:n.viewDistance,heading:r[0],pitch:r[1],flyDuration:0,hDelta:0,pDelta:0};e.flyTo(A,s)})),e.incrementDisabledInputStack(),this.d(()=>{e.decrementDisabledInputStack()}),this.d(e.pointerMoveEvent.don(a=>{const l=a==null?void 0:a.pointerEvent;if(l&&n.enabledRotationInput&&(l.buttons===1||l.buttons===2)){const{movementX:u,movementY:A}=l;n.offsetRotation=c.Vector.add(n.offsetRotation??zi.defaults.offsetRotation,[u*.2,A*-.2,0])}})),this.d(e.wheelEvent.don(a=>{if(!n.enabledScaleInput)return;const l=a.deltaY,A=Math.max(1,n.viewDistance)*(l*.001);n.viewDistance=n.viewDistance+A}))}}class zi extends c.Destroyable{constructor(e){super();O(this,"_resetWithCameraEvent",this.dv(new c.Event));const i=e.viewer;if(!i)throw new Error("viewer is undefined");const o=this;let r;const s=()=>{r&&(r.destroy(),r=void 0)};this.d(s);const a=()=>{s(),o.enabled&&(r=new l3(o,e))};a(),this.d(o.enabledChanged.don(a)),this.d(o.resetWithCameraEvent.don(l=>{if(!e.actived)return;const u=ys(i.camera);if(!u)return;const A=o.rotation;o.offsetRotation=[u[0]-(o.relativeRotation?A[0]:90),u[1]-(o.relativeRotation?A[1]:0),u[2]-(o.relativeRotation?A[2]:0)]}))}get resetWithCameraEvent(){return this._resetWithCameraEvent}resetWithCamera(e){this._resetWithCameraEvent.emit(e)}}O(zi,"defaults",{position:[116.39,39.9,0],rotation:[0,0,0],offsetRotation:[0,-60,0],relativeRotation:!0}),(t=>{t.createDefaultProps=()=>({enabled:!1,showTarget:!1,position:c.reactArrayWithUndefined(void 0),rotation:c.reactArrayWithUndefined(void 0),rotationEditing:!1,viewDistance:1e3,offsetHeight:0,offsetRotation:c.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,relativeRotation:!0})})(zi||(zi={})),c.extendClassProps(zi.prototype,zi.createDefaultProps);class bu extends c.Destroyable{constructor(e){super();O(this,"_geoCameraController");O(this,"_geoPolylinePath");this._geoCameraController=this.dv(new zi(e)),this._geoPolylinePath=this.dv(new aa(e)),this._geoPolylinePath.show=!1,this._geoPolylinePath.currentTime=0;const i=()=>{(this.usePathPosition??!0)&&(this._geoCameraController.position=this._geoPolylinePath.currentPosition),(this.usePathRotation??!0)&&(this._geoCameraController.rotation=this._geoPolylinePath.currentRotation)};i(),this.d(this._geoPolylinePath.currentPositionChanged.don(i)),this.d(this._geoPolylinePath.currentRotationChanged.don(i)),this.dispose(c.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dispose(c.bind([this._geoCameraController,"viewDistance"],[this,"viewDistance"])),this.dispose(c.bind([this._geoCameraController,"offsetHeight"],[this,"offsetHeight"])),this.dispose(c.bind([this._geoCameraController,"offsetRotation"],[this,"offsetRotation"])),this.dispose(c.track([this._geoCameraController,"enabledRotationInput"],[this,"enabledRotationInput"])),this.dispose(c.track([this._geoCameraController,"enabledScaleInput"],[this,"enabledScaleInput"])),this.dv(new c.ObjResettingWithEvent(this.lineModeChanged,()=>{if(this.lineMode!==void 0){if(this.lineMode==="auto")return new u3(this,e);if(this.lineMode==="manual")return new c3(this,e)}}))}get geoCameraController(){return this._geoCameraController}get polylinePath(){return this._geoPolylinePath}get position(){return this._geoCameraController.position}get positionChanged(){return this._geoCameraController.positionChanged}get rotation(){return this._geoCameraController.rotation}get roataionChanged(){return this._geoCameraController.rotationChanged}}(t=>{t.createDefaultProps=()=>({enabled:!1,usePathPosition:!0,usePathRotation:!0,viewDistance:1e3,offsetHeight:0,offsetRotation:c.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,lineMode:void 0})})(bu||(bu={})),c.extendClassProps(bu.prototype,bu.createDefaultProps);class u3 extends c.Destroyable{constructor(n,e){if(super(),!e.viewer)throw new Error("viewer is undefined");n.offsetRotation=[-90,0,0]}}class c3 extends c.Destroyable{constructor(n,e){if(super(),!e.viewer)throw new Error("viewer is undefined");const o=r=>{(r.key==="w"||r.key==="s")&&(n.polylinePath.playing=r.type==="keydown",n.polylinePath.speed=r.key==="w"||r.type==="keyup"?1:-1)};this.dispose(e.keyDownEvent.don(o)),this.dispose(e.keyUpEvent.don(o))}}class h3 extends c.Destroyable{constructor(n,e){super();const i=e.positionPropertyName??"position",o=e.positionChangedPropertyName??i+"Changed",r=e.rotationPropertyName??"rotation",s=e.rotationChangedPropertyName??r+"Changed",a=(e.positionTracking??!0)&&Reflect.has(n,i)&&Reflect.has(n,o),l=(e.rotationTracking??!0)&&Reflect.has(n,r)&&Reflect.has(n,s);if(!(!a&&!l)){if(a){const u=()=>{e.geoCameraController.position=n[i]};u();const A=n[o];this.d(A.don(u))}if(l){const u=()=>{e.geoCameraController.rotation=n[r]};u();const A=n[o];this.d(A.don(u))}}}}class A3 extends c.Destroyable{constructor(n,e){super();const i=this.dv(new c.ESSceneObjectWithId);i.id=n;const o=this.dv(c.createNextAnimateFrameEvent(e.enabledChanged,e.positionTrackingChanged,e.rotationTrackingChanged,e.positionPropertyNameChanged,e.positionChangedPropertyNameChanged,e.rotationPropertyNameChanged,e.rotationChangedPropertyNameChanged,i.sceneObjectChanged));this.disposeVar(new c.ObjResettingWithEvent(o,()=>{const{sceneObject:r}=i;if(!(!e.enabled||!r))return new h3(r,e)}))}}class xu extends c.Destroyable{constructor(e){super();O(this,"_geoCameraController");this._geoCameraController=this.dv(new zi(e)),this.d(c.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dv(new c.ObjResettingWithEvent(this.sceneObjectIdChanged,()=>{if(this.sceneObjectId)return new A3(this.sceneObjectId,this)}))}get geoCameraController(){return this._geoCameraController}}(t=>{t.createDefaultProps=()=>({enabled:void 0,sceneObjectId:void 0,positionTracking:void 0,rotationTracking:void 0,positionPropertyName:void 0,positionChangedPropertyName:void 0,rotationPropertyName:void 0,rotationChangedPropertyName:void 0})})(xu||(xu={})),c.extendClassProps(xu.prototype,xu.createDefaultProps);class f3 extends c.Destroyable{constructor(e){super();O(this,"height",1e7);O(this,"cycle",60);O(this,"latitude",6.632251044444445);O(this,"_running",!1);O(this,"_sseh");O(this,"_eventDisposer");O(this,"leftDownCancel",!0);this._viewer=e,this._sseh=this.dv(new w.ScreenSpaceEventHandler(this._viewer.canvas)),this._sseh.setInputAction(()=>{this.leftDownCancel&&this.cancel()},w.ScreenSpaceEventType.LEFT_DOWN),this.d(()=>{this.cancel()})}get viewer(){return this._viewer}get sseh(){return this._sseh}start(){if(this._running)return;const e=this._viewer.camera,i=e.positionCartographic;e.flyTo({destination:w.Cartesian3.fromRadians(i.longitude,this.latitude,this.height),orientation:{heading:0,pitch:-.5*w.Math.PI,roll:0},complete:()=>{this._running=!0;var o=void 0;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((r,s)=>{if(!o){o=new Date().getTime();return}const a=(new Date().getTime()-o)/1e3,l=e.positionCartographic.longitude+a*w.Math.PI*2/this.cycle;e.setView({destination:w.Cartesian3.fromRadians(l,this.latitude,this.height),orientation:{heading:0,pitch:-.5*w.Math.PI,roll:0}}),o=new Date().getTime()})},duration:.5})}cancel(){this._running&&(this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1)}}class p3 extends c.Destroyable{constructor(e){super();O(this,"_height",this.dv(c.react(1e7)));O(this,"_cycle",this.dv(c.react(60)));O(this,"_latitude",this.dv(c.react(38)));O(this,"_inner");this._czmViewer=e;const i=this._czmViewer.viewer;if(!i)throw new Error("未初始化viewer");this._inner=this.dv(new f3(i)),this._inner.leftDownCancel=!1;{const o=()=>{this._inner.height=this.height,this._inner.cycle=this.cycle,this._inner.latitude=this.latitude*Math.PI/180};o(),this.d(this.heightChanged.don(o)),this.d(this.cycleChanged.don(o)),this.d(this.latitudeChanged.don(o))}}get height(){return this._height.value}set height(e){this._height.value=e}get heightChanged(){return this._height.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get latitude(){return this._latitude.value}set latitude(e){this._latitude.value=e}get latitudeChanged(){return this._latitude.changed}get inner(){return this._inner}start(){return this._inner.start()}cancel(){return this._inner.cancel()}}class d3 extends c.Destroyable{constructor(e){super();O(this,"_position",this.dv(c.reactArrayWithUndefined(void 0)));O(this,"_distance",this.dv(c.react(5e4)));O(this,"_cycle",this.dv(c.react(60)));O(this,"_heading",this.dv(c.react(0)));O(this,"_pitch",this.dv(c.react(-30)));O(this,"_transform");O(this,"_headingRadius");O(this,"_pitchRadius");O(this,"_running",!1);O(this,"_sseh");O(this,"_eventDisposer");this._viewer=e;const i=this.viewer.scene,o=this.viewer.camera;this._sseh=this.dv(new w.ScreenSpaceEventHandler(this.viewer.canvas)),this.d(()=>{this.cancel()});{const r=()=>{let s;if(this.position==null){var a=o.getPickRay(new w.Cartesian2(i.canvas.width*.5,i.canvas.height*.5));if(!a)return;s=i.globe.pick(a,i)}else s=w.Cartesian3.fromDegrees(...this.position);s&&(this._transform=w.Transforms.eastNorthUpToFixedFrame(s),this.start())};r(),this.d(this.positionChanged.don(r))}{const r=()=>{this._headingRadius=w.Math.toRadians(this.heading)};r(),this.d(this.headingChanged.don(r))}{const r=()=>{this._pitchRadius=w.Math.toRadians(this.pitch)};r(),this.d(this.pitchChanged.don(r))}}get viewer(){return this._viewer}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get distance(){return this._distance.value}set distance(e){this._distance.value=e}get distanceChanged(){return this._distance.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get heading(){return this._heading.value}set heading(e){this._heading.value=e}get headingChanged(){return this._heading.changed}get pitch(){return this._pitch.value}set pitch(e){this._pitch.value=e}get pitchChanged(){return this._pitch.changed}get sseh(){return this._sseh}start(){if(this._running)return;const e=this.viewer.camera;e.lookAtTransform(this._transform);var i=this.distance*Math.sin(this._pitchRadius),o=this.distance*Math.cos(this._pitchRadius),r=new w.Cartesian3(0,i,o);e.flyTo({destination:w.Matrix4.multiplyByPoint(this._transform,r,new w.Cartesian3),orientation:{heading:this._headingRadius,pitch:this._pitchRadius,roll:0},endTransform:this._transform,complete:()=>{this._running=!0;let s;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((a,l)=>{if(!s){s=new Date().getTime();return}const u=(new Date().getTime()-s)/1e3;this._headingRadius+=u*w.Math.PI*2/this.cycle,e.lookAtTransform(this._transform,new w.HeadingPitchRange(this._headingRadius,this._pitchRadius,this.distance)),s=new Date().getTime()})},duration:.5,maximumHeight:e.positionCartographic.height})}cancel(){if(!this._running)return;this.viewer.camera.lookAtTransform(w.Matrix4.IDENTITY),this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1}}class g3 extends c.Destroyable{constructor(e){super();O(this,"_position",this.dv(c.reactArrayWithUndefined(void 0)));O(this,"_distance",this.dv(c.react(5e4)));O(this,"_cycle",this.dv(c.react(60)));O(this,"_heading",this.dv(c.react(0)));O(this,"_pitch",this.dv(c.react(-30)));O(this,"_inner");this._czmViewer=e;const i=this._czmViewer.viewer;if(!i)throw new Error("viewer is undefined");this._inner=this.dv(new d3(i));{const o=()=>{this.inner.distance=this.distance,this.inner.cycle=this.cycle,this.inner.position=this.position,this.inner.heading=this.heading,this.inner.pitch=this.pitch};o(),this.d(this.distanceChanged.don(o)),this.d(this.cycleChanged.don(o)),this.d(this.positionChanged.don(o)),this.d(this.headingChanged.don(o)),this.d(this.pitchChanged.don(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get distance(){return this._distance.value}set distance(e){this._distance.value=e}get distanceChanged(){return this._distance.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get heading(){return this._heading.value}set heading(e){this._heading.value=e}get headingChanged(){return this._heading.changed}get pitch(){return this._pitch.value}set pitch(e){this._pitch.value=e}get pitchChanged(){return this._pitch.changed}get inner(){return this._inner}start(){return this._inner.start()}cancel(){return this._inner.cancel()}}class m3 extends c.Destroyable{constructor(e){super();O(this,"_firstPersonController");O(this,"_rotateGlobe");O(this,"_rotatePoint");O(this,"_followController");O(this,"_pathCameraController");O(this,"_handler");this._viewer=e;{this._firstPersonController=this.dv(new a3(e)),this.d(this._viewer.keyDownEvent.don(i=>this._firstPersonController.keyboardCameraController.keyDown(i))),this.d(this._viewer.keyUpEvent.don(i=>this._firstPersonController.keyboardCameraController.keyUp(i)));{const{subContainer:i}=this._viewer;if(!i)throw new Error("_firstPersonControllerInit error!");const o=()=>this._firstPersonController.keyboardCameraController.abort();i.addEventListener("blur",o,!1),this.d(()=>i.removeEventListener("blur",o,!1))}this._firstPersonController.keyboardEnabled=!1,this._firstPersonController.mouseEnabled=!1,this._firstPersonController.keyboardCameraController.speed=.006,this._firstPersonController.keyboardCameraController.rotateSpeed=.05,this._firstPersonController.keyboardCameraController.alwaysWithCamera=!1,this._firstPersonController.keyboardCameraController.keyStatusMap=$f.defaultKeyStatusMap,this.d(this._firstPersonController.keyboardEnabledChanged.don(()=>{var i;(i=this._viewer.subContainer)==null||i.focus()}))}this._rotateGlobe=this.dv(new p3(e)),this._rotatePoint=this.dv(new g3(e)),this._followController=this.dv(new xu(e)),this._pathCameraController=this.dv(new bu(e))}get firstPersonController(){return this._firstPersonController}get rotateGlobe(){return this._rotateGlobe}get rotatePoint(){return this._rotatePoint}get followController(){return this._followController}get pathCameraController(){return this._pathCameraController}resetNavigation(){this._firstPersonController.keyboardEnabled=!1,this._rotateGlobe.cancel(),this._rotatePoint.cancel(),this._followController.enabled=!1,this._followController.sceneObjectId=void 0,this._followController.geoCameraController.offsetRotation=[-90,0,0],this._followController.geoCameraController.viewDistance=0,this._pathCameraController.enabled=!1,this._pathCameraController.polylinePath.playing=!1,this._pathCameraController.polylinePath.currentTime=0,this._pathCameraController.polylinePath.loop=!1,this._pathCameraController.geoCameraController.offsetHeight=0,this._pathCameraController.polylinePath.positions=void 0,this._pathCameraController.lineMode=void 0}changeToMap(){this.resetNavigation(),this._changedMouseEvent("Map")}changeToWalk(e,i=4.2,o=1.6){this.resetNavigation();const r=this._viewer.navigationMode!="Walk";this._changedMouseEvent("Walk");const s=this._viewer.getCameraInfo(),a=[(s==null?void 0:s.rotation[0])??0,0,0];this._viewer.getHeightByLonLat(e[0],e[1]).then(l=>{r?this._viewer.flyIn([e[0],e[1],(l??0)+o],a):this._viewer.viewer&&(this._viewer.viewer.camera.position=w.Cartesian3.fromDegrees(e[0],e[1],(l??0)+o)),this.firstPersonController.keyboardEnabled=!0,this.firstPersonController.keyboardCameraController.speed=.006,this.firstPersonController.keyboardCameraController.rotateSpeed=.05,this.firstPersonController.keyboardCameraController.keyStatusMap={ShiftLeft:"WithCamera",ShiftRight:"WithCamera",KeyW:"MoveForward",KeyS:"MoveBackword",KeyA:"MoveLeft",KeyD:"MoveRight",ArrowUp:"MoveForward",ArrowDown:"MoveBackword",ArrowLeft:"RotateLeft",ArrowRight:"RotateRight",KeyR:"SpeedUp",KeyF:"SpeedDown",KeyQ:"SwitchAlwaysWithCamera"}})}changeToRotateGlobe(e=38,i=1e7,o=60){this.resetNavigation(),this._changedMouseEvent("RotateGlobe"),this._rotateGlobe.latitude=e,this._rotateGlobe.height=i,this._rotateGlobe.cycle=o,this._rotateGlobe.start()}changeToRotatePoint(e,i=5e4,o=60,r=0,s=-30){this.resetNavigation(),this._changedMouseEvent("RotatePoint"),this._rotatePoint.position=e,this._rotatePoint.distance=i,this._rotatePoint.cycle=o,this._rotatePoint.heading=r,this._rotatePoint.pitch=s,this._rotatePoint.start()}changeToFollow(e,i=0,o=0,r=-30,s=!0){this.resetNavigation(),this._changedMouseEvent("Follow"),this._followController.sceneObjectId=e,this._followController.geoCameraController.offsetRotation=[o,r,0],this._followController.geoCameraController.relativeRotation=s,i!==0?this._followController.geoCameraController.viewDistance=i:this._followController.geoCameraController.viewDistance=1e3,this._followController.enabled=!0}changeToLine(e,i=10,o=10,r=!0,s=10,a="auto"){this.resetNavigation(),this._changedMouseEvent("Line");const l=a==="auto",u=c.ESSceneObject.getSceneObjById(e);if(!u)return;const{points:A}=u;if(!A)return;const h=c.getDistancesFromPositions(A,"NONE"),f=h[h.length-1];this._pathCameraController.viewDistance=0,this._pathCameraController.polylinePath.positions=[...A],this._pathCameraController.polylinePath.duration=f/i*1e3,this._pathCameraController.polylinePath.loop=r,this._pathCameraController.offsetHeight=o;const p=m0(A);this._pathCameraController.polylinePath.rotationRadius=!l||p==!1?[0]:p.map(d=>d/s*i),this._pathCameraController.enabledRotationInput=!l,this._pathCameraController.enabledScaleInput=!1,this._pathCameraController.polylinePath.playing=l,this._pathCameraController.lineMode=a,this._pathCameraController.enabled=!0}_changedMouseEvent(e){const i=this._viewer.viewer;if(!i)return;this._handler||(this._handler=new w.ScreenSpaceEventHandler(i.scene.canvas));const o=this._handler,r=i.scene.screenSpaceCameraController;this.d(()=>{o&&pE(o)}),e=="Walk"||e=="RotateGlobe"?(r.lookEventTypes=void 0,r.rotateEventTypes=void 0,r.tiltEventTypes=void 0,r.zoomEventTypes=void 0,r.translateEventTypes=void 0,o&&e=="Walk"&&(o.setInputAction(s=>{o.setInputAction(a=>{Lv(i.scene,a,r)},w.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(a=>{o.removeInputAction(w.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(w.ScreenSpaceEventType.LEFT_UP)},w.ScreenSpaceEventType.LEFT_UP)},w.ScreenSpaceEventType.LEFT_DOWN),o.setInputAction(s=>{o.setInputAction(a=>{Lv(i.scene,a,r)},w.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(a=>{o.removeInputAction(w.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(w.ScreenSpaceEventType.RIGHT_UP)},w.ScreenSpaceEventType.RIGHT_UP)},w.ScreenSpaceEventType.RIGHT_DOWN),o.setInputAction(s=>{o.setInputAction(a=>{Lv(i.scene,a,r)},w.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(a=>{o.removeInputAction(w.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(w.ScreenSpaceEventType.MIDDLE_UP)},w.ScreenSpaceEventType.MIDDLE_UP)},w.ScreenSpaceEventType.MIDDLE_DOWN))):(o&&pE(o),r.lookEventTypes=w.CameraEventType.RIGHT_DRAG,r.rotateEventTypes=w.CameraEventType.LEFT_DRAG,r.tiltEventTypes=[w.CameraEventType.MIDDLE_DRAG,w.CameraEventType.PINCH,{eventType:w.CameraEventType.LEFT_DRAG,modifier:w.KeyboardEventModifier.CTRL},{eventType:w.CameraEventType.RIGHT_DRAG,modifier:w.KeyboardEventModifier.CTRL}],r.translateEventTypes=w.CameraEventType.LEFT_DRAG,r.zoomEventTypes=[w.CameraEventType.WHEEL,w.CameraEventType.PINCH,{eventType:w.CameraEventType.RIGHT_DRAG,modifier:w.KeyboardEventModifier.SHIFT}])}}const y3=[{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3558367297943,39.93163726456884,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30223283037274,39.92688664316035,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.43707387584969,39.922782714050356,3300]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.27929428317248,39.895318074706246,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.36181901056395,39.89720944386167,3553.618347252562]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.40050587550184,39.87565113086582,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.31629153797958,39.88888615917464,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.38662084727662,39.93026695192356,5222.983612030221]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.35985958294472,39.879559968940974,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30061281533665,39.86521469244785,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.33589491695909,39.85251691437225,3400]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3978491755026,39.92191230041099,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.404556165088,39.901554635269065,3400]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3371677114933,39.90666589456628,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30329238580244,39.90598342431921,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.25047545555285,39.927295935589235,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.33129680063607,39.98205319015022,5500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.38241622722414,39.864780790627634,5800]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.24126681456984,39.85629130246847,6e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.4476299820832,39.9015287845667,5233.181711832771]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.33116617802452,39.824241891065384,6e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.15206905891218,39.90872966468676,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.24197212869294,39.88630968655299,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.43381133281572,39.96058832885812,5700]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.21635435523064,39.966450178376924,7e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.17908072725879,39.87211951629164,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.32516866705241,39.94534681561764,3300]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.36086721251684,39.948381883306446,3400]}];class v3 extends c.Destroyable{constructor(e){super();O(this,"_show",this.dv(c.react(!1)));O(this,"cloudsPostProcess");const i=e.viewer;if(!i)throw new Error("Cesium Viewer is not initialized");const o=new w.CloudCollection;i.scene.primitives.add(o),this.dispose(()=>i.scene.primitives.remove(o));{const r=()=>{o.show=this.show};r(),this.dispose(this.showChanged.disposableOn(r))}{const r=a=>({slice:a.slice,brightness:a.brightness,scale:Ze(a.scale),maximumSize:ri(a.maximumSize),color:Be(a.color),position:Ye(a.position)});(()=>{o.removeAll();for(let a of y3)o.add(r(a))})()}}get show(){return this._show.value}set show(e){this._show.value=e}get showChanged(){return this._show.changed}}class _u extends c.Destroyable{constructor(n){super();const e=n.viewer;if(!e){console.warn("viewer is undefined!");return}const i=e.scene.postProcessStages.add(w.PostProcessStageLibrary.createDepthOfFieldStage());this.d(()=>e.scene.postProcessStages.remove(i));{const o=()=>{i.enabled=this.show};o(),this.d(this.showChanged.don(o))}{const o=()=>{i.uniforms.fogByDistance=this.focalDistance};o(),this.d(this.focalDistanceChanged.don(o))}{const o=()=>{i.uniforms.delta=this.delta};o(),this.d(this.deltaChanged.don(o))}{const o=()=>{i.uniforms.sigma=this.sigma};o(),this.d(this.sigmaChanged.don(o))}{const o=()=>{i.uniforms.stepSize=this.stepSize};o(),this.d(this.stepSizeChanged.don(o))}}}(t=>{t.createDefaultProps=()=>({show:!1,focalDistance:87,delta:1,sigma:3.78,stepSize:2.46})})(_u||(_u={})),c.extendClassProps(_u.prototype,_u.createDefaultProps);const w3=`
|
|
3848
3848
|
float getDistance(sampler2D depthTexture, vec2 texCoords)
|
|
3849
3849
|
{
|
|
@@ -4143,10 +4143,10 @@ async function initCesiumViewer(container, czmViewer) {
|
|
|
4143
4143
|
`;function c9(){const t="https://gitee.com/mirrors/CesiumJS/blob/main/packages/engine/Source/Core/Ion.js#L7",e=` 因浏览器同源策略限制,需要用户自行打开网址获取最新的token,点击确定自动打开网址,请不要拦截!
|
|
4144
4144
|
github地址:https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/Core/Ion.js#L7
|
|
4145
4145
|
gitee地址:${t}
|
|
4146
|
-
`;console.log(e);const i=window.prompt(e,t);i&&window.open(i,"_blank")}const Wt=class Wt extends c.ESViewer{constructor(e){super(e);O(this,"_disabledInputStack",this.disposeVar(c.react(0)));O(this,"_viewer",this.dv(c.react(void 0)));O(this,"_viewerInstance");O(this,"_viewerLegend");O(this,"pickCustomAttachedInfo");O(this,"_fps",this.dv(c.react(0)));O(this,"_notSupportEditingCount",this.disposeVar(c.react(0)));O(this,"_editingSystem",qf);O(this,"_moveObjectsProcess",this.ad(LS()));if(e.type!=="ESCesiumViewer")throw new Error("option.type must be ESCesiumViewer");this.ad(new BV(this)),this.ad(new TV(this)),this.dv(new c.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new DV(this)})),this._viewerLegend=this.dv(new r9(this)),this._viewerInstance=this.dv(new c.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new Qv(this,this.viewer)})),this.d(this.viewerChanged.don(o=>{this.viewer&&(this.viewer.scene.globe.baseColor=Be([1,1,1,1]))}));const i=e;this.d(this._viewer.changed.don(o=>{this.viewerChanged.emit(o)})),this.dv(new c.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new MH(this.subContainer,this,o=>this._viewer.value=o,i.options)}))}get disabledInputStack(){return this._disabledInputStack.value}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Mt(this.viewer)}get viewerInstance(){return this._viewerInstance}get viewerLegend(){return this._viewerLegend}async pick(e,i,o){if(!this.extensions)return;const{pickingManager:r}=this.extensions;return await r.pick(e,void 0,i)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.quickPickPosition(e)}async getTerrainHeight(e){const{viewer:i}=this;if(!i)return;const o=w.Cartographic.fromDegrees(e[0],e[1],e[2],Wt.getHeightsScartchCarto);return i.scene.globe.getHeight(o)}getCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Mn(e),rotation:ys(e)}}calcFlyToParam(e){if(!this.viewer)return;const{camera:i}=this.viewer;if(!i||!e)return;const o=w.Cartesian3.fromDegrees(...e),r=w.Transforms.eastNorthUpToFixedFrame(o),s=w.Matrix4.inverse(r,new w.Matrix4),a=w.Matrix4.multiplyByPoint(s,i.positionWC,new w.Cartesian3),l=w.Cartesian3.magnitude(a);let u=-Math.asin(a.z/l);u=w.Math.toDegrees(u);let A=w.Math.PI_OVER_TWO-Math.atan(a.y/a.x);a.x>0&&(A+=a.y<0?-w.Math.PI:w.Math.PI),A=w.Math.toDegrees(A);const h=ys(i),f=h[0]-A,p=h[1]-u;return{distance:l,heading:A,pitch:u,flyDuration:1,hDelta:f,pDelta:p}}flyIn(e,i,o,r="default"){var l;const s={position:e,rotation:i,duration:(o??1)*1e3},a=(l=this.viewer)==null?void 0:l.camera;return a&&sl(a,s,r)}flyTo(e,i,o="default"){var p;const{distance:r,heading:s,pitch:a,flyDuration:l,hDelta:u,pDelta:A}=e,h={position:i,viewDistance:r,rotation:[s,a,0],duration:l*1e3,hdelta:u,pdelta:A},f=(p=this.viewer)==null?void 0:p.camera;return f&&sl(f,h,o)}flyToBoundingSphere(e,i,o=1){var h;const r=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],s=c.getGeoBoundingSphereFromPositions(r);if(!s)return;const{center:a,radius:l}=s,u={position:a,viewDistance:i??l,rotation:[0,-90,0],duration:o*1e3},A=(h=this.viewer)==null?void 0:h.camera;return A&&sl(A,u)}getCurrentCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Mn(e),rotation:ys(e)}}transformFlyParam(e,i){if("position"in i){const o=w.Cartesian3.fromDegrees(...e),r=w.Transforms.eastNorthUpToFixedFrame(o),s=w.Matrix4.inverse(r,new w.Matrix4),a=w.Matrix4.multiplyByPoint(s,Ye(i.position),new w.Cartesian3),l=w.Cartesian3.magnitude(a);let u=-Math.asin(a.z/l);u=w.Math.toDegrees(u);let A=w.Math.PI_OVER_TWO-Math.atan(a.y/a.x);a.x>0&&(A+=a.y<0?-w.Math.PI:w.Math.PI),A=w.Math.toDegrees(A);const h=i.rotation[0]-A,f=i.rotation[1]-u;return{distance:l,heading:A,pitch:u,flyDuration:i.flyDuration??1,hDelta:h,pDelta:f}}else{const o=Ye(e);let r={heading:w.Math.toRadians(i.heading),pitch:w.Math.toRadians(i.pitch),roll:0};const s=new w.HeadingPitchRoll;if(i.distance){s.heading=r.heading,s.pitch=r.pitch,s.roll=0,s.heading-=w.Math.PI_OVER_TWO;const l=w.Transforms.headingPitchRollToFixedFrame(o,s,void 0,void 0),u=w.Matrix4.multiplyByPointAsVector(l,w.Cartesian3.UNIT_X,new w.Cartesian3);w.Cartesian3.multiplyByScalar(u,i.distance,u),w.Cartesian3.subtract(o,u,o)}i.hDelta&&(r.heading+=w.Math.toRadians(i.hDelta)),i.pDelta&&(r.pitch+=w.Math.toRadians(i.pDelta));const a=De(o);return a?{position:a,rotation:[w.Math.toDegrees(r.heading),w.Math.toDegrees(r.pitch),w.Math.toDegrees(r.roll)],flyDuration:i.flyDuration??1}:void 0}}getLengthInPixel(){return this._viewerLegend.length}changeToWalk(e,i=4.2,o=1.6){var r,s;(s=(r=this._viewerInstance)==null?void 0:r.obj)==null||s.navigationManager.changeToWalk(e,i,o),this._navigationMode.value="Walk"}changeToMap(){var e,i;(i=(e=this._viewerInstance)==null?void 0:e.obj)==null||i.navigationManager.changeToMap(),this._navigationMode.value="Map"}changeToRotateGlobe(e,i,o){var r,s;(s=(r=this._viewerInstance)==null?void 0:r.obj)==null||s.navigationManager.changeToRotateGlobe(e,i,o),this._navigationMode.value="RotateGlobe"}changeToLine(e,i,o,r,s,a){var l,u;(u=(l=this._viewerInstance)==null?void 0:l.obj)==null||u.navigationManager.changeToLine(e,i,o,r,s,a),this._navigationMode.value="Line"}changeToUserDefined(e){this.changeToMap(),console.warn("Cesium引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,i,o,r,s){var a,l;(l=(a=this._viewerInstance)==null?void 0:a.obj)==null||l.navigationManager.changeToRotatePoint(e,i,o,r,s),this._navigationMode.value="RotatePoint"}changeToFollow(e,i,o,r,s){var a,l;(l=(a=this._viewerInstance)==null?void 0:a.obj)==null||l.navigationManager.changeToFollow(e,i,o,r,s),this._navigationMode.value="Follow"}getFPS(){return this._fps.value}async getBoundSphere(e){return Promise.resolve(void 0)}async getVersion(){const e=window.g_XE3CopyRights??{};return e.cesium={version:w.VERSION},e}async getHeightByLonLat(e,i,o){if(!this.viewer)return null;const r=w.Cartographic.fromDegrees(e,i,void 0,Wt.getHeightsScartchCarto);return this.viewer.scene.sampleHeight(r)??null}async getHeightsByLonLats(e,i){const o=e.map(s=>this.getHeightByLonLat(...s));return await Promise.all(o)}async capture(e,i){if(this.viewer)return await T0(this.viewer.scene,e,i)}async lonLatAltToScreenPosition(e){if(!this.viewer||!this.isPointVisible(e))return;const i=this.viewer.scene.cartesianToCanvasCoordinates(Ye(e));if(i)return[i.x,i.y]}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,i,o){o=Object.assign({useKeyToSwitch:!0,callSource:"outer"},o);const r=e.components.main??e;r&&i!=null&&(r.editingID=`${o.callSource}_${c.createGuid()}`,this._editingSystem.create(this,r,i,o.useKeyToSwitch))}stopEditing(){this._editingSystem.stop()}moveObjects(e){const i=[],o=c.createGuid();for(let r=0;r<e.length;r++){const s=e[r],a=s.components.main??s;a.editingID=o,a&&i.push(a)}this._moveObjectsProcess.restart(void 0,this,i,o)}getCzmObject(e){return this.sceneObjectsMap.get(e)}setCurrentDefaultAccessToken(){this.ionAccessToken=Wt.currentDefaultAccessToken}setLatestDefaultAccessToken(){if(!Wt.latestDefaultAccessToken){alert("Cesium最新的iontoken无法获取!"),console.error("Cesium最新的iontoken无法获取!");return}this.ionAccessToken=Wt.latestDefaultAccessToken}positionsToLocalPositions(e,i){return wn(e,i)}localPositionsToPositions(e,i){return Sr(e,i)}isPointVisible(e){if(!this.viewer)return!1;const i=e instanceof w.Cartesian3?e:Ye(e),o=new w.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.positionWC);if(o.cameraPosition=this.viewer.scene.camera.positionWC,!o.isPointVisible(i))return!1;const r=this.viewer.scene.cartesianToCanvasCoordinates(i);return!(!r||r.x<0||r.y<0)}getESProperties(){const e={...super.getESProperties()},i=Wt.defaults;return{...e,more:[...e.more,new c.GroupProperty([],"通用","通用"),new c.EvalStringProperty([this,"createCesiumViewerFuncStr"],"CesiumViewer创建函数",u9,l9,!0),new c.FunctionProperty([],()=>Wt.getCesiumIonToken(),[],"获取官方token"),new c.FunctionProperty([],()=>this.setCurrentDefaultAccessToken(),[],"重置为当前使用的Cesium版本的token"),new c.FunctionProperty([],()=>this.setLatestDefaultAccessToken(),[],"最新token","重置为当前Cesium官方的最新token"),new c.BooleanProperty([this,"flashLighting"],"头顶灯",i.flashLighting,!0),new c.BooleanProperty([this,"particleGlobalControl"],"粒子全局控制播放",i.particleGlobalControl,!0),new c.GroupProperty([],"Viewer","Viewer"),new c.NumberProperty([this,"resolutionScale"],"分辨率比率",i.resolutionScale,!0),new c.NumberProperty([this,"msaaSamples"],"msaaSamples",i.msaaSamples,!0),new c.BooleanProperty([this,"shadows"]),new c.GroupProperty([],"比例尺","比例尺(Legend)"),new c.NumberProperty([this.viewerLegend,"resolution"],"resolution",void 0,!0,!0),new c.NumberProperty([this.viewerLegend,"zoom"],"zoom",void 0,!0,!0),new c.Number3Property([this.viewerLegend,"center"],"center",void 0,!0,!0),new c.NumberProperty([this.viewerLegend.legend,"lengthInPixels"],"lengthInPixels",100,!0,!1),new c.NumberProperty([this.viewerLegend.legend,"computedLengthInPixels"],"computedLengthInPixels",void 0,!0,!0),new c.NumberProperty([this.viewerLegend.legend,"computedLengthInMeters"],"computedLengthInMeters",void 0,!0,!0),new c.StringProperty([this.viewerLegend.legend,"computedLengthInStr"],"computedLengthInStr",void 0,!0,!0),new c.GroupProperty([],"场景","场景(Scene)"),new c.NumberProperty([this,"sceneSplitPosition"],"内部视口分割比例",i.sceneSplitPosition,!0),new c.GroupProperty([],"Globe","Globe"),new c.EnumProperty([this,"sceneGlobeShadows"],[["禁用","DISABLED"],["启用","ENABLED"],["仅投射","CAST_ONLY"],["仅接收","RECEIVE_ONLY"]],"sceneGlobeShadows",i.sceneGlobeShadows,!0),new c.NumberProperty([this,"sceneGlobeTerrainExaggeration"]),new c.NumberProperty([this,"sceneGlobeTerrainExaggerationRelativeHeight"]),new c.NumberProperty([this,"sceneGlobeVerticalExaggeration"]),new c.NumberProperty([this,"sceneGlobeVerticalExaggerationRelativeHeight"]),new c.BooleanProperty([this,"sceneGlobeBackFaceCulling"]),new c.BooleanProperty([this,"sceneGlobeShowSkirts"]),new c.BooleanProperty([this,"sceneGlobeShowWaterEffect"]),new c.ColorProperty([this,"sceneGlobeBaseColor"]),new c.Number4Property([this,"sceneGlobeCartographicLimitRectangle"]),new c.JsonProperty([this,"sceneGlobeClippingPlanes"]),new c.StringProperty([this,"sceneGlobeClippingPlanesId"]),new c.JsonProperty([this,"sceneGlobeClippingPolygons"]),new c.StringsProperty([this,"sceneGlobeClippingPolygonsId"]),new c.GroupProperty([],"underground","underground"),new c.ColorProperty([this,"sceneGlobeUndergroundColor"],"sceneGlobeUndergroundColor",i.sceneGlobeUndergroundColor,!0),new c.Number4Property([this,"sceneGlobeUndergroundColorAlphaByDistance"],"sceneGlobeUndergroundColorAlphaByDistance",i.sceneGlobeUndergroundColorAlphaByDistance,!0),new c.GroupProperty([],"Translucency","Translucency"),new c.Number4Property([this,"sceneGlobeTranslucencyBackFaceAlphaByDistance"],"背面渐变透明度",i.sceneGlobeTranslucencyBackFaceAlphaByDistance,!0),new c.Number4Property([this,"sceneGlobeTranslucencyFrontFaceAlphaByDistance"],"正面渐变透明度",i.sceneGlobeTranslucencyFrontFaceAlphaByDistance,!0),new c.Number4Property([this,"sceneGlobeTranslucencyRectangle"],"矩形范围",i.sceneGlobeTranslucencyRectangle,!0),new c.GroupProperty([],"Sun","Sun"),new c.BooleanProperty([this,"sun"],"sun",i.sun,!0),new c.NumberProperty([this,"sceneSunGlowFactor"],"sceneSunGlowFactor",i.sceneSunGlowFactor,!0),new c.GroupProperty([],"Moon","Moon"),new c.BooleanProperty([this,"moon"],"moon",i.moon,!0),new c.StringProperty([this,"sceneMoonTextureUrl"],"sceneMoonTextureUrl",i.sceneMoonTextureUrl,!0),new c.BooleanProperty([this,"sceneMoonOnlySunLighting"],"sceneMoonOnlySunLighting",i.sceneMoonOnlySunLighting,!0),new c.GroupProperty([],"SkyBox","SkyBox"),new c.BooleanProperty([this,"sceneSkyBoxShow"]),new c.JsonProperty([this,"sceneSkyBoxSources"],"sceneSkyBoxSources",i.sceneSkyBoxSources,void 0,!0),new c.GroupProperty([],"Background","Background"),new c.BooleanProperty([this,"xbsjUseBackground"]),new c.StringProperty([this,"xbsjBackgroundImageUri"]),new c.ColorProperty([this,"xbsjBackgroundColor"]),new c.GroupProperty([],"SkyAtmosphere","SkyAtmosphere"),new c.JsonProperty([this,"xbsjLocalBoxSources"],"xbsjLocalBoxSources",i.xbsjLocalBoxSources,void 0,!0),new c.ColorProperty([this,"sceneBackgroundColor"]),new c.GroupProperty([],"Fog","Fog"),new c.BooleanProperty([this,"sceneFogEnabled"],"sceneFogEnabled",i.sceneFogEnabled,!0),new c.NumberProperty([this,"sceneFogDensity"],"sceneFogDensity",i.sceneFogDensity,!0),new c.NumberProperty([this,"sceneFogScreenSpaceErrorFactor"],"sceneFogScreenSpaceErrorFactor",i.sceneFogScreenSpaceErrorFactor,!0),new c.NumberProperty([this,"sceneFogMinimumBrightness"],"sceneFogMinimumBrightness",i.sceneFogMinimumBrightness,!0),new c.GroupProperty([],"Sscc","Sscc"),new c.BooleanProperty([this,"sceneSsccEnableInputs"],"sceneSsccEnableInputs",i.sceneSsccEnableInputs,!0),new c.BooleanProperty([this,"sceneSsccEnableCollisionDetection"],"sceneSsccEnableCollisionDetection",i.sceneSsccEnableCollisionDetection,!0),new c.NumberProperty([this,"sceneSsccZoomFactor"],"sceneSsccZoomFactor",i.sceneSsccZoomFactor,!0),new c.NumberProperty([this,"sceneCameraFrustumFov"],"相机广角"),new c.GroupProperty([],"后处理","后处理"),new c.BooleanProperty([this,"scenePpsfxaaEnabled"],"开启FXAA",i.scenePpsfxaaEnabled,!0),new c.GroupProperty([],"环境遮蔽","环境遮蔽"),new c.BooleanProperty([this,"scenePpsAmbientOcclusionEnabled"]),new c.BooleanProperty([this,"scenePpsAmbientOcclusionAmbientOcclusionOnly"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionIntensity"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionBias"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionLengthCap"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionStepSize"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionBlurStepSize"]),new c.GroupProperty([],"Bloom","Bloom"),new c.BooleanProperty([this,"scenePpsBloomEnabled"]),new c.BooleanProperty([this,"scenePpsBloomGlowOnly"]),new c.NumberProperty([this,"scenePpsBloomContrast"]),new c.NumberProperty([this,"scenePpsBloomBrightness"]),new c.NumberProperty([this,"scenePpsBloomDelta"]),new c.NumberProperty([this,"scenePpsBloomSigma"]),new c.NumberProperty([this,"scenePpsBloomStepSize"]),new c.GroupProperty([],"调试","调试"),new c.BooleanProperty([this,"sceneDebugShowFramesPerSecond"],"sceneDebugShowFramesPerSecond",i.sceneDebugShowFramesPerSecond,!0),new c.BooleanProperty([this,"sceneDebugShowCommands"],"sceneDebugShowCommands",i.sceneDebugShowCommands,!0),new c.BooleanProperty([this,"sceneDebugShowFrustums"],"sceneDebugShowFrustums",i.sceneDebugShowFrustums,!0),new c.BooleanProperty([this,"sceneDebugShowFrustumPlanes"],"sceneDebugShowFrustumPlanes",i.sceneDebugShowFrustumPlanes,!0),new c.NumberProperty([this,"sceneDebugShowDepthFrustum"],"sceneDebugShowDepthFrustum",i.sceneDebugShowDepthFrustum,!0),new c.GroupProperty([],"Inspector","Inspector"),new c.BooleanProperty([this,"showCesiumInspector"],"showCesiumInspector",i.showCesiumInspector,!0),new c.BooleanProperty([this,"cesiumInspectorWireframe"],"cesiumInspectorWireframe",i.cesiumInspectorWireframe,!0),new c.BooleanProperty([this,"showCesium3DTilesInspector"],"showCesium3DTilesInspector",i.showCesium3DTilesInspector,!0)]}}};O(Wt,"type",Wt.register("ESCesiumViewer",Wt)),O(Wt,"getCesiumIonToken",c9),O(Wt,"currentDefaultAccessToken",w.Ion.defaultAccessToken),O(Wt,"latestDefaultAccessToken"),O(Wt,"ObjectsToExcludeWrapper",MV),O(Wt,"defaults",{...c.ESViewer.defaults,flashLighting:!1,resolutionScale:1,msaaSamples:4,sceneSplitPosition:0,sceneGlobeShadows:"RECEIVE_ONLY",sceneGlobeUndergroundColor:[0,0,0,1],sceneGlobeUndergroundColorAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyBackFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyFrontFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyRectangle:[-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966].map(e=>180*e/Math.PI),sun:!0,sceneSunGlowFactor:1,moon:!0,sceneMoonTextureUrl:w.buildModuleUrl("Assets/Textures/moonSmall.jpg"),sceneMoonOnlySunLighting:!0,sceneSkyBoxSources:{positiveX:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_px.jpg"),negativeX:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mx.jpg"),positiveY:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_py.jpg"),negativeY:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_my.jpg"),positiveZ:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_pz.jpg"),negativeZ:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mz.jpg")},xbsjLocalBoxSources:{positiveX:"${earthsdk3-assets-script-dir}/assets/img/skybox/east.jpg",negativeX:"${earthsdk3-assets-script-dir}/assets/img/skybox/west.jpg",positiveY:"${earthsdk3-assets-script-dir}/assets/img/skybox/bottom.jpg",negativeY:"${earthsdk3-assets-script-dir}/assets/img/skybox/top.jpg",positiveZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/north.jpg",negativeZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/south.jpg"},sceneFogEnabled:!0,sceneFogDensity:2e-4,sceneFogScreenSpaceErrorFactor:2,sceneFogMinimumBrightness:.03,sceneSsccEnableInputs:!0,sceneSsccEnableCollisionDetection:!0,sceneSsccZoomFactor:5,scenePpsfxaaEnabled:!0,sceneDebugShowFramesPerSecond:!1,sceneDebugShowCommands:!1,sceneDebugShowFrustums:!1,sceneDebugShowFrustumPlanes:!1,sceneDebugShowDepthFrustum:1,showCesiumInspector:!1,cesiumInspectorWireframe:!1,showCesium3DTilesInspector:!1,particleGlobalControl:!1}),O(Wt,"getHeightsScartchCarto",new w.Cartographic);let at=Wt;(t=>{t.createDefaultProps=()=>({...c.ESViewer.createDefaultProps(),...a9()})})(at||(at={})),c.extendClassProps(at.prototype,at.createDefaultProps),ne.copyright=void 0;try{const t="earthsdk3-cesium",n="3.6.2",e="2025-12-04T02:08:23.000Z",i="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="b951704c9cc2a53b6d53468e08f41aec0794d4c0",a=((Date.now()-1764814103e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${n}.${r.slice(0,8)}.${e} (距今${a}个小时)
|
|
4146
|
+
`;console.log(e);const i=window.prompt(e,t);i&&window.open(i,"_blank")}const Wt=class Wt extends c.ESViewer{constructor(e){super(e);O(this,"_disabledInputStack",this.disposeVar(c.react(0)));O(this,"_viewer",this.dv(c.react(void 0)));O(this,"_viewerInstance");O(this,"_viewerLegend");O(this,"pickCustomAttachedInfo");O(this,"_fps",this.dv(c.react(0)));O(this,"_notSupportEditingCount",this.disposeVar(c.react(0)));O(this,"_editingSystem",qf);O(this,"_moveObjectsProcess",this.ad(LS()));if(e.type!=="ESCesiumViewer")throw new Error("option.type must be ESCesiumViewer");this.ad(new BV(this)),this.ad(new TV(this)),this.dv(new c.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new DV(this)})),this._viewerLegend=this.dv(new r9(this)),this._viewerInstance=this.dv(new c.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new Qv(this,this.viewer)})),this.d(this.viewerChanged.don(o=>{this.viewer&&(this.viewer.scene.globe.baseColor=Be([1,1,1,1]))}));const i=e;this.d(this._viewer.changed.don(o=>{this.viewerChanged.emit(o)})),this.dv(new c.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new MH(this.subContainer,this,o=>this._viewer.value=o,i.options)}))}get disabledInputStack(){return this._disabledInputStack.value}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Mt(this.viewer)}get viewerInstance(){return this._viewerInstance}get viewerLegend(){return this._viewerLegend}async pick(e,i,o){if(!this.extensions)return;const{pickingManager:r}=this.extensions;return await r.pick(e,void 0,i)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:i}=this.extensions;return await i.quickPickPosition(e)}async getTerrainHeight(e){const{viewer:i}=this;if(!i)return;const o=w.Cartographic.fromDegrees(e[0],e[1],e[2],Wt.getHeightsScartchCarto);return i.scene.globe.getHeight(o)}getCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Mn(e),rotation:ys(e)}}calcFlyToParam(e){if(!this.viewer)return;const{camera:i}=this.viewer;if(!i||!e)return;const o=w.Cartesian3.fromDegrees(...e),r=w.Transforms.eastNorthUpToFixedFrame(o),s=w.Matrix4.inverse(r,new w.Matrix4),a=w.Matrix4.multiplyByPoint(s,i.positionWC,new w.Cartesian3),l=w.Cartesian3.magnitude(a);let u=-Math.asin(a.z/l);u=w.Math.toDegrees(u);let A=w.Math.PI_OVER_TWO-Math.atan(a.y/a.x);a.x>0&&(A+=a.y<0?-w.Math.PI:w.Math.PI),A=w.Math.toDegrees(A);const h=ys(i),f=h[0]-A,p=h[1]-u;return{distance:l,heading:A,pitch:u,flyDuration:1,hDelta:f,pDelta:p}}flyIn(e,i,o,r="default"){var l;const s={position:e,rotation:i,duration:(o??1)*1e3},a=(l=this.viewer)==null?void 0:l.camera;return a&&sl(a,s,r)}flyTo(e,i,o="default"){var p;const{distance:r,heading:s,pitch:a,flyDuration:l,hDelta:u,pDelta:A}=e,h={position:i,viewDistance:r,rotation:[s,a,0],duration:l*1e3,hdelta:u,pdelta:A},f=(p=this.viewer)==null?void 0:p.camera;return f&&sl(f,h,o)}flyToBoundingSphere(e,i,o=1){var h;const r=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],s=c.getGeoBoundingSphereFromPositions(r);if(!s)return;const{center:a,radius:l}=s,u={position:a,viewDistance:i??l,rotation:[0,-90,0],duration:o*1e3},A=(h=this.viewer)==null?void 0:h.camera;return A&&sl(A,u)}getCurrentCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Mn(e),rotation:ys(e)}}transformFlyParam(e,i){if("position"in i){const o=w.Cartesian3.fromDegrees(...e),r=w.Transforms.eastNorthUpToFixedFrame(o),s=w.Matrix4.inverse(r,new w.Matrix4),a=w.Matrix4.multiplyByPoint(s,Ye(i.position),new w.Cartesian3),l=w.Cartesian3.magnitude(a);let u=-Math.asin(a.z/l);u=w.Math.toDegrees(u);let A=w.Math.PI_OVER_TWO-Math.atan(a.y/a.x);a.x>0&&(A+=a.y<0?-w.Math.PI:w.Math.PI),A=w.Math.toDegrees(A);const h=i.rotation[0]-A,f=i.rotation[1]-u;return{distance:l,heading:A,pitch:u,flyDuration:i.flyDuration??1,hDelta:h,pDelta:f}}else{const o=Ye(e);let r={heading:w.Math.toRadians(i.heading),pitch:w.Math.toRadians(i.pitch),roll:0};const s=new w.HeadingPitchRoll;if(i.distance){s.heading=r.heading,s.pitch=r.pitch,s.roll=0,s.heading-=w.Math.PI_OVER_TWO;const l=w.Transforms.headingPitchRollToFixedFrame(o,s,void 0,void 0),u=w.Matrix4.multiplyByPointAsVector(l,w.Cartesian3.UNIT_X,new w.Cartesian3);w.Cartesian3.multiplyByScalar(u,i.distance,u),w.Cartesian3.subtract(o,u,o)}i.hDelta&&(r.heading+=w.Math.toRadians(i.hDelta)),i.pDelta&&(r.pitch+=w.Math.toRadians(i.pDelta));const a=De(o);return a?{position:a,rotation:[w.Math.toDegrees(r.heading),w.Math.toDegrees(r.pitch),w.Math.toDegrees(r.roll)],flyDuration:i.flyDuration??1}:void 0}}getLengthInPixel(){return this._viewerLegend.length}changeToWalk(e,i=4.2,o=1.6){var r,s;(s=(r=this._viewerInstance)==null?void 0:r.obj)==null||s.navigationManager.changeToWalk(e,i,o),this._navigationMode.value="Walk"}changeToMap(){var e,i;(i=(e=this._viewerInstance)==null?void 0:e.obj)==null||i.navigationManager.changeToMap(),this._navigationMode.value="Map"}changeToRotateGlobe(e,i,o){var r,s;(s=(r=this._viewerInstance)==null?void 0:r.obj)==null||s.navigationManager.changeToRotateGlobe(e,i,o),this._navigationMode.value="RotateGlobe"}changeToLine(e,i,o,r,s,a){var l,u;(u=(l=this._viewerInstance)==null?void 0:l.obj)==null||u.navigationManager.changeToLine(e,i,o,r,s,a),this._navigationMode.value="Line"}changeToUserDefined(e){this.changeToMap(),console.warn("Cesium引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,i,o,r,s){var a,l;(l=(a=this._viewerInstance)==null?void 0:a.obj)==null||l.navigationManager.changeToRotatePoint(e,i,o,r,s),this._navigationMode.value="RotatePoint"}changeToFollow(e,i,o,r,s){var a,l;(l=(a=this._viewerInstance)==null?void 0:a.obj)==null||l.navigationManager.changeToFollow(e,i,o,r,s),this._navigationMode.value="Follow"}getFPS(){return this._fps.value}async getBoundSphere(e){return Promise.resolve(void 0)}async getVersion(){const e=window.g_XE3CopyRights??{};return e.cesium={version:w.VERSION},e}async getHeightByLonLat(e,i,o){if(!this.viewer)return null;const r=w.Cartographic.fromDegrees(e,i,void 0,Wt.getHeightsScartchCarto);return this.viewer.scene.sampleHeight(r)??null}async getHeightsByLonLats(e,i){const o=e.map(s=>this.getHeightByLonLat(...s));return await Promise.all(o)}async capture(e,i){if(this.viewer)return await T0(this.viewer.scene,e,i)}async lonLatAltToScreenPosition(e){if(!this.viewer||!this.isPointVisible(e))return;const i=this.viewer.scene.cartesianToCanvasCoordinates(Ye(e));if(i)return[i.x,i.y]}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,i,o){o=Object.assign({useKeyToSwitch:!0,callSource:"outer"},o);const r=e.components.main??e;r&&i!=null&&(r.editingID=`${o.callSource}_${c.createGuid()}`,this._editingSystem.create(this,r,i,o.useKeyToSwitch))}stopEditing(){this._editingSystem.stop()}moveObjects(e){const i=[],o=c.createGuid();for(let r=0;r<e.length;r++){const s=e[r],a=s.components.main??s;a.editingID=o,a&&i.push(a)}this._moveObjectsProcess.restart(void 0,this,i,o)}getCzmObject(e){return this.sceneObjectsMap.get(e)}setCurrentDefaultAccessToken(){this.ionAccessToken=Wt.currentDefaultAccessToken}setLatestDefaultAccessToken(){if(!Wt.latestDefaultAccessToken){alert("Cesium最新的iontoken无法获取!"),console.error("Cesium最新的iontoken无法获取!");return}this.ionAccessToken=Wt.latestDefaultAccessToken}positionsToLocalPositions(e,i){return wn(e,i)}localPositionsToPositions(e,i){return Sr(e,i)}isPointVisible(e){if(!this.viewer)return!1;const i=e instanceof w.Cartesian3?e:Ye(e),o=new w.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.positionWC);if(o.cameraPosition=this.viewer.scene.camera.positionWC,!o.isPointVisible(i))return!1;const r=this.viewer.scene.cartesianToCanvasCoordinates(i);return!(!r||r.x<0||r.y<0)}getESProperties(){const e={...super.getESProperties()},i=Wt.defaults;return{...e,more:[...e.more,new c.GroupProperty([],"通用","通用"),new c.EvalStringProperty([this,"createCesiumViewerFuncStr"],"CesiumViewer创建函数",u9,l9,!0),new c.FunctionProperty([],()=>Wt.getCesiumIonToken(),[],"获取官方token"),new c.FunctionProperty([],()=>this.setCurrentDefaultAccessToken(),[],"重置为当前使用的Cesium版本的token"),new c.FunctionProperty([],()=>this.setLatestDefaultAccessToken(),[],"最新token","重置为当前Cesium官方的最新token"),new c.BooleanProperty([this,"flashLighting"],"头顶灯",i.flashLighting,!0),new c.BooleanProperty([this,"particleGlobalControl"],"粒子全局控制播放",i.particleGlobalControl,!0),new c.GroupProperty([],"Viewer","Viewer"),new c.NumberProperty([this,"resolutionScale"],"分辨率比率",i.resolutionScale,!0),new c.NumberProperty([this,"msaaSamples"],"msaaSamples",i.msaaSamples,!0),new c.BooleanProperty([this,"shadows"]),new c.GroupProperty([],"比例尺","比例尺(Legend)"),new c.NumberProperty([this.viewerLegend,"resolution"],"resolution",void 0,!0,!0),new c.NumberProperty([this.viewerLegend,"zoom"],"zoom",void 0,!0,!0),new c.Number3Property([this.viewerLegend,"center"],"center",void 0,!0,!0),new c.NumberProperty([this.viewerLegend.legend,"lengthInPixels"],"lengthInPixels",100,!0,!1),new c.NumberProperty([this.viewerLegend.legend,"computedLengthInPixels"],"computedLengthInPixels",void 0,!0,!0),new c.NumberProperty([this.viewerLegend.legend,"computedLengthInMeters"],"computedLengthInMeters",void 0,!0,!0),new c.StringProperty([this.viewerLegend.legend,"computedLengthInStr"],"computedLengthInStr",void 0,!0,!0),new c.GroupProperty([],"场景","场景(Scene)"),new c.NumberProperty([this,"sceneSplitPosition"],"内部视口分割比例",i.sceneSplitPosition,!0),new c.GroupProperty([],"Globe","Globe"),new c.EnumProperty([this,"sceneGlobeShadows"],[["禁用","DISABLED"],["启用","ENABLED"],["仅投射","CAST_ONLY"],["仅接收","RECEIVE_ONLY"]],"sceneGlobeShadows",i.sceneGlobeShadows,!0),new c.NumberProperty([this,"sceneGlobeTerrainExaggeration"]),new c.NumberProperty([this,"sceneGlobeTerrainExaggerationRelativeHeight"]),new c.NumberProperty([this,"sceneGlobeVerticalExaggeration"]),new c.NumberProperty([this,"sceneGlobeVerticalExaggerationRelativeHeight"]),new c.BooleanProperty([this,"sceneGlobeBackFaceCulling"]),new c.BooleanProperty([this,"sceneGlobeShowSkirts"]),new c.BooleanProperty([this,"sceneGlobeShowWaterEffect"]),new c.ColorProperty([this,"sceneGlobeBaseColor"]),new c.Number4Property([this,"sceneGlobeCartographicLimitRectangle"]),new c.JsonProperty([this,"sceneGlobeClippingPlanes"]),new c.StringProperty([this,"sceneGlobeClippingPlanesId"]),new c.JsonProperty([this,"sceneGlobeClippingPolygons"]),new c.StringsProperty([this,"sceneGlobeClippingPolygonsId"]),new c.GroupProperty([],"underground","underground"),new c.ColorProperty([this,"sceneGlobeUndergroundColor"],"sceneGlobeUndergroundColor",i.sceneGlobeUndergroundColor,!0),new c.Number4Property([this,"sceneGlobeUndergroundColorAlphaByDistance"],"sceneGlobeUndergroundColorAlphaByDistance",i.sceneGlobeUndergroundColorAlphaByDistance,!0),new c.GroupProperty([],"Translucency","Translucency"),new c.Number4Property([this,"sceneGlobeTranslucencyBackFaceAlphaByDistance"],"背面渐变透明度",i.sceneGlobeTranslucencyBackFaceAlphaByDistance,!0),new c.Number4Property([this,"sceneGlobeTranslucencyFrontFaceAlphaByDistance"],"正面渐变透明度",i.sceneGlobeTranslucencyFrontFaceAlphaByDistance,!0),new c.Number4Property([this,"sceneGlobeTranslucencyRectangle"],"矩形范围",i.sceneGlobeTranslucencyRectangle,!0),new c.GroupProperty([],"Sun","Sun"),new c.BooleanProperty([this,"sun"],"sun",i.sun,!0),new c.NumberProperty([this,"sceneSunGlowFactor"],"sceneSunGlowFactor",i.sceneSunGlowFactor,!0),new c.GroupProperty([],"Moon","Moon"),new c.BooleanProperty([this,"moon"],"moon",i.moon,!0),new c.StringProperty([this,"sceneMoonTextureUrl"],"sceneMoonTextureUrl",i.sceneMoonTextureUrl,!0),new c.BooleanProperty([this,"sceneMoonOnlySunLighting"],"sceneMoonOnlySunLighting",i.sceneMoonOnlySunLighting,!0),new c.GroupProperty([],"SkyBox","SkyBox"),new c.BooleanProperty([this,"sceneSkyBoxShow"]),new c.JsonProperty([this,"sceneSkyBoxSources"],"sceneSkyBoxSources",i.sceneSkyBoxSources,void 0,!0),new c.GroupProperty([],"Background","Background"),new c.BooleanProperty([this,"xbsjUseBackground"]),new c.StringProperty([this,"xbsjBackgroundImageUri"]),new c.ColorProperty([this,"xbsjBackgroundColor"]),new c.GroupProperty([],"SkyAtmosphere","SkyAtmosphere"),new c.JsonProperty([this,"xbsjLocalBoxSources"],"xbsjLocalBoxSources",i.xbsjLocalBoxSources,void 0,!0),new c.ColorProperty([this,"sceneBackgroundColor"]),new c.GroupProperty([],"Fog","Fog"),new c.BooleanProperty([this,"sceneFogEnabled"],"sceneFogEnabled",i.sceneFogEnabled,!0),new c.NumberProperty([this,"sceneFogDensity"],"sceneFogDensity",i.sceneFogDensity,!0),new c.NumberProperty([this,"sceneFogScreenSpaceErrorFactor"],"sceneFogScreenSpaceErrorFactor",i.sceneFogScreenSpaceErrorFactor,!0),new c.NumberProperty([this,"sceneFogMinimumBrightness"],"sceneFogMinimumBrightness",i.sceneFogMinimumBrightness,!0),new c.GroupProperty([],"Sscc","Sscc"),new c.BooleanProperty([this,"sceneSsccEnableInputs"],"sceneSsccEnableInputs",i.sceneSsccEnableInputs,!0),new c.BooleanProperty([this,"sceneSsccEnableCollisionDetection"],"sceneSsccEnableCollisionDetection",i.sceneSsccEnableCollisionDetection,!0),new c.NumberProperty([this,"sceneSsccZoomFactor"],"sceneSsccZoomFactor",i.sceneSsccZoomFactor,!0),new c.NumberProperty([this,"sceneCameraFrustumFov"],"相机广角"),new c.GroupProperty([],"后处理","后处理"),new c.BooleanProperty([this,"scenePpsfxaaEnabled"],"开启FXAA",i.scenePpsfxaaEnabled,!0),new c.GroupProperty([],"环境遮蔽","环境遮蔽"),new c.BooleanProperty([this,"scenePpsAmbientOcclusionEnabled"]),new c.BooleanProperty([this,"scenePpsAmbientOcclusionAmbientOcclusionOnly"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionIntensity"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionBias"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionLengthCap"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionStepSize"]),new c.NumberProperty([this,"scenePpsAmbientOcclusionBlurStepSize"]),new c.GroupProperty([],"Bloom","Bloom"),new c.BooleanProperty([this,"scenePpsBloomEnabled"]),new c.BooleanProperty([this,"scenePpsBloomGlowOnly"]),new c.NumberProperty([this,"scenePpsBloomContrast"]),new c.NumberProperty([this,"scenePpsBloomBrightness"]),new c.NumberProperty([this,"scenePpsBloomDelta"]),new c.NumberProperty([this,"scenePpsBloomSigma"]),new c.NumberProperty([this,"scenePpsBloomStepSize"]),new c.GroupProperty([],"调试","调试"),new c.BooleanProperty([this,"sceneDebugShowFramesPerSecond"],"sceneDebugShowFramesPerSecond",i.sceneDebugShowFramesPerSecond,!0),new c.BooleanProperty([this,"sceneDebugShowCommands"],"sceneDebugShowCommands",i.sceneDebugShowCommands,!0),new c.BooleanProperty([this,"sceneDebugShowFrustums"],"sceneDebugShowFrustums",i.sceneDebugShowFrustums,!0),new c.BooleanProperty([this,"sceneDebugShowFrustumPlanes"],"sceneDebugShowFrustumPlanes",i.sceneDebugShowFrustumPlanes,!0),new c.NumberProperty([this,"sceneDebugShowDepthFrustum"],"sceneDebugShowDepthFrustum",i.sceneDebugShowDepthFrustum,!0),new c.GroupProperty([],"Inspector","Inspector"),new c.BooleanProperty([this,"showCesiumInspector"],"showCesiumInspector",i.showCesiumInspector,!0),new c.BooleanProperty([this,"cesiumInspectorWireframe"],"cesiumInspectorWireframe",i.cesiumInspectorWireframe,!0),new c.BooleanProperty([this,"showCesium3DTilesInspector"],"showCesium3DTilesInspector",i.showCesium3DTilesInspector,!0)]}}};O(Wt,"type",Wt.register("ESCesiumViewer",Wt)),O(Wt,"getCesiumIonToken",c9),O(Wt,"currentDefaultAccessToken",w.Ion.defaultAccessToken),O(Wt,"latestDefaultAccessToken"),O(Wt,"ObjectsToExcludeWrapper",MV),O(Wt,"defaults",{...c.ESViewer.defaults,flashLighting:!1,resolutionScale:1,msaaSamples:4,sceneSplitPosition:0,sceneGlobeShadows:"RECEIVE_ONLY",sceneGlobeUndergroundColor:[0,0,0,1],sceneGlobeUndergroundColorAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyBackFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyFrontFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyRectangle:[-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966].map(e=>180*e/Math.PI),sun:!0,sceneSunGlowFactor:1,moon:!0,sceneMoonTextureUrl:w.buildModuleUrl("Assets/Textures/moonSmall.jpg"),sceneMoonOnlySunLighting:!0,sceneSkyBoxSources:{positiveX:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_px.jpg"),negativeX:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mx.jpg"),positiveY:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_py.jpg"),negativeY:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_my.jpg"),positiveZ:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_pz.jpg"),negativeZ:w.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mz.jpg")},xbsjLocalBoxSources:{positiveX:"${earthsdk3-assets-script-dir}/assets/img/skybox/east.jpg",negativeX:"${earthsdk3-assets-script-dir}/assets/img/skybox/west.jpg",positiveY:"${earthsdk3-assets-script-dir}/assets/img/skybox/bottom.jpg",negativeY:"${earthsdk3-assets-script-dir}/assets/img/skybox/top.jpg",positiveZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/north.jpg",negativeZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/south.jpg"},sceneFogEnabled:!0,sceneFogDensity:2e-4,sceneFogScreenSpaceErrorFactor:2,sceneFogMinimumBrightness:.03,sceneSsccEnableInputs:!0,sceneSsccEnableCollisionDetection:!0,sceneSsccZoomFactor:5,scenePpsfxaaEnabled:!0,sceneDebugShowFramesPerSecond:!1,sceneDebugShowCommands:!1,sceneDebugShowFrustums:!1,sceneDebugShowFrustumPlanes:!1,sceneDebugShowDepthFrustum:1,showCesiumInspector:!1,cesiumInspectorWireframe:!1,showCesium3DTilesInspector:!1,particleGlobalControl:!1}),O(Wt,"getHeightsScartchCarto",new w.Cartographic);let at=Wt;(t=>{t.createDefaultProps=()=>({...c.ESViewer.createDefaultProps(),...a9()})})(at||(at={})),c.extendClassProps(at.prototype,at.createDefaultProps),ne.copyright=void 0;try{const t="earthsdk3-cesium",n="3.6.3",e="2025-12-04T02:15:04.000Z",i="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="961ae990522bc6051fa861e8065653128ba328ae",a=((Date.now()-1764814504e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${n}.${r.slice(0,8)}.${e} (距今${a}个小时)
|
|
4147
4147
|
%c${o?o+`
|
|
4148
4148
|
`:""}当前网站正在使用${t},此软件版权归${i}所有
|
|
4149
|
-
`;ne.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
4149
|
+
`;ne.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","961ae990522bc6051fa861e8065653128ba328ae")},get info(){return l},get date(){return"2025-12-04T02:15:04.000Z"},get author(){return"suplyang"},get version(){return"3.6.3"},get name(){return"earthsdk3-cesium"},get commitId(){return"961ae990522bc6051fa861e8065653128ba328ae"},print(){console.info(this.info,`
|
|
4150
4150
|
font-size: 18px;
|
|
4151
4151
|
font-weight: 1000;
|
|
4152
4152
|
line-height: 1;
|
package/dist/earthsdk3-cesium.js
CHANGED
|
@@ -47467,7 +47467,7 @@ class $4 extends k {
|
|
|
47467
47467
|
}, {
|
|
47468
47468
|
immediate: !0
|
|
47469
47469
|
}));
|
|
47470
|
-
}));
|
|
47470
|
+
}, void 0, !0));
|
|
47471
47471
|
}
|
|
47472
47472
|
get viewer() {
|
|
47473
47473
|
return this._viewer;
|
|
@@ -51389,7 +51389,7 @@ let qe = Pt;
|
|
|
51389
51389
|
ae(qe.prototype, qe.createDefaultProps);
|
|
51390
51390
|
let hp;
|
|
51391
51391
|
try {
|
|
51392
|
-
const t = "earthsdk3-cesium", i = "3.6.
|
|
51392
|
+
const t = "earthsdk3-cesium", i = "3.6.3", e = "2025-12-04T02:15:04.000Z", s = "北京西部世界科技有限公司", o = "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn", n = "961ae990522bc6051fa861e8065653128ba328ae", a = ((Date.now() - 1764814504e3) / 36e5).toFixed(1), l = `%c🌏 ${t}%c ${i}.${n.slice(0, 8)}.${e} (距今${a}个小时)
|
|
51393
51393
|
%c${o ? o + `
|
|
51394
51394
|
` : ""}当前网站正在使用${t},此软件版权归${s}所有
|
|
51395
51395
|
`;
|
|
@@ -51403,7 +51403,7 @@ try {
|
|
|
51403
51403
|
},
|
|
51404
51404
|
// @ts-ignore
|
|
51405
51405
|
get gituri() {
|
|
51406
|
-
return GITURI_ && GITURI_.replace("${commitId}", "
|
|
51406
|
+
return GITURI_ && GITURI_.replace("${commitId}", "961ae990522bc6051fa861e8065653128ba328ae");
|
|
51407
51407
|
},
|
|
51408
51408
|
// @ts-ignore
|
|
51409
51409
|
get info() {
|
|
@@ -51411,7 +51411,7 @@ try {
|
|
|
51411
51411
|
},
|
|
51412
51412
|
// @ts-ignore
|
|
51413
51413
|
get date() {
|
|
51414
|
-
return "2025-12-04T02:
|
|
51414
|
+
return "2025-12-04T02:15:04.000Z";
|
|
51415
51415
|
},
|
|
51416
51416
|
// @ts-ignore
|
|
51417
51417
|
get author() {
|
|
@@ -51419,7 +51419,7 @@ try {
|
|
|
51419
51419
|
},
|
|
51420
51420
|
// @ts-ignore
|
|
51421
51421
|
get version() {
|
|
51422
|
-
return "3.6.
|
|
51422
|
+
return "3.6.3";
|
|
51423
51423
|
},
|
|
51424
51424
|
// @ts-ignore
|
|
51425
51425
|
get name() {
|
|
@@ -51427,7 +51427,7 @@ try {
|
|
|
51427
51427
|
},
|
|
51428
51428
|
// @ts-ignore
|
|
51429
51429
|
get commitId() {
|
|
51430
|
-
return "
|
|
51430
|
+
return "961ae990522bc6051fa861e8065653128ba328ae";
|
|
51431
51431
|
},
|
|
51432
51432
|
print() {
|
|
51433
51433
|
console.info(
|
|
@@ -1992,7 +1992,7 @@ return material;
|
|
|
1992
1992
|
material.alpha = fragColor.a;
|
|
1993
1993
|
|
|
1994
1994
|
return material;
|
|
1995
|
-
}`},translucent:!0});function TL(){Object.defineProperties(h.Billboard.prototype,{_positionFromParent:{get(){return!1},set(t){}}})}zF(),LF(),NF(),WF(),GF(),UF(),HF(),FF(),ez(),tz(),nz(),xz(),TL(),h.Camera.DEFAULT_VIEW_RECTANGLE=h.Rectangle.fromDegrees(70,5,140,55);function IL(){return new Promise((t,i)=>h.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class ML extends a.Destroyable{constructor(i,e,n,o){super();const s=()=>{e.setStatus("Raw");const{viewer:l}=e;if(l){const c=Ke(l);if(c&&(c.destroy(),Ig(l,void 0)),h.defined(l)){l.entities.removeAll(),l.dataSources.removeAll(),l.imageryLayers.removeAll(),l.scene.primitives.removeAll(),l.scene.groundPrimitives.removeAll(),l.scene.postProcessStages.removeAll();let u=l.scene.context._originalGLContext;u.canvas.width=u.canvas.height=1,u.getExtension("WEBGL_lose_context").loseContext(),u=null}l.destroy(),n(void 0)}};this.d(s);const r=this.dv(a.createProcessingFromAsyncFunc(async(l,c)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const u=RF;await l.promise(IL());const d=await l.promise(a.createCancelablePromise(u(c,o)));d.scene._xbsjOriginSkyAtmosphere=d.scene.skyAtmosphere,d.scene._xbsjOriginSkyBox=d.scene.skyBox,d.scene.renderError.removeEventListener(d.cesiumWidget._onRenderError),d.clockViewModel.currentTime=h.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const p=h.JulianDate.fromDate(new Date(e.currentTime));h.JulianDate.equals(p,d.clockViewModel.currentTime)||(d.clockViewModel.currentTime=p)})),this.dispose(Ci(d.clockViewModel,"currentTime",p=>{const f=h.JulianDate.toDate(d.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const p=new kC(d,e);Ig(d,p)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),n(d)}));r.start(i),r.errorEvent.don(l=>{console.error(l),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const DL=new h.EllipsoidTerrainProvider;class WC extends a.Destroyable{constructor(e){super();m(this,"_terrainMap",new Map);m(this,"_nextAnimateFrame",this.dv(a.createNextAnimateFrame()));m(this,"selectedTerrain");this._viewer=e;const n=this._viewer,o=n.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{o&&o()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let s=Number.MIN_SAFE_INTEGER;for(let r of this._terrainMap.keys())r.sceneObject.activate=!1,(r.sceneObject.show??!0)&&r.sceneObject.zIndex>=s&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${r.sceneObject.name}(${r.sceneObject.id})`),s=r.sceneObject.zIndex,this.selectedTerrain=r);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),n.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??DL}))}_makeDirty(){this._nextAnimateFrame.restartIfNotRunning()}get _changed(){return this._nextAnimateFrame.completeEvent}add(e){if(this._terrainMap.has(e)){console.warn("this._terrainMap.has(imagery)");return}const n=new a.Destroyable;n.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),n.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>n.destroy()),this._makeDirty();const o=this.ad(a.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged));this.d(o.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const n=this._terrainMap.get(e);if(!n){console.error("!disposeFunc");return}n(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class GC extends a.Destroyable{constructor(e){super();m(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const n=e instanceof Ue?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`this._labelMap[${n}].has(poi)`,e);return}const o=new a.Destroyable;{const s=o.dv(a.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));o.dispose(s.don(()=>{this._updateZOrder()}))}this._labelMap[n].set(e,()=>o.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Ue?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`!this._labelMap[${n}].has(poi)`,e);return}const o=this._labelMap[n].get(e);if(!o){console.error("!disposeFunc");return}o(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){const o={};for(const l of e.keys())o[l.zOrder]||(o[l.zOrder]=new Map),o[l.zOrder].set(l,l instanceof Ue?l.czmDivPoi?l.czmDivPoi.depth:0:l.canvasObj?l.canvasObj.czmCanvasPoi.depth:0);const s=Object.keys(o).sort((l,c)=>n=="div"?Number(c)-Number(l):Number(l)-Number(c));let r=e.size;for(let l=0;l<s.length;l++)new Map([...o[s[l]]].sort((u,d)=>Number(d[1])-Number(u[1]))).forEach((u,d)=>{d instanceof Ue&&d.czmDivPoi&&(d.czmDivPoi.zOrder=r),d instanceof qi&&d.canvasObj&&(d.canvasObj.czmCanvasPoi.zOrder=r),r--})}}class RL extends a.Destroyable{constructor(e){super();m(this,"_czmImageryLayerWrappers",new Set);m(this,"_zIndexChangedEvent",this.dv(new a.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const n=[...this.czmImageryLayerWrappers.values()];n.sort((o,s)=>{const r=o.czmImageryWrapper.imagery.zIndex??a.ESImageryLayer.defaults.zIndex,l=s.czmImageryWrapper.imagery.zIndex??a.ESImageryLayer.defaults.zIndex;return r-l});for(const o of n)this.viewer.imageryLayers.raiseToTop(o.imageryLayer)}))}get viewer(){return this._viewer}get czmImageryLayerWrappers(){return this._czmImageryLayerWrappers}add(e){this._czmImageryLayerWrappers.add(e),this.viewer.imageryLayers.add(e.imageryLayer),this.zIndexChange()}delete(e){this.viewer.imageryLayers.remove(e.imageryLayer,!1),this._czmImageryLayerWrappers.delete(e)}zIndexChange(){this._zIndexChangedEvent.emit()}}class FL extends a.Destroyable{constructor(e){super();m(this,"_imageryLayer");if(this._czmImageryWrapper=e,!this._czmImageryWrapper.imagery.layer)throw new Error("this._czmCzmImageryWrapper.imagery.czmImagery");this._imageryLayer=this._czmImageryWrapper.imagery.layer;const{czmImageryWrapper:n}=this,o=n.manager.czmImageriesManager;o.add(this),this.d(()=>o.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>o.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class zL extends a.Destroyable{constructor(e){super();m(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new a.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new FL(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class LL extends a.Destroyable{constructor(e,n){super();m(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=n,this._czmImageryLayerWrapperObjResetting=this.dv(new a.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new zL(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class UC extends a.Destroyable{constructor(e){super();m(this,"_czmImageryWrappers",new Set);m(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new RL(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let n of this.czmImageryWrappers)if(n.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new LL(e,this))}has(e){for(let n of this.czmImageryWrappers)if(n.imagery===e)return!0;return!1}delete(e){for(const n of this.czmImageryWrappers)if(n.imagery===e){this.czmImageryWrappers.delete(n);return}console.warn("imageriesManager delete error!",e)}}class HC extends a.Destroyable{constructor(e){super();m(this,"_pause",this.disposeVar(a.react(!1)));m(this,"_pickPositionTasks",[]);m(this,"_pickTasks",[]);m(this,"pickHeightMustGreaterThanZero",!0);m(this,"objectsToExclude",[]);const n=e.viewer;{this.dispose(()=>{this._pickPositionTasks.length>0&&(this._pickPositionTasks.forEach(l=>l[3]("CzmViewer销毁,任务不再执行!")),this._pickPositionTasks.length=0),this._pickTasks.length>0&&(this._pickTasks.forEach(l=>l[4]("CzmViewer销毁,任务不再执行!")),this._pickTasks.length=0)});const o=()=>{const l=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let u of l){const[d,p,f,g]=u;try{(async()=>{const{scene:v,camera:y}=n,w=Pe(d),P=y.getPickRay(w);if(P){let E;if(p?E=await v.pickFromRayMostDetailed(P,this.objectsToExclude):E=v.pickFromRay(P,this.objectsToExclude),E&&E.position){const R=se(E.position);return R?f(R):g(new Error("positionFromCartesian failed"))}if(!(v.terrainProvider instanceof h.EllipsoidTerrainProvider)){const R=v.globe.pick(P,v);if(!R)return g(new Error("scene.globe.pick failed"));const N=se(R);return N?(this.pickHeightMustGreaterThanZero&&N[2]<0&&(N[2]=0),f(N)):g(new Error("positionFromCartesian failed"))}}const C=v.terrainProvider instanceof h.EllipsoidTerrainProvider?v.terrainProvider.tilingScheme.ellipsoid:n.scene.globe.ellipsoid,S=n.camera.pickEllipsoid(Pe(d),C);if(!S)return g(new Error("Pick failed"));const A=se(S);return A?f(A):g(new Error("positionFromCartesian failed"))})()}catch(v){g(v)}}const c=[...this._pickTasks];this._pickTasks.length=0;for(let u of c){const[d,p,f,g,v]=u;e.pickCustomAttachedInfo=f;try{(async()=>{var E,R,N,B;let y=n.scene.pick(Pe(d),p&&p[0],p&&p[1]);!y&&h.defined(n.scene.globe)&&(y=await NL(n,Pe(d)));let w;if(y&&y instanceof h.Cesium3DTileFeature){w={};try{y&&y.getPropertyIds().forEach(G=>{w&&(w[G]=y.getProperty(G))})}catch(V){console.warn(V)}}if(!y){const{left:V,top:G}=e.container.getBoundingClientRect();y=(E=document.elementFromPoint(d[0]+V,d[1]+G))==null?void 0:E.closest("[data-es-scene-object-id]")}let P;y&&(y.id&&y.id instanceof h.Entity&&y.id.ESSceneObjectID?P=y.id.ESSceneObjectID:y.primitive&&y.primitive.ESSceneObjectID?P=y.primitive.ESSceneObjectID:y.collection&&y.collection.ESSceneObjectID?P=y.collection.ESSceneObjectID:Array.isArray(y)&&y[0]instanceof h.ImageryLayerFeatureInfo?P=y[0].imageryLayer.ESSceneObjectID:y instanceof HTMLElement&&(P=y.dataset.esSceneObjectId));let C=P?a.ESSceneObject.getSceneObject(P):void 0;C&&C.parentID&&(C=a.ESSceneObject.getSceneObject(C.parentID));let S={};if(C&&Reflect.has(C,"allowPicking")&&Reflect.has(C,"pickedEvent")&&(C.allowPicking??!1)){if(C instanceof a.ESEntityCluster){const V=new h.JulianDate;S=y.id instanceof h.Entity?{name:y.id.label.text.getValue(V),properties:(R=y.id.properties)==null?void 0:R.getValue(V),coordinates:wr(y.id.position.getValue(V))}:(N=y.id)==null?void 0:N.map(G=>{var z;return{name:G.id,properties:(z=G.properties)==null?void 0:z.getValue(V),coordinates:wr(G.position.getValue(V))}})}else if(C instanceof a.ESGeoJson){const V=new h.JulianDate;let G,z,O;y.id.entityCollection?(G=y.id.polygon?"Polygon":y.id.polyline?"LineString":"Point",O=((B=y.id.properties)==null?void 0:B.getValue(V))??{},z=G=="Point"?se(y.id.position.getValue(V)):G=="LineString"?y.id.polyline.positions.getValue(V).map(_=>se(_)):yu(y.id.polygon.hierarchy.getValue(V))):(y.primitive instanceof h.Billboard||y.primitive instanceof h.Label)&&(G="Point",typeof y.id=="object"&&(O=y.id),z=se(y.primitive.position)),S=C.pickedInfoType=="FeatureCollection"||C.pickedInfoType=="Feature"?{type:"Feature",geometry:{type:G,coordinates:z},properties:O}:{type:G,coordinates:z,properties:O}}else if(C instanceof a.ESGltfModel){let V;Reflect.has(y,"featureId")?V=y.featureId:Reflect.has(y,"instanceId")&&(V=y.instanceId),V&&(y.id=y.primitive.structuralMetadata.getPropertyTable(0).getProperty(y.instanceId,"id"))}C.pickedEvent.emit(new a.ESJPickedResult(y,C,w,S,f,d))}C&&Reflect.has(C,"allowPicking")&&!C.allowPicking&&g(new a.ESJPickedResult);const A=new a.ESJPickedResult(y,C,w,S,f,d);g(A)})()}catch(y){v(y)}}};let s=n.scene.postRender.addEventListener(o);const r=()=>{s&&s(),s=void 0};this.ad(r),this.ad(this.pauseChanged.don(l=>{l?r():s=n.scene.postRender.addEventListener(o)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((n,o)=>{this._pickPositionTasks.push([e,!0,n,o])})}quickPickPosition(e){return new Promise((n,o)=>{this._pickPositionTasks.push([e,!1,n,o])})}pick(e,n,o){return new Promise((s,r)=>{this._pickTasks.push([e,n,o,s,r])})}}function NL(t,i){const e=t.scene,n=e.camera.getPickRay(i);if(!n)return;const o=e.imageryLayers.pickImageryLayerFeatures(n,e);if(h.defined(o))return o}class OL extends a.Destroyable{constructor(e){super();m(this,"_enabled",this.disposeVar(a.react(!1)));m(this,"_cursorPosition",a.react(void 0));m(this,"quickPickPosition",!0);let n=new a.Destroyable;const o=()=>{n&&(n.destroy(),n=void 0)};this.dispose(o);const s=()=>{if(o(),!this._enabled.value||!e)return;const r=Ke(e);if(!r)return;n=new a.Destroyable;const l=n.disposeVar(a.react(void 0)),c=n.disposeVar(a.createNextAnimateFrameEvent(l.changed));n.dispose(r.czmViewer.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&(l.value=a.getDomEventCurrentTargetPos(d.pointerEvent))}));const u=n.disposeVar(a.createProcessingFromAsyncFunc(async d=>{if(r.pickingManager&&l.value)if(this.quickPickPosition){const p=await d.promise(a.createCancelablePromise(r.pickingManager.quickPickPosition(l.value)));this._cursorPosition.value=p}else{const p=await d.promise(a.createCancelablePromise(r.pickingManager.pickPosition(l.value)));this._cursorPosition.value=p}}));n.dispose(c.disposableOn(()=>{u.restart()}))};s(),this.dispose(this._enabled.changed.disposableOn(s))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class BL extends a.Destroyable{constructor(){super();m(this,"cache",new Map);m(this,"maxSize",300);m(this,"_deleteTileEvent",this.disposeVar(new a.Event))}get deleteTileEvent(){return this._deleteTileEvent}deleteTile(e,n){this._deleteTileEvent.emit(e,n)}has(e,n){const o=this.cache.get(e);return n?(o==null?void 0:o.has(n))??!1:!!o}get(e,n){const o=this.cache.get(e);if(!o)return;if(!n)return o;const s=o.get(n);return s&&(o.delete(n),o.set(n,s)),s}set(e,n,o){let s=this.get(e);if(s||(s=new Map,this.cache.set(e,s)),s.set(n,o),s.size>=this.maxSize){const r=s.keys().next().value;r&&this.remove(e,r)}}remove(e,n){const o=e instanceof xh?e.sceneObject.id:e;let s=this.get(o);s&&(n?(s.delete(n),s.size===0&&this.cache.delete(o)):this.cache.delete(o),this.deleteTile(o,n))}}class $C extends a.Destroyable{constructor(e){super();m(this,"x");m(this,"y");m(this,"z");m(this,"tileKey");m(this,"parent",null);m(this,"children",new Set);m(this,"data",new Map);m(this,"state",ar.UNLOADED);this.tileKey=e,[this.z,this.x,this.y]=e.split("-").map(Number)}fillParentAndChildren(e){var o;const n=`${this.z-1}-${Math.floor(this.x/2)}-${Math.floor(this.y/2)}`;this.parent=e.get(n)??null,(o=this.parent)==null||o.children.add(this)}}class VL extends a.Destroyable{constructor(e,n,o){super();m(this,"workers",[]);m(this,"queue",[]);m(this,"destroyed",!1);const s=navigator.hardwareConcurrency||4;let r;n?n>s?(console.warn(`创建线程超过CPU核心数,已限制为${s-1}`),r=s-1):r=n:r=Math.max(1,s-1);for(let l=0;l<r;l++)this.workers.push(new Worker(e,o));this.ad(()=>{this.destroyed=!0;for(const l of this.queue)l(null);this.queue.length=0;for(const l of this.workers)l.terminate();this.workers.length=0})}acquire(){return this.destroyed?Promise.reject("WorkerPool destroyed"):new Promise(e=>{this.workers.length>0?e(this.workers.pop()):this.queue.push(e)})}release(e){this.destroyed||(this.queue.length>0?this.queue.shift()(e):this.workers.push(e))}}function ln(t,i){if(typeof t=="string"){const e=[...t.matchAll(/\{([^}]+)\}/g)].map(n=>n[1]);return e.length===0?null:e.length===1?e[0]:e}if(t&&typeof t=="object"&&Array.isArray(t.stops)){let e=t.stops[0][1];for(const[n,o]of t.stops)i>=n&&(e=o);return ln(e,i)}if(Array.isArray(t))switch(t[0]){case"get":{const n=t[1];return typeof n=="string"?n:null}case"step":{let n=t[2];for(let o=3;o<t.length;o+=2){const s=t[o],r=t[o+1];i>=s&&(n=r)}return ln(n,i)}case"case":{for(let n=2;n<t.length;n+=2){if(n===t.length-1)return ln(t[n],i);const o=t[n],s=ln(o,i);if(s)return s}return null}case"match":{const n=new Set;for(let o=3;o<t.length;o+=2){const s=t[o],r=ln(s,i);r&&(Array.isArray(r)?r.forEach(l=>n.add(l)):n.add(r))}return n.size?[...n]:null}case"concat":{const n=new Set;for(let o=1;o<t.length;o++){const s=ln(t[o],i);s&&(Array.isArray(s)?s.forEach(r=>n.add(r)):n.add(s))}return n.size?[...n]:null}case"format":{const n=new Set;for(let o=1;o<t.length;o+=2){const s=ln(t[o],i);s&&(Array.isArray(s)?s.forEach(r=>n.add(r)):n.add(s))}return n.size?[...n]:null}}return null}function WL(t){const i=new Map;for(const e in t){const n=t[e],o=new Set,s=n.points,r=n.pointProps;for(let g=0;g<s.length;g+=3){const v=g/3;o.add({type:"Feature",geometry:{type:"Point",coordinates:[s[g],s[g+1]]},properties:r[v]||{}})}const l=n.lines,c=n.lineOffsets,u=n.lineProps;for(let g=0;g<c.length;g++){const v=c[g]*3,y=g+1<c.length?c[g+1]*3:l.length,w=[];for(let P=v;P<y;P+=3)w.push([l[P],l[P+1]]);o.add({type:"Feature",geometry:{type:"LineString",coordinates:w},properties:u[g]||{}})}const d=n.polygons,p=n.polygonOffsets,f=n.polygonProps;for(let g=0;g<p.length;g++){const v=p[g]*3,y=g+1<p.length?p[g+1]*3:d.length,w=[];for(let P=v;P<y;P+=3)w.push([d[P],d[P+1]]);o.add({type:"Feature",geometry:{type:"Polygon",coordinates:[w]},properties:f[g]||{}})}i.set(e,o)}return i}class GL extends a.Destroyable{constructor(e){super();m(this,"pendingRequests",new Map);m(this,"sourcesMap",new Map);m(this,"workerPool");m(this,"tileSchemes",new Map);this.tilesCache=e,this.workerPool=new VL(new URL("data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJXZWJXb3JrZXIiIC8+DQppbXBvcnQgUGJmIGZyb20gInBiZiI7DQppbXBvcnQgeyBWZWN0b3JUaWxlIH0gZnJvbSAiQG1hcGJveC92ZWN0b3ItdGlsZSI7DQoNCnNlbGYub25tZXNzYWdlID0gYXN5bmMgKGUpID0+IHsNCiAgICBjb25zdCB7IHR5cGUsIHVybCwgeCwgeSwgeiB9ID0gZS5kYXRhOw0KICAgIGlmICh0eXBlICE9PSAiZmV0Y2giKSByZXR1cm47DQoNCiAgICB0cnkgew0KICAgICAgICBjb25zdCBidWZmZXIgPSBhd2FpdCAoYXdhaXQgZmV0Y2godXJsKSkuYXJyYXlCdWZmZXIoKTsNCiAgICAgICAgY29uc3QgdGlsZSA9IG5ldyBWZWN0b3JUaWxlKG5ldyBQYmYoYnVmZmVyKSk7DQoNCiAgICAgICAgY29uc3QgdGlsZURhdGE6IFJlY29yZDxzdHJpbmcsIGFueT4gPSB7fTsNCg0KICAgICAgICBmb3IgKGNvbnN0IGxheWVyTmFtZSBpbiB0aWxlLmxheWVycykgew0KICAgICAgICAgICAgY29uc3QgbGF5ZXIgPSB0aWxlLmxheWVyc1tsYXllck5hbWVdOw0KICAgICAgICAgICAgY29uc3QgZXh0ZW50ID0gbGF5ZXIuZXh0ZW50IHx8IDQwOTY7DQoNCiAgICAgICAgICAgIGNvbnN0IHBvaW50czogbnVtYmVyW10gPSBbXTsNCiAgICAgICAgICAgIGNvbnN0IHBvaW50UHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IGxpbmVzOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgbGluZU9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBsaW5lUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IHBvbHlnb25zOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgcG9seWdvbk9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBwb2x5Z29uUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGF5ZXIubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgICAgICAgICBjb25zdCBmID0gbGF5ZXIuZmVhdHVyZShpKTsNCiAgICAgICAgICAgICAgICBjb25zdCBnZW9tID0gZi5sb2FkR2VvbWV0cnkoKTsNCiAgICAgICAgICAgICAgICBjb25zdCB0ID0gZi50eXBlOw0KICAgICAgICAgICAgICAgIGNvbnN0IHByb3BlcnRpZXMgPSBmLnByb3BlcnRpZXMgfHwge307DQoNCiAgICAgICAgICAgICAgICBpZiAodCA9PT0gMSkgeyAvLyBQb2ludA0KICAgICAgICAgICAgICAgICAgICBsZXQgc3ggPSAwLCBzeSA9IDAsIGNudCA9IDA7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsgc3ggKz0gcC54OyBzeSArPSBwLnk7IGNudCsrOyB9DQogICAgICAgICAgICAgICAgICAgIGlmIChjbnQgPT09IDApIGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgICAgIHBvaW50cy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgcG9pbnRQcm9wcy5wdXNoKHByb3BlcnRpZXMpOw0KDQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0ID09PSAyKSB7IC8vIExpbmUNCiAgICAgICAgICAgICAgICAgICAgbGluZU9mZnNldHMucHVzaChsaW5lcy5sZW5ndGggLyAzKTsNCiAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbG9uLCBsYXQgfSA9IHRpbGVQaXhlbFRvTG9uTGF0KHAueCwgcC55LCBleHRlbnQsIHgsIHksIHopOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzLnB1c2gobG9uLCBsYXQsIDApOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBsaW5lUHJvcHMucHVzaChwcm9wZXJ0aWVzKTsNCg0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodCA9PT0gMykgeyAvLyBQb2x5Z29uDQogICAgICAgICAgICAgICAgICAgIHBvbHlnb25PZmZzZXRzLnB1c2gocG9seWdvbnMubGVuZ3RoIC8gMyk7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChwLngsIHAueSwgZXh0ZW50LCB4LCB5LCB6KTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2x5Z29ucy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgcG9seWdvblByb3BzLnB1c2gocHJvcGVydGllcyk7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICB0aWxlRGF0YVtsYXllck5hbWVdID0gew0KICAgICAgICAgICAgICAgIHBvaW50czogbmV3IEZsb2F0MzJBcnJheShwb2ludHMpLA0KICAgICAgICAgICAgICAgIHBvaW50UHJvcHMsDQogICAgICAgICAgICAgICAgbGluZXM6IG5ldyBGbG9hdDMyQXJyYXkobGluZXMpLA0KICAgICAgICAgICAgICAgIGxpbmVPZmZzZXRzOiBuZXcgVWludDMyQXJyYXkobGluZU9mZnNldHMpLA0KICAgICAgICAgICAgICAgIGxpbmVQcm9wcywNCiAgICAgICAgICAgICAgICBwb2x5Z29uczogbmV3IEZsb2F0MzJBcnJheShwb2x5Z29ucyksDQogICAgICAgICAgICAgICAgcG9seWdvbk9mZnNldHM6IG5ldyBVaW50MzJBcnJheShwb2x5Z29uT2Zmc2V0cyksDQogICAgICAgICAgICAgICAgcG9seWdvblByb3BzDQogICAgICAgICAgICB9Ow0KICAgICAgICB9DQoNCiAgICAgICAgLy8g5pS26ZuGIGJ1ZmZlciB0cmFuc2ZlcmFibGUNCiAgICAgICAgY29uc3QgdHJhbnNmZXJzOiBBcnJheUJ1ZmZlcltdID0gW107DQogICAgICAgIGZvciAoY29uc3QgbGF5ZXJOYW1lIGluIHRpbGVEYXRhKSB7DQogICAgICAgICAgICBjb25zdCBsYXllciA9IHRpbGVEYXRhW2xheWVyTmFtZV07DQogICAgICAgICAgICB0cmFuc2ZlcnMucHVzaChsYXllci5wb2ludHMuYnVmZmVyLCBsYXllci5saW5lcy5idWZmZXIsIGxheWVyLmxpbmVPZmZzZXRzLmJ1ZmZlciwNCiAgICAgICAgICAgICAgICBsYXllci5wb2x5Z29ucy5idWZmZXIsIGxheWVyLnBvbHlnb25PZmZzZXRzLmJ1ZmZlcik7DQogICAgICAgIH0NCg0KICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdXJsLCB0aWxlRGF0YSB9LCB0cmFuc2ZlcnMpOw0KDQogICAgfSBjYXRjaCAoZXJyKSB7DQogICAgICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB1cmwsIGVycm9yOiAoZXJyIGFzIEVycm9yKS5tZXNzYWdlIH0pOw0KICAgIH0NCn07DQovLyAtLS0tLS0tLS0tLS0tLS0tLS0g5Yeg5L2V5LyY5YyWIC0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpmdW5jdGlvbiBzaW1wbGlmeVJpbmcocmluZzogYW55W10pIHsNCiAgICBjb25zdCBvdXQ6IGFueSA9IFtdOw0KICAgIGNvbnN0IG4gPSByaW5nLmxlbmd0aDsNCiAgICBpZiAobiA8PSAyKSByZXR1cm4gcmluZzsNCg0KICAgIG91dC5wdXNoKHJpbmdbMF0pOw0KDQogICAgZm9yIChsZXQgaSA9IDE7IGkgPCBuIC0gMTsgaSsrKSB7DQogICAgICAgIGNvbnN0IEEgPSBvdXRbb3V0Lmxlbmd0aCAtIDFdOw0KICAgICAgICBjb25zdCBCID0gcmluZ1tpXTsNCiAgICAgICAgY29uc3QgQyA9IHJpbmdbaSArIDFdOw0KDQogICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgY29udGludWU7DQogICAgICAgIGlmIChpc0NvbGluZWFyKEEueCwgQS55LCBCLngsIEIueSwgQy54LCBDLnkpKSBjb250aW51ZTsNCg0KICAgICAgICBvdXQucHVzaChCKTsNCiAgICB9DQoNCiAgICBvdXQucHVzaChyaW5nW24gLSAxXSk7DQogICAgcmV0dXJuIG91dDsNCn0NCg0KZnVuY3Rpb24gY2xlYW5Qb2x5Z29uKHJpbmdzOiBhbnlbXSkgew0KICAgIHJldHVybiByaW5ncy5tYXAocmluZyA9PiB7DQogICAgICAgIGlmIChyaW5nLmxlbmd0aCA+IDIpIHsNCiAgICAgICAgICAgIGNvbnN0IEEgPSByaW5nWzBdOw0KICAgICAgICAgICAgY29uc3QgQiA9IHJpbmdbcmluZy5sZW5ndGggLSAxXTsNCiAgICAgICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgcmluZyA9IHJpbmcuc2xpY2UoMCwgLTEpOw0KICAgICAgICB9DQogICAgICAgIHJldHVybiBzaW1wbGlmeVJpbmcocmluZyk7DQogICAgfSk7DQp9DQoNCmZ1bmN0aW9uIGlzQ29saW5lYXIoYXgsIGF5LCBieCwgYnksIGN4LCBjeSkgew0KICAgIHJldHVybiAoYnggLSBheCkgKiAoY3kgLSBieSkgPT09IChieSAtIGF5KSAqIChjeCAtIGJ4KTsNCn0NCg0KLy8gLS0tLS0tLS0tLS0tLS0tLS0tIOe7j+e6rOW6pui9rOaNoiAtLS0tLS0tLS0tLS0tLS0tLS0NCg0KZnVuY3Rpb24gY29udmVydFRvTG9uTGF0KGdlb20sIHQsIGV4dGVudCwgeCwgeSwgeikgew0KICAgIGlmICh0ID09PSAxKSB7DQogICAgICAgIGxldCBzeCA9IDAsIHN5ID0gMCwgY250ID0gMDsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgeyBzeCArPSBwLng7IHN5ICs9IHAueTsgY250Kys7IH0NCiAgICAgICAgY29uc3QgbGwgPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgIHJldHVybiBbbGwubG9uLCBsbC5sYXRdOw0KICAgIH0NCg0KICAgIGlmICh0ID09PSAyKSB7DQogICAgICAgIGNvbnN0IGFycjogYW55W10gPSBbXTsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgYXJyLnB1c2goW2xsLmxvbiwgbGwubGF0XSk7DQogICAgICAgICAgICB9DQogICAgICAgIHJldHVybiBhcnI7DQogICAgfQ0KDQogICAgaWYgKHQgPT09IDMpIHsNCiAgICAgICAgcmV0dXJuIGdlb20ubWFwKHJpbmcgPT4NCiAgICAgICAgICAgIHJpbmcubWFwKHAgPT4gew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgcmV0dXJuIFtsbC5sb24sIGxsLmxhdF07DQogICAgICAgICAgICB9KQ0KICAgICAgICApOw0KICAgIH0NCn0NCg0KZnVuY3Rpb24gdGlsZVBpeGVsVG9Mb25MYXQocHgsIHB5LCBleHRlbnQsIHRpbGVYLCB0aWxlWSwgeikgew0KICAgIGNvbnN0IG4gPSBNYXRoLnBvdygyLCB6KTsNCiAgICBjb25zdCB4Tm9ybSA9ICh0aWxlWCArIHB4IC8gZXh0ZW50KSAvIG47DQogICAgY29uc3QgeU5vcm0gPSAodGlsZVkgKyBweSAvIGV4dGVudCkgLyBuOw0KICAgIGNvbnN0IGxvbiA9IHhOb3JtICogMzYwIC0gMTgwOw0KICAgIGNvbnN0IGxhdCA9IE1hdGguYXRhbihNYXRoLnNpbmgoTWF0aC5QSSAqICgxIC0gMiAqIHlOb3JtKSkpICogMTgwIC8gTWF0aC5QSTsNCiAgICByZXR1cm4geyBsb24sIGxhdCB9Ow0KfQ==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Gi&&Gi.tagName.toUpperCase()==="SCRIPT"&&Gi.src||new URL("earthsdk3-cesium.umd.cjs",document.baseURI).href),10,{type:"module"})}add(e){const n=e.sceneObject.id,o=e.mvtLayerJson.mainJson,s=e.sceneObject.scheme??"xyz";let r=this.sourcesMap.get(n),l=this.tileSchemes.get(n);if(r||(r=new Map,this.sourcesMap.set(n,r)),(!l||s!=l)&&this.tileSchemes.set(n,s),typeof o=="string")r.set("customSource",{tiles:[o],type:"vector"});else if(typeof o=="object"){const c=o.sources;for(const u in c){const d=c[u];d.type==="vector"&&Reflect.has(d,"tiles")&&r.set(u,d)}}}remove(e){const n=e.sceneObject.id;this.sourcesMap.delete(n),this.tileSchemes.delete(n),this.pendingRequests.delete(n)}async fetchTile(e,n){return new Promise(async o=>{var g,v,y,w;if((g=this.pendingRequests.get(e))!=null&&g.has(n))return o(void 0);(v=this.pendingRequests.get(e))==null||v.add(n);const[s,r,l]=n.split("-").map(Number),u=this.tileSchemes.get(e)==="tms"?Math.pow(2,s)-l-1:l,d=this.tilesCache.get(e,n)??new $C(n),p=this.sourcesMap.get(e);if(!p)return d.state=ar.FAILED,o(d);const f=Array.from(p.keys()).pop();for(const[P,C]of p.entries()){d.state=ar.LOADING;const S=Array.isArray(C.tiles)?C.tiles:[C.tiles];for(const A of S){if(d.state=ar.PROCESSING,!A.includes("{z}")||C.maxzoom&&s>C.maxzoom||C.minzoom&&s<C.minzoom)continue;const E=A.replace("{z}",s.toString()).replace("{x}",r.toString()).replace("{y}",u.toString());try{const R=await this.fetchUrl(E,r,l,s);if(d.data.set(P,R),P===f)return(y=this.pendingRequests.get(e))==null||y.delete(n),((w=this.pendingRequests.get(e))==null?void 0:w.size)===0&&this.pendingRequests.delete(e),d.state=ar.READY,o(d)}catch(R){console.error(`Failed to load tile ${n}:`,R)}}}})}fetchUrl(e,n,o,s){return new TextDecoder,new Promise((r,l)=>{this.workerPool.acquire().then(c=>{const u=d=>{const p=d.data;if(p.url!==e)return;if(c.removeEventListener("message",u),this.workerPool.release(c),p.error)return l(new Error(p.error));const f=WL(p.tileData);r(f)};c.addEventListener("message",u),c.postMessage({type:"fetch",url:e,x:n,y:o,z:s})})})}}class UL extends a.Destroyable{constructor(e,n){super();m(this,"renderedTiles",new Map);this.screenManager=e,this.styleManager=n}renderTile(e,n){var l;const o=new Set,s=this.styleManager.getStyle(e);if(!s)return;for(const c of s){const u=Number.parseInt(n.tileKey.split("-")[0]);if(!((c.maxzoom||c.minzoom)&&(c.maxzoom&&u>c.maxzoom||c.minzoom&&u<c.minzoom)))for(const d of((l=n.data.get(c.source))==null?void 0:l.get(c["source-layer"]??""))||[]){let p=d.geometry.coordinates;d.geometry.type.includes("Point")||(p=WI(d.geometry).geometry.coordinates);let f,g;if(c.labelStyle){const v=ln(c.labelStyle.text,u);f=this.screenManager.addLabel(e,"VectorTile",c.labelStyle,{position:p,name:typeof v=="string"?d.properties[v]:Array.isArray(v)?v.map(w=>d.properties[w]).join(""):"",index:c.id+d.properties.osm_id}).screenObjectId}if(c.billboardStyle){const v=ln(c.billboardStyle.text,u);g=this.screenManager.addImage(e,"VectorTile",c.billboardStyle,{position:p,name:typeof v=="string"?d.properties[v]:Array.isArray(v)?v.map(w=>d.properties[w]).join(""):"",index:c.id+d.properties.osm_id}).screenObjectId}f&&!o.has(f)&&o.add(f),g&&!o.has(g)&&o.add(g)}}let r=this.renderedTiles.get(e);r||(r=new Map,this.renderedTiles.set(e,r)),r.set(n.tileKey,o)}update(e,n,o){var s;if(typeof n=="string"){const r=(s=this.renderedTiles.get(e))==null?void 0:s.get(n);r&&this.screenManager.update("VectorTile",e,r,{all:{show:o}})}else this.screenManager.update("VectorTile",e,n,{all:{show:o}})}remove(e,n){const o=this.renderedTiles.get(e);if(n){const s=o==null?void 0:o.get(n);s&&(this.screenManager.remove("VectorTile",e,s),o==null||o.delete(n),(o==null?void 0:o.size)===0&&this.renderedTiles.delete(e))}else{const s=o==null?void 0:o.values();if(s){const r=new Set([...s].flatMap(l=>[...l]));this.screenManager.remove("VectorTile",e,r,!0),this.renderedTiles.delete(e)}}}removeAll(){const e=this.renderedTiles.keys();for(const n of e)this.remove(n)}}const HL=new h.Cartesian2;class $L extends a.Destroyable{constructor(){super();m(this,"defaultStyle",new Map);m(this,"defaultSprite",new Map)}async add(e){var o;if(typeof e.mvtLayerJson.mainJson!="string"&&((o=e.mvtLayerJson.mainJson)!=null&&o.sprite)){const s=e.mvtLayerJson.mainJson.sprite;let r=await h.Resource.fetchJson({url:s+".json"});r=await qL(s+".png",r),r&&this.defaultSprite.set(e.sceneObject.id,[s+".png",r])}const n=e.mvtLayerJson.pointJson;for(const s of n)this.setDefaultStyle(e.sceneObject.id,this.getStyleFromMVTLayers(e.sceneObject.id,s))}remove(e){this.defaultStyle.delete(e.sceneObject.id)}setDefaultStyle(e,n){let o=this.defaultStyle.get(e);o||(o=new Set,this.defaultStyle.set(e,o)),o.add(n)}getStyle(e){return this.defaultStyle.get(e)??new Set}getStyleFromMVTLayers(e,n){const o={id:n.id,type:n.type,source:n.source,"source-layer":n["source-layer"],labelStyle:void 0,billboardStyle:void 0,polygonStyle:void 0,polylineStyle:void 0};if(Reflect.has(n,"minzoom")&&(o.minzoom=n.minzoom),Reflect.has(n,"maxzoom")&&(o.maxzoom=n.maxzoom),Reflect.has(n,"type")&&n.type==="symbol"&&Reflect.has(n,"layout")){const s=n.layout;if(Reflect.has(s,"icon-image")){const r=o.billboardStyle={},l=this.defaultSprite.get(e);l&&l[1][s["icon-image"]]?(r.image=l[0],r.imageSubRegion=new h.BoundingRectangle(l[1][s["icon-image"]].x,l[1][s["icon-image"]].y,l[1][s["icon-image"]].width,l[1][s["icon-image"]].height)):r.image=s["icon-image"];const{horizontalOrigin:c,verticalOrigin:u}=qC(s["icon-anchor"]??"center");if(r.horizontalOrigin=c,r.verticalOrigin=u,Reflect.has(n,"paint")){const d=n.paint;r.color=h.Color.fromCssColorString(d["icon-color"]??"#000000").withAlpha(d["icon-opacity"]??1)}r.rotation=h.Math.toRadians(s["icon-rotate"]??0),r.scale=s["icon-size"]??1,r.pixelOffset=h.Cartesian2.multiplyByScalar(h.Cartesian2.fromArray(s["icon-offset"]??[0,0]),r.scale,HL),r.show=(s.visibility??"visible")==="visible"}if(Reflect.has(s,"text-field")){const r=o.labelStyle={};r.text=s["text-field"];const{horizontalOrigin:l,verticalOrigin:c}=qC(s["text-anchor"]??"center");if(r.horizontalOrigin=l,r.verticalOrigin=c,Reflect.has(n,"paint")){const d=n.paint;r.fillColor=h.Color.fromCssColorString(d["text-color"]??"#000000").withAlpha(d["text-opacity"]??1),d["text-halo-color"]&&(r.outlineColor=h.Color.fromCssColorString(d["text-halo-color"])),d["text-halo-width"]&&(r.outlineWidth=d["text-halo-width"]),(d["text-halo-color"]||d["text-halo-width"])&&(r.style=h.LabelStyle.FILL_AND_OUTLINE)}const u=s["text-font"]?typeof s["text-font"]=="string"?[s["text-font"]]:s["text-font"]:["Open Sans Regular","Arial Unicode MS Regular"];r.font=`${s["text-size"]??16}px `+u.map(d=>`"${d}"`).join(", "),r.pixelOffset=XL(s),r.show=(s.visibility??"visible")==="visible"}}return o}}function qC(t){let i=h.HorizontalOrigin.CENTER,e=h.VerticalOrigin.CENTER;switch(t){case"center":break;case"left":i=h.HorizontalOrigin.LEFT;break;case"right":i=h.HorizontalOrigin.RIGHT;break;case"top":e=h.VerticalOrigin.TOP;break;case"bottom":e=h.VerticalOrigin.BOTTOM;break;case"top-left":i=h.HorizontalOrigin.LEFT,e=h.VerticalOrigin.TOP;break;case"top-right":i=h.HorizontalOrigin.RIGHT,e=h.VerticalOrigin.TOP;break;case"bottom-left":i=h.HorizontalOrigin.LEFT,e=h.VerticalOrigin.BOTTOM;break;case"bottom-right":i=h.HorizontalOrigin.RIGHT,e=h.VerticalOrigin.BOTTOM;break}return{horizontalOrigin:i,verticalOrigin:e}}async function qL(t,i){const{width:e,height:n}=await Pn(t,!1),o={};for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)){const r=i[s];o[s]={width:r.width,height:r.height,x:r.x,y:n-r.y-r.height,pixelRatio:r.pixelRatio}}return o}function XL(t){const i=t["text-offset"]||[0,0],e=t["text-size"]||16;return new h.Cartesian2(i[0]*e,i[1]*e)}class YL extends a.Destroyable{constructor(){super();m(this,"callbacks",new Map)}registerEvent(e,n,o){var r;const s=`${e}-${n}`;this.callbacks.has(s)||this.callbacks.set(s,new Set),(r=this.callbacks.get(s))==null||r.add(o)}dispatchEvent(e){var o;const n=`${e.tileKey}-${e.type}`;(o=this.callbacks.get(n))==null||o.forEach(s=>s(e.data))}}var ar=(t=>(t[t.UNLOADED=0]="UNLOADED",t[t.LOADING=1]="LOADING",t[t.PROCESSING=2]="PROCESSING",t[t.READY=3]="READY",t[t.EXPIRED=4]="EXPIRED",t[t.FAILED=5]="FAILED",t))(ar||{});class ZL extends a.Destroyable{constructor(e){super();m(this,"czmESMVTLayers",new Map);m(this,"tilesCache",new BL);m(this,"tileLoader",new GL(this.tilesCache));m(this,"tileRenderer");m(this,"styleManager",new $L);m(this,"eventManager",new YL);m(this,"lastImageryTileMap",new Map);this.viewer=e;const n=Ke(e);n&&(this.tileRenderer=new UL(n.screenManager,this.styleManager)),this.ad(this.tilesCache.deleteTileEvent.don((r,l)=>{this.tileRenderer.remove(r,l)}));let o=performance.now();const s=e.scene.preUpdate.addEventListener(()=>{const r=performance.now();r-o>60&&(o=r,this.czmESMVTLayers.size>0&&this.refreshVisibleTiles())});this.ad(()=>s&&s())}async add(e){if(this.czmESMVTLayers.has(e.sceneObject.id)){console.log(`ESMVTLayer${e.sceneObject.id}已经添加过,跳过本次添加`);return}this.czmESMVTLayers.set(e.sceneObject.id,e),this.tileLoader.add(e),await this.styleManager.add(e),this.refreshVisibleTiles(!0)}remove(e){this.czmESMVTLayers.delete(e.sceneObject.id),this.tileLoader.remove(e),this.styleManager.remove(e),this.tilesCache.remove(e)}refreshVisibleTiles(e){const n=this.viewer;if(!n)return;const o=new Map;for(const[s,r]of this.czmESMVTLayers.entries()){if(!r)continue;const l={tilingScheme:{type:"WebMercatorTilingScheme"},rectangle:r.sceneObject.rectangle,tileHeight:r.sceneObject.tileSize,tileWidth:r.sceneObject.tileSize,maximumLevel:r.sceneObject.maximumLevel,minimumLevel:r.sceneObject.minimumLevel},c=new Set;wm(n.scene.globe._surface._tilesToRender,n.scene.terrainProvider,l).forEach(u=>c.add(`${u.level}-${u.x}-${u.y}`)),!o.has(s)&&o.set(s,c)}this.updateTiles(o,e)}updateTiles(e,n){var o,s;for(const r of this.czmESMVTLayers.keys()){const l=e.get(r)??new Set,c=this.lastImageryTileMap.get(r);if(c&&QL(l,c)&&!n)continue;this.lastImageryTileMap.set(r,l);const u=new Set(((o=this.tilesCache.get(r))==null?void 0:o.keys())??[]),d=new Set,p=new Set;for(const f of u){const g=(s=this.tileRenderer.renderedTiles.get(r))==null?void 0:s.get(f);if(!(!g||g.size==0))if(l.has(f))for(const v of g)d.add(v);else for(const v of g)p.add(v)}for(const f of d)p.delete(f);this.tileRenderer.update(r,p,!1),this.tileRenderer.update(r,d,!0);for(const f of l)u.has(f)||(this.tilesCache.set(r,f,new $C(f)),this.tileLoader.fetchTile(r,f).then(g=>{!g||!this.tilesCache.has(r,f)||(this.tilesCache.set(r,f,g),g.fillParentAndChildren(this.tilesCache.get(r)??new Map),this.tileRenderer.renderTile(r,g))}))}}}function QL(t,i){if(t.size!==i.size)return!1;for(const e of t)if(!i.has(e))return!1;return!0}new h.WebMercatorTilingScheme;const XC=["label","billboard","rectangle"];class kL extends a.Destroyable{constructor(e,n){super();m(this,"id",a.createGuid());m(this,"position",h.Cartesian3.ZERO);m(this,"label");m(this,"billboard");m(this,"rectangle");m(this,"zOrder");m(this,"labelRefCount",1);m(this,"billboardRefCount",1);m(this,"rectangleRefCount",1);m(this,"_showEvent",this.disposeVar(new a.Event));this.id=e,this.position=n,this.ad(this.showEvent.don(o=>{this.updateShow(o)}))}get showEvent(){return this._showEvent}show(e){this._showEvent.emit(e)}updateShow(e){this.label&&(this.label.show=e),this.billboard&&(this.billboard.show=e)}}class KL extends a.Destroyable{constructor(e){super();m(this,"objects",new Map);m(this,"screenManager");m(this,"czmViewer");m(this,"viewer");this.screenManager=e,this.czmViewer=e.czmViewer,this.viewer=e.viewer,this.ad(()=>{this.objects.clear()})}layerIsEffective(){return this.objects.size>0}addLabel(e,n,o){const s=this.makeScreenObjectId(e,o.index??a.createGuid()),r=Se(o.position),l=this.getOrCreateObject(s,r);if(this.screenManager.avoidanceManager.enable&&(n.show=!1),l.label)return l.labelRefCount++,l.label.show=n.show??!0,s;const c=this.screenManager.labelCollection.get({...n,position:r,id:o.properties??s,text:o.name});return c.ESSceneObjectID=e,l.label=c,l.zOrder=o.zOrder,s}addImage(e,n,o){const s=this.makeScreenObjectId(e,o.index??a.createGuid()),r=Se(o.position),l=this.getOrCreateObject(s,r);if(this.screenManager.avoidanceManager.enable&&(n.show=!1),l.billboard)return l.billboardRefCount++,l.billboard.show=n.show??!0,s;const c=this.screenManager.billboardCollection.get({...n,position:r,id:o.properties??s});return c.ESSceneObjectID=e,l.billboard=c,l.zOrder=o.zOrder,s}addRectangle(e,n,o,s){const r=this.makeScreenObjectId(e,o.index??a.createGuid()),l=Se(o.position),c=this.getOrCreateObject(r,l);if(this.screenManager.avoidanceManager.enable&&(n.show=!1),c.rectangle)return c.rectangleRefCount++,r;const u=this.screenManager.rectangleCollection.add({...a.getElementBounds(n.element),...n,id:o.properties??r,position:l,callback:s});return s(!0),c.rectangle=u,c.zOrder=o.zOrder,r}update(e,n){const o=Object.keys(n).length==1&&n.all&&Object.keys(n.all).length==1&&Reflect.has(n.all,"show"),s=new Map;for(const c of XC)s.set(c,Object.assign({},n[c],(n==null?void 0:n.all)??{}));const r=this.screenManager.avoidanceManager.enable,l=e instanceof Set?e:new Set([e]);for(const[c,u]of s)for(const d of l){const p=this.objects.get(d);if(!p)continue;const f=p[c];if(f){if(o){if(r&&u.show||f.show==u.show)continue;f.show=u.show;continue}for(const g in u)if(g!=="position"&&g!=="id"){if(r&&g=="show"&&u[g]||f[g]==u[g])continue;f[g]=u[g]}}}return!0}remove(e,n=!1){const o=e instanceof Set?e:typeof e=="string"?new Set([e]):e;if(o instanceof Set){for(const s of o){const r=this.objects.get(s);r&&(r.label&&(r.labelRefCount>1&&!n?r.labelRefCount--:(this.screenManager.labelCollection.release(r.label),r.label=void 0)),r.billboard&&(r.billboardRefCount>1&&!n?r.billboardRefCount--:(this.screenManager.billboardCollection.release(r.billboard),r.billboard=void 0)),r.rectangle&&(r.rectangleRefCount>1&&!n?r.rectangleRefCount--:(this.screenManager.rectangleCollection.remove(r.rectangle),r.rectangle=void 0)),this.tryDeleteEmpty(s))}return!0}else{for(const s of Object.keys(o)){const r=o[s]instanceof Set?o[s]:new Set([o[s]]);for(const l of r){if(!l)continue;const c=this.objects.get(l);if(c){if(c[`${s}RefCount`]>1&&!n)c[`${s}RefCount`]--;else{const u=c[s];u&&(this.screenManager.collectionMap[s].remove(u),c[s]=void 0)}this.tryDeleteEmpty(l)}}}return!0}}makeScreenObjectId(e,n){return`${e}_${n}`}getOrCreateObject(e,n){let o=this.objects.get(e);return o||(o=new kL(e,n),this.objects.set(e,o)),o}tryDeleteEmpty(e){const n=this.objects.get(e);n&&!n.label&&!n.billboard&&!n.rectangle&&this.objects.delete(e)}}function JL(t,i){const e=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER];for(const n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&XC.includes(n)){const o=i[n];if(!o)continue;let s,r,l,c;if(o instanceof h.Label||o instanceof h.Billboard){const u=o.computeScreenSpacePosition(t.scene);({x:s,y:r,width:l,height:c}=h[o instanceof h.Label?"Label":"Billboard"].getScreenSpaceBoundingBox(o,u))}else({x:s,y:r,width:l,height:c}=o);if(isNaN(s)||isNaN(r)||isNaN(l)||isNaN(c))continue;e[0]=Math.min(e[0],s),e[1]=Math.min(e[1],r),e[2]=Math.max(e[2],s+l),e[3]=Math.max(e[3],r+c)}return new h.Rectangle(...e)}class jL extends a.Destroyable{constructor(e){super();m(this,"rectangleCollisionCheck",new h.RectangleCollisionChecker);m(this,"screenManager");m(this,"enable",!1);m(this,"forceRebuildNext",!1);m(this,"avoidanceLayers",[]);m(this,"_processingQueue",[]);m(this,"_isProcessing",!1);m(this,"BATCH_SIZE",1e3);m(this,"_cache",new Map);m(this,"_lastCameraState",{});m(this,"CAMERA_MOVE_THRESHOLD",5e-4);this.screenManager=e,this.ad(()=>{this.rectangleCollisionCheck._tree.clear(),this._cache.clear(),this._processingQueue.length=0})}update(){if(this.avoidanceLayers.length==0)return;const e=this._shouldForceRebuild();this._buildProcessingQueue(e),this._isProcessing||(this._isProcessing=!0,requestAnimationFrame(()=>this._processBatch()))}setAvoidanceLayer(){for(let e=0;e<this.avoidanceLayers.length;e++){const n=this.screenManager.getLayer(this.avoidanceLayers[e]);n.layerIsEffective()&&n.objects.forEach((o,s)=>{o.show(!this.enable)})}this.forceRebuildNext=!0}updateAvoidanceLayer(e,n){this.enable=(e==null?void 0:e.enabled)??!1,n?e!=null&&e.enabled?this.avoidanceLayers.includes(n)||this.avoidanceLayers.push(n):this.avoidanceLayers=this.avoidanceLayers.filter(o=>o!=n):e!=null&&e.enabled?this.avoidanceLayers=Array.from(this.screenManager.layers.keys()):(this.setAvoidanceLayer(),this.avoidanceLayers=[]),this.setAvoidanceLayer()}_shouldForceRebuild(){if(this.forceRebuildNext)return this.forceRebuildNext=!1,this._updateLastCameraState(),!0;const e=this.screenManager.viewer.camera,n=e.positionWC,o=e.directionWC,s=this._lastCameraState.position,r=this._lastCameraState.direction;if(!s||!r)return this._updateLastCameraState(),!0;const l=h.Cartesian3.distanceSquared(n,s),c=h.Cartesian3.distanceSquared(o,r);return l>this.CAMERA_MOVE_THRESHOLD||c>this.CAMERA_MOVE_THRESHOLD?(this._updateLastCameraState(),!0):!1}_updateLastCameraState(){const e=this.screenManager.viewer.camera;this._lastCameraState.position=h.Cartesian3.clone(e.positionWC),this._lastCameraState.direction=h.Cartesian3.clone(e.directionWC)}_buildProcessingQueue(e){e&&(this.rectangleCollisionCheck._tree.clear(),this._cache.clear()),this._processingQueue.length=0;for(let n=0;n<this.avoidanceLayers.length;n++){const o=this.screenManager.getLayer(this.avoidanceLayers[n]);o.layerIsEffective()&&o.objects.forEach((s,r)=>{this._processingQueue.push(s)})}this._processingQueue.sort((n,o)=>(o.zOrder||0)-(n.zOrder||0))}_processBatch(){performance.now();const e=this._processingQueue,n=this.BATCH_SIZE;let o=0;for(;e.length>0&&o<n;){const s=e.shift();this._updateSingleObject(s),o++}e.length>0?requestAnimationFrame(()=>this._processBatch()):this._isProcessing=!1}_updateSingleObject(e){try{if(!this.screenManager.czmViewer.isPointVisible(e.position)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}const n=e.id.toString(),o=this._cache.get(n),s=h.Cartesian3.clone(e.position);let r;if(o&&h.Cartesian3.equalsEpsilon(o.worldPos,s,1e-6))r=o.rect,this.rectangleCollisionCheck.remove(n,r);else{if(r=JL(this.screenManager.viewer,e),isNaN(r.width)||isNaN(r.height)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}this._cache.set(n,{rect:r,worldPos:s,lastFrame:Date.now()})}this.rectangleCollisionCheck.collides(r)?e.show(!1):(e.show(!0),this.rectangleCollisionCheck.insert(e.id.toString(),r))}catch(n){console.error("ScreenManager update object error",n)}}}class YC extends a.Destroyable{constructor(){super();m(this,"_collection",[]);this.ad(()=>this._collection=[])}get length(){return this._collection.length}add(e){return this._collection.push(e),e._index=this._collection.length,e}remove(e){this._collection[e._index]=void 0}}class ZC extends a.Destroyable{constructor(e,n=500,o={minPoolRatio:.1}){super();m(this,"_pool",[]);m(this,"_minPoolRatio");m(this,"_initialSize");this._collection=e,this._initialSize=n,this._minPoolRatio=o.minPoolRatio??.1;for(let s=0;s<n;s++){const r=this._collection.add({show:!1,position:new h.Cartesian3(0,0,0)});this._pool.push(r)}this.ad(()=>{for(const s of this._pool)this.removeFromCollection(s);this._pool.length=0})}get(e,n){if(typeof e=="number"){const o=e,s=n,r=[];for(let l=0;l<o;l++){const c=this._getOne();this.update(c,s),r.push(c)}return r}else{const o=this._getOne();return this.update(o,e),o}}release(e){if(Array.isArray(e))for(const n of e)n.show=!1,this._pool.push(n);else e.show=!1,this._pool.push(e);this._dynamicRecycle()}update(e,n){if(n){Object.assign(e,n);for(const o in n)if(Object.prototype.hasOwnProperty.call(n,o)){const s=n[o];Reflect.has(e,o)&&(e[o]=s)}Reflect.has(e,"imageSubRegion")&&e.setImageSubRegion(n.image,n.imageSubRegion)}}get available(){return this._pool.length}removeFromCollection(e){this._collection instanceof h.LabelCollection?this._collection.remove(e):this._collection instanceof h.BillboardCollection&&this._collection.remove(e)}_getOne(){if(this._pool.length>0)return this._pool.pop();{const e=this._collection.add({show:!1,position:new h.Cartesian3(0,0,0)});return this._dynamicRecycle(),e}}_dynamicRecycle(){const e=this._collection.length,n=Math.max(this._initialSize,Math.floor(e*this._minPoolRatio));for(;this._pool.length>n;){const o=this._pool.pop();this.removeFromCollection(o)}}}class QC extends a.Destroyable{constructor(e){super();m(this,"layers",new Map);m(this,"czmViewer");m(this,"viewer");m(this,"avoidanceManager");m(this,"labelCollection");m(this,"billboardCollection");m(this,"rectangleCollection",this.ad(new YC));m(this,"canvasCollection",this.ad(new YC));m(this,"collectionMap");m(this,"_refreshEvent",this.ad(new a.Event));this.czmViewer=e,this.viewer=e.viewer,this.avoidanceManager=this.ad(new jL(this));const n=new h.LabelCollection({scene:this.viewer.scene}),o=new h.BillboardCollection({scene:this.viewer.scene});this.labelCollection=new ZC(n,500),this.billboardCollection=new ZC(o,500),this.viewer.scene.primitives.add(n),this.viewer.scene.primitives.add(o),this.collectionMap={label:n,billboard:o,rectangle:this.rectangleCollection},this.ad(a.createEventsCallFunc([this.czmViewer.cameraChanged,this.refreshEvent],()=>{this.avoidanceManager.update()},{immediate:!0})),this.ad(()=>{this.layers.forEach(s=>s.destroy()),this.layers.clear(),n.removeAll(),o.removeAll(),this.viewer.scene.primitives.remove(n),this.viewer.scene.primitives.remove(o)})}get refreshEvent(){return this._refreshEvent}refresh(){this._refreshEvent.emit()}getLayer(e){let n=this.layers.get(e);return n||(n=new KL(this),this.layers.set(e,n),this.avoidanceManager.enable&&this.avoidanceManager.updateAvoidanceLayer({enabled:!0})),n}addLabel(e,n,o,s){const l=this.getLayer(n).addLabel(e,o,s);return this.refresh(),{layer:n,id:e,screenObjectId:l}}addImage(e,n,o,s){const l=this.getLayer(n).addImage(e,o,s);return this.refresh(),{layer:n,id:e,screenObjectId:l}}addRectangle(e,n,o,s,r){const c=this.getLayer(n).addRectangle(e,o,s,r);return this.refresh(),{layer:n,id:e,screenObjectId:c}}update(e,n,o,s){const r=this.getLayer(e);return o instanceof Set&&o.size===0?!1:(r.update(o,s),this.refresh(),!0)}remove(e,n,o,s=!1){const r=this.getLayer(e);if(!r.remove(o,s)){console.warn(`屏幕管理器,删除${n}下的内容失败!`);return}!r.layerIsEffective()&&!r.isDestroyed()&&(r.destroy(),this.layers.delete(e)),this.refresh()}setRules(e,n){Reflect.has(e,"avoidance")&&this.avoidanceManager.updateAvoidanceLayer(e.avoidance,n),this.refresh()}}function Ke(t){return a.getExtProp(t,"_viewerExtensions")}function Ig(t,i){a.setExtProp(t,"_viewerExtensions",i)}class kC extends a.Destroyable{constructor(e,n){super();m(this,"_imageriesManager");m(this,"_terrainManager");m(this,"_labelManager");m(this,"_pickingManager");m(this,"_poiContext");m(this,"_cursorPositionInfo");m(this,"_screenManager");m(this,"_vectorTIlesManager");this._viewer=e,this._czmViewer=n,this._imageriesManager=this.dv(new UC(this.viewer)),this._terrainManager=this.dv(new WC(this.viewer)),this._labelManager=this.dv(new GC(this.viewer)),this._poiContext=this.disposeVar(new zm(this._viewer)),this._cursorPositionInfo=this.disposeVar(new OL(this._viewer)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new HC(n)),this._screenManager=this.ad(new QC(n)),this._vectorTIlesManager=this.ad(new ZL(n.viewer)),this.ad(a.createEventsCallFunc(this.czmViewer.textAvoidanceChanged,()=>{this.screenManager.setRules({avoidance:{enabled:this.czmViewer.textAvoidance}})},{immediate:!0}))}))}get viewer(){return this._viewer}get czmViewer(){return this._czmViewer}get imageriesManager(){return this._imageriesManager}get terrainManager(){return this._terrainManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}get screenManager(){return this._screenManager}get vectorTIlesManager(){return this._vectorTIlesManager}}var KC=new h.Cartesian3,JC=new h.Cartesian3;function jC(t,i,e){let n=h.Matrix4.clone(t.transform);t.lookAtTransform(h.Matrix4.IDENTITY);var o=t.positionCartographic.height,s=t.positionWC,r=h.Cartesian3.normalize(s,KC),l=h.Cartesian3.dot(t.direction,r);if(l>-.9&&l<.9)var c=h.Cartesian3.cross(t.direction,r,JC);else var c=h.Cartesian3.cross(t.up,r,JC);var u=c;if(e){var d=h.Cartesian3.cross(r,c,KC);u=d}var p=h.Cartesian3.magnitude(s);t.rotate(u,i/p);var f=t.positionCartographic,g=f.longitude,v=f.latitude;h.Cartesian3.fromRadians(g,v,o,void 0,t.position),t.lookAtTransform(n)}function e_(t,i){jC(t,i,!1)}function t_(t,i){jC(t,-i,!0)}class eN extends a.Destroyable{constructor(e){super();m(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:n}=this,{viewer:o}=n.firstPersonController,{camera:s}=o;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(r=>{const{keyStatusMap:l}=this.running.keyboardCameraController;l[r.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:l[r.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(r=>{const{keyStatusMap:l}=this.running.keyboardCameraController;l[r.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:r}=this;let l=Date.now();const c=()=>{const u=Date.now(),d=u-l;l=u;const p=this.controller.speed;r.WithCamera||this.controller.alwaysWithCamera?(r.MoveForward&&s.moveForward(d*p),r.MoveBackword&&s.moveBackward(d*p),r.MoveLeft&&s.moveLeft(d*p),r.MoveRight&&s.moveRight(d*p)):(r.MoveForward&&e_(s,d*p),r.MoveBackword&&e_(s,-d*p),r.MoveLeft&&t_(s,-d*p),r.MoveRight&&t_(s,d*p));{const{rotateSpeed:f}=this.controller,g=h.Math.toRadians(f*d);r.RotateRight?s.lookRight(g):r.RotateLeft?s.lookRight(-g):r.RotateUp?s.lookDown(-g):r.RotateDown&&s.lookDown(g)}};o.scene.preUpdate.addEventListener(c),this.dispose(()=>o.scene.preUpdate.removeEventListener(c))}}get running(){return this._running}get controller(){return this.running.keyboardCameraController}get actions(){return this._actions}_resetActions(){const e=Object.keys(this._actions);for(let n of e)this._actions[n]=!1}_updateActions(){const{running:e}=this,{keyStatus:n}=e,{actions:o}=this;this._resetActions();const{keyStatusMap:s}=this.running.keyboardCameraController;for(let r of n.currentKeyIds)o[s[r]]=!0}}class Xh extends a.Destroyable{constructor(e){super();m(this,"_currentKeyIds",new Set);m(this,"_currentKeyIdsChanged",this.dv(new a.Event));m(this,"_debug",this.dv(a.react(!1)));m(this,"_debugResetting",this.dv(new a.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends a.Destroyable{constructor(e){super();const n=()=>{console.log([...e.currentKeyIds].join(`
|
|
1995
|
+
}`},translucent:!0});function TL(){Object.defineProperties(h.Billboard.prototype,{_positionFromParent:{get(){return!1},set(t){}}})}zF(),LF(),NF(),WF(),GF(),UF(),HF(),FF(),ez(),tz(),nz(),xz(),TL(),h.Camera.DEFAULT_VIEW_RECTANGLE=h.Rectangle.fromDegrees(70,5,140,55);function IL(){return new Promise((t,i)=>h.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class ML extends a.Destroyable{constructor(i,e,n,o){super();const s=()=>{e.setStatus("Raw");const{viewer:l}=e;if(l){const c=Ke(l);if(c&&(c.destroy(),Ig(l,void 0)),h.defined(l)){l.entities.removeAll(),l.dataSources.removeAll(),l.imageryLayers.removeAll(),l.scene.primitives.removeAll(),l.scene.groundPrimitives.removeAll(),l.scene.postProcessStages.removeAll();let u=l.scene.context._originalGLContext;u.canvas.width=u.canvas.height=1,u.getExtension("WEBGL_lose_context").loseContext(),u=null}l.destroy(),n(void 0)}};this.d(s);const r=this.dv(a.createProcessingFromAsyncFunc(async(l,c)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const u=RF;await l.promise(IL());const d=await l.promise(a.createCancelablePromise(u(c,o)));d.scene._xbsjOriginSkyAtmosphere=d.scene.skyAtmosphere,d.scene._xbsjOriginSkyBox=d.scene.skyBox,d.scene.renderError.removeEventListener(d.cesiumWidget._onRenderError),d.clockViewModel.currentTime=h.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const p=h.JulianDate.fromDate(new Date(e.currentTime));h.JulianDate.equals(p,d.clockViewModel.currentTime)||(d.clockViewModel.currentTime=p)})),this.dispose(Ci(d.clockViewModel,"currentTime",p=>{const f=h.JulianDate.toDate(d.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const p=new kC(d,e);Ig(d,p)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),n(d)}));r.start(i),r.errorEvent.don(l=>{console.error(l),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const DL=new h.EllipsoidTerrainProvider;class WC extends a.Destroyable{constructor(e){super();m(this,"_terrainMap",new Map);m(this,"_nextAnimateFrame",this.dv(a.createNextAnimateFrame()));m(this,"selectedTerrain");this._viewer=e;const n=this._viewer,o=n.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{o&&o()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let s=Number.MIN_SAFE_INTEGER;for(let r of this._terrainMap.keys())r.sceneObject.activate=!1,(r.sceneObject.show??!0)&&r.sceneObject.zIndex>=s&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${r.sceneObject.name}(${r.sceneObject.id})`),s=r.sceneObject.zIndex,this.selectedTerrain=r);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),n.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??DL}))}_makeDirty(){this._nextAnimateFrame.restartIfNotRunning()}get _changed(){return this._nextAnimateFrame.completeEvent}add(e){if(this._terrainMap.has(e)){console.warn("this._terrainMap.has(imagery)");return}const n=new a.Destroyable;n.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),n.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>n.destroy()),this._makeDirty();const o=this.ad(a.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged));this.d(o.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const n=this._terrainMap.get(e);if(!n){console.error("!disposeFunc");return}n(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class GC extends a.Destroyable{constructor(e){super();m(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const n=e instanceof Ue?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`this._labelMap[${n}].has(poi)`,e);return}const o=new a.Destroyable;{const s=o.dv(a.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));o.dispose(s.don(()=>{this._updateZOrder()}))}this._labelMap[n].set(e,()=>o.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Ue?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`!this._labelMap[${n}].has(poi)`,e);return}const o=this._labelMap[n].get(e);if(!o){console.error("!disposeFunc");return}o(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){const o={};for(const l of e.keys())o[l.zOrder]||(o[l.zOrder]=new Map),o[l.zOrder].set(l,l instanceof Ue?l.czmDivPoi?l.czmDivPoi.depth:0:l.canvasObj?l.canvasObj.czmCanvasPoi.depth:0);const s=Object.keys(o).sort((l,c)=>n=="div"?Number(c)-Number(l):Number(l)-Number(c));let r=e.size;for(let l=0;l<s.length;l++)new Map([...o[s[l]]].sort((u,d)=>Number(d[1])-Number(u[1]))).forEach((u,d)=>{d instanceof Ue&&d.czmDivPoi&&(d.czmDivPoi.zOrder=r),d instanceof qi&&d.canvasObj&&(d.canvasObj.czmCanvasPoi.zOrder=r),r--})}}class RL extends a.Destroyable{constructor(e){super();m(this,"_czmImageryLayerWrappers",new Set);m(this,"_zIndexChangedEvent",this.dv(new a.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const n=[...this.czmImageryLayerWrappers.values()];n.sort((o,s)=>{const r=o.czmImageryWrapper.imagery.zIndex??a.ESImageryLayer.defaults.zIndex,l=s.czmImageryWrapper.imagery.zIndex??a.ESImageryLayer.defaults.zIndex;return r-l});for(const o of n)this.viewer.imageryLayers.raiseToTop(o.imageryLayer)}))}get viewer(){return this._viewer}get czmImageryLayerWrappers(){return this._czmImageryLayerWrappers}add(e){this._czmImageryLayerWrappers.add(e),this.viewer.imageryLayers.add(e.imageryLayer),this.zIndexChange()}delete(e){this.viewer.imageryLayers.remove(e.imageryLayer,!1),this._czmImageryLayerWrappers.delete(e)}zIndexChange(){this._zIndexChangedEvent.emit()}}class FL extends a.Destroyable{constructor(e){super();m(this,"_imageryLayer");if(this._czmImageryWrapper=e,!this._czmImageryWrapper.imagery.layer)throw new Error("this._czmCzmImageryWrapper.imagery.czmImagery");this._imageryLayer=this._czmImageryWrapper.imagery.layer;const{czmImageryWrapper:n}=this,o=n.manager.czmImageriesManager;o.add(this),this.d(()=>o.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>o.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class zL extends a.Destroyable{constructor(e){super();m(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new a.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new FL(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class LL extends a.Destroyable{constructor(e,n){super();m(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=n,this._czmImageryLayerWrapperObjResetting=this.dv(new a.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new zL(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class UC extends a.Destroyable{constructor(e){super();m(this,"_czmImageryWrappers",new Set);m(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new RL(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let n of this.czmImageryWrappers)if(n.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new LL(e,this))}has(e){for(let n of this.czmImageryWrappers)if(n.imagery===e)return!0;return!1}delete(e){for(const n of this.czmImageryWrappers)if(n.imagery===e){this.czmImageryWrappers.delete(n);return}console.warn("imageriesManager delete error!",e)}}class HC extends a.Destroyable{constructor(e){super();m(this,"_pause",this.disposeVar(a.react(!1)));m(this,"_pickPositionTasks",[]);m(this,"_pickTasks",[]);m(this,"pickHeightMustGreaterThanZero",!0);m(this,"objectsToExclude",[]);const n=e.viewer;{this.dispose(()=>{this._pickPositionTasks.length>0&&(this._pickPositionTasks.forEach(l=>l[3]("CzmViewer销毁,任务不再执行!")),this._pickPositionTasks.length=0),this._pickTasks.length>0&&(this._pickTasks.forEach(l=>l[4]("CzmViewer销毁,任务不再执行!")),this._pickTasks.length=0)});const o=()=>{const l=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let u of l){const[d,p,f,g]=u;try{(async()=>{const{scene:v,camera:y}=n,w=Pe(d),P=y.getPickRay(w);if(P){let E;if(p?E=await v.pickFromRayMostDetailed(P,this.objectsToExclude):E=v.pickFromRay(P,this.objectsToExclude),E&&E.position){const R=se(E.position);return R?f(R):g(new Error("positionFromCartesian failed"))}if(!(v.terrainProvider instanceof h.EllipsoidTerrainProvider)){const R=v.globe.pick(P,v);if(!R)return g(new Error("scene.globe.pick failed"));const N=se(R);return N?(this.pickHeightMustGreaterThanZero&&N[2]<0&&(N[2]=0),f(N)):g(new Error("positionFromCartesian failed"))}}const C=v.terrainProvider instanceof h.EllipsoidTerrainProvider?v.terrainProvider.tilingScheme.ellipsoid:n.scene.globe.ellipsoid,S=n.camera.pickEllipsoid(Pe(d),C);if(!S)return g(new Error("Pick failed"));const A=se(S);return A?f(A):g(new Error("positionFromCartesian failed"))})()}catch(v){g(v)}}const c=[...this._pickTasks];this._pickTasks.length=0;for(let u of c){const[d,p,f,g,v]=u;e.pickCustomAttachedInfo=f;try{(async()=>{var E,R,N,B;let y=n.scene.pick(Pe(d),p&&p[0],p&&p[1]);!y&&h.defined(n.scene.globe)&&(y=await NL(n,Pe(d)));let w;if(y&&y instanceof h.Cesium3DTileFeature){w={};try{y&&y.getPropertyIds().forEach(G=>{w&&(w[G]=y.getProperty(G))})}catch(V){console.warn(V)}}if(!y){const{left:V,top:G}=e.container.getBoundingClientRect();y=(E=document.elementFromPoint(d[0]+V,d[1]+G))==null?void 0:E.closest("[data-es-scene-object-id]")}let P;y&&(y.id&&y.id instanceof h.Entity&&y.id.ESSceneObjectID?P=y.id.ESSceneObjectID:y.primitive&&y.primitive.ESSceneObjectID?P=y.primitive.ESSceneObjectID:y.collection&&y.collection.ESSceneObjectID?P=y.collection.ESSceneObjectID:Array.isArray(y)&&y[0]instanceof h.ImageryLayerFeatureInfo?P=y[0].imageryLayer.ESSceneObjectID:y instanceof HTMLElement&&(P=y.dataset.esSceneObjectId));let C=P?a.ESSceneObject.getSceneObject(P):void 0;C&&C.parentID&&(C=a.ESSceneObject.getSceneObject(C.parentID));let S={};if(C&&Reflect.has(C,"allowPicking")&&Reflect.has(C,"pickedEvent")&&(C.allowPicking??!1)){if(C instanceof a.ESEntityCluster){const V=new h.JulianDate;S=y.id instanceof h.Entity?{name:y.id.label.text.getValue(V),properties:(R=y.id.properties)==null?void 0:R.getValue(V),coordinates:wr(y.id.position.getValue(V))}:(N=y.id)==null?void 0:N.map(G=>{var z;return{name:G.id,properties:(z=G.properties)==null?void 0:z.getValue(V),coordinates:wr(G.position.getValue(V))}})}else if(C instanceof a.ESGeoJson){const V=new h.JulianDate;let G,z,O;y.id.entityCollection?(G=y.id.polygon?"Polygon":y.id.polyline?"LineString":"Point",O=((B=y.id.properties)==null?void 0:B.getValue(V))??{},z=G=="Point"?se(y.id.position.getValue(V)):G=="LineString"?y.id.polyline.positions.getValue(V).map(_=>se(_)):yu(y.id.polygon.hierarchy.getValue(V))):(y.primitive instanceof h.Billboard||y.primitive instanceof h.Label)&&(G="Point",typeof y.id=="object"&&(O=y.id),z=se(y.primitive.position)),S=C.pickedInfoType=="FeatureCollection"||C.pickedInfoType=="Feature"?{type:"Feature",geometry:{type:G,coordinates:z},properties:O}:{type:G,coordinates:z,properties:O}}else if(C instanceof a.ESGltfModel){let V;Reflect.has(y,"featureId")?V=y.featureId:Reflect.has(y,"instanceId")&&(V=y.instanceId),V&&(y.id=y.primitive.structuralMetadata.getPropertyTable(0).getProperty(y.instanceId,"id"))}C.pickedEvent.emit(new a.ESJPickedResult(y,C,w,S,f,d))}C&&Reflect.has(C,"allowPicking")&&!C.allowPicking&&g(new a.ESJPickedResult);const A=new a.ESJPickedResult(y,C,w,S,f,d);g(A)})()}catch(y){v(y)}}};let s=n.scene.postRender.addEventListener(o);const r=()=>{s&&s(),s=void 0};this.ad(r),this.ad(this.pauseChanged.don(l=>{l?r():s=n.scene.postRender.addEventListener(o)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((n,o)=>{this._pickPositionTasks.push([e,!0,n,o])})}quickPickPosition(e){return new Promise((n,o)=>{this._pickPositionTasks.push([e,!1,n,o])})}pick(e,n,o){return new Promise((s,r)=>{this._pickTasks.push([e,n,o,s,r])})}}function NL(t,i){const e=t.scene,n=e.camera.getPickRay(i);if(!n)return;const o=e.imageryLayers.pickImageryLayerFeatures(n,e);if(h.defined(o))return o}class OL extends a.Destroyable{constructor(e){super();m(this,"_enabled",this.disposeVar(a.react(!1)));m(this,"_cursorPosition",a.react(void 0));m(this,"quickPickPosition",!0);let n=new a.Destroyable;const o=()=>{n&&(n.destroy(),n=void 0)};this.dispose(o);const s=()=>{if(o(),!this._enabled.value||!e)return;const r=Ke(e);if(!r)return;n=new a.Destroyable;const l=n.disposeVar(a.react(void 0)),c=n.disposeVar(a.createNextAnimateFrameEvent(l.changed));n.dispose(r.czmViewer.pointerMoveEvent.disposableOn(d=>{d.pointerEvent&&(l.value=a.getDomEventCurrentTargetPos(d.pointerEvent))}));const u=n.disposeVar(a.createProcessingFromAsyncFunc(async d=>{if(r.pickingManager&&l.value)if(this.quickPickPosition){const p=await d.promise(a.createCancelablePromise(r.pickingManager.quickPickPosition(l.value)));this._cursorPosition.value=p}else{const p=await d.promise(a.createCancelablePromise(r.pickingManager.pickPosition(l.value)));this._cursorPosition.value=p}}));n.dispose(c.disposableOn(()=>{u.restart()}))};s(),this.dispose(this._enabled.changed.disposableOn(s))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}class BL extends a.Destroyable{constructor(){super();m(this,"cache",new Map);m(this,"maxSize",300);m(this,"_deleteTileEvent",this.disposeVar(new a.Event))}get deleteTileEvent(){return this._deleteTileEvent}deleteTile(e,n){this._deleteTileEvent.emit(e,n)}has(e,n){const o=this.cache.get(e);return n?(o==null?void 0:o.has(n))??!1:!!o}get(e,n){const o=this.cache.get(e);if(!o)return;if(!n)return o;const s=o.get(n);return s&&(o.delete(n),o.set(n,s)),s}set(e,n,o){let s=this.get(e);if(s||(s=new Map,this.cache.set(e,s)),s.set(n,o),s.size>=this.maxSize){const r=s.keys().next().value;r&&this.remove(e,r)}}remove(e,n){const o=e instanceof xh?e.sceneObject.id:e;let s=this.get(o);s&&(n?(s.delete(n),s.size===0&&this.cache.delete(o)):this.cache.delete(o),this.deleteTile(o,n))}}class $C extends a.Destroyable{constructor(e){super();m(this,"x");m(this,"y");m(this,"z");m(this,"tileKey");m(this,"parent",null);m(this,"children",new Set);m(this,"data",new Map);m(this,"state",ar.UNLOADED);this.tileKey=e,[this.z,this.x,this.y]=e.split("-").map(Number)}fillParentAndChildren(e){var o;const n=`${this.z-1}-${Math.floor(this.x/2)}-${Math.floor(this.y/2)}`;this.parent=e.get(n)??null,(o=this.parent)==null||o.children.add(this)}}class VL extends a.Destroyable{constructor(e,n,o){super();m(this,"workers",[]);m(this,"queue",[]);m(this,"destroyed",!1);const s=navigator.hardwareConcurrency||4;let r;n?n>s?(console.warn(`创建线程超过CPU核心数,已限制为${s-1}`),r=s-1):r=n:r=Math.max(1,s-1);for(let l=0;l<r;l++)this.workers.push(new Worker(e,o));this.ad(()=>{this.destroyed=!0;for(const l of this.queue)l(null);this.queue.length=0;for(const l of this.workers)l.terminate();this.workers.length=0})}acquire(){return this.destroyed?Promise.reject("WorkerPool destroyed"):new Promise(e=>{this.workers.length>0?e(this.workers.pop()):this.queue.push(e)})}release(e){this.destroyed||(this.queue.length>0?this.queue.shift()(e):this.workers.push(e))}}function ln(t,i){if(typeof t=="string"){const e=[...t.matchAll(/\{([^}]+)\}/g)].map(n=>n[1]);return e.length===0?null:e.length===1?e[0]:e}if(t&&typeof t=="object"&&Array.isArray(t.stops)){let e=t.stops[0][1];for(const[n,o]of t.stops)i>=n&&(e=o);return ln(e,i)}if(Array.isArray(t))switch(t[0]){case"get":{const n=t[1];return typeof n=="string"?n:null}case"step":{let n=t[2];for(let o=3;o<t.length;o+=2){const s=t[o],r=t[o+1];i>=s&&(n=r)}return ln(n,i)}case"case":{for(let n=2;n<t.length;n+=2){if(n===t.length-1)return ln(t[n],i);const o=t[n],s=ln(o,i);if(s)return s}return null}case"match":{const n=new Set;for(let o=3;o<t.length;o+=2){const s=t[o],r=ln(s,i);r&&(Array.isArray(r)?r.forEach(l=>n.add(l)):n.add(r))}return n.size?[...n]:null}case"concat":{const n=new Set;for(let o=1;o<t.length;o++){const s=ln(t[o],i);s&&(Array.isArray(s)?s.forEach(r=>n.add(r)):n.add(s))}return n.size?[...n]:null}case"format":{const n=new Set;for(let o=1;o<t.length;o+=2){const s=ln(t[o],i);s&&(Array.isArray(s)?s.forEach(r=>n.add(r)):n.add(s))}return n.size?[...n]:null}}return null}function WL(t){const i=new Map;for(const e in t){const n=t[e],o=new Set,s=n.points,r=n.pointProps;for(let g=0;g<s.length;g+=3){const v=g/3;o.add({type:"Feature",geometry:{type:"Point",coordinates:[s[g],s[g+1]]},properties:r[v]||{}})}const l=n.lines,c=n.lineOffsets,u=n.lineProps;for(let g=0;g<c.length;g++){const v=c[g]*3,y=g+1<c.length?c[g+1]*3:l.length,w=[];for(let P=v;P<y;P+=3)w.push([l[P],l[P+1]]);o.add({type:"Feature",geometry:{type:"LineString",coordinates:w},properties:u[g]||{}})}const d=n.polygons,p=n.polygonOffsets,f=n.polygonProps;for(let g=0;g<p.length;g++){const v=p[g]*3,y=g+1<p.length?p[g+1]*3:d.length,w=[];for(let P=v;P<y;P+=3)w.push([d[P],d[P+1]]);o.add({type:"Feature",geometry:{type:"Polygon",coordinates:[w]},properties:f[g]||{}})}i.set(e,o)}return i}class GL extends a.Destroyable{constructor(e){super();m(this,"pendingRequests",new Map);m(this,"sourcesMap",new Map);m(this,"workerPool");m(this,"tileSchemes",new Map);this.tilesCache=e,this.workerPool=new VL(new URL("data:video/mp2t;base64,Ly8vIDxyZWZlcmVuY2UgbGliPSJXZWJXb3JrZXIiIC8+DQppbXBvcnQgUGJmIGZyb20gInBiZiI7DQppbXBvcnQgeyBWZWN0b3JUaWxlIH0gZnJvbSAiQG1hcGJveC92ZWN0b3ItdGlsZSI7DQoNCnNlbGYub25tZXNzYWdlID0gYXN5bmMgKGUpID0+IHsNCiAgICBjb25zdCB7IHR5cGUsIHVybCwgeCwgeSwgeiB9ID0gZS5kYXRhOw0KICAgIGlmICh0eXBlICE9PSAiZmV0Y2giKSByZXR1cm47DQoNCiAgICB0cnkgew0KICAgICAgICBjb25zdCBidWZmZXIgPSBhd2FpdCAoYXdhaXQgZmV0Y2godXJsKSkuYXJyYXlCdWZmZXIoKTsNCiAgICAgICAgY29uc3QgdGlsZSA9IG5ldyBWZWN0b3JUaWxlKG5ldyBQYmYoYnVmZmVyKSk7DQoNCiAgICAgICAgY29uc3QgdGlsZURhdGE6IFJlY29yZDxzdHJpbmcsIGFueT4gPSB7fTsNCg0KICAgICAgICBmb3IgKGNvbnN0IGxheWVyTmFtZSBpbiB0aWxlLmxheWVycykgew0KICAgICAgICAgICAgY29uc3QgbGF5ZXIgPSB0aWxlLmxheWVyc1tsYXllck5hbWVdOw0KICAgICAgICAgICAgY29uc3QgZXh0ZW50ID0gbGF5ZXIuZXh0ZW50IHx8IDQwOTY7DQoNCiAgICAgICAgICAgIGNvbnN0IHBvaW50czogbnVtYmVyW10gPSBbXTsNCiAgICAgICAgICAgIGNvbnN0IHBvaW50UHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IGxpbmVzOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgbGluZU9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBsaW5lUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGNvbnN0IHBvbHlnb25zOiBudW1iZXJbXSA9IFtdOw0KICAgICAgICAgICAgY29uc3QgcG9seWdvbk9mZnNldHM6IG51bWJlcltdID0gW107DQogICAgICAgICAgICBjb25zdCBwb2x5Z29uUHJvcHM6IGFueVtdID0gW107DQoNCiAgICAgICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbGF5ZXIubGVuZ3RoOyBpKyspIHsNCiAgICAgICAgICAgICAgICBjb25zdCBmID0gbGF5ZXIuZmVhdHVyZShpKTsNCiAgICAgICAgICAgICAgICBjb25zdCBnZW9tID0gZi5sb2FkR2VvbWV0cnkoKTsNCiAgICAgICAgICAgICAgICBjb25zdCB0ID0gZi50eXBlOw0KICAgICAgICAgICAgICAgIGNvbnN0IHByb3BlcnRpZXMgPSBmLnByb3BlcnRpZXMgfHwge307DQoNCiAgICAgICAgICAgICAgICBpZiAodCA9PT0gMSkgeyAvLyBQb2ludA0KICAgICAgICAgICAgICAgICAgICBsZXQgc3ggPSAwLCBzeSA9IDAsIGNudCA9IDA7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsgc3ggKz0gcC54OyBzeSArPSBwLnk7IGNudCsrOyB9DQogICAgICAgICAgICAgICAgICAgIGlmIChjbnQgPT09IDApIGNvbnRpbnVlOw0KICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgICAgIHBvaW50cy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgcG9pbnRQcm9wcy5wdXNoKHByb3BlcnRpZXMpOw0KDQogICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0ID09PSAyKSB7IC8vIExpbmUNCiAgICAgICAgICAgICAgICAgICAgbGluZU9mZnNldHMucHVzaChsaW5lcy5sZW5ndGggLyAzKTsNCiAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IHsgbG9uLCBsYXQgfSA9IHRpbGVQaXhlbFRvTG9uTGF0KHAueCwgcC55LCBleHRlbnQsIHgsIHksIHopOw0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxpbmVzLnB1c2gobG9uLCBsYXQsIDApOw0KICAgICAgICAgICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgICAgICBsaW5lUHJvcHMucHVzaChwcm9wZXJ0aWVzKTsNCg0KICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodCA9PT0gMykgeyAvLyBQb2x5Z29uDQogICAgICAgICAgICAgICAgICAgIHBvbHlnb25PZmZzZXRzLnB1c2gocG9seWdvbnMubGVuZ3RoIC8gMyk7DQogICAgICAgICAgICAgICAgICAgIGZvciAoY29uc3QgcmluZyBvZiBnZW9tKQ0KICAgICAgICAgICAgICAgICAgICAgICAgZm9yIChjb25zdCBwIG9mIHJpbmcpIHsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb25zdCB7IGxvbiwgbGF0IH0gPSB0aWxlUGl4ZWxUb0xvbkxhdChwLngsIHAueSwgZXh0ZW50LCB4LCB5LCB6KTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwb2x5Z29ucy5wdXNoKGxvbiwgbGF0LCAwKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgcG9seWdvblByb3BzLnB1c2gocHJvcGVydGllcyk7DQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICB0aWxlRGF0YVtsYXllck5hbWVdID0gew0KICAgICAgICAgICAgICAgIHBvaW50czogbmV3IEZsb2F0MzJBcnJheShwb2ludHMpLA0KICAgICAgICAgICAgICAgIHBvaW50UHJvcHMsDQogICAgICAgICAgICAgICAgbGluZXM6IG5ldyBGbG9hdDMyQXJyYXkobGluZXMpLA0KICAgICAgICAgICAgICAgIGxpbmVPZmZzZXRzOiBuZXcgVWludDMyQXJyYXkobGluZU9mZnNldHMpLA0KICAgICAgICAgICAgICAgIGxpbmVQcm9wcywNCiAgICAgICAgICAgICAgICBwb2x5Z29uczogbmV3IEZsb2F0MzJBcnJheShwb2x5Z29ucyksDQogICAgICAgICAgICAgICAgcG9seWdvbk9mZnNldHM6IG5ldyBVaW50MzJBcnJheShwb2x5Z29uT2Zmc2V0cyksDQogICAgICAgICAgICAgICAgcG9seWdvblByb3BzDQogICAgICAgICAgICB9Ow0KICAgICAgICB9DQoNCiAgICAgICAgLy8g5pS26ZuGIGJ1ZmZlciB0cmFuc2ZlcmFibGUNCiAgICAgICAgY29uc3QgdHJhbnNmZXJzOiBBcnJheUJ1ZmZlcltdID0gW107DQogICAgICAgIGZvciAoY29uc3QgbGF5ZXJOYW1lIGluIHRpbGVEYXRhKSB7DQogICAgICAgICAgICBjb25zdCBsYXllciA9IHRpbGVEYXRhW2xheWVyTmFtZV07DQogICAgICAgICAgICB0cmFuc2ZlcnMucHVzaChsYXllci5wb2ludHMuYnVmZmVyLCBsYXllci5saW5lcy5idWZmZXIsIGxheWVyLmxpbmVPZmZzZXRzLmJ1ZmZlciwNCiAgICAgICAgICAgICAgICBsYXllci5wb2x5Z29ucy5idWZmZXIsIGxheWVyLnBvbHlnb25PZmZzZXRzLmJ1ZmZlcik7DQogICAgICAgIH0NCg0KICAgICAgICBzZWxmLnBvc3RNZXNzYWdlKHsgdXJsLCB0aWxlRGF0YSB9LCB0cmFuc2ZlcnMpOw0KDQogICAgfSBjYXRjaCAoZXJyKSB7DQogICAgICAgIHNlbGYucG9zdE1lc3NhZ2UoeyB1cmwsIGVycm9yOiAoZXJyIGFzIEVycm9yKS5tZXNzYWdlIH0pOw0KICAgIH0NCn07DQovLyAtLS0tLS0tLS0tLS0tLS0tLS0g5Yeg5L2V5LyY5YyWIC0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpmdW5jdGlvbiBzaW1wbGlmeVJpbmcocmluZzogYW55W10pIHsNCiAgICBjb25zdCBvdXQ6IGFueSA9IFtdOw0KICAgIGNvbnN0IG4gPSByaW5nLmxlbmd0aDsNCiAgICBpZiAobiA8PSAyKSByZXR1cm4gcmluZzsNCg0KICAgIG91dC5wdXNoKHJpbmdbMF0pOw0KDQogICAgZm9yIChsZXQgaSA9IDE7IGkgPCBuIC0gMTsgaSsrKSB7DQogICAgICAgIGNvbnN0IEEgPSBvdXRbb3V0Lmxlbmd0aCAtIDFdOw0KICAgICAgICBjb25zdCBCID0gcmluZ1tpXTsNCiAgICAgICAgY29uc3QgQyA9IHJpbmdbaSArIDFdOw0KDQogICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgY29udGludWU7DQogICAgICAgIGlmIChpc0NvbGluZWFyKEEueCwgQS55LCBCLngsIEIueSwgQy54LCBDLnkpKSBjb250aW51ZTsNCg0KICAgICAgICBvdXQucHVzaChCKTsNCiAgICB9DQoNCiAgICBvdXQucHVzaChyaW5nW24gLSAxXSk7DQogICAgcmV0dXJuIG91dDsNCn0NCg0KZnVuY3Rpb24gY2xlYW5Qb2x5Z29uKHJpbmdzOiBhbnlbXSkgew0KICAgIHJldHVybiByaW5ncy5tYXAocmluZyA9PiB7DQogICAgICAgIGlmIChyaW5nLmxlbmd0aCA+IDIpIHsNCiAgICAgICAgICAgIGNvbnN0IEEgPSByaW5nWzBdOw0KICAgICAgICAgICAgY29uc3QgQiA9IHJpbmdbcmluZy5sZW5ndGggLSAxXTsNCiAgICAgICAgICAgIGlmIChBLnggPT09IEIueCAmJiBBLnkgPT09IEIueSkgcmluZyA9IHJpbmcuc2xpY2UoMCwgLTEpOw0KICAgICAgICB9DQogICAgICAgIHJldHVybiBzaW1wbGlmeVJpbmcocmluZyk7DQogICAgfSk7DQp9DQoNCmZ1bmN0aW9uIGlzQ29saW5lYXIoYXgsIGF5LCBieCwgYnksIGN4LCBjeSkgew0KICAgIHJldHVybiAoYnggLSBheCkgKiAoY3kgLSBieSkgPT09IChieSAtIGF5KSAqIChjeCAtIGJ4KTsNCn0NCg0KLy8gLS0tLS0tLS0tLS0tLS0tLS0tIOe7j+e6rOW6pui9rOaNoiAtLS0tLS0tLS0tLS0tLS0tLS0NCg0KZnVuY3Rpb24gY29udmVydFRvTG9uTGF0KGdlb20sIHQsIGV4dGVudCwgeCwgeSwgeikgew0KICAgIGlmICh0ID09PSAxKSB7DQogICAgICAgIGxldCBzeCA9IDAsIHN5ID0gMCwgY250ID0gMDsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgeyBzeCArPSBwLng7IHN5ICs9IHAueTsgY250Kys7IH0NCiAgICAgICAgY29uc3QgbGwgPSB0aWxlUGl4ZWxUb0xvbkxhdChzeCAvIGNudCwgc3kgLyBjbnQsIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgIHJldHVybiBbbGwubG9uLCBsbC5sYXRdOw0KICAgIH0NCg0KICAgIGlmICh0ID09PSAyKSB7DQogICAgICAgIGNvbnN0IGFycjogYW55W10gPSBbXTsNCiAgICAgICAgZm9yIChjb25zdCByaW5nIG9mIGdlb20pDQogICAgICAgICAgICBmb3IgKGNvbnN0IHAgb2YgcmluZykgew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgYXJyLnB1c2goW2xsLmxvbiwgbGwubGF0XSk7DQogICAgICAgICAgICB9DQogICAgICAgIHJldHVybiBhcnI7DQogICAgfQ0KDQogICAgaWYgKHQgPT09IDMpIHsNCiAgICAgICAgcmV0dXJuIGdlb20ubWFwKHJpbmcgPT4NCiAgICAgICAgICAgIHJpbmcubWFwKHAgPT4gew0KICAgICAgICAgICAgICAgIGNvbnN0IGxsID0gdGlsZVBpeGVsVG9Mb25MYXQocC54LCBwLnksIGV4dGVudCwgeCwgeSwgeik7DQogICAgICAgICAgICAgICAgcmV0dXJuIFtsbC5sb24sIGxsLmxhdF07DQogICAgICAgICAgICB9KQ0KICAgICAgICApOw0KICAgIH0NCn0NCg0KZnVuY3Rpb24gdGlsZVBpeGVsVG9Mb25MYXQocHgsIHB5LCBleHRlbnQsIHRpbGVYLCB0aWxlWSwgeikgew0KICAgIGNvbnN0IG4gPSBNYXRoLnBvdygyLCB6KTsNCiAgICBjb25zdCB4Tm9ybSA9ICh0aWxlWCArIHB4IC8gZXh0ZW50KSAvIG47DQogICAgY29uc3QgeU5vcm0gPSAodGlsZVkgKyBweSAvIGV4dGVudCkgLyBuOw0KICAgIGNvbnN0IGxvbiA9IHhOb3JtICogMzYwIC0gMTgwOw0KICAgIGNvbnN0IGxhdCA9IE1hdGguYXRhbihNYXRoLnNpbmgoTWF0aC5QSSAqICgxIC0gMiAqIHlOb3JtKSkpICogMTgwIC8gTWF0aC5QSTsNCiAgICByZXR1cm4geyBsb24sIGxhdCB9Ow0KfQ==",typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Gi&&Gi.tagName.toUpperCase()==="SCRIPT"&&Gi.src||new URL("earthsdk3-cesium.umd.cjs",document.baseURI).href),10,{type:"module"})}add(e){const n=e.sceneObject.id,o=e.mvtLayerJson.mainJson,s=e.sceneObject.scheme??"xyz";let r=this.sourcesMap.get(n),l=this.tileSchemes.get(n);if(r||(r=new Map,this.sourcesMap.set(n,r)),(!l||s!=l)&&this.tileSchemes.set(n,s),typeof o=="string")r.set("customSource",{tiles:[o],type:"vector"});else if(typeof o=="object"){const c=o.sources;for(const u in c){const d=c[u];d.type==="vector"&&Reflect.has(d,"tiles")&&r.set(u,d)}}}remove(e){const n=e.sceneObject.id;this.sourcesMap.delete(n),this.tileSchemes.delete(n),this.pendingRequests.delete(n)}async fetchTile(e,n){return new Promise(async o=>{var g,v,y,w;if((g=this.pendingRequests.get(e))!=null&&g.has(n))return o(void 0);(v=this.pendingRequests.get(e))==null||v.add(n);const[s,r,l]=n.split("-").map(Number),u=this.tileSchemes.get(e)==="tms"?Math.pow(2,s)-l-1:l,d=this.tilesCache.get(e,n)??new $C(n),p=this.sourcesMap.get(e);if(!p)return d.state=ar.FAILED,o(d);const f=Array.from(p.keys()).pop();for(const[P,C]of p.entries()){d.state=ar.LOADING;const S=Array.isArray(C.tiles)?C.tiles:[C.tiles];for(const A of S){if(d.state=ar.PROCESSING,!A.includes("{z}")||C.maxzoom&&s>C.maxzoom||C.minzoom&&s<C.minzoom)continue;const E=A.replace("{z}",s.toString()).replace("{x}",r.toString()).replace("{y}",u.toString());try{const R=await this.fetchUrl(E,r,l,s);if(d.data.set(P,R),P===f)return(y=this.pendingRequests.get(e))==null||y.delete(n),((w=this.pendingRequests.get(e))==null?void 0:w.size)===0&&this.pendingRequests.delete(e),d.state=ar.READY,o(d)}catch(R){console.error(`Failed to load tile ${n}:`,R)}}}})}fetchUrl(e,n,o,s){return new TextDecoder,new Promise((r,l)=>{this.workerPool.acquire().then(c=>{const u=d=>{const p=d.data;if(p.url!==e)return;if(c.removeEventListener("message",u),this.workerPool.release(c),p.error)return l(new Error(p.error));const f=WL(p.tileData);r(f)};c.addEventListener("message",u),c.postMessage({type:"fetch",url:e,x:n,y:o,z:s})})})}}class UL extends a.Destroyable{constructor(e,n){super();m(this,"renderedTiles",new Map);this.screenManager=e,this.styleManager=n}renderTile(e,n){var l;const o=new Set,s=this.styleManager.getStyle(e);if(!s)return;for(const c of s){const u=Number.parseInt(n.tileKey.split("-")[0]);if(!((c.maxzoom||c.minzoom)&&(c.maxzoom&&u>c.maxzoom||c.minzoom&&u<c.minzoom)))for(const d of((l=n.data.get(c.source))==null?void 0:l.get(c["source-layer"]??""))||[]){let p=d.geometry.coordinates;d.geometry.type.includes("Point")||(p=WI(d.geometry).geometry.coordinates);let f,g;if(c.labelStyle){const v=ln(c.labelStyle.text,u);f=this.screenManager.addLabel(e,"VectorTile",c.labelStyle,{position:p,name:typeof v=="string"?d.properties[v]:Array.isArray(v)?v.map(w=>d.properties[w]).join(""):"",index:c.id+d.properties.osm_id}).screenObjectId}if(c.billboardStyle){const v=ln(c.billboardStyle.text,u);g=this.screenManager.addImage(e,"VectorTile",c.billboardStyle,{position:p,name:typeof v=="string"?d.properties[v]:Array.isArray(v)?v.map(w=>d.properties[w]).join(""):"",index:c.id+d.properties.osm_id}).screenObjectId}f&&!o.has(f)&&o.add(f),g&&!o.has(g)&&o.add(g)}}let r=this.renderedTiles.get(e);r||(r=new Map,this.renderedTiles.set(e,r)),r.set(n.tileKey,o)}update(e,n,o){var s;if(typeof n=="string"){const r=(s=this.renderedTiles.get(e))==null?void 0:s.get(n);r&&this.screenManager.update("VectorTile",e,r,{all:{show:o}})}else this.screenManager.update("VectorTile",e,n,{all:{show:o}})}remove(e,n){const o=this.renderedTiles.get(e);if(n){const s=o==null?void 0:o.get(n);s&&(this.screenManager.remove("VectorTile",e,s),o==null||o.delete(n),(o==null?void 0:o.size)===0&&this.renderedTiles.delete(e))}else{const s=o==null?void 0:o.values();if(s){const r=new Set([...s].flatMap(l=>[...l]));this.screenManager.remove("VectorTile",e,r,!0),this.renderedTiles.delete(e)}}}removeAll(){const e=this.renderedTiles.keys();for(const n of e)this.remove(n)}}const HL=new h.Cartesian2;class $L extends a.Destroyable{constructor(){super();m(this,"defaultStyle",new Map);m(this,"defaultSprite",new Map)}async add(e){var o;if(typeof e.mvtLayerJson.mainJson!="string"&&((o=e.mvtLayerJson.mainJson)!=null&&o.sprite)){const s=e.mvtLayerJson.mainJson.sprite;let r=await h.Resource.fetchJson({url:s+".json"});r=await qL(s+".png",r),r&&this.defaultSprite.set(e.sceneObject.id,[s+".png",r])}const n=e.mvtLayerJson.pointJson;for(const s of n)this.setDefaultStyle(e.sceneObject.id,this.getStyleFromMVTLayers(e.sceneObject.id,s))}remove(e){this.defaultStyle.delete(e.sceneObject.id)}setDefaultStyle(e,n){let o=this.defaultStyle.get(e);o||(o=new Set,this.defaultStyle.set(e,o)),o.add(n)}getStyle(e){return this.defaultStyle.get(e)??new Set}getStyleFromMVTLayers(e,n){const o={id:n.id,type:n.type,source:n.source,"source-layer":n["source-layer"],labelStyle:void 0,billboardStyle:void 0,polygonStyle:void 0,polylineStyle:void 0};if(Reflect.has(n,"minzoom")&&(o.minzoom=n.minzoom),Reflect.has(n,"maxzoom")&&(o.maxzoom=n.maxzoom),Reflect.has(n,"type")&&n.type==="symbol"&&Reflect.has(n,"layout")){const s=n.layout;if(Reflect.has(s,"icon-image")){const r=o.billboardStyle={},l=this.defaultSprite.get(e);l&&l[1][s["icon-image"]]?(r.image=l[0],r.imageSubRegion=new h.BoundingRectangle(l[1][s["icon-image"]].x,l[1][s["icon-image"]].y,l[1][s["icon-image"]].width,l[1][s["icon-image"]].height)):r.image=s["icon-image"];const{horizontalOrigin:c,verticalOrigin:u}=qC(s["icon-anchor"]??"center");if(r.horizontalOrigin=c,r.verticalOrigin=u,Reflect.has(n,"paint")){const d=n.paint;r.color=h.Color.fromCssColorString(d["icon-color"]??"#000000").withAlpha(d["icon-opacity"]??1)}r.rotation=h.Math.toRadians(s["icon-rotate"]??0),r.scale=s["icon-size"]??1,r.pixelOffset=h.Cartesian2.multiplyByScalar(h.Cartesian2.fromArray(s["icon-offset"]??[0,0]),r.scale,HL),r.show=(s.visibility??"visible")==="visible"}if(Reflect.has(s,"text-field")){const r=o.labelStyle={};r.text=s["text-field"];const{horizontalOrigin:l,verticalOrigin:c}=qC(s["text-anchor"]??"center");if(r.horizontalOrigin=l,r.verticalOrigin=c,Reflect.has(n,"paint")){const d=n.paint;r.fillColor=h.Color.fromCssColorString(d["text-color"]??"#000000").withAlpha(d["text-opacity"]??1),d["text-halo-color"]&&(r.outlineColor=h.Color.fromCssColorString(d["text-halo-color"])),d["text-halo-width"]&&(r.outlineWidth=d["text-halo-width"]),(d["text-halo-color"]||d["text-halo-width"])&&(r.style=h.LabelStyle.FILL_AND_OUTLINE)}const u=s["text-font"]?typeof s["text-font"]=="string"?[s["text-font"]]:s["text-font"]:["Open Sans Regular","Arial Unicode MS Regular"];r.font=`${s["text-size"]??16}px `+u.map(d=>`"${d}"`).join(", "),r.pixelOffset=XL(s),r.show=(s.visibility??"visible")==="visible"}}return o}}function qC(t){let i=h.HorizontalOrigin.CENTER,e=h.VerticalOrigin.CENTER;switch(t){case"center":break;case"left":i=h.HorizontalOrigin.LEFT;break;case"right":i=h.HorizontalOrigin.RIGHT;break;case"top":e=h.VerticalOrigin.TOP;break;case"bottom":e=h.VerticalOrigin.BOTTOM;break;case"top-left":i=h.HorizontalOrigin.LEFT,e=h.VerticalOrigin.TOP;break;case"top-right":i=h.HorizontalOrigin.RIGHT,e=h.VerticalOrigin.TOP;break;case"bottom-left":i=h.HorizontalOrigin.LEFT,e=h.VerticalOrigin.BOTTOM;break;case"bottom-right":i=h.HorizontalOrigin.RIGHT,e=h.VerticalOrigin.BOTTOM;break}return{horizontalOrigin:i,verticalOrigin:e}}async function qL(t,i){const{width:e,height:n}=await Pn(t,!1),o={};for(const s in i)if(Object.prototype.hasOwnProperty.call(i,s)){const r=i[s];o[s]={width:r.width,height:r.height,x:r.x,y:n-r.y-r.height,pixelRatio:r.pixelRatio}}return o}function XL(t){const i=t["text-offset"]||[0,0],e=t["text-size"]||16;return new h.Cartesian2(i[0]*e,i[1]*e)}class YL extends a.Destroyable{constructor(){super();m(this,"callbacks",new Map)}registerEvent(e,n,o){var r;const s=`${e}-${n}`;this.callbacks.has(s)||this.callbacks.set(s,new Set),(r=this.callbacks.get(s))==null||r.add(o)}dispatchEvent(e){var o;const n=`${e.tileKey}-${e.type}`;(o=this.callbacks.get(n))==null||o.forEach(s=>s(e.data))}}var ar=(t=>(t[t.UNLOADED=0]="UNLOADED",t[t.LOADING=1]="LOADING",t[t.PROCESSING=2]="PROCESSING",t[t.READY=3]="READY",t[t.EXPIRED=4]="EXPIRED",t[t.FAILED=5]="FAILED",t))(ar||{});class ZL extends a.Destroyable{constructor(e){super();m(this,"czmESMVTLayers",new Map);m(this,"tilesCache",new BL);m(this,"tileLoader",new GL(this.tilesCache));m(this,"tileRenderer");m(this,"styleManager",new $L);m(this,"eventManager",new YL);m(this,"lastImageryTileMap",new Map);this.viewer=e;const n=Ke(e);n&&(this.tileRenderer=new UL(n.screenManager,this.styleManager)),this.ad(this.tilesCache.deleteTileEvent.don((r,l)=>{this.tileRenderer.remove(r,l)}));let o=performance.now();const s=e.scene.preUpdate.addEventListener(()=>{const r=performance.now();r-o>60&&(o=r,this.czmESMVTLayers.size>0&&this.refreshVisibleTiles())});this.ad(()=>s&&s())}async add(e){if(this.czmESMVTLayers.has(e.sceneObject.id)){console.log(`ESMVTLayer${e.sceneObject.id}已经添加过,跳过本次添加`);return}this.czmESMVTLayers.set(e.sceneObject.id,e),this.tileLoader.add(e),await this.styleManager.add(e),this.refreshVisibleTiles(!0)}remove(e){this.czmESMVTLayers.delete(e.sceneObject.id),this.tileLoader.remove(e),this.styleManager.remove(e),this.tilesCache.remove(e)}refreshVisibleTiles(e){const n=this.viewer;if(!n)return;const o=new Map;for(const[s,r]of this.czmESMVTLayers.entries()){if(!r)continue;const l={tilingScheme:{type:"WebMercatorTilingScheme"},rectangle:r.sceneObject.rectangle,tileHeight:r.sceneObject.tileSize,tileWidth:r.sceneObject.tileSize,maximumLevel:r.sceneObject.maximumLevel,minimumLevel:r.sceneObject.minimumLevel},c=new Set;wm(n.scene.globe._surface._tilesToRender,n.scene.terrainProvider,l).forEach(u=>c.add(`${u.level}-${u.x}-${u.y}`)),!o.has(s)&&o.set(s,c)}this.updateTiles(o,e)}updateTiles(e,n){var o,s;for(const r of this.czmESMVTLayers.keys()){const l=e.get(r)??new Set,c=this.lastImageryTileMap.get(r);if(c&&QL(l,c)&&!n)continue;this.lastImageryTileMap.set(r,l);const u=new Set(((o=this.tilesCache.get(r))==null?void 0:o.keys())??[]),d=new Set,p=new Set;for(const f of u){const g=(s=this.tileRenderer.renderedTiles.get(r))==null?void 0:s.get(f);if(!(!g||g.size==0))if(l.has(f))for(const v of g)d.add(v);else for(const v of g)p.add(v)}for(const f of d)p.delete(f);this.tileRenderer.update(r,p,!1),this.tileRenderer.update(r,d,!0);for(const f of l)u.has(f)||(this.tilesCache.set(r,f,new $C(f)),this.tileLoader.fetchTile(r,f).then(g=>{!g||!this.tilesCache.has(r,f)||(this.tilesCache.set(r,f,g),g.fillParentAndChildren(this.tilesCache.get(r)??new Map),this.tileRenderer.renderTile(r,g))}))}}}function QL(t,i){if(t.size!==i.size)return!1;for(const e of t)if(!i.has(e))return!1;return!0}new h.WebMercatorTilingScheme;const XC=["label","billboard","rectangle"];class kL extends a.Destroyable{constructor(e,n){super();m(this,"id",a.createGuid());m(this,"position",h.Cartesian3.ZERO);m(this,"label");m(this,"billboard");m(this,"rectangle");m(this,"zOrder");m(this,"labelRefCount",1);m(this,"billboardRefCount",1);m(this,"rectangleRefCount",1);m(this,"_showEvent",this.disposeVar(new a.Event));this.id=e,this.position=n,this.ad(this.showEvent.don(o=>{this.updateShow(o)}))}get showEvent(){return this._showEvent}show(e){this._showEvent.emit(e)}updateShow(e){this.label&&(this.label.show=e),this.billboard&&(this.billboard.show=e)}}class KL extends a.Destroyable{constructor(e){super();m(this,"objects",new Map);m(this,"screenManager");m(this,"czmViewer");m(this,"viewer");this.screenManager=e,this.czmViewer=e.czmViewer,this.viewer=e.viewer,this.ad(()=>{this.objects.clear()})}layerIsEffective(){return this.objects.size>0}addLabel(e,n,o){const s=this.makeScreenObjectId(e,o.index??a.createGuid()),r=Se(o.position),l=this.getOrCreateObject(s,r);if(this.screenManager.avoidanceManager.enable&&(n.show=!1),l.label)return l.labelRefCount++,l.label.show=n.show??!0,s;const c=this.screenManager.labelCollection.get({...n,position:r,id:o.properties??s,text:o.name});return c.ESSceneObjectID=e,l.label=c,l.zOrder=o.zOrder,s}addImage(e,n,o){const s=this.makeScreenObjectId(e,o.index??a.createGuid()),r=Se(o.position),l=this.getOrCreateObject(s,r);if(this.screenManager.avoidanceManager.enable&&(n.show=!1),l.billboard)return l.billboardRefCount++,l.billboard.show=n.show??!0,s;const c=this.screenManager.billboardCollection.get({...n,position:r,id:o.properties??s});return c.ESSceneObjectID=e,l.billboard=c,l.zOrder=o.zOrder,s}addRectangle(e,n,o,s){const r=this.makeScreenObjectId(e,o.index??a.createGuid()),l=Se(o.position),c=this.getOrCreateObject(r,l);if(this.screenManager.avoidanceManager.enable&&(n.show=!1),c.rectangle)return c.rectangleRefCount++,r;const u=this.screenManager.rectangleCollection.add({...a.getElementBounds(n.element),...n,id:o.properties??r,position:l,callback:s});return s(!0),c.rectangle=u,c.zOrder=o.zOrder,r}update(e,n){const o=Object.keys(n).length==1&&n.all&&Object.keys(n.all).length==1&&Reflect.has(n.all,"show"),s=new Map;for(const c of XC)s.set(c,Object.assign({},n[c],(n==null?void 0:n.all)??{}));const r=this.screenManager.avoidanceManager.enable,l=e instanceof Set?e:new Set([e]);for(const[c,u]of s)for(const d of l){const p=this.objects.get(d);if(!p)continue;const f=p[c];if(f){if(o){if(r&&u.show||f.show==u.show)continue;f.show=u.show;continue}for(const g in u)if(g!=="position"&&g!=="id"){if(r&&g=="show"&&u[g]||f[g]==u[g])continue;f[g]=u[g]}}}return!0}remove(e,n=!1){const o=e instanceof Set?e:typeof e=="string"?new Set([e]):e;if(o instanceof Set){for(const s of o){const r=this.objects.get(s);r&&(r.label&&(r.labelRefCount>1&&!n?r.labelRefCount--:(this.screenManager.labelCollection.release(r.label),r.label=void 0)),r.billboard&&(r.billboardRefCount>1&&!n?r.billboardRefCount--:(this.screenManager.billboardCollection.release(r.billboard),r.billboard=void 0)),r.rectangle&&(r.rectangleRefCount>1&&!n?r.rectangleRefCount--:(this.screenManager.rectangleCollection.remove(r.rectangle),r.rectangle=void 0)),this.tryDeleteEmpty(s))}return!0}else{for(const s of Object.keys(o)){const r=o[s]instanceof Set?o[s]:new Set([o[s]]);for(const l of r){if(!l)continue;const c=this.objects.get(l);if(c){if(c[`${s}RefCount`]>1&&!n)c[`${s}RefCount`]--;else{const u=c[s];u&&(this.screenManager.collectionMap[s].remove(u),c[s]=void 0)}this.tryDeleteEmpty(l)}}}return!0}}makeScreenObjectId(e,n){return`${e}_${n}`}getOrCreateObject(e,n){let o=this.objects.get(e);return o||(o=new kL(e,n),this.objects.set(e,o)),o}tryDeleteEmpty(e){const n=this.objects.get(e);n&&!n.label&&!n.billboard&&!n.rectangle&&this.objects.delete(e)}}function JL(t,i){const e=[Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER];for(const n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&XC.includes(n)){const o=i[n];if(!o)continue;let s,r,l,c;if(o instanceof h.Label||o instanceof h.Billboard){const u=o.computeScreenSpacePosition(t.scene);({x:s,y:r,width:l,height:c}=h[o instanceof h.Label?"Label":"Billboard"].getScreenSpaceBoundingBox(o,u))}else({x:s,y:r,width:l,height:c}=o);if(isNaN(s)||isNaN(r)||isNaN(l)||isNaN(c))continue;e[0]=Math.min(e[0],s),e[1]=Math.min(e[1],r),e[2]=Math.max(e[2],s+l),e[3]=Math.max(e[3],r+c)}return new h.Rectangle(...e)}class jL extends a.Destroyable{constructor(e){super();m(this,"rectangleCollisionCheck",new h.RectangleCollisionChecker);m(this,"screenManager");m(this,"enable",!1);m(this,"forceRebuildNext",!1);m(this,"avoidanceLayers",[]);m(this,"_processingQueue",[]);m(this,"_isProcessing",!1);m(this,"BATCH_SIZE",1e3);m(this,"_cache",new Map);m(this,"_lastCameraState",{});m(this,"CAMERA_MOVE_THRESHOLD",5e-4);this.screenManager=e,this.ad(()=>{this.rectangleCollisionCheck._tree.clear(),this._cache.clear(),this._processingQueue.length=0})}update(){if(this.avoidanceLayers.length==0)return;const e=this._shouldForceRebuild();this._buildProcessingQueue(e),this._isProcessing||(this._isProcessing=!0,requestAnimationFrame(()=>this._processBatch()))}setAvoidanceLayer(){for(let e=0;e<this.avoidanceLayers.length;e++){const n=this.screenManager.getLayer(this.avoidanceLayers[e]);n.layerIsEffective()&&n.objects.forEach((o,s)=>{o.show(!this.enable)})}this.forceRebuildNext=!0}updateAvoidanceLayer(e,n){this.enable=(e==null?void 0:e.enabled)??!1,n?e!=null&&e.enabled?this.avoidanceLayers.includes(n)||this.avoidanceLayers.push(n):this.avoidanceLayers=this.avoidanceLayers.filter(o=>o!=n):e!=null&&e.enabled?this.avoidanceLayers=Array.from(this.screenManager.layers.keys()):(this.setAvoidanceLayer(),this.avoidanceLayers=[]),this.setAvoidanceLayer()}_shouldForceRebuild(){if(this.forceRebuildNext)return this.forceRebuildNext=!1,this._updateLastCameraState(),!0;const e=this.screenManager.viewer.camera,n=e.positionWC,o=e.directionWC,s=this._lastCameraState.position,r=this._lastCameraState.direction;if(!s||!r)return this._updateLastCameraState(),!0;const l=h.Cartesian3.distanceSquared(n,s),c=h.Cartesian3.distanceSquared(o,r);return l>this.CAMERA_MOVE_THRESHOLD||c>this.CAMERA_MOVE_THRESHOLD?(this._updateLastCameraState(),!0):!1}_updateLastCameraState(){const e=this.screenManager.viewer.camera;this._lastCameraState.position=h.Cartesian3.clone(e.positionWC),this._lastCameraState.direction=h.Cartesian3.clone(e.directionWC)}_buildProcessingQueue(e){e&&(this.rectangleCollisionCheck._tree.clear(),this._cache.clear()),this._processingQueue.length=0;for(let n=0;n<this.avoidanceLayers.length;n++){const o=this.screenManager.getLayer(this.avoidanceLayers[n]);o.layerIsEffective()&&o.objects.forEach((s,r)=>{this._processingQueue.push(s)})}this._processingQueue.sort((n,o)=>(o.zOrder||0)-(n.zOrder||0))}_processBatch(){performance.now();const e=this._processingQueue,n=this.BATCH_SIZE;let o=0;for(;e.length>0&&o<n;){const s=e.shift();this._updateSingleObject(s),o++}e.length>0?requestAnimationFrame(()=>this._processBatch()):this._isProcessing=!1}_updateSingleObject(e){try{if(!this.screenManager.czmViewer.isPointVisible(e.position)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}const n=e.id.toString(),o=this._cache.get(n),s=h.Cartesian3.clone(e.position);let r;if(o&&h.Cartesian3.equalsEpsilon(o.worldPos,s,1e-6))r=o.rect,this.rectangleCollisionCheck.remove(n,r);else{if(r=JL(this.screenManager.viewer,e),isNaN(r.width)||isNaN(r.height)){e.show(!1),this._cache.has(e.id.toString())&&this._cache.delete(e.id.toString());return}this._cache.set(n,{rect:r,worldPos:s,lastFrame:Date.now()})}this.rectangleCollisionCheck.collides(r)?e.show(!1):(e.show(!0),this.rectangleCollisionCheck.insert(e.id.toString(),r))}catch(n){console.error("ScreenManager update object error",n)}}}class YC extends a.Destroyable{constructor(){super();m(this,"_collection",[]);this.ad(()=>this._collection=[])}get length(){return this._collection.length}add(e){return this._collection.push(e),e._index=this._collection.length,e}remove(e){this._collection[e._index]=void 0}}class ZC extends a.Destroyable{constructor(e,n=500,o={minPoolRatio:.1}){super();m(this,"_pool",[]);m(this,"_minPoolRatio");m(this,"_initialSize");this._collection=e,this._initialSize=n,this._minPoolRatio=o.minPoolRatio??.1;for(let s=0;s<n;s++){const r=this._collection.add({show:!1,position:new h.Cartesian3(0,0,0)});this._pool.push(r)}this.ad(()=>{for(const s of this._pool)this.removeFromCollection(s);this._pool.length=0})}get(e,n){if(typeof e=="number"){const o=e,s=n,r=[];for(let l=0;l<o;l++){const c=this._getOne();this.update(c,s),r.push(c)}return r}else{const o=this._getOne();return this.update(o,e),o}}release(e){if(Array.isArray(e))for(const n of e)n.show=!1,this._pool.push(n);else e.show=!1,this._pool.push(e);this._dynamicRecycle()}update(e,n){if(n){Object.assign(e,n);for(const o in n)if(Object.prototype.hasOwnProperty.call(n,o)){const s=n[o];Reflect.has(e,o)&&(e[o]=s)}Reflect.has(e,"imageSubRegion")&&e.setImageSubRegion(n.image,n.imageSubRegion)}}get available(){return this._pool.length}removeFromCollection(e){this._collection instanceof h.LabelCollection?this._collection.remove(e):this._collection instanceof h.BillboardCollection&&this._collection.remove(e)}_getOne(){if(this._pool.length>0)return this._pool.pop();{const e=this._collection.add({show:!1,position:new h.Cartesian3(0,0,0)});return this._dynamicRecycle(),e}}_dynamicRecycle(){const e=this._collection.length,n=Math.max(this._initialSize,Math.floor(e*this._minPoolRatio));for(;this._pool.length>n;){const o=this._pool.pop();this.removeFromCollection(o)}}}class QC extends a.Destroyable{constructor(e){super();m(this,"layers",new Map);m(this,"czmViewer");m(this,"viewer");m(this,"avoidanceManager");m(this,"labelCollection");m(this,"billboardCollection");m(this,"rectangleCollection",this.ad(new YC));m(this,"canvasCollection",this.ad(new YC));m(this,"collectionMap");m(this,"_refreshEvent",this.ad(new a.Event));this.czmViewer=e,this.viewer=e.viewer,this.avoidanceManager=this.ad(new jL(this));const n=new h.LabelCollection({scene:this.viewer.scene}),o=new h.BillboardCollection({scene:this.viewer.scene});this.labelCollection=new ZC(n,500),this.billboardCollection=new ZC(o,500),this.viewer.scene.primitives.add(n),this.viewer.scene.primitives.add(o),this.collectionMap={label:n,billboard:o,rectangle:this.rectangleCollection},this.ad(a.createEventsCallFunc([this.czmViewer.cameraChanged,this.refreshEvent],()=>{this.avoidanceManager.update()},{immediate:!0})),this.ad(()=>{this.layers.forEach(s=>s.destroy()),this.layers.clear(),n.removeAll(),o.removeAll(),this.viewer.scene.primitives.remove(n),this.viewer.scene.primitives.remove(o)})}get refreshEvent(){return this._refreshEvent}refresh(){this._refreshEvent.emit()}getLayer(e){let n=this.layers.get(e);return n||(n=new KL(this),this.layers.set(e,n),this.avoidanceManager.enable&&this.avoidanceManager.updateAvoidanceLayer({enabled:!0})),n}addLabel(e,n,o,s){const l=this.getLayer(n).addLabel(e,o,s);return this.refresh(),{layer:n,id:e,screenObjectId:l}}addImage(e,n,o,s){const l=this.getLayer(n).addImage(e,o,s);return this.refresh(),{layer:n,id:e,screenObjectId:l}}addRectangle(e,n,o,s,r){const c=this.getLayer(n).addRectangle(e,o,s,r);return this.refresh(),{layer:n,id:e,screenObjectId:c}}update(e,n,o,s){const r=this.getLayer(e);return o instanceof Set&&o.size===0?!1:(r.update(o,s),this.refresh(),!0)}remove(e,n,o,s=!1){const r=this.getLayer(e);if(!r.remove(o,s)){console.warn(`屏幕管理器,删除${n}下的内容失败!`);return}!r.layerIsEffective()&&!r.isDestroyed()&&(r.destroy(),this.layers.delete(e)),this.refresh()}setRules(e,n){Reflect.has(e,"avoidance")&&this.avoidanceManager.updateAvoidanceLayer(e.avoidance,n),this.refresh()}}function Ke(t){return a.getExtProp(t,"_viewerExtensions")}function Ig(t,i){a.setExtProp(t,"_viewerExtensions",i)}class kC extends a.Destroyable{constructor(e,n){super();m(this,"_imageriesManager");m(this,"_terrainManager");m(this,"_labelManager");m(this,"_pickingManager");m(this,"_poiContext");m(this,"_cursorPositionInfo");m(this,"_screenManager");m(this,"_vectorTIlesManager");this._viewer=e,this._czmViewer=n,this._imageriesManager=this.dv(new UC(this.viewer)),this._terrainManager=this.dv(new WC(this.viewer)),this._labelManager=this.dv(new GC(this.viewer)),this._poiContext=this.disposeVar(new zm(this._viewer)),this._cursorPositionInfo=this.disposeVar(new OL(this._viewer)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new HC(n)),this._screenManager=this.ad(new QC(n)),this._vectorTIlesManager=this.ad(new ZL(n.viewer)),this.ad(a.createEventsCallFunc(this.czmViewer.textAvoidanceChanged,()=>{this.screenManager.setRules({avoidance:{enabled:this.czmViewer.textAvoidance}})},{immediate:!0}))},void 0,!0))}get viewer(){return this._viewer}get czmViewer(){return this._czmViewer}get imageriesManager(){return this._imageriesManager}get terrainManager(){return this._terrainManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}get screenManager(){return this._screenManager}get vectorTIlesManager(){return this._vectorTIlesManager}}var KC=new h.Cartesian3,JC=new h.Cartesian3;function jC(t,i,e){let n=h.Matrix4.clone(t.transform);t.lookAtTransform(h.Matrix4.IDENTITY);var o=t.positionCartographic.height,s=t.positionWC,r=h.Cartesian3.normalize(s,KC),l=h.Cartesian3.dot(t.direction,r);if(l>-.9&&l<.9)var c=h.Cartesian3.cross(t.direction,r,JC);else var c=h.Cartesian3.cross(t.up,r,JC);var u=c;if(e){var d=h.Cartesian3.cross(r,c,KC);u=d}var p=h.Cartesian3.magnitude(s);t.rotate(u,i/p);var f=t.positionCartographic,g=f.longitude,v=f.latitude;h.Cartesian3.fromRadians(g,v,o,void 0,t.position),t.lookAtTransform(n)}function e_(t,i){jC(t,i,!1)}function t_(t,i){jC(t,-i,!0)}class eN extends a.Destroyable{constructor(e){super();m(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:n}=this,{viewer:o}=n.firstPersonController,{camera:s}=o;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(r=>{const{keyStatusMap:l}=this.running.keyboardCameraController;l[r.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:l[r.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(r=>{const{keyStatusMap:l}=this.running.keyboardCameraController;l[r.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:r}=this;let l=Date.now();const c=()=>{const u=Date.now(),d=u-l;l=u;const p=this.controller.speed;r.WithCamera||this.controller.alwaysWithCamera?(r.MoveForward&&s.moveForward(d*p),r.MoveBackword&&s.moveBackward(d*p),r.MoveLeft&&s.moveLeft(d*p),r.MoveRight&&s.moveRight(d*p)):(r.MoveForward&&e_(s,d*p),r.MoveBackword&&e_(s,-d*p),r.MoveLeft&&t_(s,-d*p),r.MoveRight&&t_(s,d*p));{const{rotateSpeed:f}=this.controller,g=h.Math.toRadians(f*d);r.RotateRight?s.lookRight(g):r.RotateLeft?s.lookRight(-g):r.RotateUp?s.lookDown(-g):r.RotateDown&&s.lookDown(g)}};o.scene.preUpdate.addEventListener(c),this.dispose(()=>o.scene.preUpdate.removeEventListener(c))}}get running(){return this._running}get controller(){return this.running.keyboardCameraController}get actions(){return this._actions}_resetActions(){const e=Object.keys(this._actions);for(let n of e)this._actions[n]=!1}_updateActions(){const{running:e}=this,{keyStatus:n}=e,{actions:o}=this;this._resetActions();const{keyStatusMap:s}=this.running.keyboardCameraController;for(let r of n.currentKeyIds)o[s[r]]=!0}}class Xh extends a.Destroyable{constructor(e){super();m(this,"_currentKeyIds",new Set);m(this,"_currentKeyIdsChanged",this.dv(new a.Event));m(this,"_debug",this.dv(a.react(!1)));m(this,"_debugResetting",this.dv(new a.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends a.Destroyable{constructor(e){super();const n=()=>{console.log([...e.currentKeyIds].join(`
|
|
1996
1996
|
`))};n(),this.d(e.currentKeyIdsChanged.don(n))}}(this)})));this._keyboardCameraControllerRunning=e;const{keyboardCameraController:n}=this._keyboardCameraControllerRunning;{const o=s=>{const r=Xh.getKeyId(s);this._currentKeyIds.has(r)||(this._currentKeyIds.add(r),this._currentKeyIdsChanged.emit())};this.d(n.keyDownEvent.don(o))}{const o=s=>{const r=Xh.getKeyId(s);this._currentKeyIds.has(r)&&(this._currentKeyIds.delete(r),this._currentKeyIdsChanged.emit())};this.d(n.keyUpEvent.don(o))}{const o=()=>{this._currentKeyIds.clear(),this._currentKeyIdsChanged.emit()};this.d(n.abortEvent.don(o))}}static getKeyId(e){return e.code}get currentKeyIds(){return this._currentKeyIds}get currentKeyIdsChanged(){return this._currentKeyIdsChanged}get debug(){return this._debug.value}set debug(e){this._debug.value=e}get debugChanged(){return this._debug.changed}}class tN extends a.Destroyable{constructor(e){super();m(this,"_keyStatus");m(this,"_cameraOp");this._keyboardCameraController=e,this._keyStatus=this.dv(new Xh(this)),this._cameraOp=this.dv(new eN(this))}get keyboardCameraController(){return this._keyboardCameraController}get keyStatus(){return this._keyStatus}get cameraOp(){return this._cameraOp}}const jh=class jh extends a.Destroyable{constructor(e){super();m(this,"_enabled",this.dv(a.react(!1)));m(this,"_keyStatusMap",this.dv(a.react(jh.defaultKeyStatusMap)));m(this,"_speed",this.dv(a.react(1)));m(this,"_rotateSpeed",this.dv(a.react(.01)));m(this,"_alwaysWithCamera",this.dv(a.react(!1)));m(this,"_keyDownEvent",this.dv(new a.Event));m(this,"_keyUpEvent",this.dv(new a.Event));m(this,"_abortEvent",this.dv(new a.Event));this._firstPersonController=e,this.dv(new a.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new tN(this)}))}get firstPersonController(){return this._firstPersonController}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get keyStatusMap(){return this._keyStatusMap.value}set keyStatusMap(e){this._keyStatusMap.value=e}get keyStatusMapChanged(){return this._keyStatusMap.changed}get speed(){return this._speed.value}set speed(e){this._speed.value=e}get speedChanged(){return this._speed.changed}get rotateSpeed(){return this._rotateSpeed.value}set rotateSpeed(e){this._rotateSpeed.value=e}get rotateSpeedChanged(){return this._rotateSpeed.changed}get alwaysWithCamera(){return this._alwaysWithCamera.value}set alwaysWithCamera(e){this._alwaysWithCamera.value=e}get alwaysWithCameraChanged(){return this._alwaysWithCamera.changed}get keyDownEvent(){return this._keyDownEvent}keyDown(e){this._keyDownEvent.emit(e)}get keyUpEvent(){return this._keyUpEvent}keyUp(e){this._keyUpEvent.emit(e)}get abortEvent(){return this._abortEvent}abort(){this._abortEvent.emit()}};m(jh,"defaultKeyStatusMap",{ShiftLeft:"WithCamera",ShiftRight:"WithCamera",KeyW:"MoveForward",KeyS:"MoveBackword",KeyA:"MoveLeft",KeyD:"MoveRight",ArrowUp:"MoveForward",ArrowDown:"MoveBackword",ArrowLeft:"MoveLeft",ArrowRight:"MoveRight",KeyR:"SpeedUp",KeyF:"SpeedDown",KeyQ:"SwitchAlwaysWithCamera"});let Yh=jh;function iN(t,i){t.lookRight(h.Math.toRadians(i.movementX)*.1),t.lookDown(h.Math.toRadians(i.movementY)*.1);const e=t.pitch,n=h.Math.clamp(e,-h.Math.PI_OVER_TWO,h.Math.PI_OVER_TWO);n!==e&&t.setView({destination:t.positionWC,orientation:{heading:t.heading,pitch:n,roll:t.roll}})}class nN extends a.Destroyable{constructor(i,e){super(),this._firstPersonController=i,this._mouseCameraController=e;const{canvas:n}=this._firstPersonController.viewer;{const o=s=>{const{camera:r}=this._firstPersonController.viewer.scene;iN(r,s)};n.addEventListener("pointermove",o),this.dispose(()=>n.removeEventListener("pointermove",o))}}}const eu=class eu extends a.Destroyable{constructor(e){super();m(this,"_mouseMoving",this.dv(new nN(this.firstPersonController,this.mouseCameraController)));this._mouseCameraController=e;const{viewer:n}=this.firstPersonController;this.mouseCameraController.enableViewerOriginInputs(!1),this.dispose(()=>this.mouseCameraController.enableViewerOriginInputs(!0)),Element.prototype.setPointerCapture=()=>{},this.dispose(()=>Element.prototype.setPointerCapture=eu.origin_setPointerCapture);const o=n.canvas;o.requestPointerLock(),this.dispose(()=>document.exitPointerLock());{const s=()=>{document.pointerLockElement!==o&&(this.firstPersonController.mouseEnabled=!1)};document.addEventListener("pointerlockchange",s,!1),this.dispose(()=>document.removeEventListener("pointerlockchange",s,!1))}{const s=()=>{this.firstPersonController.mouseEnabled=!1,console.log("Error locking pointer")};document.addEventListener("pointerlockerror",s)}}get mouseCameraController(){return this._mouseCameraController}get firstPersonController(){return this.mouseCameraController.firstPersonController}get mouseMoving(){return this._mouseMoving}};m(eu,"origin_setPointerCapture",Element.prototype.setPointerCapture);let Mg=eu;class oN extends a.Destroyable{constructor(e){super();m(this,"_enabled",this.dv(a.react(!1)));m(this,"enableViewerOriginInputs",e=>{e?this.firstPersonController.czmViewer.incrementDisabledInputStack():this.firstPersonController.czmViewer.decrementDisabledInputStack()});m(this,"_mouseResetting",this.dv(new a.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Mg(this)})));this._firstPersonController=e}get firstPersonController(){return this._firstPersonController}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get mouseResetting(){return this._mouseResetting}}class sN extends a.Destroyable{constructor(e){super();m(this,"viewer");m(this,"_mouseCameraController",this.dv(new oN(this)));m(this,"_keyboardCameraController",this.dv(new Yh(this)));if(this._viewer=e,!this._viewer.viewer)throw new Error("Cesium.Viewer不存在!");this.viewer=this._viewer.viewer}get czmViewer(){return this._viewer}get mouseCameraController(){return this._mouseCameraController}get mouseEnabled(){return this.mouseCameraController.enabled}set mouseEnabled(e){this.mouseCameraController.enabled=e}get mouseEnabledChanged(){return this.mouseCameraController.enabledChanged}get keyboardCameraController(){return this._keyboardCameraController}get keyboardEnabled(){return this.keyboardCameraController.enabled}set keyboardEnabled(e){this.keyboardCameraController.enabled=e}get keyboardEnabledChanged(){return this.keyboardCameraController.enabledChanged}}function i_(t){t.removeInputAction(h.ScreenSpaceEventType.LEFT_DOWN),t.removeInputAction(h.ScreenSpaceEventType.RIGHT_DOWN),t.removeInputAction(h.ScreenSpaceEventType.MIDDLE_DOWN),t.removeInputAction(h.ScreenSpaceEventType.MOUSE_MOVE),t.removeInputAction(h.ScreenSpaceEventType.LEFT_UP),t.removeInputAction(h.ScreenSpaceEventType.RIGHT_UP),t.removeInputAction(h.ScreenSpaceEventType.MIDDLE_UP)}function Dg(t,i,e,n=void 0){const s=t.camera,r=new h.Cartesian2;r.x=i.startPosition.x,r.y=0;const l=new h.Cartesian2;l.x=i.endPosition.x,l.y=0;let c=s.getPickRay(r,new h.Ray),u=s.getPickRay(l,new h.Ray),d=0,p,f;if(!c||!u)return;s.frustum instanceof h.OrthographicFrustum?(p=c.origin,f=u.origin,h.Cartesian3.add(s.direction,p,p),h.Cartesian3.add(s.direction,f,f),h.Cartesian3.subtract(p,s.position,p),h.Cartesian3.subtract(f,s.position,f),h.Cartesian3.normalize(p,p),h.Cartesian3.normalize(f,f)):(p=c.direction,f=u.direction);let g=h.Cartesian3.dot(p,f);g<1&&(d=Math.acos(g)),d=i.startPosition.x>i.endPosition.x?d:-d;const v=e._horizontalRotationAxis;if(h.defined(n)?s.look(n,-d):h.defined(v)?s.look(v,-d):s.lookLeft(d),r.x=0,r.y=i.startPosition.y,l.x=0,l.y=i.endPosition.y,c=s.getPickRay(r,new h.Ray),u=s.getPickRay(l,new h.Ray),d=0,!(!c||!u))if(s.frustum instanceof h.OrthographicFrustum?(p=c.origin,f=u.origin,h.Cartesian3.add(s.direction,p,p),h.Cartesian3.add(s.direction,f,f),h.Cartesian3.subtract(p,s.position,p),h.Cartesian3.subtract(f,s.position,f),h.Cartesian3.normalize(p,p),h.Cartesian3.normalize(f,f)):(p=c.direction,f=u.direction),g=h.Cartesian3.dot(p,f),g<1&&(d=Math.acos(g)),d=i.startPosition.y>i.endPosition.y?d:-d,n=n??v,h.defined(n)){const y=s.direction,w=h.Cartesian3.negate(n,new h.Cartesian3),P=h.Cartesian3.equalsEpsilon(y,n,h.Math.EPSILON2),C=h.Cartesian3.equalsEpsilon(y,w,h.Math.EPSILON2);if(!P&&!C){g=h.Cartesian3.dot(y,n);let S=h.Math.acosClamped(g);d>0&&d>S&&(d=S-h.Math.EPSILON4),g=h.Cartesian3.dot(y,w),S=h.Math.acosClamped(g),d<0&&-d>S&&(d=-S+h.Math.EPSILON4);const A=h.Cartesian3.cross(n,y,new h.Cartesian3);s.look(A,d)}else(P&&d<0||C&&d>0)&&s.look(s.right,-d)}else s.lookUp(d)}class rN extends a.Destroyable{constructor(i,e){super();const n=e.viewer;if(!n)throw new Error("viewer is undefined");let o=!0;this.d(i.positionChanged.don(()=>o=!0)),this.d(i.rotationChanged.don(()=>o=!0)),this.d(i.offsetHeightChanged.don(()=>o=!0)),this.d(i.viewDistanceChanged.don(()=>o=!0)),this.d(i.offsetRotationChanged.don(()=>o=!0)),this.d(i.relativeRotationChanged.don(()=>o=!0));const s=[0,0,0],r=[0,0,0];this.d(n.clock.onTick.addEventListener(()=>{if(!o)return;if(o=!1,!i.position){console.warn("相机控制器未能设置位置,无法启用!");return}if(i.viewDistance===void 0){console.warn("相机控制器未能设置视距,将自动设置视距!");const p=Se(i.position),f=n.camera.positionWC,g=h.Cartesian3.distance(p,f);i.viewDistance=g}a.Vector.clone(i.position,r),i.offsetHeight&&(r[2]+=i.offsetHeight);const{rotation:l,offsetRotation:c=Bi.defaults.offsetRotation}=i,u=[...c];a.Vector.set(s,0,0,0),l&&(i.relativeRotation??Bi.defaults.relativeRotation)&&(a.Vector.add(l,s,s),u[0]+=90),a.Vector.add(u,s,s);const d={distance:i.viewDistance,heading:s[0],pitch:s[1],flyDuration:0,hDelta:0,pDelta:0};e.flyTo(d,r)})),e.incrementDisabledInputStack(),this.d(()=>{e.decrementDisabledInputStack()}),this.d(e.pointerMoveEvent.don(l=>{const c=l==null?void 0:l.pointerEvent;if(c&&i.enabledRotationInput&&(c.buttons===1||c.buttons===2)){const{movementX:u,movementY:d}=c;i.offsetRotation=a.Vector.add(i.offsetRotation??Bi.defaults.offsetRotation,[u*.2,d*-.2,0])}})),this.d(e.wheelEvent.don(l=>{if(!i.enabledScaleInput)return;const c=l.deltaY,d=Math.max(1,i.viewDistance)*(c*.001);i.viewDistance=i.viewDistance+d}))}}class Bi extends a.Destroyable{constructor(e){super();m(this,"_resetWithCameraEvent",this.dv(new a.Event));const n=e.viewer;if(!n)throw new Error("viewer is undefined");const o=this;let s;const r=()=>{s&&(s.destroy(),s=void 0)};this.d(r);const l=()=>{r(),o.enabled&&(s=new rN(o,e))};l(),this.d(o.enabledChanged.don(l)),this.d(o.resetWithCameraEvent.don(c=>{if(!e.actived)return;const u=jo(n.camera);if(!u)return;const d=o.rotation;o.offsetRotation=[u[0]-(o.relativeRotation?d[0]:90),u[1]-(o.relativeRotation?d[1]:0),u[2]-(o.relativeRotation?d[2]:0)]}))}get resetWithCameraEvent(){return this._resetWithCameraEvent}resetWithCamera(e){this._resetWithCameraEvent.emit(e)}}m(Bi,"defaults",{position:[116.39,39.9,0],rotation:[0,0,0],offsetRotation:[0,-60,0],relativeRotation:!0}),(t=>{t.createDefaultProps=()=>({enabled:!1,showTarget:!1,position:a.reactArrayWithUndefined(void 0),rotation:a.reactArrayWithUndefined(void 0),rotationEditing:!1,viewDistance:1e3,offsetHeight:0,offsetRotation:a.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,relativeRotation:!0})})(Bi||(Bi={})),a.extendClassProps(Bi.prototype,Bi.createDefaultProps);class ga extends a.Destroyable{constructor(e){super();m(this,"_geoCameraController");m(this,"_geoPolylinePath");this._geoCameraController=this.dv(new Bi(e)),this._geoPolylinePath=this.dv(new Ms(e)),this._geoPolylinePath.show=!1,this._geoPolylinePath.currentTime=0;const n=()=>{(this.usePathPosition??!0)&&(this._geoCameraController.position=this._geoPolylinePath.currentPosition),(this.usePathRotation??!0)&&(this._geoCameraController.rotation=this._geoPolylinePath.currentRotation)};n(),this.d(this._geoPolylinePath.currentPositionChanged.don(n)),this.d(this._geoPolylinePath.currentRotationChanged.don(n)),this.dispose(a.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dispose(a.bind([this._geoCameraController,"viewDistance"],[this,"viewDistance"])),this.dispose(a.bind([this._geoCameraController,"offsetHeight"],[this,"offsetHeight"])),this.dispose(a.bind([this._geoCameraController,"offsetRotation"],[this,"offsetRotation"])),this.dispose(a.track([this._geoCameraController,"enabledRotationInput"],[this,"enabledRotationInput"])),this.dispose(a.track([this._geoCameraController,"enabledScaleInput"],[this,"enabledScaleInput"])),this.dv(new a.ObjResettingWithEvent(this.lineModeChanged,()=>{if(this.lineMode!==void 0){if(this.lineMode==="auto")return new aN(this,e);if(this.lineMode==="manual")return new lN(this,e)}}))}get geoCameraController(){return this._geoCameraController}get polylinePath(){return this._geoPolylinePath}get position(){return this._geoCameraController.position}get positionChanged(){return this._geoCameraController.positionChanged}get rotation(){return this._geoCameraController.rotation}get roataionChanged(){return this._geoCameraController.rotationChanged}}(t=>{t.createDefaultProps=()=>({enabled:!1,usePathPosition:!0,usePathRotation:!0,viewDistance:1e3,offsetHeight:0,offsetRotation:a.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,lineMode:void 0})})(ga||(ga={})),a.extendClassProps(ga.prototype,ga.createDefaultProps);class aN extends a.Destroyable{constructor(i,e){if(super(),!e.viewer)throw new Error("viewer is undefined");i.offsetRotation=[-90,0,0]}}class lN extends a.Destroyable{constructor(i,e){if(super(),!e.viewer)throw new Error("viewer is undefined");const o=s=>{(s.key==="w"||s.key==="s")&&(i.polylinePath.playing=s.type==="keydown",i.polylinePath.speed=s.key==="w"||s.type==="keyup"?1:-1)};this.dispose(e.keyDownEvent.don(o)),this.dispose(e.keyUpEvent.don(o))}}class cN extends a.Destroyable{constructor(i,e){super();const n=e.positionPropertyName??"position",o=e.positionChangedPropertyName??n+"Changed",s=e.rotationPropertyName??"rotation",r=e.rotationChangedPropertyName??s+"Changed",l=(e.positionTracking??!0)&&Reflect.has(i,n)&&Reflect.has(i,o),c=(e.rotationTracking??!0)&&Reflect.has(i,s)&&Reflect.has(i,r);if(!(!l&&!c)){if(l){const u=()=>{e.geoCameraController.position=i[n]};u();const d=i[o];this.d(d.don(u))}if(c){const u=()=>{e.geoCameraController.rotation=i[s]};u();const d=i[o];this.d(d.don(u))}}}}class hN extends a.Destroyable{constructor(i,e){super();const n=this.dv(new a.ESSceneObjectWithId);n.id=i;const o=this.dv(a.createNextAnimateFrameEvent(e.enabledChanged,e.positionTrackingChanged,e.rotationTrackingChanged,e.positionPropertyNameChanged,e.positionChangedPropertyNameChanged,e.rotationPropertyNameChanged,e.rotationChangedPropertyNameChanged,n.sceneObjectChanged));this.disposeVar(new a.ObjResettingWithEvent(o,()=>{const{sceneObject:s}=n;if(!(!e.enabled||!s))return new cN(s,e)}))}}class ma extends a.Destroyable{constructor(e){super();m(this,"_geoCameraController");this._geoCameraController=this.dv(new Bi(e)),this.d(a.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dv(new a.ObjResettingWithEvent(this.sceneObjectIdChanged,()=>{if(this.sceneObjectId)return new hN(this.sceneObjectId,this)}))}get geoCameraController(){return this._geoCameraController}}(t=>{t.createDefaultProps=()=>({enabled:void 0,sceneObjectId:void 0,positionTracking:void 0,rotationTracking:void 0,positionPropertyName:void 0,positionChangedPropertyName:void 0,rotationPropertyName:void 0,rotationChangedPropertyName:void 0})})(ma||(ma={})),a.extendClassProps(ma.prototype,ma.createDefaultProps);class uN extends a.Destroyable{constructor(e){super();m(this,"height",1e7);m(this,"cycle",60);m(this,"latitude",38*3.1415926/18);m(this,"_running",!1);m(this,"_sseh");m(this,"_eventDisposer");m(this,"leftDownCancel",!0);this._viewer=e,this._sseh=this.dv(new h.ScreenSpaceEventHandler(this._viewer.canvas)),this._sseh.setInputAction(()=>{this.leftDownCancel&&this.cancel()},h.ScreenSpaceEventType.LEFT_DOWN),this.d(()=>{this.cancel()})}get viewer(){return this._viewer}get sseh(){return this._sseh}start(){if(this._running)return;const e=this._viewer.camera,n=e.positionCartographic;e.flyTo({destination:h.Cartesian3.fromRadians(n.longitude,this.latitude,this.height),orientation:{heading:0,pitch:-.5*h.Math.PI,roll:0},complete:()=>{this._running=!0;var o=void 0;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((s,r)=>{if(!o){o=new Date().getTime();return}const l=(new Date().getTime()-o)/1e3,c=e.positionCartographic.longitude+l*h.Math.PI*2/this.cycle;e.setView({destination:h.Cartesian3.fromRadians(c,this.latitude,this.height),orientation:{heading:0,pitch:-.5*h.Math.PI,roll:0}}),o=new Date().getTime()})},duration:.5})}cancel(){this._running&&(this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1)}}class dN extends a.Destroyable{constructor(e){super();m(this,"_height",this.dv(a.react(1e7)));m(this,"_cycle",this.dv(a.react(60)));m(this,"_latitude",this.dv(a.react(38)));m(this,"_inner");this._czmViewer=e;const n=this._czmViewer.viewer;if(!n)throw new Error("未初始化viewer");this._inner=this.dv(new uN(n)),this._inner.leftDownCancel=!1;{const o=()=>{this._inner.height=this.height,this._inner.cycle=this.cycle,this._inner.latitude=this.latitude*Math.PI/180};o(),this.d(this.heightChanged.don(o)),this.d(this.cycleChanged.don(o)),this.d(this.latitudeChanged.don(o))}}get height(){return this._height.value}set height(e){this._height.value=e}get heightChanged(){return this._height.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get latitude(){return this._latitude.value}set latitude(e){this._latitude.value=e}get latitudeChanged(){return this._latitude.changed}get inner(){return this._inner}start(){return this._inner.start()}cancel(){return this._inner.cancel()}}class pN extends a.Destroyable{constructor(e){super();m(this,"_position",this.dv(a.reactArrayWithUndefined(void 0)));m(this,"_distance",this.dv(a.react(5e4)));m(this,"_cycle",this.dv(a.react(60)));m(this,"_heading",this.dv(a.react(0)));m(this,"_pitch",this.dv(a.react(-30)));m(this,"_transform");m(this,"_headingRadius");m(this,"_pitchRadius");m(this,"_running",!1);m(this,"_sseh");m(this,"_eventDisposer");this._viewer=e;const n=this.viewer.scene,o=this.viewer.camera;this._sseh=this.dv(new h.ScreenSpaceEventHandler(this.viewer.canvas)),this.d(()=>{this.cancel()});{const s=()=>{let r;if(this.position==null){var l=o.getPickRay(new h.Cartesian2(n.canvas.width*.5,n.canvas.height*.5));if(!l)return;r=n.globe.pick(l,n)}else r=h.Cartesian3.fromDegrees(...this.position);r&&(this._transform=h.Transforms.eastNorthUpToFixedFrame(r),this.start())};s(),this.d(this.positionChanged.don(s))}{const s=()=>{this._headingRadius=h.Math.toRadians(this.heading)};s(),this.d(this.headingChanged.don(s))}{const s=()=>{this._pitchRadius=h.Math.toRadians(this.pitch)};s(),this.d(this.pitchChanged.don(s))}}get viewer(){return this._viewer}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get distance(){return this._distance.value}set distance(e){this._distance.value=e}get distanceChanged(){return this._distance.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get heading(){return this._heading.value}set heading(e){this._heading.value=e}get headingChanged(){return this._heading.changed}get pitch(){return this._pitch.value}set pitch(e){this._pitch.value=e}get pitchChanged(){return this._pitch.changed}get sseh(){return this._sseh}start(){if(this._running)return;const e=this.viewer.camera;e.lookAtTransform(this._transform);var n=this.distance*Math.sin(this._pitchRadius),o=this.distance*Math.cos(this._pitchRadius),s=new h.Cartesian3(0,n,o);e.flyTo({destination:h.Matrix4.multiplyByPoint(this._transform,s,new h.Cartesian3),orientation:{heading:this._headingRadius,pitch:this._pitchRadius,roll:0},endTransform:this._transform,complete:()=>{this._running=!0;let r;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((l,c)=>{if(!r){r=new Date().getTime();return}const u=(new Date().getTime()-r)/1e3;this._headingRadius+=u*h.Math.PI*2/this.cycle,e.lookAtTransform(this._transform,new h.HeadingPitchRange(this._headingRadius,this._pitchRadius,this.distance)),r=new Date().getTime()})},duration:.5,maximumHeight:e.positionCartographic.height})}cancel(){if(!this._running)return;this.viewer.camera.lookAtTransform(h.Matrix4.IDENTITY),this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1}}class fN extends a.Destroyable{constructor(e){super();m(this,"_position",this.dv(a.reactArrayWithUndefined(void 0)));m(this,"_distance",this.dv(a.react(5e4)));m(this,"_cycle",this.dv(a.react(60)));m(this,"_heading",this.dv(a.react(0)));m(this,"_pitch",this.dv(a.react(-30)));m(this,"_inner");this._czmViewer=e;const n=this._czmViewer.viewer;if(!n)throw new Error("viewer is undefined");this._inner=this.dv(new pN(n));{const o=()=>{this.inner.distance=this.distance,this.inner.cycle=this.cycle,this.inner.position=this.position,this.inner.heading=this.heading,this.inner.pitch=this.pitch};o(),this.d(this.distanceChanged.don(o)),this.d(this.cycleChanged.don(o)),this.d(this.positionChanged.don(o)),this.d(this.headingChanged.don(o)),this.d(this.pitchChanged.don(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get distance(){return this._distance.value}set distance(e){this._distance.value=e}get distanceChanged(){return this._distance.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get heading(){return this._heading.value}set heading(e){this._heading.value=e}get headingChanged(){return this._heading.changed}get pitch(){return this._pitch.value}set pitch(e){this._pitch.value=e}get pitchChanged(){return this._pitch.changed}get inner(){return this._inner}start(){return this._inner.start()}cancel(){return this._inner.cancel()}}class gN extends a.Destroyable{constructor(e){super();m(this,"_firstPersonController");m(this,"_rotateGlobe");m(this,"_rotatePoint");m(this,"_followController");m(this,"_pathCameraController");m(this,"_handler");this._viewer=e;{this._firstPersonController=this.dv(new sN(e)),this.d(this._viewer.keyDownEvent.don(n=>this._firstPersonController.keyboardCameraController.keyDown(n))),this.d(this._viewer.keyUpEvent.don(n=>this._firstPersonController.keyboardCameraController.keyUp(n)));{const{subContainer:n}=this._viewer;if(!n)throw new Error("_firstPersonControllerInit error!");const o=()=>this._firstPersonController.keyboardCameraController.abort();n.addEventListener("blur",o,!1),this.d(()=>n.removeEventListener("blur",o,!1))}this._firstPersonController.keyboardEnabled=!1,this._firstPersonController.mouseEnabled=!1,this._firstPersonController.keyboardCameraController.speed=.006,this._firstPersonController.keyboardCameraController.rotateSpeed=.05,this._firstPersonController.keyboardCameraController.alwaysWithCamera=!1,this._firstPersonController.keyboardCameraController.keyStatusMap=Yh.defaultKeyStatusMap,this.d(this._firstPersonController.keyboardEnabledChanged.don(()=>{var n;(n=this._viewer.subContainer)==null||n.focus()}))}this._rotateGlobe=this.dv(new dN(e)),this._rotatePoint=this.dv(new fN(e)),this._followController=this.dv(new ma(e)),this._pathCameraController=this.dv(new ga(e))}get firstPersonController(){return this._firstPersonController}get rotateGlobe(){return this._rotateGlobe}get rotatePoint(){return this._rotatePoint}get followController(){return this._followController}get pathCameraController(){return this._pathCameraController}resetNavigation(){this._firstPersonController.keyboardEnabled=!1,this._rotateGlobe.cancel(),this._rotatePoint.cancel(),this._followController.enabled=!1,this._followController.sceneObjectId=void 0,this._followController.geoCameraController.offsetRotation=[-90,0,0],this._followController.geoCameraController.viewDistance=0,this._pathCameraController.enabled=!1,this._pathCameraController.polylinePath.playing=!1,this._pathCameraController.polylinePath.currentTime=0,this._pathCameraController.polylinePath.loop=!1,this._pathCameraController.geoCameraController.offsetHeight=0,this._pathCameraController.polylinePath.positions=void 0,this._pathCameraController.lineMode=void 0}changeToMap(){this.resetNavigation(),this._changedMouseEvent("Map")}changeToWalk(e,n=4.2,o=1.6){this.resetNavigation();const s=this._viewer.navigationMode!="Walk";this._changedMouseEvent("Walk");const r=this._viewer.getCameraInfo(),l=[(r==null?void 0:r.rotation[0])??0,0,0];this._viewer.getHeightByLonLat(e[0],e[1]).then(c=>{s?this._viewer.flyIn([e[0],e[1],(c??0)+o],l):this._viewer.viewer&&(this._viewer.viewer.camera.position=h.Cartesian3.fromDegrees(e[0],e[1],(c??0)+o)),this.firstPersonController.keyboardEnabled=!0,this.firstPersonController.keyboardCameraController.speed=.006,this.firstPersonController.keyboardCameraController.rotateSpeed=.05,this.firstPersonController.keyboardCameraController.keyStatusMap={ShiftLeft:"WithCamera",ShiftRight:"WithCamera",KeyW:"MoveForward",KeyS:"MoveBackword",KeyA:"MoveLeft",KeyD:"MoveRight",ArrowUp:"MoveForward",ArrowDown:"MoveBackword",ArrowLeft:"RotateLeft",ArrowRight:"RotateRight",KeyR:"SpeedUp",KeyF:"SpeedDown",KeyQ:"SwitchAlwaysWithCamera"}})}changeToRotateGlobe(e=38,n=1e7,o=60){this.resetNavigation(),this._changedMouseEvent("RotateGlobe"),this._rotateGlobe.latitude=e,this._rotateGlobe.height=n,this._rotateGlobe.cycle=o,this._rotateGlobe.start()}changeToRotatePoint(e,n=5e4,o=60,s=0,r=-30){this.resetNavigation(),this._changedMouseEvent("RotatePoint"),this._rotatePoint.position=e,this._rotatePoint.distance=n,this._rotatePoint.cycle=o,this._rotatePoint.heading=s,this._rotatePoint.pitch=r,this._rotatePoint.start()}changeToFollow(e,n=0,o=0,s=-30,r=!0){this.resetNavigation(),this._changedMouseEvent("Follow"),this._followController.sceneObjectId=e,this._followController.geoCameraController.offsetRotation=[o,s,0],this._followController.geoCameraController.relativeRotation=r,n!==0?this._followController.geoCameraController.viewDistance=n:this._followController.geoCameraController.viewDistance=1e3,this._followController.enabled=!0}changeToLine(e,n=10,o=10,s=!0,r=10,l="auto"){this.resetNavigation(),this._changedMouseEvent("Line");const c=l==="auto",u=a.ESSceneObject.getSceneObjById(e);if(!u)return;const{points:d}=u;if(!d)return;const p=a.getDistancesFromPositions(d,"NONE"),f=p[p.length-1];this._pathCameraController.viewDistance=0,this._pathCameraController.polylinePath.positions=[...d],this._pathCameraController.polylinePath.duration=f/n*1e3,this._pathCameraController.polylinePath.loop=s,this._pathCameraController.offsetHeight=o;const g=pm(d);this._pathCameraController.polylinePath.rotationRadius=!c||g==!1?[0]:g.map(v=>v/r*n),this._pathCameraController.enabledRotationInput=!c,this._pathCameraController.enabledScaleInput=!1,this._pathCameraController.polylinePath.playing=c,this._pathCameraController.lineMode=l,this._pathCameraController.enabled=!0}_changedMouseEvent(e){const n=this._viewer.viewer;if(!n)return;this._handler||(this._handler=new h.ScreenSpaceEventHandler(n.scene.canvas));const o=this._handler,s=n.scene.screenSpaceCameraController;this.d(()=>{o&&i_(o)}),e=="Walk"||e=="RotateGlobe"?(s.lookEventTypes=void 0,s.rotateEventTypes=void 0,s.tiltEventTypes=void 0,s.zoomEventTypes=void 0,s.translateEventTypes=void 0,o&&e=="Walk"&&(o.setInputAction(r=>{o.setInputAction(l=>{Dg(n.scene,l,s)},h.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(l=>{o.removeInputAction(h.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(h.ScreenSpaceEventType.LEFT_UP)},h.ScreenSpaceEventType.LEFT_UP)},h.ScreenSpaceEventType.LEFT_DOWN),o.setInputAction(r=>{o.setInputAction(l=>{Dg(n.scene,l,s)},h.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(l=>{o.removeInputAction(h.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(h.ScreenSpaceEventType.RIGHT_UP)},h.ScreenSpaceEventType.RIGHT_UP)},h.ScreenSpaceEventType.RIGHT_DOWN),o.setInputAction(r=>{o.setInputAction(l=>{Dg(n.scene,l,s)},h.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(l=>{o.removeInputAction(h.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(h.ScreenSpaceEventType.MIDDLE_UP)},h.ScreenSpaceEventType.MIDDLE_UP)},h.ScreenSpaceEventType.MIDDLE_DOWN))):(o&&i_(o),s.lookEventTypes=h.CameraEventType.RIGHT_DRAG,s.rotateEventTypes=h.CameraEventType.LEFT_DRAG,s.tiltEventTypes=[h.CameraEventType.MIDDLE_DRAG,h.CameraEventType.PINCH,{eventType:h.CameraEventType.LEFT_DRAG,modifier:h.KeyboardEventModifier.CTRL},{eventType:h.CameraEventType.RIGHT_DRAG,modifier:h.KeyboardEventModifier.CTRL}],s.translateEventTypes=h.CameraEventType.LEFT_DRAG,s.zoomEventTypes=[h.CameraEventType.WHEEL,h.CameraEventType.PINCH,{eventType:h.CameraEventType.RIGHT_DRAG,modifier:h.KeyboardEventModifier.SHIFT}])}}const mN=[{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3558367297943,39.93163726456884,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30223283037274,39.92688664316035,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.43707387584969,39.922782714050356,3300]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.27929428317248,39.895318074706246,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.36181901056395,39.89720944386167,3553.618347252562]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.40050587550184,39.87565113086582,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.31629153797958,39.88888615917464,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.38662084727662,39.93026695192356,5222.983612030221]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.35985958294472,39.879559968940974,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30061281533665,39.86521469244785,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.33589491695909,39.85251691437225,3400]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3978491755026,39.92191230041099,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.404556165088,39.901554635269065,3400]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3371677114933,39.90666589456628,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30329238580244,39.90598342431921,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.25047545555285,39.927295935589235,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.33129680063607,39.98205319015022,5500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.38241622722414,39.864780790627634,5800]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.24126681456984,39.85629130246847,6e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.4476299820832,39.9015287845667,5233.181711832771]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.33116617802452,39.824241891065384,6e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.15206905891218,39.90872966468676,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.24197212869294,39.88630968655299,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.43381133281572,39.96058832885812,5700]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.21635435523064,39.966450178376924,7e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.17908072725879,39.87211951629164,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.32516866705241,39.94534681561764,3300]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.36086721251684,39.948381883306446,3400]}];class vN extends a.Destroyable{constructor(e){super();m(this,"_show",this.dv(a.react(!1)));m(this,"cloudsPostProcess");const n=e.viewer;if(!n)throw new Error("Cesium Viewer is not initialized");const o=new h.CloudCollection;n.scene.primitives.add(o),this.dispose(()=>n.scene.primitives.remove(o));{const s=()=>{o.show=this.show};s(),this.dispose(this.showChanged.disposableOn(s))}{const s=l=>({slice:l.slice,brightness:l.brightness,scale:Pe(l.scale),maximumSize:hi(l.maximumSize),color:te(l.color),position:Se(l.position)});(()=>{o.removeAll();for(let l of mN)o.add(s(l))})()}}get show(){return this._show.value}set show(e){this._show.value=e}get showChanged(){return this._show.changed}}class va extends a.Destroyable{constructor(i){super();const e=i.viewer;if(!e){console.warn("viewer is undefined!");return}const n=e.scene.postProcessStages.add(h.PostProcessStageLibrary.createDepthOfFieldStage());this.d(()=>e.scene.postProcessStages.remove(n));{const o=()=>{n.enabled=this.show};o(),this.d(this.showChanged.don(o))}{const o=()=>{n.uniforms.fogByDistance=this.focalDistance};o(),this.d(this.focalDistanceChanged.don(o))}{const o=()=>{n.uniforms.delta=this.delta};o(),this.d(this.deltaChanged.don(o))}{const o=()=>{n.uniforms.sigma=this.sigma};o(),this.d(this.sigmaChanged.don(o))}{const o=()=>{n.uniforms.stepSize=this.stepSize};o(),this.d(this.stepSizeChanged.don(o))}}}(t=>{t.createDefaultProps=()=>({show:!1,focalDistance:87,delta:1,sigma:3.78,stepSize:2.46})})(va||(va={})),a.extendClassProps(va.prototype,va.createDefaultProps);const yN=`
|
|
1997
1997
|
float getDistance(sampler2D depthTexture, vec2 texCoords)
|
|
1998
1998
|
{
|
|
@@ -2292,10 +2292,10 @@ async function initCesiumViewer(container, czmViewer) {
|
|
|
2292
2292
|
`;function lO(){const t="https://gitee.com/mirrors/CesiumJS/blob/main/packages/engine/Source/Core/Ion.js#L7",e=` 因浏览器同源策略限制,需要用户自行打开网址获取最新的token,点击确定自动打开网址,请不要拦截!
|
|
2293
2293
|
github地址:https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/Core/Ion.js#L7
|
|
2294
2294
|
gitee地址:${t}
|
|
2295
|
-
`;console.log(e);const n=globalThis.prompt(e,t);n&&globalThis.open(n,"_blank")}const lt=class lt extends a.ESViewer{constructor(e){super(e);m(this,"_disabledInputStack",this.disposeVar(a.react(0)));m(this,"_viewer",this.dv(a.react(void 0)));m(this,"_viewerInstance");m(this,"_viewerLegend");m(this,"pickCustomAttachedInfo");m(this,"_fps",this.dv(a.react(0)));m(this,"_notSupportEditingCount",this.disposeVar(a.react(0)));m(this,"_editingSystem",$h);m(this,"_moveObjectsProcess",this.ad(xC()));if(e.type!=="ESCesiumViewer")throw new Error("option.type must be ESCesiumViewer");this.ad(new AF(this)),this.ad(new EF(this)),this.dv(new a.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new DF(this)})),this._viewerLegend=this.dv(new iO(this)),this._viewerInstance=this.dv(new a.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new zg(this,this.viewer)})),this.d(this.viewerChanged.don(o=>{this.viewer&&(this.viewer.scene.globe.baseColor=te([1,1,1,1]))}));const n=e;this.d(this._viewer.changed.don(o=>{this.viewerChanged.emit(o)})),this.dv(new a.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new ML(this.subContainer,this,o=>this._viewer.value=o,n.options)}))}get disabledInputStack(){return this._disabledInputStack.value}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Ke(this.viewer)}get viewerInstance(){return this._viewerInstance}get viewerLegend(){return this._viewerLegend}async pick(e,n,o){if(!this.extensions)return;const{pickingManager:s}=this.extensions;return await s.pick(e,void 0,n)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(e)}async getTerrainHeight(e){const{viewer:n}=this;if(!n)return;const o=h.Cartographic.fromDegrees(e[0],e[1],e[2],lt.getHeightsScartchCarto);return n.scene.globe.getHeight(o)}getCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Ht(e),rotation:jo(e)}}calcFlyToParam(e){if(!this.viewer)return;const{camera:n}=this.viewer;if(!n||!e)return;const o=h.Cartesian3.fromDegrees(...e),s=h.Transforms.eastNorthUpToFixedFrame(o),r=h.Matrix4.inverse(s,new h.Matrix4),l=h.Matrix4.multiplyByPoint(r,n.positionWC,new h.Cartesian3),c=h.Cartesian3.magnitude(l);let u=-Math.asin(l.z/c);u=h.Math.toDegrees(u);let d=h.Math.PI_OVER_TWO-Math.atan(l.y/l.x);l.x>0&&(d+=l.y<0?-h.Math.PI:h.Math.PI),d=h.Math.toDegrees(d);const p=jo(n),f=p[0]-d,g=p[1]-u;return{distance:c,heading:d,pitch:u,flyDuration:1,hDelta:f,pDelta:g}}flyIn(e,n,o,s="default"){var c;const r={position:e,rotation:n,duration:(o??1)*1e3},l=(c=this.viewer)==null?void 0:c.camera;return l&&Er(l,r,s)}flyTo(e,n,o="default"){var g;const{distance:s,heading:r,pitch:l,flyDuration:c,hDelta:u,pDelta:d}=e,p={position:n,viewDistance:s,rotation:[r,l,0],duration:c*1e3,hdelta:u,pdelta:d},f=(g=this.viewer)==null?void 0:g.camera;return f&&Er(f,p,o)}flyToBoundingSphere(e,n,o=1){var p;const s=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],r=a.getGeoBoundingSphereFromPositions(s);if(!r)return;const{center:l,radius:c}=r,u={position:l,viewDistance:n??c,rotation:[0,-90,0],duration:o*1e3},d=(p=this.viewer)==null?void 0:p.camera;return d&&Er(d,u)}getCurrentCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Ht(e),rotation:jo(e)}}transformFlyParam(e,n){if("position"in n){const o=h.Cartesian3.fromDegrees(...e),s=h.Transforms.eastNorthUpToFixedFrame(o),r=h.Matrix4.inverse(s,new h.Matrix4),l=h.Matrix4.multiplyByPoint(r,Se(n.position),new h.Cartesian3),c=h.Cartesian3.magnitude(l);let u=-Math.asin(l.z/c);u=h.Math.toDegrees(u);let d=h.Math.PI_OVER_TWO-Math.atan(l.y/l.x);l.x>0&&(d+=l.y<0?-h.Math.PI:h.Math.PI),d=h.Math.toDegrees(d);const p=n.rotation[0]-d,f=n.rotation[1]-u;return{distance:c,heading:d,pitch:u,flyDuration:n.flyDuration??1,hDelta:p,pDelta:f}}else{const o=Se(e);let s={heading:h.Math.toRadians(n.heading),pitch:h.Math.toRadians(n.pitch),roll:0};const r=new h.HeadingPitchRoll;if(n.distance){r.heading=s.heading,r.pitch=s.pitch,r.roll=0,r.heading-=h.Math.PI_OVER_TWO;const c=h.Transforms.headingPitchRollToFixedFrame(o,r,void 0,void 0),u=h.Matrix4.multiplyByPointAsVector(c,h.Cartesian3.UNIT_X,new h.Cartesian3);h.Cartesian3.multiplyByScalar(u,n.distance,u),h.Cartesian3.subtract(o,u,o)}n.hDelta&&(s.heading+=h.Math.toRadians(n.hDelta)),n.pDelta&&(s.pitch+=h.Math.toRadians(n.pDelta));const l=se(o);return l?{position:l,rotation:[h.Math.toDegrees(s.heading),h.Math.toDegrees(s.pitch),h.Math.toDegrees(s.roll)],flyDuration:n.flyDuration??1}:void 0}}getLengthInPixel(){return this._viewerLegend.length}changeToWalk(e,n=4.2,o=1.6){var s,r;(r=(s=this._viewerInstance)==null?void 0:s.obj)==null||r.navigationManager.changeToWalk(e,n,o),this._navigationMode.value="Walk"}changeToMap(){var e,n;(n=(e=this._viewerInstance)==null?void 0:e.obj)==null||n.navigationManager.changeToMap(),this._navigationMode.value="Map"}changeToRotateGlobe(e,n,o){var s,r;(r=(s=this._viewerInstance)==null?void 0:s.obj)==null||r.navigationManager.changeToRotateGlobe(e,n,o),this._navigationMode.value="RotateGlobe"}changeToLine(e,n,o,s,r,l){var c,u;(u=(c=this._viewerInstance)==null?void 0:c.obj)==null||u.navigationManager.changeToLine(e,n,o,s,r,l),this._navigationMode.value="Line"}changeToUserDefined(e){this.changeToMap(),console.warn("Cesium引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,n,o,s,r){var l,c;(c=(l=this._viewerInstance)==null?void 0:l.obj)==null||c.navigationManager.changeToRotatePoint(e,n,o,s,r),this._navigationMode.value="RotatePoint"}changeToFollow(e,n,o,s,r){var l,c;(c=(l=this._viewerInstance)==null?void 0:l.obj)==null||c.navigationManager.changeToFollow(e,n,o,s,r),this._navigationMode.value="Follow"}getFPS(){return this._fps.value}async getBoundSphere(e){return Promise.resolve(void 0)}async getVersion(){const e=globalThis.g_XE3CopyRights??{};return e.cesium={version:h.VERSION},e}async getHeightByLonLat(e,n,o){if(!this.viewer)return null;const s=h.Cartographic.fromDegrees(e,n,void 0,lt.getHeightsScartchCarto);return this.viewer.scene.sampleHeight(s)??null}async getHeightsByLonLats(e,n){const o=e.map(r=>this.getHeightByLonLat(...r));return await Promise.all(o)}async capture(e,n){if(this.viewer)return await xm(this.viewer.scene,e,n)}async lonLatAltToScreenPosition(e){if(!this.viewer||!this.isPointVisible(e))return;const n=this.viewer.scene.cartesianToCanvasCoordinates(Se(e));if(n)return[n.x,n.y]}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,n,o){o=Object.assign({useKeyToSwitch:!0,callSource:"outer"},o);const s=e.components.main??e;s&&n!=null&&(s.editingID=`${o.callSource}_${a.createGuid()}`,this._editingSystem.create(this,s,n,o.useKeyToSwitch))}stopEditing(){this._editingSystem.stop()}moveObjects(e){const n=[],o=a.createGuid();for(let s=0;s<e.length;s++){const r=e[s],l=r.components.main??r;l.editingID=o,l&&n.push(l)}this._moveObjectsProcess.restart(void 0,this,n,o)}getCzmObject(e){return this.sceneObjectsMap.get(e)}setCurrentDefaultAccessToken(){this.ionAccessToken=lt.currentDefaultAccessToken}setLatestDefaultAccessToken(){if(!lt.latestDefaultAccessToken){alert("Cesium最新的iontoken无法获取!"),console.error("Cesium最新的iontoken无法获取!");return}this.ionAccessToken=lt.latestDefaultAccessToken}positionsToLocalPositions(e,n){return Dt(e,n)}localPositionsToPositions(e,n){return Cn(e,n)}isPointVisible(e){if(!this.viewer)return!1;const n=e instanceof h.Cartesian3?e:Se(e),o=new h.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.positionWC);if(o.cameraPosition=this.viewer.scene.camera.positionWC,!o.isPointVisible(n))return!1;const s=this.viewer.scene.cartesianToCanvasCoordinates(n);return!(!s||s.x<0||s.y<0)}getESProperties(){const e={...super.getESProperties()},n=lt.defaults;return{...e,more:[...e.more,new a.GroupProperty([],"通用","通用"),new a.EvalStringProperty([this,"createCesiumViewerFuncStr"],"CesiumViewer创建函数",aO,rO,!0),new a.FunctionProperty([],()=>lt.getCesiumIonToken(),[],"获取官方token"),new a.FunctionProperty([],()=>this.setCurrentDefaultAccessToken(),[],"重置为当前使用的Cesium版本的token"),new a.FunctionProperty([],()=>this.setLatestDefaultAccessToken(),[],"最新token","重置为当前Cesium官方的最新token"),new a.BooleanProperty([this,"flashLighting"],"头顶灯",n.flashLighting,!0),new a.BooleanProperty([this,"particleGlobalControl"],"粒子全局控制播放",n.particleGlobalControl,!0),new a.GroupProperty([],"Viewer","Viewer"),new a.NumberProperty([this,"resolutionScale"],"分辨率比率",n.resolutionScale,!0),new a.NumberProperty([this,"msaaSamples"],"msaaSamples",n.msaaSamples,!0),new a.BooleanProperty([this,"shadows"]),new a.GroupProperty([],"比例尺","比例尺(Legend)"),new a.NumberProperty([this.viewerLegend,"resolution"],"resolution",void 0,!0,!0),new a.NumberProperty([this.viewerLegend,"zoom"],"zoom",void 0,!0,!0),new a.Number3Property([this.viewerLegend,"center"],"center",void 0,!0,!0),new a.NumberProperty([this.viewerLegend.legend,"lengthInPixels"],"lengthInPixels",100,!0,!1),new a.NumberProperty([this.viewerLegend.legend,"computedLengthInPixels"],"computedLengthInPixels",void 0,!0,!0),new a.NumberProperty([this.viewerLegend.legend,"computedLengthInMeters"],"computedLengthInMeters",void 0,!0,!0),new a.StringProperty([this.viewerLegend.legend,"computedLengthInStr"],"computedLengthInStr",void 0,!0,!0),new a.GroupProperty([],"场景","场景(Scene)"),new a.NumberProperty([this,"sceneSplitPosition"],"内部视口分割比例",n.sceneSplitPosition,!0),new a.GroupProperty([],"Globe","Globe"),new a.EnumProperty([this,"sceneGlobeShadows"],[["禁用","DISABLED"],["启用","ENABLED"],["仅投射","CAST_ONLY"],["仅接收","RECEIVE_ONLY"]],"sceneGlobeShadows",n.sceneGlobeShadows,!0),new a.NumberProperty([this,"sceneGlobeTerrainExaggeration"]),new a.NumberProperty([this,"sceneGlobeTerrainExaggerationRelativeHeight"]),new a.NumberProperty([this,"sceneGlobeVerticalExaggeration"]),new a.NumberProperty([this,"sceneGlobeVerticalExaggerationRelativeHeight"]),new a.BooleanProperty([this,"sceneGlobeBackFaceCulling"]),new a.BooleanProperty([this,"sceneGlobeShowSkirts"]),new a.BooleanProperty([this,"sceneGlobeShowWaterEffect"]),new a.ColorProperty([this,"sceneGlobeBaseColor"]),new a.Number4Property([this,"sceneGlobeCartographicLimitRectangle"]),new a.JsonProperty([this,"sceneGlobeClippingPlanes"]),new a.StringProperty([this,"sceneGlobeClippingPlanesId"]),new a.JsonProperty([this,"sceneGlobeClippingPolygons"]),new a.StringsProperty([this,"sceneGlobeClippingPolygonsId"]),new a.GroupProperty([],"underground","underground"),new a.ColorProperty([this,"sceneGlobeUndergroundColor"],"sceneGlobeUndergroundColor",n.sceneGlobeUndergroundColor,!0),new a.Number4Property([this,"sceneGlobeUndergroundColorAlphaByDistance"],"sceneGlobeUndergroundColorAlphaByDistance",n.sceneGlobeUndergroundColorAlphaByDistance,!0),new a.GroupProperty([],"Translucency","Translucency"),new a.Number4Property([this,"sceneGlobeTranslucencyBackFaceAlphaByDistance"],"背面渐变透明度",n.sceneGlobeTranslucencyBackFaceAlphaByDistance,!0),new a.Number4Property([this,"sceneGlobeTranslucencyFrontFaceAlphaByDistance"],"正面渐变透明度",n.sceneGlobeTranslucencyFrontFaceAlphaByDistance,!0),new a.Number4Property([this,"sceneGlobeTranslucencyRectangle"],"矩形范围",n.sceneGlobeTranslucencyRectangle,!0),new a.GroupProperty([],"Sun","Sun"),new a.BooleanProperty([this,"sun"],"sun",n.sun,!0),new a.NumberProperty([this,"sceneSunGlowFactor"],"sceneSunGlowFactor",n.sceneSunGlowFactor,!0),new a.GroupProperty([],"Moon","Moon"),new a.BooleanProperty([this,"moon"],"moon",n.moon,!0),new a.StringProperty([this,"sceneMoonTextureUrl"],"sceneMoonTextureUrl",n.sceneMoonTextureUrl,!0),new a.BooleanProperty([this,"sceneMoonOnlySunLighting"],"sceneMoonOnlySunLighting",n.sceneMoonOnlySunLighting,!0),new a.GroupProperty([],"SkyBox","SkyBox"),new a.BooleanProperty([this,"sceneSkyBoxShow"]),new a.JsonProperty([this,"sceneSkyBoxSources"],"sceneSkyBoxSources",n.sceneSkyBoxSources,void 0,!0),new a.GroupProperty([],"Background","Background"),new a.BooleanProperty([this,"xbsjUseBackground"]),new a.StringProperty([this,"xbsjBackgroundImageUri"]),new a.ColorProperty([this,"xbsjBackgroundColor"]),new a.GroupProperty([],"SkyAtmosphere","SkyAtmosphere"),new a.JsonProperty([this,"xbsjLocalBoxSources"],"xbsjLocalBoxSources",n.xbsjLocalBoxSources,void 0,!0),new a.ColorProperty([this,"sceneBackgroundColor"]),new a.GroupProperty([],"Fog","Fog"),new a.BooleanProperty([this,"sceneFogEnabled"],"sceneFogEnabled",n.sceneFogEnabled,!0),new a.NumberProperty([this,"sceneFogDensity"],"sceneFogDensity",n.sceneFogDensity,!0),new a.NumberProperty([this,"sceneFogScreenSpaceErrorFactor"],"sceneFogScreenSpaceErrorFactor",n.sceneFogScreenSpaceErrorFactor,!0),new a.NumberProperty([this,"sceneFogMinimumBrightness"],"sceneFogMinimumBrightness",n.sceneFogMinimumBrightness,!0),new a.GroupProperty([],"Sscc","Sscc"),new a.BooleanProperty([this,"sceneSsccEnableInputs"],"sceneSsccEnableInputs",n.sceneSsccEnableInputs,!0),new a.BooleanProperty([this,"sceneSsccEnableCollisionDetection"],"sceneSsccEnableCollisionDetection",n.sceneSsccEnableCollisionDetection,!0),new a.NumberProperty([this,"sceneSsccZoomFactor"],"sceneSsccZoomFactor",n.sceneSsccZoomFactor,!0),new a.NumberProperty([this,"sceneCameraFrustumFov"],"相机广角"),new a.GroupProperty([],"后处理","后处理"),new a.BooleanProperty([this,"scenePpsfxaaEnabled"],"开启FXAA",n.scenePpsfxaaEnabled,!0),new a.GroupProperty([],"环境遮蔽","环境遮蔽"),new a.BooleanProperty([this,"scenePpsAmbientOcclusionEnabled"]),new a.BooleanProperty([this,"scenePpsAmbientOcclusionAmbientOcclusionOnly"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionIntensity"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionBias"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionLengthCap"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionStepSize"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionBlurStepSize"]),new a.GroupProperty([],"Bloom","Bloom"),new a.BooleanProperty([this,"scenePpsBloomEnabled"]),new a.BooleanProperty([this,"scenePpsBloomGlowOnly"]),new a.NumberProperty([this,"scenePpsBloomContrast"]),new a.NumberProperty([this,"scenePpsBloomBrightness"]),new a.NumberProperty([this,"scenePpsBloomDelta"]),new a.NumberProperty([this,"scenePpsBloomSigma"]),new a.NumberProperty([this,"scenePpsBloomStepSize"]),new a.GroupProperty([],"调试","调试"),new a.BooleanProperty([this,"sceneDebugShowFramesPerSecond"],"sceneDebugShowFramesPerSecond",n.sceneDebugShowFramesPerSecond,!0),new a.BooleanProperty([this,"sceneDebugShowCommands"],"sceneDebugShowCommands",n.sceneDebugShowCommands,!0),new a.BooleanProperty([this,"sceneDebugShowFrustums"],"sceneDebugShowFrustums",n.sceneDebugShowFrustums,!0),new a.BooleanProperty([this,"sceneDebugShowFrustumPlanes"],"sceneDebugShowFrustumPlanes",n.sceneDebugShowFrustumPlanes,!0),new a.NumberProperty([this,"sceneDebugShowDepthFrustum"],"sceneDebugShowDepthFrustum",n.sceneDebugShowDepthFrustum,!0),new a.GroupProperty([],"Inspector","Inspector"),new a.BooleanProperty([this,"showCesiumInspector"],"showCesiumInspector",n.showCesiumInspector,!0),new a.BooleanProperty([this,"cesiumInspectorWireframe"],"cesiumInspectorWireframe",n.cesiumInspectorWireframe,!0),new a.BooleanProperty([this,"showCesium3DTilesInspector"],"showCesium3DTilesInspector",n.showCesium3DTilesInspector,!0)]}}};m(lt,"type",lt.register("ESCesiumViewer",lt)),m(lt,"getCesiumIonToken",lO),m(lt,"currentDefaultAccessToken",h.Ion.defaultAccessToken),m(lt,"latestDefaultAccessToken"),m(lt,"ObjectsToExcludeWrapper",MF),m(lt,"defaults",{...a.ESViewer.defaults,flashLighting:!1,resolutionScale:1,msaaSamples:4,sceneSplitPosition:0,sceneGlobeShadows:"RECEIVE_ONLY",sceneGlobeUndergroundColor:[0,0,0,1],sceneGlobeUndergroundColorAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyBackFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyFrontFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyRectangle:[-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966].map(e=>180*e/Math.PI),sun:!0,sceneSunGlowFactor:1,moon:!0,sceneMoonTextureUrl:h.buildModuleUrl("Assets/Textures/moonSmall.jpg"),sceneMoonOnlySunLighting:!0,sceneSkyBoxSources:{positiveX:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_px.jpg"),negativeX:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mx.jpg"),positiveY:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_py.jpg"),negativeY:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_my.jpg"),positiveZ:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_pz.jpg"),negativeZ:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mz.jpg")},xbsjLocalBoxSources:{positiveX:"${earthsdk3-assets-script-dir}/assets/img/skybox/east.jpg",negativeX:"${earthsdk3-assets-script-dir}/assets/img/skybox/west.jpg",positiveY:"${earthsdk3-assets-script-dir}/assets/img/skybox/bottom.jpg",negativeY:"${earthsdk3-assets-script-dir}/assets/img/skybox/top.jpg",positiveZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/north.jpg",negativeZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/south.jpg"},sceneFogEnabled:!0,sceneFogDensity:2e-4,sceneFogScreenSpaceErrorFactor:2,sceneFogMinimumBrightness:.03,sceneSsccEnableInputs:!0,sceneSsccEnableCollisionDetection:!0,sceneSsccZoomFactor:5,scenePpsfxaaEnabled:!0,sceneDebugShowFramesPerSecond:!1,sceneDebugShowCommands:!1,sceneDebugShowFrustums:!1,sceneDebugShowFrustumPlanes:!1,sceneDebugShowDepthFrustum:1,showCesiumInspector:!1,cesiumInspectorWireframe:!1,showCesium3DTilesInspector:!1,particleGlobalControl:!1}),m(lt,"getHeightsScartchCarto",new h.Cartographic);let Me=lt;(t=>{t.createDefaultProps=()=>({...a.ESViewer.createDefaultProps(),...sO()})})(Me||(Me={})),a.extendClassProps(Me.prototype,Me.createDefaultProps),I.copyright=void 0;try{const t="earthsdk3-cesium",i="3.6.2",e="2025-12-04T02:08:23.000Z",n="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="b951704c9cc2a53b6d53468e08f41aec0794d4c0",l=((Date.now()-1764814103e3)/36e5).toFixed(1),c=`%c🌏 ${t}%c ${i}.${s.slice(0,8)}.${e} (距今${l}个小时)
|
|
2295
|
+
`;console.log(e);const n=globalThis.prompt(e,t);n&&globalThis.open(n,"_blank")}const lt=class lt extends a.ESViewer{constructor(e){super(e);m(this,"_disabledInputStack",this.disposeVar(a.react(0)));m(this,"_viewer",this.dv(a.react(void 0)));m(this,"_viewerInstance");m(this,"_viewerLegend");m(this,"pickCustomAttachedInfo");m(this,"_fps",this.dv(a.react(0)));m(this,"_notSupportEditingCount",this.disposeVar(a.react(0)));m(this,"_editingSystem",$h);m(this,"_moveObjectsProcess",this.ad(xC()));if(e.type!=="ESCesiumViewer")throw new Error("option.type must be ESCesiumViewer");this.ad(new AF(this)),this.ad(new EF(this)),this.dv(new a.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new DF(this)})),this._viewerLegend=this.dv(new iO(this)),this._viewerInstance=this.dv(new a.ObjResettingWithEvent(this.viewerChanged,()=>{if(this.viewer)return new zg(this,this.viewer)})),this.d(this.viewerChanged.don(o=>{this.viewer&&(this.viewer.scene.globe.baseColor=te([1,1,1,1]))}));const n=e;this.d(this._viewer.changed.don(o=>{this.viewerChanged.emit(o)})),this.dv(new a.ObjResettingWithEvent(this.subContainerChanged,()=>{if(this.setStatus("Raw"),this.setStatusLog(""),!!this.subContainer)return new ML(this.subContainer,this,o=>this._viewer.value=o,n.options)}))}get disabledInputStack(){return this._disabledInputStack.value}get disabledInputStackChanged(){return this._disabledInputStack.changed}incrementDisabledInputStack(){++this._disabledInputStack.value}decrementDisabledInputStack(){--this._disabledInputStack.value}get viewer(){return this._viewer.value}get extensions(){return this.viewer&&Ke(this.viewer)}get viewerInstance(){return this._viewerInstance}get viewerLegend(){return this._viewerLegend}async pick(e,n,o){if(!this.extensions)return;const{pickingManager:s}=this.extensions;return await s.pick(e,void 0,n)}async pickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.pickPosition(e)}async quickPickPosition(e){if(!this.extensions)return;const{pickingManager:n}=this.extensions;return await n.quickPickPosition(e)}async getTerrainHeight(e){const{viewer:n}=this;if(!n)return;const o=h.Cartographic.fromDegrees(e[0],e[1],e[2],lt.getHeightsScartchCarto);return n.scene.globe.getHeight(o)}getCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Ht(e),rotation:jo(e)}}calcFlyToParam(e){if(!this.viewer)return;const{camera:n}=this.viewer;if(!n||!e)return;const o=h.Cartesian3.fromDegrees(...e),s=h.Transforms.eastNorthUpToFixedFrame(o),r=h.Matrix4.inverse(s,new h.Matrix4),l=h.Matrix4.multiplyByPoint(r,n.positionWC,new h.Cartesian3),c=h.Cartesian3.magnitude(l);let u=-Math.asin(l.z/c);u=h.Math.toDegrees(u);let d=h.Math.PI_OVER_TWO-Math.atan(l.y/l.x);l.x>0&&(d+=l.y<0?-h.Math.PI:h.Math.PI),d=h.Math.toDegrees(d);const p=jo(n),f=p[0]-d,g=p[1]-u;return{distance:c,heading:d,pitch:u,flyDuration:1,hDelta:f,pDelta:g}}flyIn(e,n,o,s="default"){var c;const r={position:e,rotation:n,duration:(o??1)*1e3},l=(c=this.viewer)==null?void 0:c.camera;return l&&Er(l,r,s)}flyTo(e,n,o="default"){var g;const{distance:s,heading:r,pitch:l,flyDuration:c,hDelta:u,pDelta:d}=e,p={position:n,viewDistance:s,rotation:[r,l,0],duration:c*1e3,hdelta:u,pdelta:d},f=(g=this.viewer)==null?void 0:g.camera;return f&&Er(f,p,o)}flyToBoundingSphere(e,n,o=1){var p;const s=[[e[0],e[1],0],[e[0],e[3],0],[e[2],e[3],0],[e[2],e[1],0]],r=a.getGeoBoundingSphereFromPositions(s);if(!r)return;const{center:l,radius:c}=r,u={position:l,viewDistance:n??c,rotation:[0,-90,0],duration:o*1e3},d=(p=this.viewer)==null?void 0:p.camera;return d&&Er(d,u)}getCurrentCameraInfo(){if(!this.viewer)return;const{camera:e}=this.viewer;return{position:Ht(e),rotation:jo(e)}}transformFlyParam(e,n){if("position"in n){const o=h.Cartesian3.fromDegrees(...e),s=h.Transforms.eastNorthUpToFixedFrame(o),r=h.Matrix4.inverse(s,new h.Matrix4),l=h.Matrix4.multiplyByPoint(r,Se(n.position),new h.Cartesian3),c=h.Cartesian3.magnitude(l);let u=-Math.asin(l.z/c);u=h.Math.toDegrees(u);let d=h.Math.PI_OVER_TWO-Math.atan(l.y/l.x);l.x>0&&(d+=l.y<0?-h.Math.PI:h.Math.PI),d=h.Math.toDegrees(d);const p=n.rotation[0]-d,f=n.rotation[1]-u;return{distance:c,heading:d,pitch:u,flyDuration:n.flyDuration??1,hDelta:p,pDelta:f}}else{const o=Se(e);let s={heading:h.Math.toRadians(n.heading),pitch:h.Math.toRadians(n.pitch),roll:0};const r=new h.HeadingPitchRoll;if(n.distance){r.heading=s.heading,r.pitch=s.pitch,r.roll=0,r.heading-=h.Math.PI_OVER_TWO;const c=h.Transforms.headingPitchRollToFixedFrame(o,r,void 0,void 0),u=h.Matrix4.multiplyByPointAsVector(c,h.Cartesian3.UNIT_X,new h.Cartesian3);h.Cartesian3.multiplyByScalar(u,n.distance,u),h.Cartesian3.subtract(o,u,o)}n.hDelta&&(s.heading+=h.Math.toRadians(n.hDelta)),n.pDelta&&(s.pitch+=h.Math.toRadians(n.pDelta));const l=se(o);return l?{position:l,rotation:[h.Math.toDegrees(s.heading),h.Math.toDegrees(s.pitch),h.Math.toDegrees(s.roll)],flyDuration:n.flyDuration??1}:void 0}}getLengthInPixel(){return this._viewerLegend.length}changeToWalk(e,n=4.2,o=1.6){var s,r;(r=(s=this._viewerInstance)==null?void 0:s.obj)==null||r.navigationManager.changeToWalk(e,n,o),this._navigationMode.value="Walk"}changeToMap(){var e,n;(n=(e=this._viewerInstance)==null?void 0:e.obj)==null||n.navigationManager.changeToMap(),this._navigationMode.value="Map"}changeToRotateGlobe(e,n,o){var s,r;(r=(s=this._viewerInstance)==null?void 0:s.obj)==null||r.navigationManager.changeToRotateGlobe(e,n,o),this._navigationMode.value="RotateGlobe"}changeToLine(e,n,o,s,r,l){var c,u;(u=(c=this._viewerInstance)==null?void 0:c.obj)==null||u.navigationManager.changeToLine(e,n,o,s,r,l),this._navigationMode.value="Line"}changeToUserDefined(e){this.changeToMap(),console.warn("Cesium引擎暂不支持自定义漫游,已切换为Map模式")}changeToRotatePoint(e,n,o,s,r){var l,c;(c=(l=this._viewerInstance)==null?void 0:l.obj)==null||c.navigationManager.changeToRotatePoint(e,n,o,s,r),this._navigationMode.value="RotatePoint"}changeToFollow(e,n,o,s,r){var l,c;(c=(l=this._viewerInstance)==null?void 0:l.obj)==null||c.navigationManager.changeToFollow(e,n,o,s,r),this._navigationMode.value="Follow"}getFPS(){return this._fps.value}async getBoundSphere(e){return Promise.resolve(void 0)}async getVersion(){const e=globalThis.g_XE3CopyRights??{};return e.cesium={version:h.VERSION},e}async getHeightByLonLat(e,n,o){if(!this.viewer)return null;const s=h.Cartographic.fromDegrees(e,n,void 0,lt.getHeightsScartchCarto);return this.viewer.scene.sampleHeight(s)??null}async getHeightsByLonLats(e,n){const o=e.map(r=>this.getHeightByLonLat(...r));return await Promise.all(o)}async capture(e,n){if(this.viewer)return await xm(this.viewer.scene,e,n)}async lonLatAltToScreenPosition(e){if(!this.viewer||!this.isPointVisible(e))return;const n=this.viewer.scene.cartesianToCanvasCoordinates(Se(e));if(n)return[n.x,n.y]}get notSupportEditingCount(){return this._notSupportEditingCount.value}set notSupportEditingCount(e){this._notSupportEditingCount.value=e}get notSupportEditingCountChanged(){return this._notSupportEditingCount.changed}startEditing(e,n,o){o=Object.assign({useKeyToSwitch:!0,callSource:"outer"},o);const s=e.components.main??e;s&&n!=null&&(s.editingID=`${o.callSource}_${a.createGuid()}`,this._editingSystem.create(this,s,n,o.useKeyToSwitch))}stopEditing(){this._editingSystem.stop()}moveObjects(e){const n=[],o=a.createGuid();for(let s=0;s<e.length;s++){const r=e[s],l=r.components.main??r;l.editingID=o,l&&n.push(l)}this._moveObjectsProcess.restart(void 0,this,n,o)}getCzmObject(e){return this.sceneObjectsMap.get(e)}setCurrentDefaultAccessToken(){this.ionAccessToken=lt.currentDefaultAccessToken}setLatestDefaultAccessToken(){if(!lt.latestDefaultAccessToken){alert("Cesium最新的iontoken无法获取!"),console.error("Cesium最新的iontoken无法获取!");return}this.ionAccessToken=lt.latestDefaultAccessToken}positionsToLocalPositions(e,n){return Dt(e,n)}localPositionsToPositions(e,n){return Cn(e,n)}isPointVisible(e){if(!this.viewer)return!1;const n=e instanceof h.Cartesian3?e:Se(e),o=new h.EllipsoidalOccluder(this.viewer.scene.globe.ellipsoid,this.viewer.scene.camera.positionWC);if(o.cameraPosition=this.viewer.scene.camera.positionWC,!o.isPointVisible(n))return!1;const s=this.viewer.scene.cartesianToCanvasCoordinates(n);return!(!s||s.x<0||s.y<0)}getESProperties(){const e={...super.getESProperties()},n=lt.defaults;return{...e,more:[...e.more,new a.GroupProperty([],"通用","通用"),new a.EvalStringProperty([this,"createCesiumViewerFuncStr"],"CesiumViewer创建函数",aO,rO,!0),new a.FunctionProperty([],()=>lt.getCesiumIonToken(),[],"获取官方token"),new a.FunctionProperty([],()=>this.setCurrentDefaultAccessToken(),[],"重置为当前使用的Cesium版本的token"),new a.FunctionProperty([],()=>this.setLatestDefaultAccessToken(),[],"最新token","重置为当前Cesium官方的最新token"),new a.BooleanProperty([this,"flashLighting"],"头顶灯",n.flashLighting,!0),new a.BooleanProperty([this,"particleGlobalControl"],"粒子全局控制播放",n.particleGlobalControl,!0),new a.GroupProperty([],"Viewer","Viewer"),new a.NumberProperty([this,"resolutionScale"],"分辨率比率",n.resolutionScale,!0),new a.NumberProperty([this,"msaaSamples"],"msaaSamples",n.msaaSamples,!0),new a.BooleanProperty([this,"shadows"]),new a.GroupProperty([],"比例尺","比例尺(Legend)"),new a.NumberProperty([this.viewerLegend,"resolution"],"resolution",void 0,!0,!0),new a.NumberProperty([this.viewerLegend,"zoom"],"zoom",void 0,!0,!0),new a.Number3Property([this.viewerLegend,"center"],"center",void 0,!0,!0),new a.NumberProperty([this.viewerLegend.legend,"lengthInPixels"],"lengthInPixels",100,!0,!1),new a.NumberProperty([this.viewerLegend.legend,"computedLengthInPixels"],"computedLengthInPixels",void 0,!0,!0),new a.NumberProperty([this.viewerLegend.legend,"computedLengthInMeters"],"computedLengthInMeters",void 0,!0,!0),new a.StringProperty([this.viewerLegend.legend,"computedLengthInStr"],"computedLengthInStr",void 0,!0,!0),new a.GroupProperty([],"场景","场景(Scene)"),new a.NumberProperty([this,"sceneSplitPosition"],"内部视口分割比例",n.sceneSplitPosition,!0),new a.GroupProperty([],"Globe","Globe"),new a.EnumProperty([this,"sceneGlobeShadows"],[["禁用","DISABLED"],["启用","ENABLED"],["仅投射","CAST_ONLY"],["仅接收","RECEIVE_ONLY"]],"sceneGlobeShadows",n.sceneGlobeShadows,!0),new a.NumberProperty([this,"sceneGlobeTerrainExaggeration"]),new a.NumberProperty([this,"sceneGlobeTerrainExaggerationRelativeHeight"]),new a.NumberProperty([this,"sceneGlobeVerticalExaggeration"]),new a.NumberProperty([this,"sceneGlobeVerticalExaggerationRelativeHeight"]),new a.BooleanProperty([this,"sceneGlobeBackFaceCulling"]),new a.BooleanProperty([this,"sceneGlobeShowSkirts"]),new a.BooleanProperty([this,"sceneGlobeShowWaterEffect"]),new a.ColorProperty([this,"sceneGlobeBaseColor"]),new a.Number4Property([this,"sceneGlobeCartographicLimitRectangle"]),new a.JsonProperty([this,"sceneGlobeClippingPlanes"]),new a.StringProperty([this,"sceneGlobeClippingPlanesId"]),new a.JsonProperty([this,"sceneGlobeClippingPolygons"]),new a.StringsProperty([this,"sceneGlobeClippingPolygonsId"]),new a.GroupProperty([],"underground","underground"),new a.ColorProperty([this,"sceneGlobeUndergroundColor"],"sceneGlobeUndergroundColor",n.sceneGlobeUndergroundColor,!0),new a.Number4Property([this,"sceneGlobeUndergroundColorAlphaByDistance"],"sceneGlobeUndergroundColorAlphaByDistance",n.sceneGlobeUndergroundColorAlphaByDistance,!0),new a.GroupProperty([],"Translucency","Translucency"),new a.Number4Property([this,"sceneGlobeTranslucencyBackFaceAlphaByDistance"],"背面渐变透明度",n.sceneGlobeTranslucencyBackFaceAlphaByDistance,!0),new a.Number4Property([this,"sceneGlobeTranslucencyFrontFaceAlphaByDistance"],"正面渐变透明度",n.sceneGlobeTranslucencyFrontFaceAlphaByDistance,!0),new a.Number4Property([this,"sceneGlobeTranslucencyRectangle"],"矩形范围",n.sceneGlobeTranslucencyRectangle,!0),new a.GroupProperty([],"Sun","Sun"),new a.BooleanProperty([this,"sun"],"sun",n.sun,!0),new a.NumberProperty([this,"sceneSunGlowFactor"],"sceneSunGlowFactor",n.sceneSunGlowFactor,!0),new a.GroupProperty([],"Moon","Moon"),new a.BooleanProperty([this,"moon"],"moon",n.moon,!0),new a.StringProperty([this,"sceneMoonTextureUrl"],"sceneMoonTextureUrl",n.sceneMoonTextureUrl,!0),new a.BooleanProperty([this,"sceneMoonOnlySunLighting"],"sceneMoonOnlySunLighting",n.sceneMoonOnlySunLighting,!0),new a.GroupProperty([],"SkyBox","SkyBox"),new a.BooleanProperty([this,"sceneSkyBoxShow"]),new a.JsonProperty([this,"sceneSkyBoxSources"],"sceneSkyBoxSources",n.sceneSkyBoxSources,void 0,!0),new a.GroupProperty([],"Background","Background"),new a.BooleanProperty([this,"xbsjUseBackground"]),new a.StringProperty([this,"xbsjBackgroundImageUri"]),new a.ColorProperty([this,"xbsjBackgroundColor"]),new a.GroupProperty([],"SkyAtmosphere","SkyAtmosphere"),new a.JsonProperty([this,"xbsjLocalBoxSources"],"xbsjLocalBoxSources",n.xbsjLocalBoxSources,void 0,!0),new a.ColorProperty([this,"sceneBackgroundColor"]),new a.GroupProperty([],"Fog","Fog"),new a.BooleanProperty([this,"sceneFogEnabled"],"sceneFogEnabled",n.sceneFogEnabled,!0),new a.NumberProperty([this,"sceneFogDensity"],"sceneFogDensity",n.sceneFogDensity,!0),new a.NumberProperty([this,"sceneFogScreenSpaceErrorFactor"],"sceneFogScreenSpaceErrorFactor",n.sceneFogScreenSpaceErrorFactor,!0),new a.NumberProperty([this,"sceneFogMinimumBrightness"],"sceneFogMinimumBrightness",n.sceneFogMinimumBrightness,!0),new a.GroupProperty([],"Sscc","Sscc"),new a.BooleanProperty([this,"sceneSsccEnableInputs"],"sceneSsccEnableInputs",n.sceneSsccEnableInputs,!0),new a.BooleanProperty([this,"sceneSsccEnableCollisionDetection"],"sceneSsccEnableCollisionDetection",n.sceneSsccEnableCollisionDetection,!0),new a.NumberProperty([this,"sceneSsccZoomFactor"],"sceneSsccZoomFactor",n.sceneSsccZoomFactor,!0),new a.NumberProperty([this,"sceneCameraFrustumFov"],"相机广角"),new a.GroupProperty([],"后处理","后处理"),new a.BooleanProperty([this,"scenePpsfxaaEnabled"],"开启FXAA",n.scenePpsfxaaEnabled,!0),new a.GroupProperty([],"环境遮蔽","环境遮蔽"),new a.BooleanProperty([this,"scenePpsAmbientOcclusionEnabled"]),new a.BooleanProperty([this,"scenePpsAmbientOcclusionAmbientOcclusionOnly"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionIntensity"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionBias"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionLengthCap"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionStepSize"]),new a.NumberProperty([this,"scenePpsAmbientOcclusionBlurStepSize"]),new a.GroupProperty([],"Bloom","Bloom"),new a.BooleanProperty([this,"scenePpsBloomEnabled"]),new a.BooleanProperty([this,"scenePpsBloomGlowOnly"]),new a.NumberProperty([this,"scenePpsBloomContrast"]),new a.NumberProperty([this,"scenePpsBloomBrightness"]),new a.NumberProperty([this,"scenePpsBloomDelta"]),new a.NumberProperty([this,"scenePpsBloomSigma"]),new a.NumberProperty([this,"scenePpsBloomStepSize"]),new a.GroupProperty([],"调试","调试"),new a.BooleanProperty([this,"sceneDebugShowFramesPerSecond"],"sceneDebugShowFramesPerSecond",n.sceneDebugShowFramesPerSecond,!0),new a.BooleanProperty([this,"sceneDebugShowCommands"],"sceneDebugShowCommands",n.sceneDebugShowCommands,!0),new a.BooleanProperty([this,"sceneDebugShowFrustums"],"sceneDebugShowFrustums",n.sceneDebugShowFrustums,!0),new a.BooleanProperty([this,"sceneDebugShowFrustumPlanes"],"sceneDebugShowFrustumPlanes",n.sceneDebugShowFrustumPlanes,!0),new a.NumberProperty([this,"sceneDebugShowDepthFrustum"],"sceneDebugShowDepthFrustum",n.sceneDebugShowDepthFrustum,!0),new a.GroupProperty([],"Inspector","Inspector"),new a.BooleanProperty([this,"showCesiumInspector"],"showCesiumInspector",n.showCesiumInspector,!0),new a.BooleanProperty([this,"cesiumInspectorWireframe"],"cesiumInspectorWireframe",n.cesiumInspectorWireframe,!0),new a.BooleanProperty([this,"showCesium3DTilesInspector"],"showCesium3DTilesInspector",n.showCesium3DTilesInspector,!0)]}}};m(lt,"type",lt.register("ESCesiumViewer",lt)),m(lt,"getCesiumIonToken",lO),m(lt,"currentDefaultAccessToken",h.Ion.defaultAccessToken),m(lt,"latestDefaultAccessToken"),m(lt,"ObjectsToExcludeWrapper",MF),m(lt,"defaults",{...a.ESViewer.defaults,flashLighting:!1,resolutionScale:1,msaaSamples:4,sceneSplitPosition:0,sceneGlobeShadows:"RECEIVE_ONLY",sceneGlobeUndergroundColor:[0,0,0,1],sceneGlobeUndergroundColorAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyBackFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyFrontFaceAlphaByDistance:[6378.137,0,12756274e-1,1],sceneGlobeTranslucencyRectangle:[-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966].map(e=>180*e/Math.PI),sun:!0,sceneSunGlowFactor:1,moon:!0,sceneMoonTextureUrl:h.buildModuleUrl("Assets/Textures/moonSmall.jpg"),sceneMoonOnlySunLighting:!0,sceneSkyBoxSources:{positiveX:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_px.jpg"),negativeX:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mx.jpg"),positiveY:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_py.jpg"),negativeY:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_my.jpg"),positiveZ:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_pz.jpg"),negativeZ:h.buildModuleUrl("Assets/Textures/SkyBox/tycho2t3_80_mz.jpg")},xbsjLocalBoxSources:{positiveX:"${earthsdk3-assets-script-dir}/assets/img/skybox/east.jpg",negativeX:"${earthsdk3-assets-script-dir}/assets/img/skybox/west.jpg",positiveY:"${earthsdk3-assets-script-dir}/assets/img/skybox/bottom.jpg",negativeY:"${earthsdk3-assets-script-dir}/assets/img/skybox/top.jpg",positiveZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/north.jpg",negativeZ:"${earthsdk3-assets-script-dir}/assets/img/skybox/south.jpg"},sceneFogEnabled:!0,sceneFogDensity:2e-4,sceneFogScreenSpaceErrorFactor:2,sceneFogMinimumBrightness:.03,sceneSsccEnableInputs:!0,sceneSsccEnableCollisionDetection:!0,sceneSsccZoomFactor:5,scenePpsfxaaEnabled:!0,sceneDebugShowFramesPerSecond:!1,sceneDebugShowCommands:!1,sceneDebugShowFrustums:!1,sceneDebugShowFrustumPlanes:!1,sceneDebugShowDepthFrustum:1,showCesiumInspector:!1,cesiumInspectorWireframe:!1,showCesium3DTilesInspector:!1,particleGlobalControl:!1}),m(lt,"getHeightsScartchCarto",new h.Cartographic);let Me=lt;(t=>{t.createDefaultProps=()=>({...a.ESViewer.createDefaultProps(),...sO()})})(Me||(Me={})),a.extendClassProps(Me.prototype,Me.createDefaultProps),I.copyright=void 0;try{const t="earthsdk3-cesium",i="3.6.3",e="2025-12-04T02:15:04.000Z",n="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",s="961ae990522bc6051fa861e8065653128ba328ae",l=((Date.now()-1764814504e3)/36e5).toFixed(1),c=`%c🌏 ${t}%c ${i}.${s.slice(0,8)}.${e} (距今${l}个小时)
|
|
2296
2296
|
%c${o?o+`
|
|
2297
2297
|
`:""}当前网站正在使用${t},此软件版权归${n}所有
|
|
2298
|
-
`;I.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
2298
|
+
`;I.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","961ae990522bc6051fa861e8065653128ba328ae")},get info(){return c},get date(){return"2025-12-04T02:15:04.000Z"},get author(){return"suplyang"},get version(){return"3.6.3"},get name(){return"earthsdk3-cesium"},get commitId(){return"961ae990522bc6051fa861e8065653128ba328ae"},print(){console.info(this.info,`
|
|
2299
2299
|
font-size: 18px;
|
|
2300
2300
|
font-weight: 1000;
|
|
2301
2301
|
line-height: 1;
|