earthsdk3-cesium 3.3.0-beta.11 → 3.3.0-beta.12

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.
@@ -166,7 +166,7 @@ material.alpha = materialInput.color.a;
166
166
 
167
167
  return material;
168
168
  }
169
- `;C.Material.GlobeLevelMaterialType="GlobelLevel",C.Material._materialCache.addMaterial(C.Material.GlobeLevelMaterialType,{fabric:{type:C.Material.GlobeLevelMaterialType,uniforms:{input_shadows:new C.Cartesian3(0,0,0),input_highlights:new C.Cartesian3(1,1,1),midtones:new C.Cartesian3(.5,.5,.5),output_shadows:new C.Cartesian3(0,0,0),output_highlights:new C.Cartesian3(1,1,1)},source:wP},translucent:!1});const{PrimitiveRenderResources:bP,ModelUtility:_P,Cartesian3:Un,Matrix4:va,ModelRenderResources:CP,defined:xP,NodeRenderResources:SP,BoundingSphere:zi,ModelDrawCommands:EP}=C,PP=new Un,TP=new Un,M0=new Un,D0=new Un;class IP extends bP{constructor(n,e,i){if(super(n,e),!n.runtimeNode.instancingTranslationMin||!n.runtimeNode.instancingTranslationMax)return;const o=va.inverse(i,new va),r=_P.getPositionMinMax(e.primitive,va.multiplyByPoint(o,n.runtimeNode.instancingTranslationMin,M0),va.multiplyByPoint(o,n.runtimeNode.instancingTranslationMax,D0));this.positionMin=Un.clone(r.min,new Un),this.positionMax=Un.clone(r.max,new Un),this.boundingSphere=zi.fromCornerPoints(this.positionMin,this.positionMax,new zi)}}function kP(){C.ModelSceneGraph.prototype.buildDrawCommands=function(t){const n=this._model,e=new CP(n);n.statistics.clear(),this.configurePipeline(t);const i=this.modelPipelineStages;let o,r,s;for(o=0;o<i.length;o++)i[o].process(e,n,t);const a=Un.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,PP),l=Un.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,TP);for(o=0;o<this._runtimeNodes.length;o++){const c=this._runtimeNodes[o];if(!xP(c))continue;c.configurePipeline();const h=c.pipelineStages,u=new SP(e,c);for(r=0;r<h.length;r++)h[r].process(u,c.node,t);const A=c.computedTransform;for(r=0;r<c.runtimePrimitives.length;r++){const d=c.runtimePrimitives[r];d.configurePipeline(t);const f=d.pipelineStages,g=new IP(u,d,A);for(s=0;s<f.length;s++)f[s].process(g,d.primitive,t);d.boundingSphere=zi.clone(g.boundingSphere,new zi);const v=va.multiplyByPoint(A,g.positionMin,M0),y=va.multiplyByPoint(A,g.positionMax,D0);Un.minimumByComponent(a,v,a),Un.maximumByComponent(l,y,l);const m=EP.buildModelDrawCommand(g,t);d.drawCommand=m}}this._boundingSphere=zi.fromCornerPoints(a,l,new zi),this._boundingSphere=zi.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=zi.transform(this._boundingSphere,this._components.transform,this._boundingSphere),n._boundingSphere=zi.transform(this._boundingSphere,n.modelMatrix,n._boundingSphere),n._initialRadius=n._boundingSphere.radius,n._boundingSphere.radius*=n._clampedScale}}const nu=class nu extends p.Destroyable{constructor(){super(),C.ParticleSystem.prototype.update=function(n){const e=n.time;n.time=this._falseTime;try{nu.oldUpdate.call(this,n),this._particles.forEach(i=>{C.Billboard.prototype&&(i._billboard.ESSceneObjectID=this.ESSceneObjectID)})}catch{}n.time=e},this.d(()=>{C.ParticleSystem.prototype.update=nu.oldUpdate})}};L(nu,"oldUpdate",C.ParticleSystem.prototype.update);let ld=nu;function FP(){if(C.ParticleSystem.prototype.timeStamp!==void 0){console.warn("fixParticleSystem已经执行过!");return}Object.defineProperties(C.ParticleSystem.prototype,{timeStamp:{get(){return this._innerCurrentTimeStamp===void 0&&(this._innerCurrentTimeStamp=0),this._innerCurrentTimeStamp},set(t){this.timeStamp!==t&&(this._innerCurrentTimeStamp=t,C.JulianDate.fromDate(new Date(t),this._falseTime))}},_falseTime:{get(){return this.__falseTime||(this.__falseTime=C.JulianDate.fromDate(new Date(0))),this.__falseTime}}})}class BP{constructor(n){L(this,"index");L(this,"image");L(this,"resolve");L(this,"reject");L(this,"rectangle");this.index=n.index,this.image=n.image,this.resolve=n.resolve,this.reject=n.reject,this.rectangle=void 0}}function MP(){C.TextureAtlas.prototype._resize=function(t,n=0){const e=this._borderWidthInPixels,i=this._rectangles,o=this._imagesToAddQueue,r=this._texture;let s=r.width,a=r.height;const l=this._subRegions,c=i.map((y,m)=>new BP({index:m,image:y})).filter((y,m)=>C.defined(y.image)&&!C.defined(l.get(m)));let h=0,u=0,A=0;for(let y=n;y<o.length;++y){const{width:m,height:w}=o[y].image;h=Math.max(h,m),u=Math.max(u,w),A+=m*w,c.push(o[y])}s=Math.max(h,s),a=Math.max(u,a),t.webgl2||(s=C.Math.nextPowerOfTwo(s),a=C.Math.nextPowerOfTwo(a));const d=Math.sqrt(A);a*=Math.ceil(d/a),s*=Math.ceil(d/s),c.sort(({image:y},{image:m})=>m.height*m.width-y.height*y.width);const f=new Array(this._nextIndex);for(const y of this._subRegions.keys())C.defined(l.get(y))&&(f[y]=i[y]);let g,v=!1;for(;!v;){g=new C.TexturePacker({height:a,width:s,borderPadding:e});let y;for(y=0;y<c.length;++y){const{index:m,image:w}=c[y];if(!C.defined(w))continue;const _=g.pack(m,w);if(!C.defined(_)){s>a?a*=2:s*=2;break}f[m]=_.rectangle}v=y===c.length}this._texturePacker=g,this._texture=this._copyFromTexture(t,s,a,f),r.destroy(),this._rectangles=f,this._guid=C.createGuid()}}cP(),hP(),AP(),mP(),gP(),yP(),vP(),uP(),kP(),FP(),MP(),C.Camera.DEFAULT_VIEW_RECTANGLE=C.Rectangle.fromDegrees(70,5,140,55);function DP(){return new Promise((t,n)=>C.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class RP extends p.Destroyable{constructor(n,e,i,o){super();const r=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=En(a);if(l&&(l.destroy(),ud(a,void 0)),C.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let c=a.scene.context._originalGLContext;c.canvas.width=c.canvas.height=1,c.getExtension("WEBGL_lose_context").loseContext(),c=null}a.destroy(),i(void 0)}};this.d(r);const s=this.dv(p.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const c=lP;await a.promise(DP());const h=await a.promise(p.createCancelablePromise(c(l,o)));h.scene._xbsjOriginSkyAtmosphere=h.scene.skyAtmosphere,h.scene._xbsjOriginSkyBox=h.scene.skyBox,h.clockViewModel.currentTime=C.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const u=C.JulianDate.fromDate(new Date(e.currentTime));C.JulianDate.equals(u,h.clockViewModel.currentTime)||(h.clockViewModel.currentTime=u)})),this.dispose(li(h.clockViewModel,"currentTime",u=>{const A=C.JulianDate.toDate(h.clockViewModel.currentTime).getTime();A!==e.currentTime&&(e.currentTime=A)}));{const u=new z0(h,e);ud(h,u)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),i(h)}));s.start(n),s.errorEvent.don(()=>{e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const UP=new C.EllipsoidTerrainProvider;class R0 extends p.Destroyable{constructor(e){super();L(this,"_terrainMap",new Map);L(this,"_nextAnimateFrame",this.dv(p.createNextAnimateFrame()));L(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)??UP,i.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,i.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,i.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?p.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,i.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?p.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1}))}_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 p.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(p.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));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 U0 extends p.Destroyable{constructor(e){super();L(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 wt?"div":"canvas";if(this._labelMap[i].has(e)){console.warn(`this._labelMap[${i}].has(poi)`,e);return}const o=new p.Destroyable;{const r=o.dv(p.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 wt?"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 wt?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((c,h)=>Number(h[1])-Number(c[1]))).forEach((c,h)=>{h instanceof wt&&h.czmDivPoi&&(h.czmDivPoi.zOrder=s),h instanceof Hi&&h.canvasObj&&(h.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class OP extends p.Destroyable{constructor(e){super();L(this,"_czmImageryLayerWrappers",new Set);L(this,"_zIndexChangedEvent",this.dv(new p.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const i=[...this.czmImageryLayerWrappers.values()];i.sort((o,r)=>{const s=o.czmImageryWrapper.imagery.zIndex??Q.ESImageryLayer.defaults.zIndex,a=r.czmImageryWrapper.imagery.zIndex??Q.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 LP extends p.Destroyable{constructor(e){super();L(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 zP extends p.Destroyable{constructor(e){super();L(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new p.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new LP(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class QP extends p.Destroyable{constructor(e,i){super();L(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=i,this._czmImageryLayerWrapperObjResetting=this.dv(new p.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new zP(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class O0 extends p.Destroyable{constructor(e){super();L(this,"_czmImageryWrappers",new Set);L(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new OP(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 QP(e,this))}delete(e){for(const i of this.czmImageryWrappers)if(i.imagery===e){this.czmImageryWrappers.delete(i);return}console.warn("imageriesManager delete error!",e)}}class L0 extends p.Destroyable{constructor(e){super();L(this,"_pause",this.disposeVar(p.react(!1)));L(this,"_pickPositionTasks",[]);L(this,"_pickTasks",[]);L(this,"pickHeightMustGreaterThanZero",!0);L(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 c of a){const[h,u,A,d]=c;try{(async()=>{const{scene:f,camera:g}=i,v=Xe(h),y=g.getPickRay(v);do{if(!y)break;let m;if(u?m=await f.pickFromRayMostDetailed(y,this.objectsToExclude):m=f.pickFromRay(y,this.objectsToExclude),!m||!m.position)break;const w=Ue(m.position);if(!w){d(new Error("positionFromCartesian failed"));return}A(w);return}while(!1);if(y&&!(f.terrainProvider instanceof C.EllipsoidTerrainProvider)){const m=f.globe.pick(y,f);if(!m){d(new Error("scene.globe.pick failed"));return}const w=Ue(m);if(!w){d(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&w[2]<0&&(w[2]=0),A(w);return}{const m=f.terrainProvider instanceof C.EllipsoidTerrainProvider?f.terrainProvider.tilingScheme.ellipsoid:i.scene.globe.ellipsoid,w=i.camera.pickEllipsoid(Xe(h),m);if(!w){d(new Error("Pick failed"));return}const _=Ue(w);if(!_){d(new Error("positionFromCartesian failed"));return}A(_)}})()}catch(f){d(f)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let c of l){const[h,u,A,d,f]=c;e.pickCustomAttachedInfo=A;try{(async()=>{var E,T,P;let g=i.scene.pick(Xe(h),u&&u[0],u&&u[1]);!g&&C.defined(i.scene.globe)&&(g=await VP(i,Xe(h)));let v;if(g&&g instanceof C.Cesium3DTileFeature){v={};try{g&&g.getPropertyIds().forEach(D=>{v&&(v[D]=g.getProperty(D))})}catch(k){console.warn(k)}}let y;do{if(!g)break;if(g.id&&g.id instanceof C.Entity&&g.id.ESSceneObjectID){y=g.id.ESSceneObjectID;break}if(g.primitive&&g.primitive.ESSceneObjectID){y=g.primitive.ESSceneObjectID;break}if(Array.isArray(g)&&g[0]instanceof C.ImageryLayerFeatureInfo){y=g[0].imageryLayer.ESSceneObjectID;break}}while(!1);let m=y?Q.ESSceneObject.getSceneObject(y):void 0;m&&m.parentID&&(m=Q.ESSceneObject.getSceneObject(m.parentID));let w={};if(m&&Reflect.has(m,"allowPicking")&&Reflect.has(m,"pickedEvent")&&(m.allowPicking??!1)){do{if(m instanceof Q.ESEntityCluster){const k=new C.JulianDate;w=g.id instanceof C.Entity?{name:g.id.label.text.getValue(k),properties:(E=g.id.properties)==null?void 0:E.getValue(k),coordinates:Vs(g.id.position.getValue(k))}:(T=g.id)==null?void 0:T.map(D=>{var B;return{name:D.id,properties:(B=D.properties)==null?void 0:B.getValue(k),coordinates:Vs(D.position.getValue(k))}});break}if(m instanceof Q.ESGeoJson){const k=new C.JulianDate;if(!g.id.entityCollection)return;const D=g.id.polygon?"Polygon":g.id.polyline?"LineString":"Point",B=((P=g.id.properties)==null?void 0:P.getValue(k))??{},S=D=="Point"?Ue(g.id.position.getValue(k)):D=="LineString"?g.id.polyline.positions.getValue(k).map(I=>Ue(I)):Hf(g.id.polygon.hierarchy.getValue(k));w=m.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:D,coordinates:S},properties:B}:{type:D,coordinates:S,properties:B};break}if(m instanceof Q.ESGltfModel){let k;Reflect.has(g,"featureId")?k=g.featureId:Reflect.has(g,"instanceId")&&(k=g.instanceId),k&&(g.id=g.primitive.structuralMetadata.getPropertyTable(0).getProperty(g.instanceId,"id"))}}while(!1);m.pickedEvent.emit(new Q.ESJPickedResult(g,m,v,w,A,h))}m&&Reflect.has(m,"allowPicking")&&!m.allowPicking&&d(new Q.ESJPickedResult);const _=new Q.ESJPickedResult(g,m,v,w,A,h);d(_)})()}catch(g){f(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 VP(t,n){const e=t.scene,i=e.camera.getPickRay(n);if(!i)return;const o=e.imageryLayers.pickImageryLayerFeatures(i,e);if(C.defined(o))return o}class HP extends p.Destroyable{constructor(e){super();L(this,"_enabled",this.disposeVar(p.react(!1)));L(this,"_cursorPosition",p.react(void 0));L(this,"quickPickPosition",!0);let i=new p.Destroyable;const o=()=>{i&&(i.destroy(),i=void 0)};this.dispose(o);const r=()=>{if(o(),!this._enabled.value||!e)return;const s=En(e);if(!s)return;i=new p.Destroyable;const a=i.disposeVar(p.react(void 0)),l=i.disposeVar(p.createNextAnimateFrameEvent(a.changed));i.dispose(s.czmViewer.pointerMoveEvent.disposableOn(h=>{h.pointerEvent&&(a.value=p.getDomEventCurrentTargetPos(h.pointerEvent))}));const c=i.disposeVar(p.createProcessingFromAsyncFunc(async h=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const u=await h.promise(p.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=u}else{const u=await h.promise(p.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=u}}));i.dispose(l.disposableOn(()=>{c.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}}function En(t){return p.getExtProp(t,"_viewerExtensions")}function ud(t,n){p.setExtProp(t,"_viewerExtensions",n)}class z0 extends p.Destroyable{constructor(e,i){super();L(this,"_imageriesManager");L(this,"_terrainManager");L(this,"_labelManager");L(this,"_pickingManager");L(this,"_poiContext");L(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=i,this._imageriesManager=this.dv(new O0(this.viewer)),this._terrainManager=this.dv(new R0(this.viewer)),this._labelManager=this.dv(new U0(this.viewer)),this._poiContext=this.disposeVar(new aw(this._viewer)),this._cursorPositionInfo=this.disposeVar(new HP(this._viewer)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new L0(i))}))}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}}var Q0=new C.Cartesian3,V0=new C.Cartesian3;function H0(t,n,e){let i=C.Matrix4.clone(t.transform);t.lookAtTransform(C.Matrix4.IDENTITY);var o=t.positionCartographic.height,r=t.positionWC,s=C.Cartesian3.normalize(r,Q0),a=C.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var l=C.Cartesian3.cross(t.direction,s,V0);else var l=C.Cartesian3.cross(t.up,s,V0);var c=l;if(e){var h=C.Cartesian3.cross(s,l,Q0);c=h}var u=C.Cartesian3.magnitude(r);t.rotate(c,n/u);var A=t.positionCartographic,d=A.longitude,f=A.latitude;C.Cartesian3.fromRadians(d,f,o,void 0,t.position),t.lookAtTransform(i)}function N0(t,n){H0(t,n,!1)}function G0(t,n){H0(t,-n,!0)}class NP extends p.Destroyable{constructor(e){super();L(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 c=Date.now(),h=c-a;a=c;const u=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&r.moveForward(h*u),s.MoveBackword&&r.moveBackward(h*u),s.MoveLeft&&r.moveLeft(h*u),s.MoveRight&&r.moveRight(h*u)):(s.MoveForward&&N0(r,h*u),s.MoveBackword&&N0(r,-h*u),s.MoveLeft&&G0(r,-h*u),s.MoveRight&&G0(r,h*u));{const{rotateSpeed:A}=this.controller,d=C.Math.toRadians(A*h);s.RotateRight?r.lookRight(d):s.RotateLeft?r.lookRight(-d):s.RotateUp?r.lookDown(-d):s.RotateDown&&r.lookDown(d)}};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 ch extends p.Destroyable{constructor(e){super();L(this,"_currentKeyIds",new Set);L(this,"_currentKeyIdsChanged",this.dv(new p.Event));L(this,"_debug",this.dv(p.react(!1)));L(this,"_debugResetting",this.dv(new p.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends p.Destroyable{constructor(e){super();const i=()=>{console.log([...e.currentKeyIds].join(`
169
+ `;C.Material.GlobeLevelMaterialType="GlobelLevel",C.Material._materialCache.addMaterial(C.Material.GlobeLevelMaterialType,{fabric:{type:C.Material.GlobeLevelMaterialType,uniforms:{input_shadows:new C.Cartesian3(0,0,0),input_highlights:new C.Cartesian3(1,1,1),midtones:new C.Cartesian3(.5,.5,.5),output_shadows:new C.Cartesian3(0,0,0),output_highlights:new C.Cartesian3(1,1,1)},source:wP},translucent:!1});const{PrimitiveRenderResources:bP,ModelUtility:_P,Cartesian3:Un,Matrix4:va,ModelRenderResources:CP,defined:xP,NodeRenderResources:SP,BoundingSphere:zi,ModelDrawCommands:EP}=C,PP=new Un,TP=new Un,M0=new Un,D0=new Un;class IP extends bP{constructor(n,e,i){if(super(n,e),!n.runtimeNode.instancingTranslationMin||!n.runtimeNode.instancingTranslationMax)return;const o=va.inverse(i,new va),r=_P.getPositionMinMax(e.primitive,va.multiplyByPoint(o,n.runtimeNode.instancingTranslationMin,M0),va.multiplyByPoint(o,n.runtimeNode.instancingTranslationMax,D0));this.positionMin=Un.clone(r.min,new Un),this.positionMax=Un.clone(r.max,new Un),this.boundingSphere=zi.fromCornerPoints(this.positionMin,this.positionMax,new zi)}}function kP(){C.ModelSceneGraph.prototype.buildDrawCommands=function(t){const n=this._model,e=new CP(n);n.statistics.clear(),this.configurePipeline(t);const i=this.modelPipelineStages;let o,r,s;for(o=0;o<i.length;o++)i[o].process(e,n,t);const a=Un.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,PP),l=Un.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,TP);for(o=0;o<this._runtimeNodes.length;o++){const c=this._runtimeNodes[o];if(!xP(c))continue;c.configurePipeline();const h=c.pipelineStages,u=new SP(e,c);for(r=0;r<h.length;r++)h[r].process(u,c.node,t);const A=c.computedTransform;for(r=0;r<c.runtimePrimitives.length;r++){const d=c.runtimePrimitives[r];d.configurePipeline(t);const f=d.pipelineStages,g=new IP(u,d,A);for(s=0;s<f.length;s++)f[s].process(g,d.primitive,t);d.boundingSphere=zi.clone(g.boundingSphere,new zi);const v=va.multiplyByPoint(A,g.positionMin,M0),y=va.multiplyByPoint(A,g.positionMax,D0);Un.minimumByComponent(a,v,a),Un.maximumByComponent(l,y,l);const m=EP.buildModelDrawCommand(g,t);d.drawCommand=m}}this._boundingSphere=zi.fromCornerPoints(a,l,new zi),this._boundingSphere=zi.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=zi.transform(this._boundingSphere,this._components.transform,this._boundingSphere),n._boundingSphere=zi.transform(this._boundingSphere,n.modelMatrix,n._boundingSphere),n._initialRadius=n._boundingSphere.radius,n._boundingSphere.radius*=n._clampedScale}}const nu=class nu extends p.Destroyable{constructor(){super(),C.ParticleSystem.prototype.update=function(n){const e=n.time;n.time=this._falseTime;try{nu.oldUpdate.call(this,n),this._particles.forEach(i=>{C.Billboard.prototype&&(i._billboard.ESSceneObjectID=this.ESSceneObjectID)})}catch{}n.time=e},this.d(()=>{C.ParticleSystem.prototype.update=nu.oldUpdate})}};L(nu,"oldUpdate",C.ParticleSystem.prototype.update);let ld=nu;function FP(){if(C.ParticleSystem.prototype.timeStamp!==void 0){console.warn("fixParticleSystem已经执行过!");return}Object.defineProperties(C.ParticleSystem.prototype,{timeStamp:{get(){return this._innerCurrentTimeStamp===void 0&&(this._innerCurrentTimeStamp=0),this._innerCurrentTimeStamp},set(t){this.timeStamp!==t&&(this._innerCurrentTimeStamp=t,C.JulianDate.fromDate(new Date(t),this._falseTime))}},_falseTime:{get(){return this.__falseTime||(this.__falseTime=C.JulianDate.fromDate(new Date(0))),this.__falseTime}}})}class BP{constructor(n){L(this,"index");L(this,"image");L(this,"resolve");L(this,"reject");L(this,"rectangle");this.index=n.index,this.image=n.image,this.resolve=n.resolve,this.reject=n.reject,this.rectangle=void 0}}function MP(){C.TextureAtlas.prototype._resize=function(t,n=0){const e=this._borderWidthInPixels,i=this._rectangles,o=this._imagesToAddQueue,r=this._texture;let s=r.width,a=r.height;const l=this._subRegions,c=i.map((y,m)=>new BP({index:m,image:y})).filter((y,m)=>C.defined(y.image)&&!C.defined(l.get(m)));let h=0,u=0,A=0;for(let y=n;y<o.length;++y){const{width:m,height:w}=o[y].image;h=Math.max(h,m),u=Math.max(u,w),A+=m*w,c.push(o[y])}s=Math.max(h,s),a=Math.max(u,a),t.webgl2||(s=C.Math.nextPowerOfTwo(s),a=C.Math.nextPowerOfTwo(a));const d=Math.sqrt(A);a*=Math.ceil(d/a),s*=Math.ceil(d/s),c.sort(({image:y},{image:m})=>m.height*m.width-y.height*y.width);const f=new Array(this._nextIndex);for(const y of this._subRegions.keys())C.defined(l.get(y))&&(f[y]=i[y]);let g,v=!1;for(;!v;){g=new C.TexturePacker({height:a,width:s,borderPadding:e});let y;for(y=0;y<c.length;++y){const{index:m,image:w}=c[y];if(!C.defined(w))continue;const _=g.pack(m,w);if(!C.defined(_)){s>a?a*=2:s*=2;break}f[m]=_.rectangle}v=y===c.length}this._texturePacker=g,this._texture=this._copyFromTexture(t,s,a,f),r.destroy(),this._rectangles=f,this._guid=C.createGuid()}}cP(),hP(),AP(),mP(),gP(),yP(),vP(),uP(),kP(),FP(),MP(),C.Camera.DEFAULT_VIEW_RECTANGLE=C.Rectangle.fromDegrees(70,5,140,55);function DP(){return new Promise((t,n)=>C.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class RP extends p.Destroyable{constructor(n,e,i,o){super();const r=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=En(a);if(l&&(l.destroy(),ud(a,void 0)),C.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let c=a.scene.context._originalGLContext;c.canvas.width=c.canvas.height=1,c.getExtension("WEBGL_lose_context").loseContext(),c=null}a.destroy(),i(void 0)}};this.d(r);const s=this.dv(p.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const c=lP;await a.promise(DP());const h=await a.promise(p.createCancelablePromise(c(l,o)));h.scene._xbsjOriginSkyAtmosphere=h.scene.skyAtmosphere,h.scene._xbsjOriginSkyBox=h.scene.skyBox,h.clockViewModel.currentTime=C.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const u=C.JulianDate.fromDate(new Date(e.currentTime));C.JulianDate.equals(u,h.clockViewModel.currentTime)||(h.clockViewModel.currentTime=u)})),this.dispose(li(h.clockViewModel,"currentTime",u=>{const A=C.JulianDate.toDate(h.clockViewModel.currentTime).getTime();A!==e.currentTime&&(e.currentTime=A)}));{const u=new z0(h,e);ud(h,u)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),i(h)}));s.start(n),s.errorEvent.don(a=>{console.log(a,"ccccccc"),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const UP=new C.EllipsoidTerrainProvider;class R0 extends p.Destroyable{constructor(e){super();L(this,"_terrainMap",new Map);L(this,"_nextAnimateFrame",this.dv(p.createNextAnimateFrame()));L(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)??UP,i.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,i.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,i.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?p.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,i.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?p.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1}))}_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 p.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(p.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));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 U0 extends p.Destroyable{constructor(e){super();L(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 wt?"div":"canvas";if(this._labelMap[i].has(e)){console.warn(`this._labelMap[${i}].has(poi)`,e);return}const o=new p.Destroyable;{const r=o.dv(p.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 wt?"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 wt?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((c,h)=>Number(h[1])-Number(c[1]))).forEach((c,h)=>{h instanceof wt&&h.czmDivPoi&&(h.czmDivPoi.zOrder=s),h instanceof Hi&&h.canvasObj&&(h.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class OP extends p.Destroyable{constructor(e){super();L(this,"_czmImageryLayerWrappers",new Set);L(this,"_zIndexChangedEvent",this.dv(new p.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const i=[...this.czmImageryLayerWrappers.values()];i.sort((o,r)=>{const s=o.czmImageryWrapper.imagery.zIndex??Q.ESImageryLayer.defaults.zIndex,a=r.czmImageryWrapper.imagery.zIndex??Q.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 LP extends p.Destroyable{constructor(e){super();L(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 zP extends p.Destroyable{constructor(e){super();L(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new p.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new LP(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class QP extends p.Destroyable{constructor(e,i){super();L(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=i,this._czmImageryLayerWrapperObjResetting=this.dv(new p.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new zP(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class O0 extends p.Destroyable{constructor(e){super();L(this,"_czmImageryWrappers",new Set);L(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new OP(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 QP(e,this))}delete(e){for(const i of this.czmImageryWrappers)if(i.imagery===e){this.czmImageryWrappers.delete(i);return}console.warn("imageriesManager delete error!",e)}}class L0 extends p.Destroyable{constructor(e){super();L(this,"_pause",this.disposeVar(p.react(!1)));L(this,"_pickPositionTasks",[]);L(this,"_pickTasks",[]);L(this,"pickHeightMustGreaterThanZero",!0);L(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 c of a){const[h,u,A,d]=c;try{(async()=>{const{scene:f,camera:g}=i,v=Xe(h),y=g.getPickRay(v);do{if(!y)break;let m;if(u?m=await f.pickFromRayMostDetailed(y,this.objectsToExclude):m=f.pickFromRay(y,this.objectsToExclude),!m||!m.position)break;const w=Ue(m.position);if(!w){d(new Error("positionFromCartesian failed"));return}A(w);return}while(!1);if(y&&!(f.terrainProvider instanceof C.EllipsoidTerrainProvider)){const m=f.globe.pick(y,f);if(!m){d(new Error("scene.globe.pick failed"));return}const w=Ue(m);if(!w){d(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&w[2]<0&&(w[2]=0),A(w);return}{const m=f.terrainProvider instanceof C.EllipsoidTerrainProvider?f.terrainProvider.tilingScheme.ellipsoid:i.scene.globe.ellipsoid,w=i.camera.pickEllipsoid(Xe(h),m);if(!w){d(new Error("Pick failed"));return}const _=Ue(w);if(!_){d(new Error("positionFromCartesian failed"));return}A(_)}})()}catch(f){d(f)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let c of l){const[h,u,A,d,f]=c;e.pickCustomAttachedInfo=A;try{(async()=>{var E,T,P;let g=i.scene.pick(Xe(h),u&&u[0],u&&u[1]);!g&&C.defined(i.scene.globe)&&(g=await VP(i,Xe(h)));let v;if(g&&g instanceof C.Cesium3DTileFeature){v={};try{g&&g.getPropertyIds().forEach(D=>{v&&(v[D]=g.getProperty(D))})}catch(k){console.warn(k)}}let y;do{if(!g)break;if(g.id&&g.id instanceof C.Entity&&g.id.ESSceneObjectID){y=g.id.ESSceneObjectID;break}if(g.primitive&&g.primitive.ESSceneObjectID){y=g.primitive.ESSceneObjectID;break}if(Array.isArray(g)&&g[0]instanceof C.ImageryLayerFeatureInfo){y=g[0].imageryLayer.ESSceneObjectID;break}}while(!1);let m=y?Q.ESSceneObject.getSceneObject(y):void 0;m&&m.parentID&&(m=Q.ESSceneObject.getSceneObject(m.parentID));let w={};if(m&&Reflect.has(m,"allowPicking")&&Reflect.has(m,"pickedEvent")&&(m.allowPicking??!1)){do{if(m instanceof Q.ESEntityCluster){const k=new C.JulianDate;w=g.id instanceof C.Entity?{name:g.id.label.text.getValue(k),properties:(E=g.id.properties)==null?void 0:E.getValue(k),coordinates:Vs(g.id.position.getValue(k))}:(T=g.id)==null?void 0:T.map(D=>{var B;return{name:D.id,properties:(B=D.properties)==null?void 0:B.getValue(k),coordinates:Vs(D.position.getValue(k))}});break}if(m instanceof Q.ESGeoJson){const k=new C.JulianDate;if(!g.id.entityCollection)return;const D=g.id.polygon?"Polygon":g.id.polyline?"LineString":"Point",B=((P=g.id.properties)==null?void 0:P.getValue(k))??{},S=D=="Point"?Ue(g.id.position.getValue(k)):D=="LineString"?g.id.polyline.positions.getValue(k).map(I=>Ue(I)):Hf(g.id.polygon.hierarchy.getValue(k));w=m.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:D,coordinates:S},properties:B}:{type:D,coordinates:S,properties:B};break}if(m instanceof Q.ESGltfModel){let k;Reflect.has(g,"featureId")?k=g.featureId:Reflect.has(g,"instanceId")&&(k=g.instanceId),k&&(g.id=g.primitive.structuralMetadata.getPropertyTable(0).getProperty(g.instanceId,"id"))}}while(!1);m.pickedEvent.emit(new Q.ESJPickedResult(g,m,v,w,A,h))}m&&Reflect.has(m,"allowPicking")&&!m.allowPicking&&d(new Q.ESJPickedResult);const _=new Q.ESJPickedResult(g,m,v,w,A,h);d(_)})()}catch(g){f(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 VP(t,n){const e=t.scene,i=e.camera.getPickRay(n);if(!i)return;const o=e.imageryLayers.pickImageryLayerFeatures(i,e);if(C.defined(o))return o}class HP extends p.Destroyable{constructor(e){super();L(this,"_enabled",this.disposeVar(p.react(!1)));L(this,"_cursorPosition",p.react(void 0));L(this,"quickPickPosition",!0);let i=new p.Destroyable;const o=()=>{i&&(i.destroy(),i=void 0)};this.dispose(o);const r=()=>{if(o(),!this._enabled.value||!e)return;const s=En(e);if(!s)return;i=new p.Destroyable;const a=i.disposeVar(p.react(void 0)),l=i.disposeVar(p.createNextAnimateFrameEvent(a.changed));i.dispose(s.czmViewer.pointerMoveEvent.disposableOn(h=>{h.pointerEvent&&(a.value=p.getDomEventCurrentTargetPos(h.pointerEvent))}));const c=i.disposeVar(p.createProcessingFromAsyncFunc(async h=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const u=await h.promise(p.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=u}else{const u=await h.promise(p.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=u}}));i.dispose(l.disposableOn(()=>{c.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}}function En(t){return p.getExtProp(t,"_viewerExtensions")}function ud(t,n){p.setExtProp(t,"_viewerExtensions",n)}class z0 extends p.Destroyable{constructor(e,i){super();L(this,"_imageriesManager");L(this,"_terrainManager");L(this,"_labelManager");L(this,"_pickingManager");L(this,"_poiContext");L(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=i,this._imageriesManager=this.dv(new O0(this.viewer)),this._terrainManager=this.dv(new R0(this.viewer)),this._labelManager=this.dv(new U0(this.viewer)),this._poiContext=this.disposeVar(new aw(this._viewer)),this._cursorPositionInfo=this.disposeVar(new HP(this._viewer)),this.ad(i.viewerChanged.don(()=>{this._pickingManager=this.dv(new L0(i))}))}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}}var Q0=new C.Cartesian3,V0=new C.Cartesian3;function H0(t,n,e){let i=C.Matrix4.clone(t.transform);t.lookAtTransform(C.Matrix4.IDENTITY);var o=t.positionCartographic.height,r=t.positionWC,s=C.Cartesian3.normalize(r,Q0),a=C.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var l=C.Cartesian3.cross(t.direction,s,V0);else var l=C.Cartesian3.cross(t.up,s,V0);var c=l;if(e){var h=C.Cartesian3.cross(s,l,Q0);c=h}var u=C.Cartesian3.magnitude(r);t.rotate(c,n/u);var A=t.positionCartographic,d=A.longitude,f=A.latitude;C.Cartesian3.fromRadians(d,f,o,void 0,t.position),t.lookAtTransform(i)}function N0(t,n){H0(t,n,!1)}function G0(t,n){H0(t,-n,!0)}class NP extends p.Destroyable{constructor(e){super();L(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 c=Date.now(),h=c-a;a=c;const u=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&r.moveForward(h*u),s.MoveBackword&&r.moveBackward(h*u),s.MoveLeft&&r.moveLeft(h*u),s.MoveRight&&r.moveRight(h*u)):(s.MoveForward&&N0(r,h*u),s.MoveBackword&&N0(r,-h*u),s.MoveLeft&&G0(r,-h*u),s.MoveRight&&G0(r,h*u));{const{rotateSpeed:A}=this.controller,d=C.Math.toRadians(A*h);s.RotateRight?r.lookRight(d):s.RotateLeft?r.lookRight(-d):s.RotateUp?r.lookDown(-d):s.RotateDown&&r.lookDown(d)}};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 ch extends p.Destroyable{constructor(e){super();L(this,"_currentKeyIds",new Set);L(this,"_currentKeyIdsChanged",this.dv(new p.Event));L(this,"_debug",this.dv(p.react(!1)));L(this,"_debugResetting",this.dv(new p.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends p.Destroyable{constructor(e){super();const i=()=>{console.log([...e.currentKeyIds].join(`
170
170
  `))};i(),this.d(e.currentKeyIdsChanged.don(i))}}(this)})));this._keyboardCameraControllerRunning=e;const{keyboardCameraController:i}=this._keyboardCameraControllerRunning;{const o=r=>{const s=ch.getKeyId(r);this._currentKeyIds.has(s)||(this._currentKeyIds.add(s),this._currentKeyIdsChanged.emit())};this.d(i.keyDownEvent.don(o))}{const o=r=>{const s=ch.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 GP extends p.Destroyable{constructor(e){super();L(this,"_keyStatus");L(this,"_cameraOp");this._keyboardCameraController=e,this._keyStatus=this.dv(new ch(this)),this._cameraOp=this.dv(new NP(this))}get keyboardCameraController(){return this._keyboardCameraController}get keyStatus(){return this._keyStatus}get cameraOp(){return this._cameraOp}}const bf=class bf extends p.Destroyable{constructor(e){super();L(this,"_enabled",this.dv(p.react(!1)));L(this,"_keyStatusMap",this.dv(p.react(bf.defaultKeyStatusMap)));L(this,"_speed",this.dv(p.react(1)));L(this,"_rotateSpeed",this.dv(p.react(.01)));L(this,"_alwaysWithCamera",this.dv(p.react(!1)));L(this,"_keyDownEvent",this.dv(new p.Event));L(this,"_keyUpEvent",this.dv(new p.Event));L(this,"_abortEvent",this.dv(new p.Event));this._firstPersonController=e,this.dv(new p.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new GP(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()}};L(bf,"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 hh=bf;function WP(t,n){t.lookRight(C.Math.toRadians(n.movementX)*.1),t.lookDown(C.Math.toRadians(n.movementY)*.1);const e=t.pitch,i=C.Math.clamp(e,-C.Math.PI_OVER_TWO,C.Math.PI_OVER_TWO);i!==e&&t.setView({destination:t.positionWC,orientation:{heading:t.heading,pitch:i,roll:t.roll}})}class qP extends p.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;WP(s,r)};i.addEventListener("pointermove",o),this.dispose(()=>i.removeEventListener("pointermove",o))}}}const _f=class _f extends p.Destroyable{constructor(e){super();L(this,"_mouseMoving",this.dv(new qP(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=_f.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}};L(_f,"origin_setPointerCapture",Element.prototype.setPointerCapture);let cd=_f;class KP extends p.Destroyable{constructor(e){super();L(this,"_enabled",this.dv(p.react(!1)));L(this,"enableViewerOriginInputs",e=>{e?this.firstPersonController.czmViewer.incrementDisabledInputStack():this.firstPersonController.czmViewer.decrementDisabledInputStack()});L(this,"_mouseResetting",this.dv(new p.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new cd(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 ZP extends p.Destroyable{constructor(e){super();L(this,"viewer");L(this,"_mouseCameraController",this.dv(new KP(this)));L(this,"_keyboardCameraController",this.dv(new hh(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 W0(t){t.removeInputAction(C.ScreenSpaceEventType.LEFT_DOWN),t.removeInputAction(C.ScreenSpaceEventType.RIGHT_DOWN),t.removeInputAction(C.ScreenSpaceEventType.MIDDLE_DOWN),t.removeInputAction(C.ScreenSpaceEventType.MOUSE_MOVE),t.removeInputAction(C.ScreenSpaceEventType.LEFT_UP),t.removeInputAction(C.ScreenSpaceEventType.RIGHT_UP),t.removeInputAction(C.ScreenSpaceEventType.MIDDLE_UP)}function hd(t,n,e,i=void 0){const r=t.camera,s=new C.Cartesian2;s.x=n.startPosition.x,s.y=0;const a=new C.Cartesian2;a.x=n.endPosition.x,a.y=0;let l=r.getPickRay(s,new C.Ray),c=r.getPickRay(a,new C.Ray),h=0,u,A;if(!l||!c)return;r.frustum instanceof C.OrthographicFrustum?(u=l.origin,A=c.origin,C.Cartesian3.add(r.direction,u,u),C.Cartesian3.add(r.direction,A,A),C.Cartesian3.subtract(u,r.position,u),C.Cartesian3.subtract(A,r.position,A),C.Cartesian3.normalize(u,u),C.Cartesian3.normalize(A,A)):(u=l.direction,A=c.direction);let d=C.Cartesian3.dot(u,A);d<1&&(h=Math.acos(d)),h=n.startPosition.x>n.endPosition.x?h:-h;const f=e._horizontalRotationAxis;if(C.defined(i)?r.look(i,-h):C.defined(f)?r.look(f,-h):r.lookLeft(h),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=r.getPickRay(s,new C.Ray),c=r.getPickRay(a,new C.Ray),h=0,!(!l||!c))if(r.frustum instanceof C.OrthographicFrustum?(u=l.origin,A=c.origin,C.Cartesian3.add(r.direction,u,u),C.Cartesian3.add(r.direction,A,A),C.Cartesian3.subtract(u,r.position,u),C.Cartesian3.subtract(A,r.position,A),C.Cartesian3.normalize(u,u),C.Cartesian3.normalize(A,A)):(u=l.direction,A=c.direction),d=C.Cartesian3.dot(u,A),d<1&&(h=Math.acos(d)),h=n.startPosition.y>n.endPosition.y?h:-h,i=C.defaultValue(i,f),C.defined(i)){const g=r.direction,v=C.Cartesian3.negate(i,new C.Cartesian3),y=C.Cartesian3.equalsEpsilon(g,i,C.Math.EPSILON2),m=C.Cartesian3.equalsEpsilon(g,v,C.Math.EPSILON2);if(!y&&!m){d=C.Cartesian3.dot(g,i);let w=C.Math.acosClamped(d);h>0&&h>w&&(h=w-C.Math.EPSILON4),d=C.Cartesian3.dot(g,v),w=C.Math.acosClamped(d),h<0&&-h>w&&(h=-w+C.Math.EPSILON4);const _=C.Cartesian3.cross(i,g,new C.Cartesian3);r.look(_,h)}else(y&&h<0||m&&h>0)&&r.look(r.right,-h)}else r.lookUp(h)}class XP extends p.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 u=dt(n.position),A=i.camera.positionWC,d=C.Cartesian3.distance(u,A);n.viewDistance=d}p.Vector.clone(n.position,s),n.offsetHeight&&(s[2]+=n.offsetHeight);const{rotation:a,offsetRotation:l=ui.defaults.offsetRotation}=n,c=[...l];p.Vector.set(r,0,0,0),a&&(n.relativeRotation??ui.defaults.relativeRotation)&&(p.Vector.add(a,r,r),c[0]+=90),p.Vector.add(c,r,r);const h={distance:n.viewDistance,heading:r[0],pitch:r[1],flyDuration:0,hDelta:0,pDelta:0};e.flyTo(h,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:c,movementY:h}=l;n.offsetRotation=p.Vector.add(n.offsetRotation??ui.defaults.offsetRotation,[c*.2,h*-.2,0])}})),this.d(e.wheelEvent.don(a=>{if(!n.enabledScaleInput)return;const l=a.deltaY,h=Math.max(1,n.viewDistance)*(l*.001);n.viewDistance=n.viewDistance+h}))}}class ui extends p.Destroyable{constructor(e){super();L(this,"_resetWithCameraEvent",this.dv(new p.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 XP(o,e))};a(),this.d(o.enabledChanged.don(a)),this.d(o.resetWithCameraEvent.don(l=>{if(!e.actived)return;const c=fa(i.camera);if(!c)return;const h=o.rotation;o.offsetRotation=[c[0]-(o.relativeRotation?h[0]:90),c[1]-(o.relativeRotation?h[1]:0),c[2]-(o.relativeRotation?h[2]:0)]}))}get resetWithCameraEvent(){return this._resetWithCameraEvent}resetWithCamera(e){this._resetWithCameraEvent.emit(e)}}L(ui,"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:p.reactArrayWithUndefined(void 0),rotation:p.reactArrayWithUndefined(void 0),positionEditing:!1,rotationEditing:!1,viewDistance:1e3,offsetHeight:0,offsetRotation:p.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,relativeRotation:!0})})(ui||(ui={})),p.extendClassProps(ui.prototype,ui.createDefaultProps);class Ys extends p.Destroyable{constructor(e){super();L(this,"_geoCameraController");L(this,"_geoPolylinePath");this._geoCameraController=this.dv(new ui(e)),this._geoPolylinePath=this.dv(new ls(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(p.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dispose(p.bind([this._geoCameraController,"viewDistance"],[this,"viewDistance"])),this.dispose(p.bind([this._geoCameraController,"offsetHeight"],[this,"offsetHeight"])),this.dispose(p.bind([this._geoCameraController,"offsetRotation"],[this,"offsetRotation"])),this.dispose(p.track([this._geoCameraController,"enabledRotationInput"],[this,"enabledRotationInput"])),this.dispose(p.track([this._geoCameraController,"enabledScaleInput"],[this,"enabledScaleInput"])),this.dv(new p.ObjResettingWithEvent(this.lineModeChanged,()=>{if(this.lineMode!==void 0){if(this.lineMode==="auto")return new $P(this,e);if(this.lineMode==="manual")return new YP(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:p.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,lineMode:void 0})})(Ys||(Ys={})),p.extendClassProps(Ys.prototype,Ys.createDefaultProps);class $P extends p.Destroyable{constructor(n,e){if(super(),!e.viewer)throw new Error("viewer is undefined");n.offsetRotation=[-90,0,0]}}class YP extends p.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 JP extends p.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 c=()=>{e.geoCameraController.position=n[i]};c();const h=n[o];this.d(h.don(c))}if(l){const c=()=>{e.geoCameraController.rotation=n[r]};c();const h=n[o];this.d(h.don(c))}}}}class jP extends p.Destroyable{constructor(n,e){super();const i=this.dv(new Q.ESSceneObjectWithId);i.id=n;const o=this.dv(p.createNextAnimateFrameEvent(e.enabledChanged,e.positionTrackingChanged,e.rotationTrackingChanged,e.positionPropertyNameChanged,e.positionChangedPropertyNameChanged,e.rotationPropertyNameChanged,e.rotationChangedPropertyNameChanged,i.sceneObjectChanged));this.disposeVar(new p.ObjResettingWithEvent(o,()=>{const{sceneObject:r}=i;if(!(!e.enabled||!r))return new JP(r,e)}))}}class Js extends p.Destroyable{constructor(e){super();L(this,"_geoCameraController");this._geoCameraController=this.dv(new ui(e)),this.d(p.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dv(new p.ObjResettingWithEvent(this.sceneObjectIdChanged,()=>{if(this.sceneObjectId)return new jP(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})})(Js||(Js={})),p.extendClassProps(Js.prototype,Js.createDefaultProps);class eT extends p.Destroyable{constructor(e){super();L(this,"height",1e7);L(this,"cycle",60);L(this,"latitude",6.632251044444445);L(this,"_running",!1);L(this,"_sseh");L(this,"_eventDisposer");L(this,"leftDownCancel",!0);this._viewer=e,this._sseh=this.dv(new C.ScreenSpaceEventHandler(this._viewer.canvas)),this._sseh.setInputAction(()=>{this.leftDownCancel&&this.cancel()},C.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:C.Cartesian3.fromRadians(i.longitude,this.latitude,this.height),orientation:{heading:0,pitch:-.5*C.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*C.Math.PI*2/this.cycle;e.setView({destination:C.Cartesian3.fromRadians(l,this.latitude,this.height),orientation:{heading:0,pitch:-.5*C.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 tT extends p.Destroyable{constructor(e){super();L(this,"_height",this.dv(p.react(1e7)));L(this,"_cycle",this.dv(p.react(60)));L(this,"_latitude",this.dv(p.react(38)));L(this,"_inner");this._czmViewer=e;const i=this._czmViewer.viewer;if(!i)throw new Error("未初始化viewer");this._inner=this.dv(new eT(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 nT extends p.Destroyable{constructor(e){super();L(this,"_position",this.dv(p.reactArrayWithUndefined(void 0)));L(this,"_distance",this.dv(p.react(5e4)));L(this,"_cycle",this.dv(p.react(60)));L(this,"_heading",this.dv(p.react(0)));L(this,"_pitch",this.dv(p.react(-30)));L(this,"_transform");L(this,"_headingRadius");L(this,"_pitchRadius");L(this,"_running",!1);L(this,"_sseh");L(this,"_eventDisposer");this._viewer=e;const i=this.viewer.scene,o=this.viewer.camera;this._sseh=this.dv(new C.ScreenSpaceEventHandler(this.viewer.canvas)),this.d(()=>{this.cancel()});{const r=()=>{let s;if(this.position==null){var a=o.getPickRay(new C.Cartesian2(i.canvas.width*.5,i.canvas.height*.5));if(!a)return;s=i.globe.pick(a,i)}else s=C.Cartesian3.fromDegrees(...this.position);s&&(this._transform=C.Transforms.eastNorthUpToFixedFrame(s),this.start())};r(),this.d(this.positionChanged.don(r))}{const r=()=>{this._headingRadius=C.Math.toRadians(this.heading)};r(),this.d(this.headingChanged.don(r))}{const r=()=>{this._pitchRadius=C.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 C.Cartesian3(0,i,o);e.flyTo({destination:C.Matrix4.multiplyByPoint(this._transform,r,new C.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 c=(new Date().getTime()-s)/1e3;this._headingRadius+=c*C.Math.PI*2/this.cycle,e.lookAtTransform(this._transform,new C.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(C.Matrix4.IDENTITY),this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1}}class iT extends p.Destroyable{constructor(e){super();L(this,"_position",this.dv(p.reactArrayWithUndefined(void 0)));L(this,"_distance",this.dv(p.react(5e4)));L(this,"_cycle",this.dv(p.react(60)));L(this,"_heading",this.dv(p.react(0)));L(this,"_pitch",this.dv(p.react(-30)));L(this,"_inner");this._czmViewer=e;const i=this._czmViewer.viewer;if(!i)throw new Error("viewer is undefined");this._inner=this.dv(new nT(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 rT extends p.Destroyable{constructor(e){super();L(this,"_firstPersonController");L(this,"_rotateGlobe");L(this,"_rotatePoint");L(this,"_followController");L(this,"_pathCameraController");L(this,"_handler");this._viewer=e;{this._firstPersonController=this.dv(new ZP(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=hh.defaultKeyStatusMap,this.d(this._firstPersonController.keyboardEnabledChanged.don(()=>{var i;(i=this._viewer.subContainer)==null||i.focus()}))}this._rotateGlobe=this.dv(new tT(e)),this._rotatePoint=this.dv(new iT(e)),this._followController=this.dv(new Js(e)),this._pathCameraController=this.dv(new Ys(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){this.resetNavigation(),this._changedMouseEvent("Walk");const o=this._viewer.getCameraInfo(),r=[(o==null?void 0:o.rotation[0])??0,0,0];this._viewer.getHeightByLonLat(e[0],e[1]).then(s=>{this._viewer.flyIn([e[0],e[1],(s??0)+1],r),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",c=Q.ESSceneObject.getSceneObjById(e);if(!c)return;const{points:h}=c;if(!h)return;const u=Q.getDistancesFromPositions(h,"NONE"),A=u[u.length-1];this._pathCameraController.viewDistance=0,this._pathCameraController.polylinePath.positions=[...h],this._pathCameraController.polylinePath.duration=A/i*1e3,this._pathCameraController.polylinePath.loop=r,this._pathCameraController.offsetHeight=o;const d=d0(h);this._pathCameraController.polylinePath.rotationRadius=!l||d==!1?[0]:d.map(f=>f/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 C.ScreenSpaceEventHandler(i.scene.canvas));const o=this._handler,r=i.scene.screenSpaceCameraController;this.d(()=>{o&&W0(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=>{hd(i.scene,a,r)},C.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(a=>{o.removeInputAction(C.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(C.ScreenSpaceEventType.LEFT_UP)},C.ScreenSpaceEventType.LEFT_UP)},C.ScreenSpaceEventType.LEFT_DOWN),o.setInputAction(s=>{o.setInputAction(a=>{hd(i.scene,a,r)},C.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(a=>{o.removeInputAction(C.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(C.ScreenSpaceEventType.RIGHT_UP)},C.ScreenSpaceEventType.RIGHT_UP)},C.ScreenSpaceEventType.RIGHT_DOWN),o.setInputAction(s=>{o.setInputAction(a=>{hd(i.scene,a,r)},C.ScreenSpaceEventType.MOUSE_MOVE),o.setInputAction(a=>{o.removeInputAction(C.ScreenSpaceEventType.MOUSE_MOVE),o.removeInputAction(C.ScreenSpaceEventType.MIDDLE_UP)},C.ScreenSpaceEventType.MIDDLE_UP)},C.ScreenSpaceEventType.MIDDLE_DOWN))):(o&&W0(o),r.lookEventTypes=C.CameraEventType.RIGHT_DRAG,r.rotateEventTypes=C.CameraEventType.LEFT_DRAG,r.tiltEventTypes=[C.CameraEventType.MIDDLE_DRAG,C.CameraEventType.PINCH,{eventType:C.CameraEventType.LEFT_DRAG,modifier:C.KeyboardEventModifier.CTRL},{eventType:C.CameraEventType.RIGHT_DRAG,modifier:C.KeyboardEventModifier.CTRL}],r.translateEventTypes=C.CameraEventType.LEFT_DRAG,r.zoomEventTypes=[C.CameraEventType.WHEEL,C.CameraEventType.PINCH,{eventType:C.CameraEventType.RIGHT_DRAG,modifier:C.KeyboardEventModifier.SHIFT}])}}const oT=[{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 aT extends p.Destroyable{constructor(e){super();L(this,"_show",this.dv(p.react(!1)));L(this,"cloudsPostProcess");const i=e.viewer;if(!i)throw new Error("Cesium Viewer is not initialized");const o=new C.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:Xe(a.scale),maximumSize:Zn(a.maximumSize),color:Ie(a.color),position:dt(a.position)});(()=>{o.removeAll();for(let a of oT)o.add(r(a))})()}}get show(){return this._show.value}set show(e){this._show.value=e}get showChanged(){return this._show.changed}}class js extends p.Destroyable{constructor(n){super();const e=n.viewer;if(!e){console.warn("viewer is undefined!");return}const i=e.scene.postProcessStages.add(C.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})})(js||(js={})),p.extendClassProps(js.prototype,js.createDefaultProps);const sT=`
171
171
  float getDistance(sampler2D depthTexture, vec2 texCoords)
172
172
  {
@@ -4142,10 +4142,10 @@ void main()
4142
4142
  {
4143
4143
  out_FragColor = u_color;
4144
4144
  }
4145
- `,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},st,t)}class mQ extends p.HasOwner{constructor(n){super(n);const{czmViewer:e}=this.owner;let i;this.dispose(()=>this.owner.hoveredPlaneType="none");const o=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(r=>{const s=i=this._getStartInfo(r.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(r=>{i&&i.currentPlaneType!=="none"&&(o.restart(void 0,e,i),i=void 0)})),this.dispose(e.dblclickEvent.disposableOn(r=>{do{const s=this._getStartInfo(r.pointerEvent);if(!s||s.currentPlaneType==="none")break;const{currentPlaneType:a}=s,l=[...this.owner.selfRotation];l[oi.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(p.createProcessingFromAsyncFunc(async(n,e,i)=>{const o=this.owner.circles[i.currentPlaneType];e.incrementDisabledInputStack(),n.disposer.dispose(()=>e.decrementDisabledInputStack()),n.disposer.dispose(e.pointerMoveEvent.don(r=>{if(i&&r.pointerEvent){const{offsetX:s,offsetY:a}=r.pointerEvent,l=[s,a],{currentPlaneType:c}=i;if(c==="none")return;const h=this.owner.getPlane(c);if(!i.currentV)return;const u=h.pick(l);if(!u||!this.owner.cartesian)return;const A=C.Cartesian3.subtract(i.currentV,this.owner.cartesian,new C.Cartesian3);C.Cartesian3.normalize(A,A);const d=C.Cartesian3.subtract(u,this.owner.cartesian,new C.Cartesian3);if(C.Cartesian3.normalize(d,d),!h.normal||!h.origin)return;const f=xv(A,d,h.normal),g=xv(h.origin,A,h.normal),v=xv(h.origin,d,h.normal);{const y=[...this.owner.selfRotation];y[oi.rotationNum[c]]=i.startRotation+f,this.owner.selfRotation=y,o.circleStartRotation=g,o.circleEndRotation=v}}})),this.owner.movingPlaneType=i.currentPlaneType,n.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),n.disposer.dispose(()=>{o.circleStartRotation=0,o.circleEndRotation=0}),await p.step(n,r=>new Promise((s,a)=>{r.disposer.dispose(a),r.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),r.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(n,e,i,o,r){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,l=this.owner.getPlane(i).pick(o);if(!l)return;const c=C.Cartesian3.distance(s,l),h=r/4,u=h*3/128;if(!(c>=h-u&&c<=h+u))return;const d=C.Cartesian3.distance(e.camera.positionWC,l);n.currentD2c<=d||(n.currentPlaneType=i,n.currentD2c=d,n.currentV=l,n.startRotation=a[oi.rotationNum[i]])}_getStartInfo(n){var h;const{czmViewer:e}=this.owner,i=(h=e.viewer)==null?void 0:h.scene;if(!this.owner.position||!this.owner.cartesian)return;const o=Ui(i,this.owner.cartesian,this.owner.pixelSize);if(!o)return;const{offsetX:r,offsetY:s}=n,a=[r,s],l=n.pointerId,c={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(c,i,"heading",a,o),this._pickPlane(c,i,"pitch",a,o),this._pickPlane(c,i,"roll",a,o),c}}function xv(t,n,e){const i=C.Cartesian3.cross(n,t,new C.Cartesian3);if(i.equals(C.Cartesian3.ZERO))return 0;C.Cartesian3.normalize(i,i);const o=C.Cartesian3.dot(i,e);let r=Math.acos(C.Cartesian3.dot(t,n))*180/Math.PI;return r=o>0?r:-r,r}const ua=class ua extends Fn{constructor(e){super();L(this,"_hoveredPlaneType",this.disposeVar(p.react("none")));L(this,"_movingPlaneType",this.disposeVar(p.react("none")));L(this,"_circles");L(this,"_czmCameraModel");L(this,"_cartesian");L(this,"_planes",{heading:this.disposeVar(new hQ(this)),pitch:this.disposeVar(new AQ(this)),roll:this.disposeVar(new fQ(this))});L(this,"_rotatorRunningResetting");this._czmViewer=e;const i=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new p.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new mQ(this)})),this._circles={heading:this._createRotatorCircle(i,"heading"),pitch:this._createRotatorCircle(i,"pitch"),roll:this._createRotatorCircle(i,"roll")},!!i.viewer){{const r=()=>{this._cartesian=this.position&&dt(this.position)||void 0};r(),this.dispose(this.positionChanged.disposableOn(r))}this._createCameraModel(i)}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get circles(){return this._circles}get czmCameraModel(){return this._czmCameraModel}get cartesian(){return this._cartesian}get czmViewer(){return this._czmViewer}getPlane(e){return this._planes[e]}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createCameraModel(e){this._czmCameraModel=new Ht(e),this._czmCameraModel.url="${earthsdk3-assets-script-dir}/assets/glb/camera1/camera1.gltf",this._czmCameraModel.localRotation=[90,0,0],this._czmCameraModel.allowPicking=!1,this._czmCameraModel.opaquePass="OVERLAY",this.dispose(p.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],i=>i*.1)),this.dispose(p.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(p.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const i=()=>{const o=at({rotation:this.selfRotation});if(!o)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=C.Matrix4.toArray(o))};i(),this.dispose(this.selfRotationChanged.disposableOn(i))}{const i=()=>{this.circles.heading.show=this.enabled,this.circles.pitch.show=this.enabled,this.circles.roll.show=this.enabled,this._czmCameraModel&&(this._czmCameraModel.show=this.enabled&&this.showHelper)};i(),this.dispose(this.enabledChanged.disposableOn(i)),this.dispose(this.showHelperChanged.disposableOn(i))}}_createRotatorCircle(e,i){const o=this.ad(new Is(e));this.dispose(p.track([o,"position"],[this,"position"])),this.dispose(p.track([o,"pixelSize"],[this,"pixelSize"])),this.dispose(p.track([o,"debug"],[this,"debug"])),this.dispose(p.track([o,"rotation"],[this,"rotation"]));{const r=()=>{o.selfRotation=ua.rotationFuncs[i](this.selfRotation),o.circleRotation=this.selfRotation[ua.rotationNum[i]]};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{const s=this.movingPlaneType===i,a=this.hoveredPlaneType===i,c=[0,0,0,s||a?1:.8];c[ua.rotationNum[i]]=1,o.color=c};r(),this.dispose(this.movingPlaneTypeChanged.disposableOn(r)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(r))}return o}};L(ua,"rotationNum",{heading:0,pitch:1,roll:2}),L(ua,"rotationFuncs",{heading:([e,i,o])=>[0,0,0],pitch:([e,i,o])=>[e,0,-90],roll:([e,i,o])=>[e,i+90,0]});let oi=ua;(t=>{t.createDefaultProps=()=>({...Fn.createDefaultProps(),rotation:p.reactArray([0,0,0]),selfRotation:p.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(oi||(oi={})),p.extendClassProps(oi.prototype,oi.createDefaultProps);const ca=class ca extends p.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(n){this.positions=[n??ca.defaults.positions[0],this.stopPosition??ca.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(n){this.positions=[this.startPosition??ca.defaults.positions[0],n??ca.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(n,e){if(super(),!n.viewer)return;const o=this.ad(new Je(n,e));o.arcType="RHUMB";const r=this.ad(new On(n,e));this.ad(p.track([o,"allowPicking"],[this,"allowPicking"])),this.ad(p.track([r,"allowPicking"],[this,"allowPicking"]));{const s=()=>{o.show=r.show=this.show};s(),this.ad(this.showChanged.don(s))}{const s=()=>{o.width=this.width/2,r.pixelSize=this.width};s(),this.ad(this.widthChanged.don(s))}{const s=()=>{o.color=r.color=this.color};s(),this.ad(this.colorChanged.don(s))}{const s=()=>{o.positions=this.positions,r.position=this.stopPosition};s(),this.dispose(this.startPositionChanged.disposableOn(s)),this.dispose(this.stopPositionChanged.disposableOn(s))}}};L(ca,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let ta=ca;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(t.defaults.positions),width:10,color:p.reactArray([1,0,0,1])})})(ta||(ta={})),p.extendClassProps(ta.prototype,ta.createDefaultProps);class ar extends Fn{constructor(e){super();L(this,"_lastPosition");L(this,"_opInfo",{step:this.ad(p.react(!1)),moved:this.ad(p.react(!1)),constraintMode:this.disposeVar(p.react("none")),originPosition:this.disposeVar(p.reactArray([0,0,0])),originHeading:this.disposeVar(p.react(0)),originDimensions:this.disposeVar(p.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(p.reactArray([0,0,0])),movingPosition:this.disposeVar(p.reactArray([0,0,0])),targetPosition:this.disposeVar(p.reactArray([0,0,0])),targetHeading:this.disposeVar(p.react(0))});L(this,"_scaleAxis");L(this,"_pickingXYProcessing",e=>this.disposeVar(new p.Processing((i,o,r)=>{const s=[0,0,0],a=new C.Cartographic;return e.pointerMoveEvent.disposableOn(l=>{if(!l.pointerEvent||!e.viewer)return;const c=Xn(p.getDomEventCurrentTargetPos(l.pointerEvent));if(!da(e.viewer.scene,c,this._opInfo.originPosition.value[2],a))return;Aa(a,s),this._opInfo.constraintMode.value==="x"?mo(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?mo(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,s,s):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=s,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const h=[0,0,0];Q.geoRhumbDestination(s,r,o,h),this._opInfo.targetPosition.value=h;let u=this.scale[0],A=this.scale[1];const d=Q.geoDistance(h,this._opInfo.originPosition.value)-Q.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...h];const f=this._opInfo.originDimensions.value[0]/100;d!=0&&this._opInfo.constraintMode.value==="y"&&(d>0?u+=f:u-=f),d!=0&&this._opInfo.constraintMode.value==="x"&&(d>0?A+=f:A-=f),u<=0&&(u+=f),A<=0&&(A+=f),this.scale=[u??1,A??1,this.scale[2]??1]})})));L(this,"_pickingZProcessing",e=>this.disposeVar(new p.Processing(()=>{const i=new C.Cartesian3,o=[0,0,0];return e.pointerMoveEvent.disposableOn(r=>{if(!r.pointerEvent||!e.viewer)return;const s=Xn(p.getDomEventCurrentTargetPos(r.pointerEvent));if(!eh(e.viewer.scene,dt(this._opInfo.originPosition.value),s,i))return;this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(Ue(i,o)){this._opInfo.movingPosition.value=o;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],o[2]+a];let c=this.scale[2];const h=o[2]-this._lastPosition[2];this._lastPosition=[...o];const u=this._opInfo.originDimensions.value[0]/100;h!=0&&(h>0?c+=u:c-=u),c<=0&&(c+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,c??1]}})})));const i=e.viewer;if(!i)return;const{scene:o}=i;this.ad(new Nf(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={zAxis:this._createScaleAxis(e,"zAxis"),yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const c=()=>{if(!this._scaleAxis)return;const{zAxis:h,yAxis:u,xAxis:A}=this._scaleAxis,d=this._opInfo.constraintMode.value,f=this._opInfo.step;h.color=[0,0,1,.99],u.color=[0,1,0,.99],A.color=[1,0,0,.99],d==="x"?A.color=f?[1,1,0,.8]:[1,1,0,.99]:d==="y"?u.color=f?[1,1,0,.8]:[1,1,0,.99]:d==="z"&&(h.color=f?[1,1,0,.8]:[1,1,0,.99])};c(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(c)),this.dispose(this._opInfo.step.changed.disposableOn(c))}{const c=()=>{if(!this._scaleAxis)return;const{position:u=ar.defaults.position}=this,{zAxis:A,yAxis:d,xAxis:f}=this._scaleAxis;A.startPosition=d.startPosition=f.startPosition=u;const[g,v,y]=u;A.stopPosition=[g,v,y+this._opInfo.originDimensions.value[2]];const m=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);m&&(f.stopPosition=m);const w=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);w&&(d.stopPosition=w)};c();const h=this.ad(p.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(h.don(c))}{const c=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((h,u)=>h===this._opInfo.targetPosition.value[u])){this._opInfo.moved.value=!0;return}};c(),this.dispose(this._opInfo.originHeading.changed.disposableOn(c)),this.dispose(this._opInfo.originPosition.changed.disposableOn(c)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(c)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(c))}const r=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(p.createProcessingFromAsyncFunc(async c=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",c.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await p.step(c,async h=>{const u=()=>{const f=[...this.position??ar.defaults.position];e.editingHeightOffset&&(f[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=f};h.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const A={constraintMode:"none",startDragPos:[0,0,0]},d=f=>{if(!this.position)return;const g={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Ff(f,o,g,this.axisSnapPixelSize,A),this._opInfo.constraintMode.value=A.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=A.startDragPos};h.disposer.dispose(e.pointerMoveEvent.disposableOn(f=>{f.pointerEvent&&d(f.pointerEvent)})),await p.step(h,f=>new Promise((g,v)=>{f.disposer.dispose(v),f.disposer.dispose(e.pointerDownEvent.don(y=>{y.pointerEvent&&d(y.pointerEvent),y.pointerEvent&&y.pointerEvent.button===0&&A.constraintMode!=="none"&&g()}))}))}),this._opInfo.step.value=!1,await p.step(c,async h=>{if(e.incrementDisabledInputStack(),h.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const u=Q.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),A=Q.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);r.restart(void 0,u,A),h.disposer.dispose(()=>r.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),h.disposer.dispose(()=>s.cancel()));await p.step(h,u=>new Promise((A,d)=>{u.disposer.dispose(d),u.disposer.dispose(e.pointerUpEvent.don(()=>{A()})),u.disposer.dispose(e.pointerOutEvent.don(()=>{A()}))})),this._lastPosition=void 0});while(!0)})),l=()=>{this.enabled?a.restart():a.isRunning&&a.cancel()};l(),this.dispose(this.enabledChanged.disposableOn(l))}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,i){const o=this.ad(new ta(e));return o.width=10,this.ad(p.track([o,"show"],[this,"enabled"])),o}}(t=>{t.createDefaultProps=()=>({...Fn.createDefaultProps(),scale:p.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(ar||(ar={})),p.extendClassProps(ar.prototype,ar.createDefaultProps);const fo=class fo extends An{constructor(e){super();L(this,"_editingPoints",this.disposeVar(new p.ObservableArray));L(this,"_cancelEvent",this.disposeVar(new p.Event));L(this,"_currentProcess");L(this,"_menuPoiEnabled",this.disposeVar(p.react(!1)));L(this,"_status",this.disposeVar(p.react("None")));L(this,"_positionsChanged",this.ad(new p.Event));L(this,"_cursorInfo");this._czmViewer=e,this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(i=>{for(let{start:o,deleteCount:r,items:s}of i){for(const a of s)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=o;a<o+r;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let i of this.editingPoints)i.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(i=>{this.ad(p.nextAnimateFrame(()=>{var o;((o=i.pointerEvent)==null?void 0:o.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(i=>{this._currentProcess&&(i?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const i=()=>{this.polylineShow=this.czmViewer.editingLineShow};i(),this.ad(this.czmViewer.editingLineShowChanged.don(i))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let i of this._editingPoints)i.position&&e.push([...i.position]);return e}resetPositions(e){if(this.enabled??fo.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const i=e||[];return!(i.length===this.editingPoints.length&&i.every((o,r)=>o.every((s,a)=>{const l=this.editingPoints.get(r);return l.position&&l.position[a]===s})))}forceResetPositions(e){(this.enabled??fo.defaults.enabled)&&(this.enabled=!1),this.resetPositions(e)}get positions(){return this.getPositions()}set positions(e){this.resetPositions(e)}get positionsChanged(){return this._positionsChanged}get czmViewer(){return this._czmViewer}get cursorInfo(){return this._cursorInfo}createPolyline(e){const i=this.ad(new Je(e));this.ad(p.track([i,"color"],[this,"polylineColor"])),this.ad(p.track([i,"width"],[this,"polylineWidth"])),this.ad(p.track([i,"show"],[this,"polylineShow"])),this.ad(p.track([i,"arcType"],[this,"polylineArcType"])),this.ad(p.track([i,"loop"],[this,"loop"]));{const o=()=>{const r=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,r.push(s);i.positions=r};o(),this.ad(this.positionsChanged.don(o))}}_createCursorInfo(e){const i=this._cursorInfo=this.ad(new p.CursorInfo(e.container,p.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const o=this.status;if(i){if(!this.hideCursorInfo){i.show=!1;return}o==="Adding"?(i.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",i.show=!0):o==="Modifying"||o==="Modifying_Point"?(i.text="Esc键或左键双击:退出编辑状态",i.show=!0):o==="None"&&(i.text="",i.show=!1)}}))}};L(fo,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),L(fo,"defaults",{...An.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:fo.baseImageUrl+"point-green.png",otherControlPointImageUrl:fo.baseImageUrl+"point-yellow.png"});let Wn=fo;(t=>{t.createDefaultProps=()=>({...An.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:p.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:t.baseImageUrl+"point-green.png",otherControlPointImageUrl:t.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(Wn||(Wn={})),p.extendClassProps(Wn.prototype,Wn.createDefaultProps);let gQ=0;class YS extends p.Destroyable{constructor(e,i){super();L(this,"_position",this.disposeVar(p.reactArrayWithUndefined(void 0)));L(this,"_id",gQ++);L(this,"_menuPoi");i&&(this.position=i),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const o=this._menuPoi=this.ad(new Sa(e.czmViewer));o.enabled=!1,this.ad(p.track([o,"show"],[e,"enabled"]));{const r=()=>{if(this.position===void 0){o.position=void 0;return}const s=[...this.position];s[2]-=e.czmViewer.editingHeightOffset??0,o.position=s,e.positionsChanged.emit()};r(),this.d(this.positionChanged.don(r))}{const r=()=>{const s=e.editingPoints.indexOf(this)+1;s!==0&&(o.title=`控制点${s}`,s===1?o.imageUri=e.firstControlPointImageUrl??Wn.defaults.firstControlPointImageUrl:o.imageUri=e.otherControlPointImageUrl??Wn.defaults.otherControlPointImageUrl)};r(),this.dispose(e.editingPoints.changedEvent.disposableOn(r))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class JS extends YS{constructor(n,e){super(n,e)}}class Pt extends Wn{constructor(e){super(e);L(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new p.Event));L(this,"placeEditing");if(!e.viewer)return;const i=this.placeEditing=this.ad(new ri(e));i.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async o=>{o.disposer.dispose(()=>{(this.debug??Pt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??Pt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await o.promise(p.step(o,async r=>{const s=r.disposer,a=s.ad(this._addingEditingProcessing());s.dispose(()=>"adding canceled!"),s.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await r.promise(new Promise(l=>{s.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(o=>{var r;((r=o.pointerEvent)==null?void 0:r.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const i=e?e.map(o=>new JS(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??Pt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},i=p.createProcessingFromAsyncFunc(async o=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await o.promise(p.step(o,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new yQ(this,r)));const h=a.disposer.disposeVar(new wQ(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(A=>{A?(r++,u(!0)):u(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(A=>{A?(r--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return i.start(),i}}(t=>{t.createDefaultProps=()=>({...Wn.createDefaultProps()})})(Pt||(Pt={})),p.extendClassProps(Pt.prototype,Pt.createDefaultProps);class yQ extends p.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new p.Event));const{placeEditing:o}=e;let r=new JS(e,void 0);e.editingPoints.splice(i,0,r);const s=()=>{(e.debug??Pt.defaults.debug)&&console.log("delete currentPosEditor");const c=e.editingPoints.indexOf(r);if(c===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(c,1)};if(o.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(p.track([r,"position"],[o,"position"])),o.enabled=!0;let a=!1;const l=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{o.enabled=!1,!a&&l()}),this.dispose(o.overEvent.disposableOnce(()=>{a=!0,r.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??Pt.defaults.debug)&&console.log(`PointAdding creating! index(${i})`),this.dispose(()=>{(e.debug??Pt.defaults.debug)&&console.log(`PointAdding destroying! index(${i})`)})}get overEvent(){return this._overEvent}}function vQ(t,n){const e=t.editingPoints,i=n-1;return i<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(i,1),!0)}class wQ extends p.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new p.Event));L(this,"_doEvent",this.disposeVar(new p.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(vQ(e,i)))),(e.debug??Pt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${i})`),this.dispose(()=>{(e.debug??Pt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${i})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class jS extends Pt{constructor(n){super(n),this.loop=!1}}class eE extends Pt{constructor(n){super(n),this.loop=!0}}class yf extends YS{constructor(n,e){super(n,e);{const{menuPoi:i}=this;i.commands=[["add","增加控制点","",tt.baseImageUrl+"add.png"],["delete","删除当前控制点","",tt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",tt.baseImageUrl+"modify.png"]],i.clickCommandName="modify",i.rightClickCommandName="delete",this.dispose(i.commandEvent.disposableOn(o=>{n.menuPoiCommand(this,o)})),this.dispose(i.dbclickEvent.disposableOn(()=>{n.menuPoiCommand(this,"dbClick")}))}if(n.middlePointShow){const i=this.ad(new ci(n.czmViewer));{i.imageUri=n.firstControlPointImageUrl??tt.defaults.firstControlPointImageUrl,i.tooltip="点击增加一个控制点",i.bgColor=[0,0,0,.6],i.fgColor=[1,1,1,1],i.size=[8,8],i.originRatioAndOffset=[.5,.5,0,0];{const o=()=>{if(!(n.enabled??tt.defaults.enabled)){i.enabled=!1,i.show=!1;return}do{const s=n.editingPoints.indexOf(this);if(s===-1)break;const a=n.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(n.loop??tt.defaults.loop)&&s+1>=a)break;const c=this.position;if(!c)break;let h=(s+1)%a;const A=n.editingPoints.get(h).position;if(!A)break;const d=Rf(c,A);if(!d)break;d[2]-=n.czmViewer.editingHeightOffset??0,i.position=d;const f=n.editingPoints.length<(n.maxPointsNum??tt.defaults.maxPointsNum);i.enabled=f,i.show=f;return}while(!1);i.enabled=!1,i.show=!1};o(),this.dispose(n.positionsChanged.disposableOn(o)),this.dispose(n.loopChanged.disposableOn(o)),this.dispose(n.enabledChanged.disposableOn(o))}this.dispose(i.clickEvent.disposableOn(o=>{if(o.button!==0||n.editingPoints.length>=(n.maxPointsNum??tt.defaults.maxPointsNum))return;const r=n.editingPoints.indexOf(this);if(r===-1)return;const s=i.position?[...i.position]:void 0;s&&(s[2]+=n.czmViewer.editingHeightOffset??0);let a=new yf(n,s);n.editingPoints.splice(r+1,0,a),n.modify(a)}))}}}}class tt extends Wn{constructor(e){super(e);L(this,"_menuPoiCommand",this.disposeVar(new p.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));L(this,"_overEvent",this.disposeVar(new p.Event));L(this,"translationEditing");{const o=this.ad(p.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new p.ObjResettingWithEvent(o,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new bQ(this.editingPoints.get(0),this)}))}const i=this.translationEditing=this.disposeVar(new or(e));i.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async o=>{o.disposer.dispose(()=>{(this.debug??tt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let r=-1;do if((this.debug??tt.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",r=await o.promise(p.step(o,async s=>{const a=s.disposer,l=a.ad(new _Q(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(r===-1||r>=this.editingPoints.length?0:r)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(h=>l.modify(h))),await s.promise(new Promise(h=>{a.dispose(l.overEvent.disposableOnce(u=>{h(u)}))}))})),r===-1){(this.debug??tt.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??tt.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??tt.defaults.loop;const a=this.editingPoints.get(r-1).position;if(!a)return;let l=r%this.editingPoints.length;const h=this.editingPoints.get(l).position;if(!h)return;const u=Rf(a,h);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let A=new yf(this,u);this.editingPoints.splice(r,0,A)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,i){this._menuPoiCommand.emit(e,i)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const i=e?e.map(o=>new yf(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...Wn.createDefaultProps(),moveWithFirstPosition:!1})})(tt||(tt={})),p.extendClassProps(tt.prototype,tt.createDefaultProps);class bQ extends p.Destroyable{constructor(n,e){super(),this._firstPositionEditor=n,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((i,o)=>{if(i===void 0||o===void 0)return;var r=[i[0]-o[0],i[1]-o[1],i[2]-o[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const l=this.multiPointsModifyEditing.editingPoints.get(a),c=l.position;c!==void 0&&(l.position=[c[0]+r[0],c[1]+r[1],c[2]+r[2]])}})}}class _Q extends p.Destroyable{constructor(e){super();L(this,"_overEvent",this.disposeVar(new p.Event));L(this,"_cancelEvent",this.disposeVar(new p.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let i;const o=()=>{i==null||i.destroy(),i=void 0,e.status="Modifying"};this.dispose(o);const r=s=>{o(),e.status="Modifying_Point",i=new CQ(e,s),i.dispose(i.overEvent.disposableOn(()=>{o()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(r)),this.dispose(e._menuPoiCommand.disposableOn((s,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const l=e.editingPoints.indexOf(s);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(l,1)}else if(a==="modify")r(s);else if(a==="add"){const l=e.editingPoints.indexOf(s);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(l+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(e){this._forceModifyPosEditorEvent.emit(e)}}class CQ extends p.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new p.Event));this._modifying=e,this._posEditor=i,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:o}=this._modifying;if(o.enabled=!0,o.heading=0,this.dispose(()=>{o.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");o.position=this._posEditor.position,this.dispose(p.track([this._posEditor,"position"],[o,"position"])),this.dispose(o.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class tE extends tt{constructor(n){super(n),this.loop=!1}}class nE extends tt{constructor(n){super(n),this.loop=!0}}class ks extends Pt{init(){const n=this.startPosition;if(!n)return;const e=this.distance,i=this.rotation,o=e*Math.cos(i[1]*Math.PI/180),r=Q.geoDestination(n,o,i[0]);if(!r){this.positions=[n];return}const s=e*Math.sin(i[1]*Math.PI/180);r[2]+=s,this.positions=[n,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=r)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const i=Q.geoHeading(this.startPosition,this.endPosition),o=Q.geoDistance(this.startPosition,this.endPosition);if(o<=0){this.rotation=[90,0,0],this.distance=1;return}const r=this.endPosition[2]-this.startPosition[2],s=Math.atan(r/o)*180/Math.PI,a=Math.sqrt(o*o+r*r);this.rotation=[i,s,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Pt.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([90,0,0]),distance:p.react(1)})})(ks||(ks={})),p.extendClassProps(ks.prototype,ks.createDefaultProps);class na extends tt{init(){const n=this.startPosition;if(!n)return;const e=this.distance,i=this.rotation,o=e*Math.cos(i[1]*Math.PI/180),r=Q.geoDestination(n,o,i[0]);if(!r){this.positions=[n];return}const s=e*Math.sin(i[1]*Math.PI/180);r[2]+=s,this.positions=[n,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=r)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",tt.baseImageUrl+"add.png"],["delete","删除当前控制点","",tt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",tt.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let l of this.editingPoints)l.menuPoi.commands=[["delete","删除当前控制点","",tt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",tt.baseImageUrl+"modify.png"]];const i=Q.geoHeading(this.startPosition,this.endPosition),o=Q.geoDistance(this.startPosition,this.endPosition);if(Math.abs(o)<=0){this.rotation=[90,0,0],this.distance=1;return}const r=this.endPosition[2]-this.startPosition[2],s=Math.atan(r/o)*180/Math.PI,a=Math.sqrt(o*o+r*r);this.rotation=[i,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...tt.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([0,0,0]),distance:p.react(0)})})(na||(na={})),p.extendClassProps(na.prototype,na.createDefaultProps);class iE extends Pt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1}}class rE extends tt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Fs extends Pt{constructor(n){super(n),n.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const i=[...this.positions[0]];i[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(o=>(o[2]-=n.editingHeightOffset??0,[i,o]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(n){const e=this.ad(new Yn(n));e.topOrBottom="bottom",this.ad(p.track([e,"color"],[this,"polylineColor"])),this.ad(p.track([e,"width"],[this,"polylineWidth"])),this.ad(p.track([e,"show"],[this,"polylineShow"])),this.ad(p.track([e,"arcType"],[this,"polylineArcType"])),this.ad(p.track([e,"loop"],[this,"loop"])),this.ad(p.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Pt.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(Fs||(Fs={})),p.extendClassProps(Fs.prototype,Fs.createDefaultProps);class Bs extends tt{constructor(n){if(super(n),!!n.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const i=[...this.positions[0]];i[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(o=>(o[2]-=n.editingHeightOffset??0,[i,o]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(n){const e=this.ad(new Yn(n));e.topOrBottom="bottom",this.ad(p.track([e,"color"],[this,"polylineColor"])),this.ad(p.track([e,"width"],[this,"polylineWidth"])),this.ad(p.track([e,"show"],[this,"polylineShow"])),this.ad(p.track([e,"arcType"],[this,"polylineArcType"])),this.ad(p.track([e,"loop"],[this,"loop"])),this.ad(p.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...tt.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(Bs||(Bs={})),p.extendClassProps(Bs.prototype,Bs.createDefaultProps);class oE extends na{constructor(n){super(n),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.zAxisShow=!0,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class rn extends Q.EngineObject{constructor(e,i,o){super(e,i,o??!0);L(this,"_supportEditing",this.disposeVar(p.react(!0)));L(this,"_currentEditing",this.disposeVar(p.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var r;if(this.currentEditing){if(this.currentEditing instanceof Pt&&((r=this.currentEditing.currentProcess)!=null&&r.isRunning))if(this.currentEditing.currentProcess.cancel(),e!=null&&e.position){if(this.currentEditing.positions.length>1)return;e.position=this.currentEditing.positions[0]??[0,0,0],e!=null&&e.rotation&&(e.rotation=[0,0,0]),e!=null&&e.far&&(e.far=1),e!=null&&e.radius&&(e.radius=1),e!=null&&e.distance&&(e.distance=1)}else e.points=this.currentEditing.positions;this.currentEditing instanceof ri&&this.currentEditing.enabled&&(e.position=[0,0,0])}}))}get supportEditing(){return this._supportEditing.value}set supportEditing(e){this._supportEditing.value=e}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(e){this._currentEditing.value=e}get currentEditingChanged(){return this._currentEditing.changed}}const Uc=class Uc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ri(e));this.ad(e.clickEvent.don(o=>{var r;((r=o.pointerEvent)==null?void 0:r.button)==2&&(i.enabled=!0)}));do{if(Reflect.has(n,"position")){this.ad(p.bind([i,"position"],[n,"position"])),i.enabled=!i.position||Q.equalsN3(i.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};L(Uc,"type",Uc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Place,Uc));let Sv=Uc;const Oc=class Oc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new oi(e));i.rotation=[90,0,0],this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);o&&(this.ad(p.bind([i,"position"],[o.czm3DTiles,"position"])),this.ad(p.bind([i,"selfRotation"],[n,"rotation"])))});break}if(Reflect.has(n,"position")&&Reflect.has(n,"rotation")){this.ad(p.bind([i,"position"],[n,"position"])),this.ad(p.bind([i,"selfRotation"],[n,"rotation"]));break}this.supportEditing=!1}while(!1)}};L(Oc,"type",Oc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Rotation,Oc));let Ev=Oc;const Lc=class Lc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ar(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")&&Reflect.has(n,"scale")){this.ad(p.bind([i,"position"],[n,"position"])),this.ad(p.bind([i,"scale"],[n,"scale"]));break}this.supportEditing=!1}while(!1)}};L(Lc,"type",Lc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Scale,Lc));let Pv=Lc;const zc=class zc extends rn{constructor(n,e){super(Array.isArray(n)?n[0]:n,e,!0);const i=this.currentEditing=this.ad(new or(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(n)){const o=[];for(let r=0;r<n.length;r++){const s=n[r];Reflect.has(s,"position")?o.push(s.position):s.points&&o.push(...s.points)}i.position=Q.getMinMaxCorner(o).center,this.ad(i.positionChanged.disposableOn((r,s)=>{if(!(!r||!s)){var a=dn({originPosition:s},[r])[0][0];n.forEach(l=>{if(Reflect.has(l,"position")){const c=dn({originPosition:s},[l.position])[0][0];l.position=gr({originPosition:s},[[c[0]+a[0],c[1]+a[1],c[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const c=dn({originPosition:s},l.points)[0];l.points=gr({originPosition:s},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}})}}));break}if(Reflect.has(n,"position")){this.ad(p.bind([i,"position"],[n,"position"]));break}if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);this.ad(p.bind([i,"position"],[o.czm3DTiles,"position"]))});break}if(Reflect.has(n,"points")){if(n.points===void 0||n.points.length===0){this.destroy();break}i.position=Q.getMinMaxCorner(n.points).center,this.ad(i.positionChanged.disposableOn((o,r)=>{if(o===void 0||r===void 0||n.points===void 0||n.points.length===0){this.destroy();return}var s=dn({originPosition:r},[o])[0][0];const a=dn({originPosition:r},n.points)[0];n.points=gr({originPosition:r},a.map(l=>[l[0]+s[0],l[1]+s[1],l[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};L(zc,"type",zc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Translation,zc));let vf=zc;const Qc=class Qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ks(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")){this.ad(p.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(p.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(p.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(p.bind([i,"distance"],[n,"distance"]));break}const o=dt(n.position);if(C.Cartesian3.ZERO.equals(o)||!e.viewer)return;i.distance=Ui(e.viewer.scene,o,100)??1}while(!1);break}if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1);i.startPosition&&!Q.equalsN3(i.startPosition,[0,0,0])&&i.init(),i.enabled=!0}};L(Qc,"type",Qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsAppend,Qc));let Tv=Qc;const Vc=class Vc extends rn{constructor(n,e){var r;if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new na(e));do{if(Reflect.has(n,"position")){this.ad(p.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(p.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(p.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(p.bind([i,"distance"],[n,"distance"]));break}const s=dt(n.position);if(C.Cartesian3.ZERO.equals(s)||!e.viewer)return;i.distance=Ui(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(n,"points")&&((r=n.points)==null?void 0:r.length)==2){i.moveWithFirstPosition=!1;const s=()=>i.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!i.enabled&&s())),this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1;return}while(!1);i.init(),i.enabled=!0;const o=this.ad(p.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L(Vc,"type",Vc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsModify,Vc));let Iv=Vc;const Hc=class Hc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new eE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Hc,"type",Hc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularAppend,Hc));let kv=Hc;const Nc=class Nc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new nE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Nc,"type",Nc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularInsert,Nc));let Fv=Nc;const Gc=class Gc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new jS(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Gc,"type",Gc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringAppend,Gc));let Bv=Gc;const Wc=class Wc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new tE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Wc,"type",Wc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringInsert,Wc));let Mv=Wc;const qc=class qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new iE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(qc,"type",qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterAppend,qc));let Dv=qc;const Kc=class Kc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new rE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Kc,"type",Kc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterModify,Kc));let Rv=Kc;const Zc=class Zc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Fs(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Zc,"type",Zc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityAppend,Zc));let Uv=Zc;const Xc=class Xc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Bs(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Xc,"type",Xc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityModify,Xc));let Ov=Xc;const $c=class $c extends rn{constructor(n,e){if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new oE(e));do{if(Reflect.has(n,"points")){const r=Reflect.has(n,"extrudedHeight"),s=Reflect.has(n,"height"),a=Reflect.has(n,"perPositionHeight")?n.perPositionHeight:!r,l=n instanceof Q.ESClassification||n instanceof Q.ESPolygonFence;let c=Q.getMinMaxCorner(n.points).center,h=[...c],u=l?n.points[0][2]:0;a?r?h[2]=n.extrudedHeight:h[2]=n.height+u:(s&&(c[2]=n.height),r&&(h[2]=n.extrudedHeight)),i.startPosition=c,i.distance=h[2]-c[2],i.moveWithFirstPosition=!1;let A=[...c];this.ad(i.positionsChanged.don(()=>{i.positions.length===2&&(a?(n.points=n.points.map(d=>[d[0],d[1],d[2]+i.positions[0][2]-A[2]]),r?n.extrudedHeight=i.positions[1][2]:s&&(n.height=i.positions[1][2]-(l?i.positions[0][2]:0))):(s&&(n.height=i.positions[0][2]),r&&(n.extrudedHeight=i.positions[1][2])),A=[...i.positions[0]])}));break}this.supportEditing=!1;return}while(!1);i.init(),i.enabled=!0;const o=this.ad(p.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L($c,"type",$c.registerEditing("ESCesiumViewer",Q.ESJEditingMode.HeightModify,$c));let Lv=$c;const on=class on extends p.Destroyable{constructor(e,i,o,r=!0){super();L(this,"czmViewer");L(this,"sceneObject");L(this,"editingModes",[]);L(this,"editingID");L(this,"useKeyToSwitch");L(this,"currentIndex",0);const s=this.czmViewer=e,a=this.sceneObject=i,l=this.editingModes=Array.isArray(o)?[...o]:[o],c=this.editingID=a.editingID;this.useKeyToSwitch=r,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:c,type:"start",add:{modes:l}}),this.ad(a.toDestroyEvent.don(on.stop)),this.ad(s.keyDownEvent.don(h=>{h.code=="Escape"&&on.stop()})),this.createEditingMode(this.currentIndex)}createEditingMode(e){const{sceneObject:i,czmViewer:o,editingID:r}=this,s=new p.Destroyable;this.ad(()=>!s.isDestroyed()&&s.destroy());const a=this.editingModes[e%this.editingModes.length],l=Q.EngineObject.contextEditing.getEngineObjConstructor(a,o.typeName);if(!l||!i.supportEditingModes().includes(a))return this._createNextEditingMode(s,a);const c=new l(i,o);if(s.ad(()=>!c.isDestroyed()&&c.destroy()),c.isDestroyed())return this._createNextEditingMode(s,a);const h=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),p.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(c.toDestroyEvent.don(h)),this.useKeyToSwitch&&s.ad(o.keyDownEvent.don(u=>{u.code=="Space"&&h()})),s.ad(o.dblclickEvent.donce(()=>this.useKeyToSwitch?on.stop():h())),c.supportEditing)o.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:r,type:"changed",add:{cMode:a,cIndex:e}}),o.notSupportEditingCount=0;else return this._createNextEditingMode(s,a)}_createNextEditingMode(e,i){const{sceneObject:o,czmViewer:r,editingID:s}=this;if(!e.isDestroyed()&&e.destroy(),console.log(`未找到编辑模式或不支持当前编辑模式${i},已跳过当前编辑模式,请检查输入`),r.editingEvent.emit({objectIDs:[o.parentID??o.id],editingID:s,type:"changedFailed",add:{cMode:i,cIndex:this.currentIndex}}),r.notSupportEditingCount++,r.notSupportEditingCount==this.editingModes.length)return on.stop();p.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})}static create(e,i,o,r=!0){on.stop(),on.currentEditingInstance=new on(e,i,o,r)}static stop(){if(on.currentEditingInstance&&!on.currentEditingInstance.isDestroyed()){if(!on.currentEditingInstance)return;const{czmViewer:e,sceneObject:i,editingID:o,editingModes:r}=on.currentEditingInstance;on.currentEditingInstance.destroy(),e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:o,type:"end",add:{modes:r}})}on.currentEditingInstance=void 0}};L(on,"currentEditingInstance");let wf=on;function xQ(){const t=p.createProcessingFromAsyncFunc(async(n,e,i,o,r=!0)=>{const s=Array.isArray(o)?[...o]:[o],a=i.editingID;e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"start",add:{modes:s}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"end",add:{modes:s}}),t.isRunning&&t.cancel()};n.disposer.ad(l),n.disposer.ad(i.toDestroyEvent.don(l));const c=u=>{u.code=="Escape"&&l()};n.disposer.ad(e.keyDownEvent.don(c));let h=0;do{const u=s[h%s.length],A=await p.step(n,async d=>{const f=d.disposer,g=Q.EngineObject.contextEditing.getEngineObjConstructor(u,e.typeName);if(!g||!i.supportEditingModes().includes(u))return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;const v=new g(i,e);if(f.ad(()=>{!v.isDestroyed()&&v.destroy()}),v.supportEditing)e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;return await d.promise(new Promise(m=>{if(v.isDestroyed()&&m(!1),f.ad(v.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),m(!1)})),r){const w=_=>{_.code=="Space"&&(console.log(`编辑模式${u}结束`),m(!1))};f.ad(e.keyDownEvent.don(w)),f.ad(e.dblclickEvent.don(()=>m(!0)))}}))});if(r&&A||!r&&h==s.length-1||e.notSupportEditingCount==s.length)break;h++}while(!0)});return t}function aE(){const t=p.createProcessingFromAsyncFunc(async(n,e,i,o)=>{e.editingEvent.emit({objectIDs:i.map(l=>l.parentID??l.id),editingID:o,type:"start"});const r=()=>{e.editingEvent.emit({objectIDs:i.map(l=>l.parentID??l.id),editingID:o,type:"end"}),t.isRunning&&t.cancel()};n.disposer.ad(r);const s=l=>{l.code=="Escape"&&r()};n.disposer.ad(e.keyDownEvent.don(s));const a=new vf(i,e);n.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await n.promise(new Promise(l=>{a.isDestroyed()&&l(),n.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),l()})),n.disposer.ad(e.dblclickEvent.don(()=>l()))}))});return t}ae.copyright=void 0;try{const t="earthsdk3-cesium",n="3.3.0-beta.11",e="2025-08-07T03:21:44.000Z",i="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="4fc1c9db95c3d8a08c72995a4328bf2db103b608",a=((Date.now()-1754536904e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${n}.${r.slice(0,8)}.${e} (距今${a}个小时)
4145
+ `,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},st,t)}class mQ extends p.HasOwner{constructor(n){super(n);const{czmViewer:e}=this.owner;let i;this.dispose(()=>this.owner.hoveredPlaneType="none");const o=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(r=>{const s=i=this._getStartInfo(r.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(r=>{i&&i.currentPlaneType!=="none"&&(o.restart(void 0,e,i),i=void 0)})),this.dispose(e.dblclickEvent.disposableOn(r=>{do{const s=this._getStartInfo(r.pointerEvent);if(!s||s.currentPlaneType==="none")break;const{currentPlaneType:a}=s,l=[...this.owner.selfRotation];l[oi.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(p.createProcessingFromAsyncFunc(async(n,e,i)=>{const o=this.owner.circles[i.currentPlaneType];e.incrementDisabledInputStack(),n.disposer.dispose(()=>e.decrementDisabledInputStack()),n.disposer.dispose(e.pointerMoveEvent.don(r=>{if(i&&r.pointerEvent){const{offsetX:s,offsetY:a}=r.pointerEvent,l=[s,a],{currentPlaneType:c}=i;if(c==="none")return;const h=this.owner.getPlane(c);if(!i.currentV)return;const u=h.pick(l);if(!u||!this.owner.cartesian)return;const A=C.Cartesian3.subtract(i.currentV,this.owner.cartesian,new C.Cartesian3);C.Cartesian3.normalize(A,A);const d=C.Cartesian3.subtract(u,this.owner.cartesian,new C.Cartesian3);if(C.Cartesian3.normalize(d,d),!h.normal||!h.origin)return;const f=xv(A,d,h.normal),g=xv(h.origin,A,h.normal),v=xv(h.origin,d,h.normal);{const y=[...this.owner.selfRotation];y[oi.rotationNum[c]]=i.startRotation+f,this.owner.selfRotation=y,o.circleStartRotation=g,o.circleEndRotation=v}}})),this.owner.movingPlaneType=i.currentPlaneType,n.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),n.disposer.dispose(()=>{o.circleStartRotation=0,o.circleEndRotation=0}),await p.step(n,r=>new Promise((s,a)=>{r.disposer.dispose(a),r.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),r.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(n,e,i,o,r){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,l=this.owner.getPlane(i).pick(o);if(!l)return;const c=C.Cartesian3.distance(s,l),h=r/4,u=h*3/128;if(!(c>=h-u&&c<=h+u))return;const d=C.Cartesian3.distance(e.camera.positionWC,l);n.currentD2c<=d||(n.currentPlaneType=i,n.currentD2c=d,n.currentV=l,n.startRotation=a[oi.rotationNum[i]])}_getStartInfo(n){var h;const{czmViewer:e}=this.owner,i=(h=e.viewer)==null?void 0:h.scene;if(!this.owner.position||!this.owner.cartesian)return;const o=Ui(i,this.owner.cartesian,this.owner.pixelSize);if(!o)return;const{offsetX:r,offsetY:s}=n,a=[r,s],l=n.pointerId,c={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(c,i,"heading",a,o),this._pickPlane(c,i,"pitch",a,o),this._pickPlane(c,i,"roll",a,o),c}}function xv(t,n,e){const i=C.Cartesian3.cross(n,t,new C.Cartesian3);if(i.equals(C.Cartesian3.ZERO))return 0;C.Cartesian3.normalize(i,i);const o=C.Cartesian3.dot(i,e);let r=Math.acos(C.Cartesian3.dot(t,n))*180/Math.PI;return r=o>0?r:-r,r}const ua=class ua extends Fn{constructor(e){super();L(this,"_hoveredPlaneType",this.disposeVar(p.react("none")));L(this,"_movingPlaneType",this.disposeVar(p.react("none")));L(this,"_circles");L(this,"_czmCameraModel");L(this,"_cartesian");L(this,"_planes",{heading:this.disposeVar(new hQ(this)),pitch:this.disposeVar(new AQ(this)),roll:this.disposeVar(new fQ(this))});L(this,"_rotatorRunningResetting");this._czmViewer=e;const i=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new p.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new mQ(this)})),this._circles={heading:this._createRotatorCircle(i,"heading"),pitch:this._createRotatorCircle(i,"pitch"),roll:this._createRotatorCircle(i,"roll")},!!i.viewer){{const r=()=>{this._cartesian=this.position&&dt(this.position)||void 0};r(),this.dispose(this.positionChanged.disposableOn(r))}this._createCameraModel(i)}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get circles(){return this._circles}get czmCameraModel(){return this._czmCameraModel}get cartesian(){return this._cartesian}get czmViewer(){return this._czmViewer}getPlane(e){return this._planes[e]}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createCameraModel(e){this._czmCameraModel=new Ht(e),this._czmCameraModel.url="${earthsdk3-assets-script-dir}/assets/glb/camera1/camera1.gltf",this._czmCameraModel.localRotation=[90,0,0],this._czmCameraModel.allowPicking=!1,this._czmCameraModel.opaquePass="OVERLAY",this.dispose(p.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],i=>i*.1)),this.dispose(p.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(p.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const i=()=>{const o=at({rotation:this.selfRotation});if(!o)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=C.Matrix4.toArray(o))};i(),this.dispose(this.selfRotationChanged.disposableOn(i))}{const i=()=>{this.circles.heading.show=this.enabled,this.circles.pitch.show=this.enabled,this.circles.roll.show=this.enabled,this._czmCameraModel&&(this._czmCameraModel.show=this.enabled&&this.showHelper)};i(),this.dispose(this.enabledChanged.disposableOn(i)),this.dispose(this.showHelperChanged.disposableOn(i))}}_createRotatorCircle(e,i){const o=this.ad(new Is(e));this.dispose(p.track([o,"position"],[this,"position"])),this.dispose(p.track([o,"pixelSize"],[this,"pixelSize"])),this.dispose(p.track([o,"debug"],[this,"debug"])),this.dispose(p.track([o,"rotation"],[this,"rotation"]));{const r=()=>{o.selfRotation=ua.rotationFuncs[i](this.selfRotation),o.circleRotation=this.selfRotation[ua.rotationNum[i]]};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{const s=this.movingPlaneType===i,a=this.hoveredPlaneType===i,c=[0,0,0,s||a?1:.8];c[ua.rotationNum[i]]=1,o.color=c};r(),this.dispose(this.movingPlaneTypeChanged.disposableOn(r)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(r))}return o}};L(ua,"rotationNum",{heading:0,pitch:1,roll:2}),L(ua,"rotationFuncs",{heading:([e,i,o])=>[0,0,0],pitch:([e,i,o])=>[e,0,-90],roll:([e,i,o])=>[e,i+90,0]});let oi=ua;(t=>{t.createDefaultProps=()=>({...Fn.createDefaultProps(),rotation:p.reactArray([0,0,0]),selfRotation:p.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(oi||(oi={})),p.extendClassProps(oi.prototype,oi.createDefaultProps);const ca=class ca extends p.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(n){this.positions=[n??ca.defaults.positions[0],this.stopPosition??ca.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(n){this.positions=[this.startPosition??ca.defaults.positions[0],n??ca.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(n,e){if(super(),!n.viewer)return;const o=this.ad(new Je(n,e));o.arcType="RHUMB";const r=this.ad(new On(n,e));this.ad(p.track([o,"allowPicking"],[this,"allowPicking"])),this.ad(p.track([r,"allowPicking"],[this,"allowPicking"]));{const s=()=>{o.show=r.show=this.show};s(),this.ad(this.showChanged.don(s))}{const s=()=>{o.width=this.width/2,r.pixelSize=this.width};s(),this.ad(this.widthChanged.don(s))}{const s=()=>{o.color=r.color=this.color};s(),this.ad(this.colorChanged.don(s))}{const s=()=>{o.positions=this.positions,r.position=this.stopPosition};s(),this.dispose(this.startPositionChanged.disposableOn(s)),this.dispose(this.stopPositionChanged.disposableOn(s))}}};L(ca,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let ta=ca;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:p.reactPositions(t.defaults.positions),width:10,color:p.reactArray([1,0,0,1])})})(ta||(ta={})),p.extendClassProps(ta.prototype,ta.createDefaultProps);class ar extends Fn{constructor(e){super();L(this,"_lastPosition");L(this,"_opInfo",{step:this.ad(p.react(!1)),moved:this.ad(p.react(!1)),constraintMode:this.disposeVar(p.react("none")),originPosition:this.disposeVar(p.reactArray([0,0,0])),originHeading:this.disposeVar(p.react(0)),originDimensions:this.disposeVar(p.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(p.reactArray([0,0,0])),movingPosition:this.disposeVar(p.reactArray([0,0,0])),targetPosition:this.disposeVar(p.reactArray([0,0,0])),targetHeading:this.disposeVar(p.react(0))});L(this,"_scaleAxis");L(this,"_pickingXYProcessing",e=>this.disposeVar(new p.Processing((i,o,r)=>{const s=[0,0,0],a=new C.Cartographic;return e.pointerMoveEvent.disposableOn(l=>{if(!l.pointerEvent||!e.viewer)return;const c=Xn(p.getDomEventCurrentTargetPos(l.pointerEvent));if(!da(e.viewer.scene,c,this._opInfo.originPosition.value[2],a))return;Aa(a,s),this._opInfo.constraintMode.value==="x"?mo(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?mo(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,s,s):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=s,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const h=[0,0,0];Q.geoRhumbDestination(s,r,o,h),this._opInfo.targetPosition.value=h;let u=this.scale[0],A=this.scale[1];const d=Q.geoDistance(h,this._opInfo.originPosition.value)-Q.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...h];const f=this._opInfo.originDimensions.value[0]/100;d!=0&&this._opInfo.constraintMode.value==="y"&&(d>0?u+=f:u-=f),d!=0&&this._opInfo.constraintMode.value==="x"&&(d>0?A+=f:A-=f),u<=0&&(u+=f),A<=0&&(A+=f),this.scale=[u??1,A??1,this.scale[2]??1]})})));L(this,"_pickingZProcessing",e=>this.disposeVar(new p.Processing(()=>{const i=new C.Cartesian3,o=[0,0,0];return e.pointerMoveEvent.disposableOn(r=>{if(!r.pointerEvent||!e.viewer)return;const s=Xn(p.getDomEventCurrentTargetPos(r.pointerEvent));if(!eh(e.viewer.scene,dt(this._opInfo.originPosition.value),s,i))return;this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(Ue(i,o)){this._opInfo.movingPosition.value=o;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],o[2]+a];let c=this.scale[2];const h=o[2]-this._lastPosition[2];this._lastPosition=[...o];const u=this._opInfo.originDimensions.value[0]/100;h!=0&&(h>0?c+=u:c-=u),c<=0&&(c+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,c??1]}})})));const i=e.viewer;if(!i)return;const{scene:o}=i;this.ad(new Nf(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={zAxis:this._createScaleAxis(e,"zAxis"),yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const c=()=>{if(!this._scaleAxis)return;const{zAxis:h,yAxis:u,xAxis:A}=this._scaleAxis,d=this._opInfo.constraintMode.value,f=this._opInfo.step;h.color=[0,0,1,.99],u.color=[0,1,0,.99],A.color=[1,0,0,.99],d==="x"?A.color=f?[1,1,0,.8]:[1,1,0,.99]:d==="y"?u.color=f?[1,1,0,.8]:[1,1,0,.99]:d==="z"&&(h.color=f?[1,1,0,.8]:[1,1,0,.99])};c(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(c)),this.dispose(this._opInfo.step.changed.disposableOn(c))}{const c=()=>{if(!this._scaleAxis)return;const{position:u=ar.defaults.position}=this,{zAxis:A,yAxis:d,xAxis:f}=this._scaleAxis;A.startPosition=d.startPosition=f.startPosition=u;const[g,v,y]=u;A.stopPosition=[g,v,y+this._opInfo.originDimensions.value[2]];const m=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);m&&(f.stopPosition=m);const w=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);w&&(d.stopPosition=w)};c();const h=this.ad(p.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(h.don(c))}{const c=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((h,u)=>h===this._opInfo.targetPosition.value[u])){this._opInfo.moved.value=!0;return}};c(),this.dispose(this._opInfo.originHeading.changed.disposableOn(c)),this.dispose(this._opInfo.originPosition.changed.disposableOn(c)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(c)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(c))}const r=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(p.createProcessingFromAsyncFunc(async c=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",c.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await p.step(c,async h=>{const u=()=>{const f=[...this.position??ar.defaults.position];e.editingHeightOffset&&(f[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=f};h.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const A={constraintMode:"none",startDragPos:[0,0,0]},d=f=>{if(!this.position)return;const g={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Ff(f,o,g,this.axisSnapPixelSize,A),this._opInfo.constraintMode.value=A.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=A.startDragPos};h.disposer.dispose(e.pointerMoveEvent.disposableOn(f=>{f.pointerEvent&&d(f.pointerEvent)})),await p.step(h,f=>new Promise((g,v)=>{f.disposer.dispose(v),f.disposer.dispose(e.pointerDownEvent.don(y=>{y.pointerEvent&&d(y.pointerEvent),y.pointerEvent&&y.pointerEvent.button===0&&A.constraintMode!=="none"&&g()}))}))}),this._opInfo.step.value=!1,await p.step(c,async h=>{if(e.incrementDisabledInputStack(),h.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const u=Q.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),A=Q.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);r.restart(void 0,u,A),h.disposer.dispose(()=>r.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),h.disposer.dispose(()=>s.cancel()));await p.step(h,u=>new Promise((A,d)=>{u.disposer.dispose(d),u.disposer.dispose(e.pointerUpEvent.don(()=>{A()})),u.disposer.dispose(e.pointerOutEvent.don(()=>{A()}))})),this._lastPosition=void 0});while(!0)})),l=()=>{this.enabled?a.restart():a.isRunning&&a.cancel()};l(),this.dispose(this.enabledChanged.disposableOn(l))}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,i){const o=this.ad(new ta(e));return o.width=10,this.ad(p.track([o,"show"],[this,"enabled"])),o}}(t=>{t.createDefaultProps=()=>({...Fn.createDefaultProps(),scale:p.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(ar||(ar={})),p.extendClassProps(ar.prototype,ar.createDefaultProps);const fo=class fo extends An{constructor(e){super();L(this,"_editingPoints",this.disposeVar(new p.ObservableArray));L(this,"_cancelEvent",this.disposeVar(new p.Event));L(this,"_currentProcess");L(this,"_menuPoiEnabled",this.disposeVar(p.react(!1)));L(this,"_status",this.disposeVar(p.react("None")));L(this,"_positionsChanged",this.ad(new p.Event));L(this,"_cursorInfo");this._czmViewer=e,this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(i=>{for(let{start:o,deleteCount:r,items:s}of i){for(const a of s)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=o;a<o+r;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let i of this.editingPoints)i.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(i=>{this.ad(p.nextAnimateFrame(()=>{var o;((o=i.pointerEvent)==null?void 0:o.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(i=>{this._currentProcess&&(i?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const i=()=>{this.polylineShow=this.czmViewer.editingLineShow};i(),this.ad(this.czmViewer.editingLineShowChanged.don(i))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let i of this._editingPoints)i.position&&e.push([...i.position]);return e}resetPositions(e){if(this.enabled??fo.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const i=e||[];return!(i.length===this.editingPoints.length&&i.every((o,r)=>o.every((s,a)=>{const l=this.editingPoints.get(r);return l.position&&l.position[a]===s})))}forceResetPositions(e){(this.enabled??fo.defaults.enabled)&&(this.enabled=!1),this.resetPositions(e)}get positions(){return this.getPositions()}set positions(e){this.resetPositions(e)}get positionsChanged(){return this._positionsChanged}get czmViewer(){return this._czmViewer}get cursorInfo(){return this._cursorInfo}createPolyline(e){const i=this.ad(new Je(e));this.ad(p.track([i,"color"],[this,"polylineColor"])),this.ad(p.track([i,"width"],[this,"polylineWidth"])),this.ad(p.track([i,"show"],[this,"polylineShow"])),this.ad(p.track([i,"arcType"],[this,"polylineArcType"])),this.ad(p.track([i,"loop"],[this,"loop"]));{const o=()=>{const r=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,r.push(s);i.positions=r};o(),this.ad(this.positionsChanged.don(o))}}_createCursorInfo(e){const i=this._cursorInfo=this.ad(new p.CursorInfo(e.container,p.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const o=this.status;if(i){if(!this.hideCursorInfo){i.show=!1;return}o==="Adding"?(i.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",i.show=!0):o==="Modifying"||o==="Modifying_Point"?(i.text="Esc键或左键双击:退出编辑状态",i.show=!0):o==="None"&&(i.text="",i.show=!1)}}))}};L(fo,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),L(fo,"defaults",{...An.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:fo.baseImageUrl+"point-green.png",otherControlPointImageUrl:fo.baseImageUrl+"point-yellow.png"});let Wn=fo;(t=>{t.createDefaultProps=()=>({...An.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:p.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:t.baseImageUrl+"point-green.png",otherControlPointImageUrl:t.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(Wn||(Wn={})),p.extendClassProps(Wn.prototype,Wn.createDefaultProps);let gQ=0;class YS extends p.Destroyable{constructor(e,i){super();L(this,"_position",this.disposeVar(p.reactArrayWithUndefined(void 0)));L(this,"_id",gQ++);L(this,"_menuPoi");i&&(this.position=i),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const o=this._menuPoi=this.ad(new Sa(e.czmViewer));o.enabled=!1,this.ad(p.track([o,"show"],[e,"enabled"]));{const r=()=>{if(this.position===void 0){o.position=void 0;return}const s=[...this.position];s[2]-=e.czmViewer.editingHeightOffset??0,o.position=s,e.positionsChanged.emit()};r(),this.d(this.positionChanged.don(r))}{const r=()=>{const s=e.editingPoints.indexOf(this)+1;s!==0&&(o.title=`控制点${s}`,s===1?o.imageUri=e.firstControlPointImageUrl??Wn.defaults.firstControlPointImageUrl:o.imageUri=e.otherControlPointImageUrl??Wn.defaults.otherControlPointImageUrl)};r(),this.dispose(e.editingPoints.changedEvent.disposableOn(r))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class JS extends YS{constructor(n,e){super(n,e)}}class Pt extends Wn{constructor(e){super(e);L(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new p.Event));L(this,"placeEditing");if(!e.viewer)return;const i=this.placeEditing=this.ad(new ri(e));i.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async o=>{o.disposer.dispose(()=>{(this.debug??Pt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??Pt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await o.promise(p.step(o,async r=>{const s=r.disposer,a=s.ad(this._addingEditingProcessing());s.dispose(()=>"adding canceled!"),s.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await r.promise(new Promise(l=>{s.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(o=>{var r;((r=o.pointerEvent)==null?void 0:r.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const i=e?e.map(o=>new JS(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??Pt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},i=p.createProcessingFromAsyncFunc(async o=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await o.promise(p.step(o,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new yQ(this,r)));const h=a.disposer.disposeVar(new wQ(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(A=>{A?(r++,u(!0)):u(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(A=>{A?(r--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return i.start(),i}}(t=>{t.createDefaultProps=()=>({...Wn.createDefaultProps()})})(Pt||(Pt={})),p.extendClassProps(Pt.prototype,Pt.createDefaultProps);class yQ extends p.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new p.Event));const{placeEditing:o}=e;let r=new JS(e,void 0);e.editingPoints.splice(i,0,r);const s=()=>{(e.debug??Pt.defaults.debug)&&console.log("delete currentPosEditor");const c=e.editingPoints.indexOf(r);if(c===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(c,1)};if(o.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(p.track([r,"position"],[o,"position"])),o.enabled=!0;let a=!1;const l=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{o.enabled=!1,!a&&l()}),this.dispose(o.overEvent.disposableOnce(()=>{a=!0,r.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??Pt.defaults.debug)&&console.log(`PointAdding creating! index(${i})`),this.dispose(()=>{(e.debug??Pt.defaults.debug)&&console.log(`PointAdding destroying! index(${i})`)})}get overEvent(){return this._overEvent}}function vQ(t,n){const e=t.editingPoints,i=n-1;return i<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(i,1),!0)}class wQ extends p.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new p.Event));L(this,"_doEvent",this.disposeVar(new p.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(vQ(e,i)))),(e.debug??Pt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${i})`),this.dispose(()=>{(e.debug??Pt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${i})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class jS extends Pt{constructor(n){super(n),this.loop=!1}}class eE extends Pt{constructor(n){super(n),this.loop=!0}}class yf extends YS{constructor(n,e){super(n,e);{const{menuPoi:i}=this;i.commands=[["add","增加控制点","",tt.baseImageUrl+"add.png"],["delete","删除当前控制点","",tt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",tt.baseImageUrl+"modify.png"]],i.clickCommandName="modify",i.rightClickCommandName="delete",this.dispose(i.commandEvent.disposableOn(o=>{n.menuPoiCommand(this,o)})),this.dispose(i.dbclickEvent.disposableOn(()=>{n.menuPoiCommand(this,"dbClick")}))}if(n.middlePointShow){const i=this.ad(new ci(n.czmViewer));{i.imageUri=n.firstControlPointImageUrl??tt.defaults.firstControlPointImageUrl,i.tooltip="点击增加一个控制点",i.bgColor=[0,0,0,.6],i.fgColor=[1,1,1,1],i.size=[8,8],i.originRatioAndOffset=[.5,.5,0,0];{const o=()=>{if(!(n.enabled??tt.defaults.enabled)){i.enabled=!1,i.show=!1;return}do{const s=n.editingPoints.indexOf(this);if(s===-1)break;const a=n.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(n.loop??tt.defaults.loop)&&s+1>=a)break;const c=this.position;if(!c)break;let h=(s+1)%a;const A=n.editingPoints.get(h).position;if(!A)break;const d=Rf(c,A);if(!d)break;d[2]-=n.czmViewer.editingHeightOffset??0,i.position=d;const f=n.editingPoints.length<(n.maxPointsNum??tt.defaults.maxPointsNum);i.enabled=f,i.show=f;return}while(!1);i.enabled=!1,i.show=!1};o(),this.dispose(n.positionsChanged.disposableOn(o)),this.dispose(n.loopChanged.disposableOn(o)),this.dispose(n.enabledChanged.disposableOn(o))}this.dispose(i.clickEvent.disposableOn(o=>{if(o.button!==0||n.editingPoints.length>=(n.maxPointsNum??tt.defaults.maxPointsNum))return;const r=n.editingPoints.indexOf(this);if(r===-1)return;const s=i.position?[...i.position]:void 0;s&&(s[2]+=n.czmViewer.editingHeightOffset??0);let a=new yf(n,s);n.editingPoints.splice(r+1,0,a),n.modify(a)}))}}}}class tt extends Wn{constructor(e){super(e);L(this,"_menuPoiCommand",this.disposeVar(new p.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));L(this,"_overEvent",this.disposeVar(new p.Event));L(this,"translationEditing");{const o=this.ad(p.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new p.ObjResettingWithEvent(o,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new bQ(this.editingPoints.get(0),this)}))}const i=this.translationEditing=this.disposeVar(new or(e));i.enabled=!1,this.currentProcess=this.disposeVar(p.createProcessingFromAsyncFunc(async o=>{o.disposer.dispose(()=>{(this.debug??tt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let r=-1;do if((this.debug??tt.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",r=await o.promise(p.step(o,async s=>{const a=s.disposer,l=a.ad(new _Q(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(r===-1||r>=this.editingPoints.length?0:r)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(h=>l.modify(h))),await s.promise(new Promise(h=>{a.dispose(l.overEvent.disposableOnce(u=>{h(u)}))}))})),r===-1){(this.debug??tt.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??tt.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??tt.defaults.loop;const a=this.editingPoints.get(r-1).position;if(!a)return;let l=r%this.editingPoints.length;const h=this.editingPoints.get(l).position;if(!h)return;const u=Rf(a,h);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let A=new yf(this,u);this.editingPoints.splice(r,0,A)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,i){this._menuPoiCommand.emit(e,i)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const i=e?e.map(o=>new yf(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...Wn.createDefaultProps(),moveWithFirstPosition:!1})})(tt||(tt={})),p.extendClassProps(tt.prototype,tt.createDefaultProps);class bQ extends p.Destroyable{constructor(n,e){super(),this._firstPositionEditor=n,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((i,o)=>{if(i===void 0||o===void 0)return;var r=[i[0]-o[0],i[1]-o[1],i[2]-o[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const l=this.multiPointsModifyEditing.editingPoints.get(a),c=l.position;c!==void 0&&(l.position=[c[0]+r[0],c[1]+r[1],c[2]+r[2]])}})}}class _Q extends p.Destroyable{constructor(e){super();L(this,"_overEvent",this.disposeVar(new p.Event));L(this,"_cancelEvent",this.disposeVar(new p.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new p.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let i;const o=()=>{i==null||i.destroy(),i=void 0,e.status="Modifying"};this.dispose(o);const r=s=>{o(),e.status="Modifying_Point",i=new CQ(e,s),i.dispose(i.overEvent.disposableOn(()=>{o()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(r)),this.dispose(e._menuPoiCommand.disposableOn((s,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const l=e.editingPoints.indexOf(s);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(l,1)}else if(a==="modify")r(s);else if(a==="add"){const l=e.editingPoints.indexOf(s);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(l+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(e){this._forceModifyPosEditorEvent.emit(e)}}class CQ extends p.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new p.Event));this._modifying=e,this._posEditor=i,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:o}=this._modifying;if(o.enabled=!0,o.heading=0,this.dispose(()=>{o.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");o.position=this._posEditor.position,this.dispose(p.track([this._posEditor,"position"],[o,"position"])),this.dispose(o.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class tE extends tt{constructor(n){super(n),this.loop=!1}}class nE extends tt{constructor(n){super(n),this.loop=!0}}class ks extends Pt{init(){const n=this.startPosition;if(!n)return;const e=this.distance,i=this.rotation,o=e*Math.cos(i[1]*Math.PI/180),r=Q.geoDestination(n,o,i[0]);if(!r){this.positions=[n];return}const s=e*Math.sin(i[1]*Math.PI/180);r[2]+=s,this.positions=[n,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=r)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const i=Q.geoHeading(this.startPosition,this.endPosition),o=Q.geoDistance(this.startPosition,this.endPosition);if(o<=0){this.rotation=[90,0,0],this.distance=1;return}const r=this.endPosition[2]-this.startPosition[2],s=Math.atan(r/o)*180/Math.PI,a=Math.sqrt(o*o+r*r);this.rotation=[i,s,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Pt.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([90,0,0]),distance:p.react(1)})})(ks||(ks={})),p.extendClassProps(ks.prototype,ks.createDefaultProps);class na extends tt{init(){const n=this.startPosition;if(!n)return;const e=this.distance,i=this.rotation,o=e*Math.cos(i[1]*Math.PI/180),r=Q.geoDestination(n,o,i[0]);if(!r){this.positions=[n];return}const s=e*Math.sin(i[1]*Math.PI/180);r[2]+=s,this.positions=[n,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=r)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",tt.baseImageUrl+"add.png"],["delete","删除当前控制点","",tt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",tt.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let l of this.editingPoints)l.menuPoi.commands=[["delete","删除当前控制点","",tt.baseImageUrl+"delete.png"],["modify","修改当前控制点","",tt.baseImageUrl+"modify.png"]];const i=Q.geoHeading(this.startPosition,this.endPosition),o=Q.geoDistance(this.startPosition,this.endPosition);if(Math.abs(o)<=0){this.rotation=[90,0,0],this.distance=1;return}const r=this.endPosition[2]-this.startPosition[2],s=Math.atan(r/o)*180/Math.PI,a=Math.sqrt(o*o+r*r);this.rotation=[i,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...tt.createDefaultProps(),startPosition:p.reactArrayWithUndefined(void 0),endPosition:p.reactArrayWithUndefined(void 0),rotation:p.reactArray([0,0,0]),distance:p.react(0)})})(na||(na={})),p.extendClassProps(na.prototype,na.createDefaultProps);class iE extends Pt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1}}class rE extends tt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Fs extends Pt{constructor(n){super(n),n.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const i=[...this.positions[0]];i[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(o=>(o[2]-=n.editingHeightOffset??0,[i,o]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(n){const e=this.ad(new Yn(n));e.topOrBottom="bottom",this.ad(p.track([e,"color"],[this,"polylineColor"])),this.ad(p.track([e,"width"],[this,"polylineWidth"])),this.ad(p.track([e,"show"],[this,"polylineShow"])),this.ad(p.track([e,"arcType"],[this,"polylineArcType"])),this.ad(p.track([e,"loop"],[this,"loop"])),this.ad(p.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Pt.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(Fs||(Fs={})),p.extendClassProps(Fs.prototype,Fs.createDefaultProps);class Bs extends tt{constructor(n){if(super(n),!!n.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const i=[...this.positions[0]];i[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(o=>(o[2]-=n.editingHeightOffset??0,[i,o]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(n){const e=this.ad(new Yn(n));e.topOrBottom="bottom",this.ad(p.track([e,"color"],[this,"polylineColor"])),this.ad(p.track([e,"width"],[this,"polylineWidth"])),this.ad(p.track([e,"show"],[this,"polylineShow"])),this.ad(p.track([e,"arcType"],[this,"polylineArcType"])),this.ad(p.track([e,"loop"],[this,"loop"])),this.ad(p.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...tt.createDefaultProps(),visibilityPositions:p.reactPositionsSet(void 0)})})(Bs||(Bs={})),p.extendClassProps(Bs.prototype,Bs.createDefaultProps);class oE extends na{constructor(n){super(n),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.zAxisShow=!0,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class rn extends Q.EngineObject{constructor(e,i,o){super(e,i,o??!0);L(this,"_supportEditing",this.disposeVar(p.react(!0)));L(this,"_currentEditing",this.disposeVar(p.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var r;if(this.currentEditing){if(this.currentEditing instanceof Pt&&((r=this.currentEditing.currentProcess)!=null&&r.isRunning))if(this.currentEditing.currentProcess.cancel(),e!=null&&e.position){if(this.currentEditing.positions.length>1)return;e.position=this.currentEditing.positions[0]??[0,0,0],e!=null&&e.rotation&&(e.rotation=[0,0,0]),e!=null&&e.far&&(e.far=1),e!=null&&e.radius&&(e.radius=1),e!=null&&e.distance&&(e.distance=1)}else e.points=this.currentEditing.positions;this.currentEditing instanceof ri&&this.currentEditing.enabled&&(e.position=[0,0,0])}}))}get supportEditing(){return this._supportEditing.value}set supportEditing(e){this._supportEditing.value=e}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(e){this._currentEditing.value=e}get currentEditingChanged(){return this._currentEditing.changed}}const Uc=class Uc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ri(e));this.ad(e.clickEvent.don(o=>{var r;((r=o.pointerEvent)==null?void 0:r.button)==2&&(i.enabled=!0)}));do{if(Reflect.has(n,"position")){this.ad(p.bind([i,"position"],[n,"position"])),i.enabled=!i.position||Q.equalsN3(i.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};L(Uc,"type",Uc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Place,Uc));let Sv=Uc;const Oc=class Oc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new oi(e));i.rotation=[90,0,0],this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);o&&(this.ad(p.bind([i,"position"],[o.czm3DTiles,"position"])),this.ad(p.bind([i,"selfRotation"],[n,"rotation"])))});break}if(Reflect.has(n,"position")&&Reflect.has(n,"rotation")){this.ad(p.bind([i,"position"],[n,"position"])),this.ad(p.bind([i,"selfRotation"],[n,"rotation"]));break}this.supportEditing=!1}while(!1)}};L(Oc,"type",Oc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Rotation,Oc));let Ev=Oc;const Lc=class Lc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ar(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")&&Reflect.has(n,"scale")){this.ad(p.bind([i,"position"],[n,"position"])),this.ad(p.bind([i,"scale"],[n,"scale"]));break}this.supportEditing=!1}while(!1)}};L(Lc,"type",Lc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Scale,Lc));let Pv=Lc;const zc=class zc extends rn{constructor(n,e){super(Array.isArray(n)?n[0]:n,e,!0);const i=this.currentEditing=this.ad(new or(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(n)){const o=[];for(let r=0;r<n.length;r++){const s=n[r];Reflect.has(s,"position")?o.push(s.position):s.points&&o.push(...s.points)}i.position=Q.getMinMaxCorner(o).center,this.ad(i.positionChanged.disposableOn((r,s)=>{if(!(!r||!s)){var a=dn({originPosition:s},[r])[0][0];n.forEach(l=>{if(Reflect.has(l,"position")){const c=dn({originPosition:s},[l.position])[0][0];l.position=gr({originPosition:s},[[c[0]+a[0],c[1]+a[1],c[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const c=dn({originPosition:s},l.points)[0];l.points=gr({originPosition:s},c.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}})}}));break}if(Reflect.has(n,"position")){this.ad(p.bind([i,"position"],[n,"position"]));break}if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);this.ad(p.bind([i,"position"],[o.czm3DTiles,"position"]))});break}if(Reflect.has(n,"points")){if(n.points===void 0||n.points.length===0){this.destroy();break}i.position=Q.getMinMaxCorner(n.points).center,this.ad(i.positionChanged.disposableOn((o,r)=>{if(o===void 0||r===void 0||n.points===void 0||n.points.length===0){this.destroy();return}var s=dn({originPosition:r},[o])[0][0];const a=dn({originPosition:r},n.points)[0];n.points=gr({originPosition:r},a.map(l=>[l[0]+s[0],l[1]+s[1],l[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};L(zc,"type",zc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Translation,zc));let vf=zc;const Qc=class Qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ks(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")){this.ad(p.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(p.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(p.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(p.bind([i,"distance"],[n,"distance"]));break}const o=dt(n.position);if(C.Cartesian3.ZERO.equals(o)||!e.viewer)return;i.distance=Ui(e.viewer.scene,o,100)??1}while(!1);break}if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1);i.startPosition&&!Q.equalsN3(i.startPosition,[0,0,0])&&i.init(),i.enabled=!0}};L(Qc,"type",Qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsAppend,Qc));let Tv=Qc;const Vc=class Vc extends rn{constructor(n,e){var r;if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new na(e));do{if(Reflect.has(n,"position")){this.ad(p.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(p.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(p.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(p.bind([i,"distance"],[n,"distance"]));break}const s=dt(n.position);if(C.Cartesian3.ZERO.equals(s)||!e.viewer)return;i.distance=Ui(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(n,"points")&&((r=n.points)==null?void 0:r.length)==2){i.moveWithFirstPosition=!1;const s=()=>i.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!i.enabled&&s())),this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1;return}while(!1);i.init(),i.enabled=!0;const o=this.ad(p.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L(Vc,"type",Vc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsModify,Vc));let Iv=Vc;const Hc=class Hc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new eE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Hc,"type",Hc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularAppend,Hc));let kv=Hc;const Nc=class Nc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new nE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Nc,"type",Nc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularInsert,Nc));let Fv=Nc;const Gc=class Gc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new jS(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Gc,"type",Gc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringAppend,Gc));let Bv=Gc;const Wc=class Wc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new tE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Wc,"type",Wc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringInsert,Wc));let Mv=Wc;const qc=class qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new iE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(qc,"type",qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterAppend,qc));let Dv=qc;const Kc=class Kc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new rE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Kc,"type",Kc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterModify,Kc));let Rv=Kc;const Zc=class Zc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Fs(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Zc,"type",Zc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityAppend,Zc));let Uv=Zc;const Xc=class Xc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Bs(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(p.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const o=()=>i.positions=n.points??[];o(),this.ad(n.pointsChanged.don(()=>!i.enabled&&o())),i.enabled=!0,this.ad(p.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Xc,"type",Xc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityModify,Xc));let Ov=Xc;const $c=class $c extends rn{constructor(n,e){if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new oE(e));do{if(Reflect.has(n,"points")){const r=Reflect.has(n,"extrudedHeight"),s=Reflect.has(n,"height"),a=Reflect.has(n,"perPositionHeight")?n.perPositionHeight:!r,l=n instanceof Q.ESClassification||n instanceof Q.ESPolygonFence;let c=Q.getMinMaxCorner(n.points).center,h=[...c],u=l?n.points[0][2]:0;a?r?h[2]=n.extrudedHeight:h[2]=n.height+u:(s&&(c[2]=n.height),r&&(h[2]=n.extrudedHeight)),i.startPosition=c,i.distance=h[2]-c[2],i.moveWithFirstPosition=!1;let A=[...c];this.ad(i.positionsChanged.don(()=>{i.positions.length===2&&(a?(n.points=n.points.map(d=>[d[0],d[1],d[2]+i.positions[0][2]-A[2]]),r?n.extrudedHeight=i.positions[1][2]:s&&(n.height=i.positions[1][2]-(l?i.positions[0][2]:0))):(s&&(n.height=i.positions[0][2]),r&&(n.extrudedHeight=i.positions[1][2])),A=[...i.positions[0]])}));break}this.supportEditing=!1;return}while(!1);i.init(),i.enabled=!0;const o=this.ad(p.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L($c,"type",$c.registerEditing("ESCesiumViewer",Q.ESJEditingMode.HeightModify,$c));let Lv=$c;const on=class on extends p.Destroyable{constructor(e,i,o,r=!0){super();L(this,"czmViewer");L(this,"sceneObject");L(this,"editingModes",[]);L(this,"editingID");L(this,"useKeyToSwitch");L(this,"currentIndex",0);const s=this.czmViewer=e,a=this.sceneObject=i,l=this.editingModes=Array.isArray(o)?[...o]:[o],c=this.editingID=a.editingID;this.useKeyToSwitch=r,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:c,type:"start",add:{modes:l}}),this.ad(a.toDestroyEvent.don(on.stop)),this.ad(s.keyDownEvent.don(h=>{h.code=="Escape"&&on.stop()})),this.createEditingMode(this.currentIndex)}createEditingMode(e){const{sceneObject:i,czmViewer:o,editingID:r}=this,s=new p.Destroyable;this.ad(()=>!s.isDestroyed()&&s.destroy());const a=this.editingModes[e%this.editingModes.length],l=Q.EngineObject.contextEditing.getEngineObjConstructor(a,o.typeName);if(!l||!i.supportEditingModes().includes(a))return this._createNextEditingMode(s,a);const c=new l(i,o);if(s.ad(()=>!c.isDestroyed()&&c.destroy()),c.isDestroyed())return this._createNextEditingMode(s,a);const h=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),p.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(c.toDestroyEvent.don(h)),this.useKeyToSwitch&&s.ad(o.keyDownEvent.don(u=>{u.code=="Space"&&h()})),s.ad(o.dblclickEvent.donce(()=>this.useKeyToSwitch?on.stop():h())),c.supportEditing)o.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:r,type:"changed",add:{cMode:a,cIndex:e}}),o.notSupportEditingCount=0;else return this._createNextEditingMode(s,a)}_createNextEditingMode(e,i){const{sceneObject:o,czmViewer:r,editingID:s}=this;if(!e.isDestroyed()&&e.destroy(),console.log(`未找到编辑模式或不支持当前编辑模式${i},已跳过当前编辑模式,请检查输入`),r.editingEvent.emit({objectIDs:[o.parentID??o.id],editingID:s,type:"changedFailed",add:{cMode:i,cIndex:this.currentIndex}}),r.notSupportEditingCount++,r.notSupportEditingCount==this.editingModes.length)return on.stop();p.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})}static create(e,i,o,r=!0){on.stop(),on.currentEditingInstance=new on(e,i,o,r)}static stop(){if(on.currentEditingInstance&&!on.currentEditingInstance.isDestroyed()){if(!on.currentEditingInstance)return;const{czmViewer:e,sceneObject:i,editingID:o,editingModes:r}=on.currentEditingInstance;on.currentEditingInstance.destroy(),e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:o,type:"end",add:{modes:r}})}on.currentEditingInstance=void 0}};L(on,"currentEditingInstance");let wf=on;function xQ(){const t=p.createProcessingFromAsyncFunc(async(n,e,i,o,r=!0)=>{const s=Array.isArray(o)?[...o]:[o],a=i.editingID;e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"start",add:{modes:s}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"end",add:{modes:s}}),t.isRunning&&t.cancel()};n.disposer.ad(l),n.disposer.ad(i.toDestroyEvent.don(l));const c=u=>{u.code=="Escape"&&l()};n.disposer.ad(e.keyDownEvent.don(c));let h=0;do{const u=s[h%s.length],A=await p.step(n,async d=>{const f=d.disposer,g=Q.EngineObject.contextEditing.getEngineObjConstructor(u,e.typeName);if(!g||!i.supportEditingModes().includes(u))return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;const v=new g(i,e);if(f.ad(()=>{!v.isDestroyed()&&v.destroy()}),v.supportEditing)e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;return await d.promise(new Promise(m=>{if(v.isDestroyed()&&m(!1),f.ad(v.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),m(!1)})),r){const w=_=>{_.code=="Space"&&(console.log(`编辑模式${u}结束`),m(!1))};f.ad(e.keyDownEvent.don(w)),f.ad(e.dblclickEvent.don(()=>m(!0)))}}))});if(r&&A||!r&&h==s.length-1||e.notSupportEditingCount==s.length)break;h++}while(!0)});return t}function aE(){const t=p.createProcessingFromAsyncFunc(async(n,e,i,o)=>{e.editingEvent.emit({objectIDs:i.map(l=>l.parentID??l.id),editingID:o,type:"start"});const r=()=>{e.editingEvent.emit({objectIDs:i.map(l=>l.parentID??l.id),editingID:o,type:"end"}),t.isRunning&&t.cancel()};n.disposer.ad(r);const s=l=>{l.code=="Escape"&&r()};n.disposer.ad(e.keyDownEvent.don(s));const a=new vf(i,e);n.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await n.promise(new Promise(l=>{a.isDestroyed()&&l(),n.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),l()})),n.disposer.ad(e.dblclickEvent.don(()=>l()))}))});return t}ae.copyright=void 0;try{const t="earthsdk3-cesium",n="3.3.0-beta.11",e="2025-08-07T03:50:52.000Z",i="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="74763c45d16892034482b10dcc96c5b026d4ad5c",a=((Date.now()-1754538652e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${n}.${r.slice(0,8)}.${e} (距今${a}个小时)
4146
4146
  %c${o?o+`
4147
4147
  `:""}当前网站正在使用${t},此软件版权归${i}所有
4148
- `;ae.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","4fc1c9db95c3d8a08c72995a4328bf2db103b608")},get info(){return l},get date(){return"2025-08-07T03:21:44.000Z"},get author(){return"suplyang"},get version(){return"3.3.0-beta.11"},get name(){return"earthsdk3-cesium"},get commitId(){return"4fc1c9db95c3d8a08c72995a4328bf2db103b608"},print(){console.info(this.info,`
4148
+ `;ae.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","74763c45d16892034482b10dcc96c5b026d4ad5c")},get info(){return l},get date(){return"2025-08-07T03:50:52.000Z"},get author(){return"suplyang"},get version(){return"3.3.0-beta.11"},get name(){return"earthsdk3-cesium"},get commitId(){return"74763c45d16892034482b10dcc96c5b026d4ad5c"},print(){console.info(this.info,`
4149
4149
  font-size: 18px;
4150
4150
  font-weight: 1000;
4151
4151
  line-height: 1;
@@ -4413,8 +4413,8 @@ class Hb extends N {
4413
4413
  }
4414
4414
  e.setStatus("Created"), e.setStatusLog("成功创建Cesium视口!"), s(u);
4415
4415
  }));
4416
- r.start(i), r.errorEvent.don(() => {
4417
- e.setStatus("Error"), e.setStatusLog("创建Cesium视口失败!");
4416
+ r.start(i), r.errorEvent.don((a) => {
4417
+ console.log(a, "ccccccc"), e.setStatus("Error"), e.setStatusLog("创建Cesium视口失败!");
4418
4418
  });
4419
4419
  }
4420
4420
  }
@@ -49137,7 +49137,7 @@ function kz() {
49137
49137
  }
49138
49138
  let Zp;
49139
49139
  try {
49140
- const t = "earthsdk3-cesium", i = "3.3.0-beta.11", e = "2025-08-07T03:21:44.000Z", s = "北京西部世界科技有限公司", n = "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn", o = "4fc1c9db95c3d8a08c72995a4328bf2db103b608", a = ((Date.now() - 1754536904e3) / 36e5).toFixed(1), l = `%c🌏 ${t}%c ${i}.${o.slice(0, 8)}.${e} (距今${a}个小时)
49140
+ const t = "earthsdk3-cesium", i = "3.3.0-beta.11", e = "2025-08-07T03:50:52.000Z", s = "北京西部世界科技有限公司", n = "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn", o = "74763c45d16892034482b10dcc96c5b026d4ad5c", a = ((Date.now() - 1754538652e3) / 36e5).toFixed(1), l = `%c🌏 ${t}%c ${i}.${o.slice(0, 8)}.${e} (距今${a}个小时)
49141
49141
  %c${n ? n + `
49142
49142
  ` : ""}当前网站正在使用${t},此软件版权归${s}所有
49143
49143
  `;
@@ -49151,7 +49151,7 @@ try {
49151
49151
  },
49152
49152
  // @ts-ignore
49153
49153
  get gituri() {
49154
- return GITURI_ && GITURI_.replace("${commitId}", "4fc1c9db95c3d8a08c72995a4328bf2db103b608");
49154
+ return GITURI_ && GITURI_.replace("${commitId}", "74763c45d16892034482b10dcc96c5b026d4ad5c");
49155
49155
  },
49156
49156
  // @ts-ignore
49157
49157
  get info() {
@@ -49159,7 +49159,7 @@ try {
49159
49159
  },
49160
49160
  // @ts-ignore
49161
49161
  get date() {
49162
- return "2025-08-07T03:21:44.000Z";
49162
+ return "2025-08-07T03:50:52.000Z";
49163
49163
  },
49164
49164
  // @ts-ignore
49165
49165
  get author() {
@@ -49175,7 +49175,7 @@ try {
49175
49175
  },
49176
49176
  // @ts-ignore
49177
49177
  get commitId() {
49178
- return "4fc1c9db95c3d8a08c72995a4328bf2db103b608";
49178
+ return "74763c45d16892034482b10dcc96c5b026d4ad5c";
49179
49179
  },
49180
49180
  print() {
49181
49181
  console.info(
@@ -166,7 +166,7 @@ material.alpha = materialInput.color.a;
166
166
 
167
167
  return material;
168
168
  }
169
- `;d.Material.GlobeLevelMaterialType="GlobelLevel",d.Material._materialCache.addMaterial(d.Material.GlobeLevelMaterialType,{fabric:{type:d.Material.GlobeLevelMaterialType,uniforms:{input_shadows:new d.Cartesian3(0,0,0),input_highlights:new d.Cartesian3(1,1,1),midtones:new d.Cartesian3(.5,.5,.5),output_shadows:new d.Cartesian3(0,0,0),output_highlights:new d.Cartesian3(1,1,1)},source:k_},translucent:!1});const{PrimitiveRenderResources:F_,ModelUtility:z_,Cartesian3:Qt,Matrix4:or,ModelRenderResources:L_,defined:N_,NodeRenderResources:O_,BoundingSphere:Wi,ModelDrawCommands:V_}=d,U_=new Qt,W_=new Qt,Zm=new Qt,Qm=new Qt;class G_ extends F_{constructor(i,e,n){if(super(i,e),!i.runtimeNode.instancingTranslationMin||!i.runtimeNode.instancingTranslationMax)return;const r=or.inverse(n,new or),o=z_.getPositionMinMax(e.primitive,or.multiplyByPoint(r,i.runtimeNode.instancingTranslationMin,Zm),or.multiplyByPoint(r,i.runtimeNode.instancingTranslationMax,Qm));this.positionMin=Qt.clone(o.min,new Qt),this.positionMax=Qt.clone(o.max,new Qt),this.boundingSphere=Wi.fromCornerPoints(this.positionMin,this.positionMax,new Wi)}}function H_(){d.ModelSceneGraph.prototype.buildDrawCommands=function(t){const i=this._model,e=new L_(i);i.statistics.clear(),this.configurePipeline(t);const n=this.modelPipelineStages;let r,o,s;for(r=0;r<n.length;r++)n[r].process(e,i,t);const a=Qt.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,U_),c=Qt.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,W_);for(r=0;r<this._runtimeNodes.length;r++){const h=this._runtimeNodes[r];if(!N_(h))continue;h.configurePipeline();const p=h.pipelineStages,u=new O_(e,h);for(o=0;o<p.length;o++)p[o].process(u,h.node,t);const f=h.computedTransform;for(o=0;o<h.runtimePrimitives.length;o++){const m=h.runtimePrimitives[o];m.configurePipeline(t);const g=m.pipelineStages,y=new G_(u,m,f);for(s=0;s<g.length;s++)g[s].process(y,m.primitive,t);m.boundingSphere=Wi.clone(y.boundingSphere,new Wi);const _=or.multiplyByPoint(f,y.positionMin,Zm),S=or.multiplyByPoint(f,y.positionMax,Qm);Qt.minimumByComponent(a,_,a),Qt.maximumByComponent(c,S,c);const C=V_.buildModelDrawCommand(y,t);m.drawCommand=C}}this._boundingSphere=Wi.fromCornerPoints(a,c,new Wi),this._boundingSphere=Wi.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=Wi.transform(this._boundingSphere,this._components.transform,this._boundingSphere),i._boundingSphere=Wi.transform(this._boundingSphere,i.modelMatrix,i._boundingSphere),i._initialRadius=i._boundingSphere.radius,i._boundingSphere.radius*=i._clampedScale}}const oa=class oa extends l.Destroyable{constructor(){super(),d.ParticleSystem.prototype.update=function(i){const e=i.time;i.time=this._falseTime;try{oa.oldUpdate.call(this,i),this._particles.forEach(n=>{d.Billboard.prototype&&(n._billboard.ESSceneObjectID=this.ESSceneObjectID)})}catch{}i.time=e},this.d(()=>{d.ParticleSystem.prototype.update=oa.oldUpdate})}};v(oa,"oldUpdate",d.ParticleSystem.prototype.update);let Pd=oa;function q_(){if(d.ParticleSystem.prototype.timeStamp!==void 0){console.warn("fixParticleSystem已经执行过!");return}Object.defineProperties(d.ParticleSystem.prototype,{timeStamp:{get(){return this._innerCurrentTimeStamp===void 0&&(this._innerCurrentTimeStamp=0),this._innerCurrentTimeStamp},set(t){this.timeStamp!==t&&(this._innerCurrentTimeStamp=t,d.JulianDate.fromDate(new Date(t),this._falseTime))}},_falseTime:{get(){return this.__falseTime||(this.__falseTime=d.JulianDate.fromDate(new Date(0))),this.__falseTime}}})}class $_{constructor(i){v(this,"index");v(this,"image");v(this,"resolve");v(this,"reject");v(this,"rectangle");this.index=i.index,this.image=i.image,this.resolve=i.resolve,this.reject=i.reject,this.rectangle=void 0}}function X_(){d.TextureAtlas.prototype._resize=function(t,i=0){const e=this._borderWidthInPixels,n=this._rectangles,r=this._imagesToAddQueue,o=this._texture;let s=o.width,a=o.height;const c=this._subRegions,h=n.map((S,C)=>new $_({index:C,image:S})).filter((S,C)=>d.defined(S.image)&&!d.defined(c.get(C)));let p=0,u=0,f=0;for(let S=i;S<r.length;++S){const{width:C,height:E}=r[S].image;p=Math.max(p,C),u=Math.max(u,E),f+=C*E,h.push(r[S])}s=Math.max(p,s),a=Math.max(u,a),t.webgl2||(s=d.Math.nextPowerOfTwo(s),a=d.Math.nextPowerOfTwo(a));const m=Math.sqrt(f);a*=Math.ceil(m/a),s*=Math.ceil(m/s),h.sort(({image:S},{image:C})=>C.height*C.width-S.height*S.width);const g=new Array(this._nextIndex);for(const S of this._subRegions.keys())d.defined(c.get(S))&&(g[S]=n[S]);let y,_=!1;for(;!_;){y=new d.TexturePacker({height:a,width:s,borderPadding:e});let S;for(S=0;S<h.length;++S){const{index:C,image:E}=h[S];if(!d.defined(E))continue;const M=y.pack(C,E);if(!d.defined(M)){s>a?a*=2:s*=2;break}g[C]=M.rectangle}_=S===h.length}this._texturePacker=y,this._texture=this._copyFromTexture(t,s,a,g),o.destroy(),this._rectangles=g,this._guid=d.createGuid()}}S_(),E_(),A_(),I_(),R_(),b_(),x_(),__(),H_(),q_(),X_(),d.Camera.DEFAULT_VIEW_RECTANGLE=d.Rectangle.fromDegrees(70,5,140,55);function Y_(){return new Promise((t,i)=>d.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class Z_ extends l.Destroyable{constructor(i,e,n,r){super();const o=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const c=Ut(a);if(c&&(c.destroy(),_d(a,void 0)),d.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let h=a.scene.context._originalGLContext;h.canvas.width=h.canvas.height=1,h.getExtension("WEBGL_lose_context").loseContext(),h=null}a.destroy(),n(void 0)}};this.d(o);const s=this.dv(l.createProcessingFromAsyncFunc(async(a,c)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const h=P_;await a.promise(Y_());const p=await a.promise(l.createCancelablePromise(h(c,r)));p.scene._xbsjOriginSkyAtmosphere=p.scene.skyAtmosphere,p.scene._xbsjOriginSkyBox=p.scene.skyBox,p.clockViewModel.currentTime=d.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const u=d.JulianDate.fromDate(new Date(e.currentTime));d.JulianDate.equals(u,p.clockViewModel.currentTime)||(p.clockViewModel.currentTime=u)})),this.dispose(fi(p.clockViewModel,"currentTime",u=>{const f=d.JulianDate.toDate(p.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const u=new ev(p,e);_d(p,u)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),n(p)}));s.start(i),s.errorEvent.don(()=>{e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const Q_=new d.EllipsoidTerrainProvider;class Km extends l.Destroyable{constructor(e){super();v(this,"_terrainMap",new Map);v(this,"_nextAnimateFrame",this.dv(l.createNextAnimateFrame()));v(this,"selectedTerrain");this._viewer=e;const n=this._viewer,r=n.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{r&&r()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let o=Number.MIN_SAFE_INTEGER;for(let s of this._terrainMap.keys())s.sceneObject.activate=!1,(s.sceneObject.show??!0)&&s.sceneObject.zIndex>=o&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${s.sceneObject.name}(${s.sceneObject.id})`),o=s.sceneObject.zIndex,this.selectedTerrain=s);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),n.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??Q_,n.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,n.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,n.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?l.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,n.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?l.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1}))}_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 l.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 r=this.ad(l.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));this.d(r.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 Jm extends l.Destroyable{constructor(e){super();v(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 Xe?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`this._labelMap[${n}].has(poi)`,e);return}const r=new l.Destroyable;{const o=r.dv(l.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));r.dispose(o.don(()=>{this._updateZOrder()}))}this._labelMap[n].set(e,()=>r.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Xe?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`!this._labelMap[${n}].has(poi)`,e);return}const r=this._labelMap[n].get(e);if(!r){console.error("!disposeFunc");return}r(),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 r={};for(const a of e.keys())r[a.zOrder]||(r[a.zOrder]=new Map),r[a.zOrder].set(a,a instanceof Xe?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const o=Object.keys(r).sort((a,c)=>n=="div"?Number(c)-Number(a):Number(a)-Number(c));let s=e.size;for(let a=0;a<o.length;a++)new Map([...r[o[a]]].sort((h,p)=>Number(p[1])-Number(h[1]))).forEach((h,p)=>{p instanceof Xe&&p.czmDivPoi&&(p.czmDivPoi.zOrder=s),p instanceof qi&&p.canvasObj&&(p.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class K_ extends l.Destroyable{constructor(e){super();v(this,"_czmImageryLayerWrappers",new Set);v(this,"_zIndexChangedEvent",this.dv(new l.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const n=[...this.czmImageryLayerWrappers.values()];n.sort((r,o)=>{const s=r.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex,a=o.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex;return s-a});for(const r of n)this.viewer.imageryLayers.raiseToTop(r.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 J_ extends l.Destroyable{constructor(e){super();v(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,r=n.manager.czmImageriesManager;r.add(this),this.d(()=>r.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>r.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class B_ extends l.Destroyable{constructor(e){super();v(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new l.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new J_(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class j_ extends l.Destroyable{constructor(e,n){super();v(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=n,this._czmImageryLayerWrapperObjResetting=this.dv(new l.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new B_(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class Bm extends l.Destroyable{constructor(e){super();v(this,"_czmImageryWrappers",new Set);v(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new K_(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 j_(e,this))}delete(e){for(const n of this.czmImageryWrappers)if(n.imagery===e){this.czmImageryWrappers.delete(n);return}console.warn("imageriesManager delete error!",e)}}class jm extends l.Destroyable{constructor(e){super();v(this,"_pause",this.disposeVar(l.react(!1)));v(this,"_pickPositionTasks",[]);v(this,"_pickTasks",[]);v(this,"pickHeightMustGreaterThanZero",!0);v(this,"objectsToExclude",[]);const n=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 r=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let h of a){const[p,u,f,m]=h;try{(async()=>{const{scene:g,camera:y}=n,_=Ee(p),S=y.getPickRay(_);do{if(!S)break;let C;if(u?C=await g.pickFromRayMostDetailed(S,this.objectsToExclude):C=g.pickFromRay(S,this.objectsToExclude),!C||!C.position)break;const E=ce(C.position);if(!E){m(new Error("positionFromCartesian failed"));return}f(E);return}while(!1);if(S&&!(g.terrainProvider instanceof d.EllipsoidTerrainProvider)){const C=g.globe.pick(S,g);if(!C){m(new Error("scene.globe.pick failed"));return}const E=ce(C);if(!E){m(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&E[2]<0&&(E[2]=0),f(E);return}{const C=g.terrainProvider instanceof d.EllipsoidTerrainProvider?g.terrainProvider.tilingScheme.ellipsoid:n.scene.globe.ellipsoid,E=n.camera.pickEllipsoid(Ee(p),C);if(!E){m(new Error("Pick failed"));return}const M=ce(E);if(!M){m(new Error("positionFromCartesian failed"));return}f(M)}})()}catch(g){m(g)}}const c=[...this._pickTasks];this._pickTasks.length=0;for(let h of c){const[p,u,f,m,g]=h;e.pickCustomAttachedInfo=f;try{(async()=>{var D,b,x;let y=n.scene.pick(Ee(p),u&&u[0],u&&u[1]);!y&&d.defined(n.scene.globe)&&(y=await eS(n,Ee(p)));let _;if(y&&y instanceof d.Cesium3DTileFeature){_={};try{y&&y.getPropertyIds().forEach(W=>{_&&(_[W]=y.getProperty(W))})}catch(z){console.warn(z)}}let S;do{if(!y)break;if(y.id&&y.id instanceof d.Entity&&y.id.ESSceneObjectID){S=y.id.ESSceneObjectID;break}if(y.primitive&&y.primitive.ESSceneObjectID){S=y.primitive.ESSceneObjectID;break}if(Array.isArray(y)&&y[0]instanceof d.ImageryLayerFeatureInfo){S=y[0].imageryLayer.ESSceneObjectID;break}}while(!1);let C=S?w.ESSceneObject.getSceneObject(S):void 0;C&&C.parentID&&(C=w.ESSceneObject.getSceneObject(C.parentID));let E={};if(C&&Reflect.has(C,"allowPicking")&&Reflect.has(C,"pickedEvent")&&(C.allowPicking??!1)){do{if(C instanceof w.ESEntityCluster){const z=new d.JulianDate;E=y.id instanceof d.Entity?{name:y.id.label.text.getValue(z),properties:(D=y.id.properties)==null?void 0:D.getValue(z),coordinates:us(y.id.position.getValue(z))}:(b=y.id)==null?void 0:b.map(W=>{var O;return{name:W.id,properties:(O=W.properties)==null?void 0:O.getValue(z),coordinates:us(W.position.getValue(z))}});break}if(C instanceof w.ESGeoJson){const z=new d.JulianDate;if(!y.id.entityCollection)return;const W=y.id.polygon?"Polygon":y.id.polyline?"LineString":"Point",O=((x=y.id.properties)==null?void 0:x.getValue(z))??{},L=W=="Point"?ce(y.id.position.getValue(z)):W=="LineString"?y.id.polyline.positions.getValue(z).map(U=>ce(U)):td(y.id.polygon.hierarchy.getValue(z));E=C.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:W,coordinates:L},properties:O}:{type:W,coordinates:L,properties:O};break}if(C instanceof w.ESGltfModel){let z;Reflect.has(y,"featureId")?z=y.featureId:Reflect.has(y,"instanceId")&&(z=y.instanceId),z&&(y.id=y.primitive.structuralMetadata.getPropertyTable(0).getProperty(y.instanceId,"id"))}}while(!1);C.pickedEvent.emit(new w.ESJPickedResult(y,C,_,E,f,p))}C&&Reflect.has(C,"allowPicking")&&!C.allowPicking&&m(new w.ESJPickedResult);const M=new w.ESJPickedResult(y,C,_,E,f,p);m(M)})()}catch(y){g(y)}}};let o=n.scene.postRender.addEventListener(r);const s=()=>{o&&o(),o=void 0};this.ad(s),this.ad(this.pauseChanged.don(a=>{a?s():o=n.scene.postRender.addEventListener(r)}))}}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,r)=>{this._pickPositionTasks.push([e,!0,n,r])})}quickPickPosition(e){return new Promise((n,r)=>{this._pickPositionTasks.push([e,!1,n,r])})}pick(e,n,r){return new Promise((o,s)=>{this._pickTasks.push([e,n,r,o,s])})}}function eS(t,i){const e=t.scene,n=e.camera.getPickRay(i);if(!n)return;const r=e.imageryLayers.pickImageryLayerFeatures(n,e);if(d.defined(r))return r}class tS extends l.Destroyable{constructor(e){super();v(this,"_enabled",this.disposeVar(l.react(!1)));v(this,"_cursorPosition",l.react(void 0));v(this,"quickPickPosition",!0);let n=new l.Destroyable;const r=()=>{n&&(n.destroy(),n=void 0)};this.dispose(r);const o=()=>{if(r(),!this._enabled.value||!e)return;const s=Ut(e);if(!s)return;n=new l.Destroyable;const a=n.disposeVar(l.react(void 0)),c=n.disposeVar(l.createNextAnimateFrameEvent(a.changed));n.dispose(s.czmViewer.pointerMoveEvent.disposableOn(p=>{p.pointerEvent&&(a.value=l.getDomEventCurrentTargetPos(p.pointerEvent))}));const h=n.disposeVar(l.createProcessingFromAsyncFunc(async p=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const u=await p.promise(l.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=u}else{const u=await p.promise(l.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=u}}));n.dispose(c.disposableOn(()=>{h.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}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}}function Ut(t){return l.getExtProp(t,"_viewerExtensions")}function _d(t,i){l.setExtProp(t,"_viewerExtensions",i)}class ev extends l.Destroyable{constructor(e,n){super();v(this,"_imageriesManager");v(this,"_terrainManager");v(this,"_labelManager");v(this,"_pickingManager");v(this,"_poiContext");v(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=n,this._imageriesManager=this.dv(new Bm(this.viewer)),this._terrainManager=this.dv(new Km(this.viewer)),this._labelManager=this.dv(new Jm(this.viewer)),this._poiContext=this.disposeVar(new Pv(this._viewer)),this._cursorPositionInfo=this.disposeVar(new tS(this._viewer)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new jm(n))}))}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}}var tv=new d.Cartesian3,iv=new d.Cartesian3;function nv(t,i,e){let n=d.Matrix4.clone(t.transform);t.lookAtTransform(d.Matrix4.IDENTITY);var r=t.positionCartographic.height,o=t.positionWC,s=d.Cartesian3.normalize(o,tv),a=d.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var c=d.Cartesian3.cross(t.direction,s,iv);else var c=d.Cartesian3.cross(t.up,s,iv);var h=c;if(e){var p=d.Cartesian3.cross(s,c,tv);h=p}var u=d.Cartesian3.magnitude(o);t.rotate(h,i/u);var f=t.positionCartographic,m=f.longitude,g=f.latitude;d.Cartesian3.fromRadians(m,g,r,void 0,t.position),t.lookAtTransform(n)}function ov(t,i){nv(t,i,!1)}function rv(t,i){nv(t,-i,!0)}class iS extends l.Destroyable{constructor(e){super();v(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:n}=this,{viewer:r}=n.firstPersonController,{camera:o}=r;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 c=()=>{const h=Date.now(),p=h-a;a=h;const u=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&o.moveForward(p*u),s.MoveBackword&&o.moveBackward(p*u),s.MoveLeft&&o.moveLeft(p*u),s.MoveRight&&o.moveRight(p*u)):(s.MoveForward&&ov(o,p*u),s.MoveBackword&&ov(o,-p*u),s.MoveLeft&&rv(o,-p*u),s.MoveRight&&rv(o,p*u));{const{rotateSpeed:f}=this.controller,m=d.Math.toRadians(f*p);s.RotateRight?o.lookRight(m):s.RotateLeft?o.lookRight(-m):s.RotateUp?o.lookDown(-m):s.RotateDown&&o.lookDown(m)}};r.scene.preUpdate.addEventListener(c),this.dispose(()=>r.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:r}=this;this._resetActions();const{keyStatusMap:o}=this.running.keyboardCameraController;for(let s of n.currentKeyIds)r[o[s]]=!0}}class pc extends l.Destroyable{constructor(e){super();v(this,"_currentKeyIds",new Set);v(this,"_currentKeyIdsChanged",this.dv(new l.Event));v(this,"_debug",this.dv(l.react(!1)));v(this,"_debugResetting",this.dv(new l.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends l.Destroyable{constructor(e){super();const n=()=>{console.log([...e.currentKeyIds].join(`
169
+ `;d.Material.GlobeLevelMaterialType="GlobelLevel",d.Material._materialCache.addMaterial(d.Material.GlobeLevelMaterialType,{fabric:{type:d.Material.GlobeLevelMaterialType,uniforms:{input_shadows:new d.Cartesian3(0,0,0),input_highlights:new d.Cartesian3(1,1,1),midtones:new d.Cartesian3(.5,.5,.5),output_shadows:new d.Cartesian3(0,0,0),output_highlights:new d.Cartesian3(1,1,1)},source:k_},translucent:!1});const{PrimitiveRenderResources:F_,ModelUtility:z_,Cartesian3:Qt,Matrix4:or,ModelRenderResources:L_,defined:N_,NodeRenderResources:O_,BoundingSphere:Wi,ModelDrawCommands:V_}=d,U_=new Qt,W_=new Qt,Zm=new Qt,Qm=new Qt;class G_ extends F_{constructor(i,e,n){if(super(i,e),!i.runtimeNode.instancingTranslationMin||!i.runtimeNode.instancingTranslationMax)return;const r=or.inverse(n,new or),o=z_.getPositionMinMax(e.primitive,or.multiplyByPoint(r,i.runtimeNode.instancingTranslationMin,Zm),or.multiplyByPoint(r,i.runtimeNode.instancingTranslationMax,Qm));this.positionMin=Qt.clone(o.min,new Qt),this.positionMax=Qt.clone(o.max,new Qt),this.boundingSphere=Wi.fromCornerPoints(this.positionMin,this.positionMax,new Wi)}}function H_(){d.ModelSceneGraph.prototype.buildDrawCommands=function(t){const i=this._model,e=new L_(i);i.statistics.clear(),this.configurePipeline(t);const n=this.modelPipelineStages;let r,o,s;for(r=0;r<n.length;r++)n[r].process(e,i,t);const a=Qt.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,U_),c=Qt.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,W_);for(r=0;r<this._runtimeNodes.length;r++){const h=this._runtimeNodes[r];if(!N_(h))continue;h.configurePipeline();const p=h.pipelineStages,u=new O_(e,h);for(o=0;o<p.length;o++)p[o].process(u,h.node,t);const f=h.computedTransform;for(o=0;o<h.runtimePrimitives.length;o++){const m=h.runtimePrimitives[o];m.configurePipeline(t);const g=m.pipelineStages,y=new G_(u,m,f);for(s=0;s<g.length;s++)g[s].process(y,m.primitive,t);m.boundingSphere=Wi.clone(y.boundingSphere,new Wi);const _=or.multiplyByPoint(f,y.positionMin,Zm),S=or.multiplyByPoint(f,y.positionMax,Qm);Qt.minimumByComponent(a,_,a),Qt.maximumByComponent(c,S,c);const C=V_.buildModelDrawCommand(y,t);m.drawCommand=C}}this._boundingSphere=Wi.fromCornerPoints(a,c,new Wi),this._boundingSphere=Wi.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=Wi.transform(this._boundingSphere,this._components.transform,this._boundingSphere),i._boundingSphere=Wi.transform(this._boundingSphere,i.modelMatrix,i._boundingSphere),i._initialRadius=i._boundingSphere.radius,i._boundingSphere.radius*=i._clampedScale}}const oa=class oa extends l.Destroyable{constructor(){super(),d.ParticleSystem.prototype.update=function(i){const e=i.time;i.time=this._falseTime;try{oa.oldUpdate.call(this,i),this._particles.forEach(n=>{d.Billboard.prototype&&(n._billboard.ESSceneObjectID=this.ESSceneObjectID)})}catch{}i.time=e},this.d(()=>{d.ParticleSystem.prototype.update=oa.oldUpdate})}};v(oa,"oldUpdate",d.ParticleSystem.prototype.update);let Pd=oa;function q_(){if(d.ParticleSystem.prototype.timeStamp!==void 0){console.warn("fixParticleSystem已经执行过!");return}Object.defineProperties(d.ParticleSystem.prototype,{timeStamp:{get(){return this._innerCurrentTimeStamp===void 0&&(this._innerCurrentTimeStamp=0),this._innerCurrentTimeStamp},set(t){this.timeStamp!==t&&(this._innerCurrentTimeStamp=t,d.JulianDate.fromDate(new Date(t),this._falseTime))}},_falseTime:{get(){return this.__falseTime||(this.__falseTime=d.JulianDate.fromDate(new Date(0))),this.__falseTime}}})}class $_{constructor(i){v(this,"index");v(this,"image");v(this,"resolve");v(this,"reject");v(this,"rectangle");this.index=i.index,this.image=i.image,this.resolve=i.resolve,this.reject=i.reject,this.rectangle=void 0}}function X_(){d.TextureAtlas.prototype._resize=function(t,i=0){const e=this._borderWidthInPixels,n=this._rectangles,r=this._imagesToAddQueue,o=this._texture;let s=o.width,a=o.height;const c=this._subRegions,h=n.map((S,C)=>new $_({index:C,image:S})).filter((S,C)=>d.defined(S.image)&&!d.defined(c.get(C)));let p=0,u=0,f=0;for(let S=i;S<r.length;++S){const{width:C,height:E}=r[S].image;p=Math.max(p,C),u=Math.max(u,E),f+=C*E,h.push(r[S])}s=Math.max(p,s),a=Math.max(u,a),t.webgl2||(s=d.Math.nextPowerOfTwo(s),a=d.Math.nextPowerOfTwo(a));const m=Math.sqrt(f);a*=Math.ceil(m/a),s*=Math.ceil(m/s),h.sort(({image:S},{image:C})=>C.height*C.width-S.height*S.width);const g=new Array(this._nextIndex);for(const S of this._subRegions.keys())d.defined(c.get(S))&&(g[S]=n[S]);let y,_=!1;for(;!_;){y=new d.TexturePacker({height:a,width:s,borderPadding:e});let S;for(S=0;S<h.length;++S){const{index:C,image:E}=h[S];if(!d.defined(E))continue;const M=y.pack(C,E);if(!d.defined(M)){s>a?a*=2:s*=2;break}g[C]=M.rectangle}_=S===h.length}this._texturePacker=y,this._texture=this._copyFromTexture(t,s,a,g),o.destroy(),this._rectangles=g,this._guid=d.createGuid()}}S_(),E_(),A_(),I_(),R_(),b_(),x_(),__(),H_(),q_(),X_(),d.Camera.DEFAULT_VIEW_RECTANGLE=d.Rectangle.fromDegrees(70,5,140,55);function Y_(){return new Promise((t,i)=>d.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class Z_ extends l.Destroyable{constructor(i,e,n,r){super();const o=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const c=Ut(a);if(c&&(c.destroy(),_d(a,void 0)),d.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let h=a.scene.context._originalGLContext;h.canvas.width=h.canvas.height=1,h.getExtension("WEBGL_lose_context").loseContext(),h=null}a.destroy(),n(void 0)}};this.d(o);const s=this.dv(l.createProcessingFromAsyncFunc(async(a,c)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const h=P_;await a.promise(Y_());const p=await a.promise(l.createCancelablePromise(h(c,r)));p.scene._xbsjOriginSkyAtmosphere=p.scene.skyAtmosphere,p.scene._xbsjOriginSkyBox=p.scene.skyBox,p.clockViewModel.currentTime=d.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const u=d.JulianDate.fromDate(new Date(e.currentTime));d.JulianDate.equals(u,p.clockViewModel.currentTime)||(p.clockViewModel.currentTime=u)})),this.dispose(fi(p.clockViewModel,"currentTime",u=>{const f=d.JulianDate.toDate(p.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const u=new ev(p,e);_d(p,u)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),n(p)}));s.start(i),s.errorEvent.don(a=>{console.log(a,"ccccccc"),e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const Q_=new d.EllipsoidTerrainProvider;class Km extends l.Destroyable{constructor(e){super();v(this,"_terrainMap",new Map);v(this,"_nextAnimateFrame",this.dv(l.createNextAnimateFrame()));v(this,"selectedTerrain");this._viewer=e;const n=this._viewer,r=n.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{r&&r()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let o=Number.MIN_SAFE_INTEGER;for(let s of this._terrainMap.keys())s.sceneObject.activate=!1,(s.sceneObject.show??!0)&&s.sceneObject.zIndex>=o&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${s.sceneObject.name}(${s.sceneObject.id})`),o=s.sceneObject.zIndex,this.selectedTerrain=s);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),n.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??Q_,n.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,n.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,n.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?l.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,n.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?l.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1}))}_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 l.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 r=this.ad(l.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));this.d(r.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 Jm extends l.Destroyable{constructor(e){super();v(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 Xe?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`this._labelMap[${n}].has(poi)`,e);return}const r=new l.Destroyable;{const o=r.dv(l.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));r.dispose(o.don(()=>{this._updateZOrder()}))}this._labelMap[n].set(e,()=>r.destroy()),this._updateZOrder()}delete(e){const n=e instanceof Xe?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`!this._labelMap[${n}].has(poi)`,e);return}const r=this._labelMap[n].get(e);if(!r){console.error("!disposeFunc");return}r(),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 r={};for(const a of e.keys())r[a.zOrder]||(r[a.zOrder]=new Map),r[a.zOrder].set(a,a instanceof Xe?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const o=Object.keys(r).sort((a,c)=>n=="div"?Number(c)-Number(a):Number(a)-Number(c));let s=e.size;for(let a=0;a<o.length;a++)new Map([...r[o[a]]].sort((h,p)=>Number(p[1])-Number(h[1]))).forEach((h,p)=>{p instanceof Xe&&p.czmDivPoi&&(p.czmDivPoi.zOrder=s),p instanceof qi&&p.canvasObj&&(p.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class K_ extends l.Destroyable{constructor(e){super();v(this,"_czmImageryLayerWrappers",new Set);v(this,"_zIndexChangedEvent",this.dv(new l.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const n=[...this.czmImageryLayerWrappers.values()];n.sort((r,o)=>{const s=r.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex,a=o.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex;return s-a});for(const r of n)this.viewer.imageryLayers.raiseToTop(r.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 J_ extends l.Destroyable{constructor(e){super();v(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,r=n.manager.czmImageriesManager;r.add(this),this.d(()=>r.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>r.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class B_ extends l.Destroyable{constructor(e){super();v(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new l.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new J_(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class j_ extends l.Destroyable{constructor(e,n){super();v(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=n,this._czmImageryLayerWrapperObjResetting=this.dv(new l.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new B_(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class Bm extends l.Destroyable{constructor(e){super();v(this,"_czmImageryWrappers",new Set);v(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new K_(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 j_(e,this))}delete(e){for(const n of this.czmImageryWrappers)if(n.imagery===e){this.czmImageryWrappers.delete(n);return}console.warn("imageriesManager delete error!",e)}}class jm extends l.Destroyable{constructor(e){super();v(this,"_pause",this.disposeVar(l.react(!1)));v(this,"_pickPositionTasks",[]);v(this,"_pickTasks",[]);v(this,"pickHeightMustGreaterThanZero",!0);v(this,"objectsToExclude",[]);const n=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 r=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let h of a){const[p,u,f,m]=h;try{(async()=>{const{scene:g,camera:y}=n,_=Ee(p),S=y.getPickRay(_);do{if(!S)break;let C;if(u?C=await g.pickFromRayMostDetailed(S,this.objectsToExclude):C=g.pickFromRay(S,this.objectsToExclude),!C||!C.position)break;const E=ce(C.position);if(!E){m(new Error("positionFromCartesian failed"));return}f(E);return}while(!1);if(S&&!(g.terrainProvider instanceof d.EllipsoidTerrainProvider)){const C=g.globe.pick(S,g);if(!C){m(new Error("scene.globe.pick failed"));return}const E=ce(C);if(!E){m(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&E[2]<0&&(E[2]=0),f(E);return}{const C=g.terrainProvider instanceof d.EllipsoidTerrainProvider?g.terrainProvider.tilingScheme.ellipsoid:n.scene.globe.ellipsoid,E=n.camera.pickEllipsoid(Ee(p),C);if(!E){m(new Error("Pick failed"));return}const M=ce(E);if(!M){m(new Error("positionFromCartesian failed"));return}f(M)}})()}catch(g){m(g)}}const c=[...this._pickTasks];this._pickTasks.length=0;for(let h of c){const[p,u,f,m,g]=h;e.pickCustomAttachedInfo=f;try{(async()=>{var D,b,x;let y=n.scene.pick(Ee(p),u&&u[0],u&&u[1]);!y&&d.defined(n.scene.globe)&&(y=await eS(n,Ee(p)));let _;if(y&&y instanceof d.Cesium3DTileFeature){_={};try{y&&y.getPropertyIds().forEach(W=>{_&&(_[W]=y.getProperty(W))})}catch(z){console.warn(z)}}let S;do{if(!y)break;if(y.id&&y.id instanceof d.Entity&&y.id.ESSceneObjectID){S=y.id.ESSceneObjectID;break}if(y.primitive&&y.primitive.ESSceneObjectID){S=y.primitive.ESSceneObjectID;break}if(Array.isArray(y)&&y[0]instanceof d.ImageryLayerFeatureInfo){S=y[0].imageryLayer.ESSceneObjectID;break}}while(!1);let C=S?w.ESSceneObject.getSceneObject(S):void 0;C&&C.parentID&&(C=w.ESSceneObject.getSceneObject(C.parentID));let E={};if(C&&Reflect.has(C,"allowPicking")&&Reflect.has(C,"pickedEvent")&&(C.allowPicking??!1)){do{if(C instanceof w.ESEntityCluster){const z=new d.JulianDate;E=y.id instanceof d.Entity?{name:y.id.label.text.getValue(z),properties:(D=y.id.properties)==null?void 0:D.getValue(z),coordinates:us(y.id.position.getValue(z))}:(b=y.id)==null?void 0:b.map(W=>{var O;return{name:W.id,properties:(O=W.properties)==null?void 0:O.getValue(z),coordinates:us(W.position.getValue(z))}});break}if(C instanceof w.ESGeoJson){const z=new d.JulianDate;if(!y.id.entityCollection)return;const W=y.id.polygon?"Polygon":y.id.polyline?"LineString":"Point",O=((x=y.id.properties)==null?void 0:x.getValue(z))??{},L=W=="Point"?ce(y.id.position.getValue(z)):W=="LineString"?y.id.polyline.positions.getValue(z).map(U=>ce(U)):td(y.id.polygon.hierarchy.getValue(z));E=C.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:W,coordinates:L},properties:O}:{type:W,coordinates:L,properties:O};break}if(C instanceof w.ESGltfModel){let z;Reflect.has(y,"featureId")?z=y.featureId:Reflect.has(y,"instanceId")&&(z=y.instanceId),z&&(y.id=y.primitive.structuralMetadata.getPropertyTable(0).getProperty(y.instanceId,"id"))}}while(!1);C.pickedEvent.emit(new w.ESJPickedResult(y,C,_,E,f,p))}C&&Reflect.has(C,"allowPicking")&&!C.allowPicking&&m(new w.ESJPickedResult);const M=new w.ESJPickedResult(y,C,_,E,f,p);m(M)})()}catch(y){g(y)}}};let o=n.scene.postRender.addEventListener(r);const s=()=>{o&&o(),o=void 0};this.ad(s),this.ad(this.pauseChanged.don(a=>{a?s():o=n.scene.postRender.addEventListener(r)}))}}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,r)=>{this._pickPositionTasks.push([e,!0,n,r])})}quickPickPosition(e){return new Promise((n,r)=>{this._pickPositionTasks.push([e,!1,n,r])})}pick(e,n,r){return new Promise((o,s)=>{this._pickTasks.push([e,n,r,o,s])})}}function eS(t,i){const e=t.scene,n=e.camera.getPickRay(i);if(!n)return;const r=e.imageryLayers.pickImageryLayerFeatures(n,e);if(d.defined(r))return r}class tS extends l.Destroyable{constructor(e){super();v(this,"_enabled",this.disposeVar(l.react(!1)));v(this,"_cursorPosition",l.react(void 0));v(this,"quickPickPosition",!0);let n=new l.Destroyable;const r=()=>{n&&(n.destroy(),n=void 0)};this.dispose(r);const o=()=>{if(r(),!this._enabled.value||!e)return;const s=Ut(e);if(!s)return;n=new l.Destroyable;const a=n.disposeVar(l.react(void 0)),c=n.disposeVar(l.createNextAnimateFrameEvent(a.changed));n.dispose(s.czmViewer.pointerMoveEvent.disposableOn(p=>{p.pointerEvent&&(a.value=l.getDomEventCurrentTargetPos(p.pointerEvent))}));const h=n.disposeVar(l.createProcessingFromAsyncFunc(async p=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const u=await p.promise(l.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=u}else{const u=await p.promise(l.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=u}}));n.dispose(c.disposableOn(()=>{h.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}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}}function Ut(t){return l.getExtProp(t,"_viewerExtensions")}function _d(t,i){l.setExtProp(t,"_viewerExtensions",i)}class ev extends l.Destroyable{constructor(e,n){super();v(this,"_imageriesManager");v(this,"_terrainManager");v(this,"_labelManager");v(this,"_pickingManager");v(this,"_poiContext");v(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=n,this._imageriesManager=this.dv(new Bm(this.viewer)),this._terrainManager=this.dv(new Km(this.viewer)),this._labelManager=this.dv(new Jm(this.viewer)),this._poiContext=this.disposeVar(new Pv(this._viewer)),this._cursorPositionInfo=this.disposeVar(new tS(this._viewer)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new jm(n))}))}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}}var tv=new d.Cartesian3,iv=new d.Cartesian3;function nv(t,i,e){let n=d.Matrix4.clone(t.transform);t.lookAtTransform(d.Matrix4.IDENTITY);var r=t.positionCartographic.height,o=t.positionWC,s=d.Cartesian3.normalize(o,tv),a=d.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var c=d.Cartesian3.cross(t.direction,s,iv);else var c=d.Cartesian3.cross(t.up,s,iv);var h=c;if(e){var p=d.Cartesian3.cross(s,c,tv);h=p}var u=d.Cartesian3.magnitude(o);t.rotate(h,i/u);var f=t.positionCartographic,m=f.longitude,g=f.latitude;d.Cartesian3.fromRadians(m,g,r,void 0,t.position),t.lookAtTransform(n)}function ov(t,i){nv(t,i,!1)}function rv(t,i){nv(t,-i,!0)}class iS extends l.Destroyable{constructor(e){super();v(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:n}=this,{viewer:r}=n.firstPersonController,{camera:o}=r;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 c=()=>{const h=Date.now(),p=h-a;a=h;const u=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&o.moveForward(p*u),s.MoveBackword&&o.moveBackward(p*u),s.MoveLeft&&o.moveLeft(p*u),s.MoveRight&&o.moveRight(p*u)):(s.MoveForward&&ov(o,p*u),s.MoveBackword&&ov(o,-p*u),s.MoveLeft&&rv(o,-p*u),s.MoveRight&&rv(o,p*u));{const{rotateSpeed:f}=this.controller,m=d.Math.toRadians(f*p);s.RotateRight?o.lookRight(m):s.RotateLeft?o.lookRight(-m):s.RotateUp?o.lookDown(-m):s.RotateDown&&o.lookDown(m)}};r.scene.preUpdate.addEventListener(c),this.dispose(()=>r.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:r}=this;this._resetActions();const{keyStatusMap:o}=this.running.keyboardCameraController;for(let s of n.currentKeyIds)r[o[s]]=!0}}class pc extends l.Destroyable{constructor(e){super();v(this,"_currentKeyIds",new Set);v(this,"_currentKeyIdsChanged",this.dv(new l.Event));v(this,"_debug",this.dv(l.react(!1)));v(this,"_debugResetting",this.dv(new l.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends l.Destroyable{constructor(e){super();const n=()=>{console.log([...e.currentKeyIds].join(`
170
170
  `))};n(),this.d(e.currentKeyIdsChanged.don(n))}}(this)})));this._keyboardCameraControllerRunning=e;const{keyboardCameraController:n}=this._keyboardCameraControllerRunning;{const r=o=>{const s=pc.getKeyId(o);this._currentKeyIds.has(s)||(this._currentKeyIds.add(s),this._currentKeyIdsChanged.emit())};this.d(n.keyDownEvent.don(r))}{const r=o=>{const s=pc.getKeyId(o);this._currentKeyIds.has(s)&&(this._currentKeyIds.delete(s),this._currentKeyIdsChanged.emit())};this.d(n.keyUpEvent.don(r))}{const r=()=>{this._currentKeyIds.clear(),this._currentKeyIdsChanged.emit()};this.d(n.abortEvent.don(r))}}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 nS extends l.Destroyable{constructor(e){super();v(this,"_keyStatus");v(this,"_cameraOp");this._keyboardCameraController=e,this._keyStatus=this.dv(new pc(this)),this._cameraOp=this.dv(new iS(this))}get keyboardCameraController(){return this._keyboardCameraController}get keyStatus(){return this._keyStatus}get cameraOp(){return this._cameraOp}}const Dh=class Dh extends l.Destroyable{constructor(e){super();v(this,"_enabled",this.dv(l.react(!1)));v(this,"_keyStatusMap",this.dv(l.react(Dh.defaultKeyStatusMap)));v(this,"_speed",this.dv(l.react(1)));v(this,"_rotateSpeed",this.dv(l.react(.01)));v(this,"_alwaysWithCamera",this.dv(l.react(!1)));v(this,"_keyDownEvent",this.dv(new l.Event));v(this,"_keyUpEvent",this.dv(new l.Event));v(this,"_abortEvent",this.dv(new l.Event));this._firstPersonController=e,this.dv(new l.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new nS(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()}};v(Dh,"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 fc=Dh;function oS(t,i){t.lookRight(d.Math.toRadians(i.movementX)*.1),t.lookDown(d.Math.toRadians(i.movementY)*.1);const e=t.pitch,n=d.Math.clamp(e,-d.Math.PI_OVER_TWO,d.Math.PI_OVER_TWO);n!==e&&t.setView({destination:t.positionWC,orientation:{heading:t.heading,pitch:n,roll:t.roll}})}class rS extends l.Destroyable{constructor(i,e){super(),this._firstPersonController=i,this._mouseCameraController=e;const{canvas:n}=this._firstPersonController.viewer;{const r=o=>{const{camera:s}=this._firstPersonController.viewer.scene;oS(s,o)};n.addEventListener("pointermove",r),this.dispose(()=>n.removeEventListener("pointermove",r))}}}const Ih=class Ih extends l.Destroyable{constructor(e){super();v(this,"_mouseMoving",this.dv(new rS(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=Ih.origin_setPointerCapture);const r=n.canvas;r.requestPointerLock(),this.dispose(()=>document.exitPointerLock());{const o=()=>{document.pointerLockElement!==r&&(this.firstPersonController.mouseEnabled=!1)};document.addEventListener("pointerlockchange",o,!1),this.dispose(()=>document.removeEventListener("pointerlockchange",o,!1))}{const o=()=>{this.firstPersonController.mouseEnabled=!1,console.log("Error locking pointer")};document.addEventListener("pointerlockerror",o)}}get mouseCameraController(){return this._mouseCameraController}get firstPersonController(){return this.mouseCameraController.firstPersonController}get mouseMoving(){return this._mouseMoving}};v(Ih,"origin_setPointerCapture",Element.prototype.setPointerCapture);let Sd=Ih;class sS extends l.Destroyable{constructor(e){super();v(this,"_enabled",this.dv(l.react(!1)));v(this,"enableViewerOriginInputs",e=>{e?this.firstPersonController.czmViewer.incrementDisabledInputStack():this.firstPersonController.czmViewer.decrementDisabledInputStack()});v(this,"_mouseResetting",this.dv(new l.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Sd(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 aS extends l.Destroyable{constructor(e){super();v(this,"viewer");v(this,"_mouseCameraController",this.dv(new sS(this)));v(this,"_keyboardCameraController",this.dv(new fc(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 sv(t){t.removeInputAction(d.ScreenSpaceEventType.LEFT_DOWN),t.removeInputAction(d.ScreenSpaceEventType.RIGHT_DOWN),t.removeInputAction(d.ScreenSpaceEventType.MIDDLE_DOWN),t.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),t.removeInputAction(d.ScreenSpaceEventType.LEFT_UP),t.removeInputAction(d.ScreenSpaceEventType.RIGHT_UP),t.removeInputAction(d.ScreenSpaceEventType.MIDDLE_UP)}function Ed(t,i,e,n=void 0){const o=t.camera,s=new d.Cartesian2;s.x=i.startPosition.x,s.y=0;const a=new d.Cartesian2;a.x=i.endPosition.x,a.y=0;let c=o.getPickRay(s,new d.Ray),h=o.getPickRay(a,new d.Ray),p=0,u,f;if(!c||!h)return;o.frustum instanceof d.OrthographicFrustum?(u=c.origin,f=h.origin,d.Cartesian3.add(o.direction,u,u),d.Cartesian3.add(o.direction,f,f),d.Cartesian3.subtract(u,o.position,u),d.Cartesian3.subtract(f,o.position,f),d.Cartesian3.normalize(u,u),d.Cartesian3.normalize(f,f)):(u=c.direction,f=h.direction);let m=d.Cartesian3.dot(u,f);m<1&&(p=Math.acos(m)),p=i.startPosition.x>i.endPosition.x?p:-p;const g=e._horizontalRotationAxis;if(d.defined(n)?o.look(n,-p):d.defined(g)?o.look(g,-p):o.lookLeft(p),s.x=0,s.y=i.startPosition.y,a.x=0,a.y=i.endPosition.y,c=o.getPickRay(s,new d.Ray),h=o.getPickRay(a,new d.Ray),p=0,!(!c||!h))if(o.frustum instanceof d.OrthographicFrustum?(u=c.origin,f=h.origin,d.Cartesian3.add(o.direction,u,u),d.Cartesian3.add(o.direction,f,f),d.Cartesian3.subtract(u,o.position,u),d.Cartesian3.subtract(f,o.position,f),d.Cartesian3.normalize(u,u),d.Cartesian3.normalize(f,f)):(u=c.direction,f=h.direction),m=d.Cartesian3.dot(u,f),m<1&&(p=Math.acos(m)),p=i.startPosition.y>i.endPosition.y?p:-p,n=d.defaultValue(n,g),d.defined(n)){const y=o.direction,_=d.Cartesian3.negate(n,new d.Cartesian3),S=d.Cartesian3.equalsEpsilon(y,n,d.Math.EPSILON2),C=d.Cartesian3.equalsEpsilon(y,_,d.Math.EPSILON2);if(!S&&!C){m=d.Cartesian3.dot(y,n);let E=d.Math.acosClamped(m);p>0&&p>E&&(p=E-d.Math.EPSILON4),m=d.Cartesian3.dot(y,_),E=d.Math.acosClamped(m),p<0&&-p>E&&(p=-E+d.Math.EPSILON4);const M=d.Cartesian3.cross(n,y,new d.Cartesian3);o.look(M,p)}else(S&&p<0||C&&p>0)&&o.look(o.right,-p)}else o.lookUp(p)}class lS extends l.Destroyable{constructor(i,e){super();const n=e.viewer;if(!n)throw new Error("viewer is undefined");let r=!0;this.d(i.positionChanged.don(()=>r=!0)),this.d(i.rotationChanged.don(()=>r=!0)),this.d(i.offsetHeightChanged.don(()=>r=!0)),this.d(i.viewDistanceChanged.don(()=>r=!0)),this.d(i.offsetRotationChanged.don(()=>r=!0)),this.d(i.relativeRotationChanged.don(()=>r=!0));const o=[0,0,0],s=[0,0,0];this.d(n.clock.onTick.addEventListener(()=>{if(!r)return;if(r=!1,!i.position){console.warn("相机控制器未能设置位置,无法启用!");return}if(i.viewDistance===void 0){console.warn("相机控制器未能设置视距,将自动设置视距!");const u=Ue(i.position),f=n.camera.positionWC,m=d.Cartesian3.distance(u,f);i.viewDistance=m}l.Vector.clone(i.position,s),i.offsetHeight&&(s[2]+=i.offsetHeight);const{rotation:a,offsetRotation:c=gi.defaults.offsetRotation}=i,h=[...c];l.Vector.set(o,0,0,0),a&&(i.relativeRotation??gi.defaults.relativeRotation)&&(l.Vector.add(a,o,o),h[0]+=90),l.Vector.add(h,o,o);const p={distance:i.viewDistance,heading:o[0],pitch:o[1],flyDuration:0,hDelta:0,pDelta:0};e.flyTo(p,s)})),e.incrementDisabledInputStack(),this.d(()=>{e.decrementDisabledInputStack()}),this.d(e.pointerMoveEvent.don(a=>{const c=a==null?void 0:a.pointerEvent;if(c&&i.enabledRotationInput&&(c.buttons===1||c.buttons===2)){const{movementX:h,movementY:p}=c;i.offsetRotation=l.Vector.add(i.offsetRotation??gi.defaults.offsetRotation,[h*.2,p*-.2,0])}})),this.d(e.wheelEvent.don(a=>{if(!i.enabledScaleInput)return;const c=a.deltaY,p=Math.max(1,i.viewDistance)*(c*.001);i.viewDistance=i.viewDistance+p}))}}class gi extends l.Destroyable{constructor(e){super();v(this,"_resetWithCameraEvent",this.dv(new l.Event));const n=e.viewer;if(!n)throw new Error("viewer is undefined");const r=this;let o;const s=()=>{o&&(o.destroy(),o=void 0)};this.d(s);const a=()=>{s(),r.enabled&&(o=new lS(r,e))};a(),this.d(r.enabledChanged.don(a)),this.d(r.resetWithCameraEvent.don(c=>{if(!e.actived)return;const h=Bo(n.camera);if(!h)return;const p=r.rotation;r.offsetRotation=[h[0]-(r.relativeRotation?p[0]:90),h[1]-(r.relativeRotation?p[1]:0),h[2]-(r.relativeRotation?p[2]:0)]}))}get resetWithCameraEvent(){return this._resetWithCameraEvent}resetWithCamera(e){this._resetWithCameraEvent.emit(e)}}v(gi,"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:l.reactArrayWithUndefined(void 0),rotation:l.reactArrayWithUndefined(void 0),positionEditing:!1,rotationEditing:!1,viewDistance:1e3,offsetHeight:0,offsetRotation:l.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,relativeRotation:!0})})(gi||(gi={})),l.extendClassProps(gi.prototype,gi.createDefaultProps);class _s extends l.Destroyable{constructor(e){super();v(this,"_geoCameraController");v(this,"_geoPolylinePath");this._geoCameraController=this.dv(new gi(e)),this._geoPolylinePath=this.dv(new Fr(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(l.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dispose(l.bind([this._geoCameraController,"viewDistance"],[this,"viewDistance"])),this.dispose(l.bind([this._geoCameraController,"offsetHeight"],[this,"offsetHeight"])),this.dispose(l.bind([this._geoCameraController,"offsetRotation"],[this,"offsetRotation"])),this.dispose(l.track([this._geoCameraController,"enabledRotationInput"],[this,"enabledRotationInput"])),this.dispose(l.track([this._geoCameraController,"enabledScaleInput"],[this,"enabledScaleInput"])),this.dv(new l.ObjResettingWithEvent(this.lineModeChanged,()=>{if(this.lineMode!==void 0){if(this.lineMode==="auto")return new cS(this,e);if(this.lineMode==="manual")return new hS(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:l.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,lineMode:void 0})})(_s||(_s={})),l.extendClassProps(_s.prototype,_s.createDefaultProps);class cS extends l.Destroyable{constructor(i,e){if(super(),!e.viewer)throw new Error("viewer is undefined");i.offsetRotation=[-90,0,0]}}class hS extends l.Destroyable{constructor(i,e){if(super(),!e.viewer)throw new Error("viewer is undefined");const r=o=>{(o.key==="w"||o.key==="s")&&(i.polylinePath.playing=o.type==="keydown",i.polylinePath.speed=o.key==="w"||o.type==="keyup"?1:-1)};this.dispose(e.keyDownEvent.don(r)),this.dispose(e.keyUpEvent.don(r))}}class dS extends l.Destroyable{constructor(i,e){super();const n=e.positionPropertyName??"position",r=e.positionChangedPropertyName??n+"Changed",o=e.rotationPropertyName??"rotation",s=e.rotationChangedPropertyName??o+"Changed",a=(e.positionTracking??!0)&&Reflect.has(i,n)&&Reflect.has(i,r),c=(e.rotationTracking??!0)&&Reflect.has(i,o)&&Reflect.has(i,s);if(!(!a&&!c)){if(a){const h=()=>{e.geoCameraController.position=i[n]};h();const p=i[r];this.d(p.don(h))}if(c){const h=()=>{e.geoCameraController.rotation=i[o]};h();const p=i[r];this.d(p.don(h))}}}}class uS extends l.Destroyable{constructor(i,e){super();const n=this.dv(new w.ESSceneObjectWithId);n.id=i;const r=this.dv(l.createNextAnimateFrameEvent(e.enabledChanged,e.positionTrackingChanged,e.rotationTrackingChanged,e.positionPropertyNameChanged,e.positionChangedPropertyNameChanged,e.rotationPropertyNameChanged,e.rotationChangedPropertyNameChanged,n.sceneObjectChanged));this.disposeVar(new l.ObjResettingWithEvent(r,()=>{const{sceneObject:o}=n;if(!(!e.enabled||!o))return new dS(o,e)}))}}class Ss extends l.Destroyable{constructor(e){super();v(this,"_geoCameraController");this._geoCameraController=this.dv(new gi(e)),this.d(l.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dv(new l.ObjResettingWithEvent(this.sceneObjectIdChanged,()=>{if(this.sceneObjectId)return new uS(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})})(Ss||(Ss={})),l.extendClassProps(Ss.prototype,Ss.createDefaultProps);class pS extends l.Destroyable{constructor(e){super();v(this,"height",1e7);v(this,"cycle",60);v(this,"latitude",38*3.1415926/18);v(this,"_running",!1);v(this,"_sseh");v(this,"_eventDisposer");v(this,"leftDownCancel",!0);this._viewer=e,this._sseh=this.dv(new d.ScreenSpaceEventHandler(this._viewer.canvas)),this._sseh.setInputAction(()=>{this.leftDownCancel&&this.cancel()},d.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:d.Cartesian3.fromRadians(n.longitude,this.latitude,this.height),orientation:{heading:0,pitch:-.5*d.Math.PI,roll:0},complete:()=>{this._running=!0;var r=void 0;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((o,s)=>{if(!r){r=new Date().getTime();return}const a=(new Date().getTime()-r)/1e3,c=e.positionCartographic.longitude+a*d.Math.PI*2/this.cycle;e.setView({destination:d.Cartesian3.fromRadians(c,this.latitude,this.height),orientation:{heading:0,pitch:-.5*d.Math.PI,roll:0}}),r=new Date().getTime()})},duration:.5})}cancel(){this._running&&(this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1)}}class fS extends l.Destroyable{constructor(e){super();v(this,"_height",this.dv(l.react(1e7)));v(this,"_cycle",this.dv(l.react(60)));v(this,"_latitude",this.dv(l.react(38)));v(this,"_inner");this._czmViewer=e;const n=this._czmViewer.viewer;if(!n)throw new Error("未初始化viewer");this._inner=this.dv(new pS(n)),this._inner.leftDownCancel=!1;{const r=()=>{this._inner.height=this.height,this._inner.cycle=this.cycle,this._inner.latitude=this.latitude*Math.PI/180};r(),this.d(this.heightChanged.don(r)),this.d(this.cycleChanged.don(r)),this.d(this.latitudeChanged.don(r))}}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 gS extends l.Destroyable{constructor(e){super();v(this,"_position",this.dv(l.reactArrayWithUndefined(void 0)));v(this,"_distance",this.dv(l.react(5e4)));v(this,"_cycle",this.dv(l.react(60)));v(this,"_heading",this.dv(l.react(0)));v(this,"_pitch",this.dv(l.react(-30)));v(this,"_transform");v(this,"_headingRadius");v(this,"_pitchRadius");v(this,"_running",!1);v(this,"_sseh");v(this,"_eventDisposer");this._viewer=e;const n=this.viewer.scene,r=this.viewer.camera;this._sseh=this.dv(new d.ScreenSpaceEventHandler(this.viewer.canvas)),this.d(()=>{this.cancel()});{const o=()=>{let s;if(this.position==null){var a=r.getPickRay(new d.Cartesian2(n.canvas.width*.5,n.canvas.height*.5));if(!a)return;s=n.globe.pick(a,n)}else s=d.Cartesian3.fromDegrees(...this.position);s&&(this._transform=d.Transforms.eastNorthUpToFixedFrame(s),this.start())};o(),this.d(this.positionChanged.don(o))}{const o=()=>{this._headingRadius=d.Math.toRadians(this.heading)};o(),this.d(this.headingChanged.don(o))}{const o=()=>{this._pitchRadius=d.Math.toRadians(this.pitch)};o(),this.d(this.pitchChanged.don(o))}}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),r=this.distance*Math.cos(this._pitchRadius),o=new d.Cartesian3(0,n,r);e.flyTo({destination:d.Matrix4.multiplyByPoint(this._transform,o,new d.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,c)=>{if(!s){s=new Date().getTime();return}const h=(new Date().getTime()-s)/1e3;this._headingRadius+=h*d.Math.PI*2/this.cycle,e.lookAtTransform(this._transform,new d.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(d.Matrix4.IDENTITY),this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1}}class mS extends l.Destroyable{constructor(e){super();v(this,"_position",this.dv(l.reactArrayWithUndefined(void 0)));v(this,"_distance",this.dv(l.react(5e4)));v(this,"_cycle",this.dv(l.react(60)));v(this,"_heading",this.dv(l.react(0)));v(this,"_pitch",this.dv(l.react(-30)));v(this,"_inner");this._czmViewer=e;const n=this._czmViewer.viewer;if(!n)throw new Error("viewer is undefined");this._inner=this.dv(new gS(n));{const r=()=>{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};r(),this.d(this.distanceChanged.don(r)),this.d(this.cycleChanged.don(r)),this.d(this.positionChanged.don(r)),this.d(this.headingChanged.don(r)),this.d(this.pitchChanged.don(r))}}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 vS extends l.Destroyable{constructor(e){super();v(this,"_firstPersonController");v(this,"_rotateGlobe");v(this,"_rotatePoint");v(this,"_followController");v(this,"_pathCameraController");v(this,"_handler");this._viewer=e;{this._firstPersonController=this.dv(new aS(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 r=()=>this._firstPersonController.keyboardCameraController.abort();n.addEventListener("blur",r,!1),this.d(()=>n.removeEventListener("blur",r,!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=fc.defaultKeyStatusMap,this.d(this._firstPersonController.keyboardEnabledChanged.don(()=>{var n;(n=this._viewer.subContainer)==null||n.focus()}))}this._rotateGlobe=this.dv(new fS(e)),this._rotatePoint=this.dv(new mS(e)),this._followController=this.dv(new Ss(e)),this._pathCameraController=this.dv(new _s(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){this.resetNavigation(),this._changedMouseEvent("Walk");const r=this._viewer.getCameraInfo(),o=[(r==null?void 0:r.rotation[0])??0,0,0];this._viewer.getHeightByLonLat(e[0],e[1]).then(s=>{this._viewer.flyIn([e[0],e[1],(s??0)+1],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,r=60){this.resetNavigation(),this._changedMouseEvent("RotateGlobe"),this._rotateGlobe.latitude=e,this._rotateGlobe.height=n,this._rotateGlobe.cycle=r,this._rotateGlobe.start()}changeToRotatePoint(e,n=5e4,r=60,o=0,s=-30){this.resetNavigation(),this._changedMouseEvent("RotatePoint"),this._rotatePoint.position=e,this._rotatePoint.distance=n,this._rotatePoint.cycle=r,this._rotatePoint.heading=o,this._rotatePoint.pitch=s,this._rotatePoint.start()}changeToFollow(e,n=0,r=0,o=-30,s=!0){this.resetNavigation(),this._changedMouseEvent("Follow"),this._followController.sceneObjectId=e,this._followController.geoCameraController.offsetRotation=[r,o,0],this._followController.geoCameraController.relativeRotation=s,n!==0?this._followController.geoCameraController.viewDistance=n:this._followController.geoCameraController.viewDistance=1e3,this._followController.enabled=!0}changeToLine(e,n=10,r=10,o=!0,s=10,a="auto"){this.resetNavigation(),this._changedMouseEvent("Line");const c=a==="auto",h=w.ESSceneObject.getSceneObjById(e);if(!h)return;const{points:p}=h;if(!p)return;const u=w.getDistancesFromPositions(p,"NONE"),f=u[u.length-1];this._pathCameraController.viewDistance=0,this._pathCameraController.polylinePath.positions=[...p],this._pathCameraController.polylinePath.duration=f/n*1e3,this._pathCameraController.polylinePath.loop=o,this._pathCameraController.offsetHeight=r;const m=Im(p);this._pathCameraController.polylinePath.rotationRadius=!c||m==!1?[0]:m.map(g=>g/s*n),this._pathCameraController.enabledRotationInput=!c,this._pathCameraController.enabledScaleInput=!1,this._pathCameraController.polylinePath.playing=c,this._pathCameraController.lineMode=a,this._pathCameraController.enabled=!0}_changedMouseEvent(e){const n=this._viewer.viewer;if(!n)return;this._handler||(this._handler=new d.ScreenSpaceEventHandler(n.scene.canvas));const r=this._handler,o=n.scene.screenSpaceCameraController;this.d(()=>{r&&sv(r)}),e=="Walk"||e=="RotateGlobe"?(o.lookEventTypes=void 0,o.rotateEventTypes=void 0,o.tiltEventTypes=void 0,o.zoomEventTypes=void 0,o.translateEventTypes=void 0,r&&e=="Walk"&&(r.setInputAction(s=>{r.setInputAction(a=>{Ed(n.scene,a,o)},d.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(a=>{r.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),r.removeInputAction(d.ScreenSpaceEventType.LEFT_UP)},d.ScreenSpaceEventType.LEFT_UP)},d.ScreenSpaceEventType.LEFT_DOWN),r.setInputAction(s=>{r.setInputAction(a=>{Ed(n.scene,a,o)},d.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(a=>{r.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),r.removeInputAction(d.ScreenSpaceEventType.RIGHT_UP)},d.ScreenSpaceEventType.RIGHT_UP)},d.ScreenSpaceEventType.RIGHT_DOWN),r.setInputAction(s=>{r.setInputAction(a=>{Ed(n.scene,a,o)},d.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(a=>{r.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),r.removeInputAction(d.ScreenSpaceEventType.MIDDLE_UP)},d.ScreenSpaceEventType.MIDDLE_UP)},d.ScreenSpaceEventType.MIDDLE_DOWN))):(r&&sv(r),o.lookEventTypes=d.CameraEventType.RIGHT_DRAG,o.rotateEventTypes=d.CameraEventType.LEFT_DRAG,o.tiltEventTypes=[d.CameraEventType.MIDDLE_DRAG,d.CameraEventType.PINCH,{eventType:d.CameraEventType.LEFT_DRAG,modifier:d.KeyboardEventModifier.CTRL},{eventType:d.CameraEventType.RIGHT_DRAG,modifier:d.KeyboardEventModifier.CTRL}],o.translateEventTypes=d.CameraEventType.LEFT_DRAG,o.zoomEventTypes=[d.CameraEventType.WHEEL,d.CameraEventType.PINCH,{eventType:d.CameraEventType.RIGHT_DRAG,modifier:d.KeyboardEventModifier.SHIFT}])}}const yS=[{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 wS extends l.Destroyable{constructor(e){super();v(this,"_show",this.dv(l.react(!1)));v(this,"cloudsPostProcess");const n=e.viewer;if(!n)throw new Error("Cesium Viewer is not initialized");const r=new d.CloudCollection;n.scene.primitives.add(r),this.dispose(()=>n.scene.primitives.remove(r));{const o=()=>{r.show=this.show};o(),this.dispose(this.showChanged.disposableOn(o))}{const o=a=>({slice:a.slice,brightness:a.brightness,scale:Ee(a.scale),maximumSize:ni(a.maximumSize),color:ie(a.color),position:Ue(a.position)});(()=>{r.removeAll();for(let a of yS)r.add(o(a))})()}}get show(){return this._show.value}set show(e){this._show.value=e}get showChanged(){return this._show.changed}}class Es extends l.Destroyable{constructor(i){super();const e=i.viewer;if(!e){console.warn("viewer is undefined!");return}const n=e.scene.postProcessStages.add(d.PostProcessStageLibrary.createDepthOfFieldStage());this.d(()=>e.scene.postProcessStages.remove(n));{const r=()=>{n.enabled=this.show};r(),this.d(this.showChanged.don(r))}{const r=()=>{n.uniforms.fogByDistance=this.focalDistance};r(),this.d(this.focalDistanceChanged.don(r))}{const r=()=>{n.uniforms.delta=this.delta};r(),this.d(this.deltaChanged.don(r))}{const r=()=>{n.uniforms.sigma=this.sigma};r(),this.d(this.sigmaChanged.don(r))}{const r=()=>{n.uniforms.stepSize=this.stepSize};r(),this.d(this.stepSizeChanged.don(r))}}}(t=>{t.createDefaultProps=()=>({show:!1,focalDistance:87,delta:1,sigma:3.78,stepSize:2.46})})(Es||(Es={})),l.extendClassProps(Es.prototype,Es.createDefaultProps);const CS=`
171
171
  float getDistance(sampler2D depthTexture, vec2 texCoords)
172
172
  {
@@ -2291,10 +2291,10 @@ void main()
2291
2291
  {
2292
2292
  out_FragColor = u_color;
2293
2293
  }
2294
- `,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},Fe,t)}class $x extends l.HasOwner{constructor(i){super(i);const{czmViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const r=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const s=n=this._getStartInfo(o.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(o=>{n&&n.currentPlaneType!=="none"&&(r.restart(void 0,e,n),n=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{do{const s=this._getStartInfo(o.pointerEvent);if(!s||s.currentPlaneType==="none")break;const{currentPlaneType:a}=s,c=[...this.owner.selfRotation];c[ui.rotationNum[a]]=0,this.owner.selfRotation=c;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(l.createProcessingFromAsyncFunc(async(i,e,n)=>{const r=this.owner.circles[n.currentPlaneType];e.incrementDisabledInputStack(),i.disposer.dispose(()=>e.decrementDisabledInputStack()),i.disposer.dispose(e.pointerMoveEvent.don(o=>{if(n&&o.pointerEvent){const{offsetX:s,offsetY:a}=o.pointerEvent,c=[s,a],{currentPlaneType:h}=n;if(h==="none")return;const p=this.owner.getPlane(h);if(!n.currentV)return;const u=p.pick(c);if(!u||!this.owner.cartesian)return;const f=d.Cartesian3.subtract(n.currentV,this.owner.cartesian,new d.Cartesian3);d.Cartesian3.normalize(f,f);const m=d.Cartesian3.subtract(u,this.owner.cartesian,new d.Cartesian3);if(d.Cartesian3.normalize(m,m),!p.normal||!p.origin)return;const g=Ng(f,m,p.normal),y=Ng(p.origin,f,p.normal),_=Ng(p.origin,m,p.normal);{const S=[...this.owner.selfRotation];S[ui.rotationNum[h]]=n.startRotation+g,this.owner.selfRotation=S,r.circleStartRotation=y,r.circleEndRotation=_}}})),this.owner.movingPlaneType=n.currentPlaneType,i.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),i.disposer.dispose(()=>{r.circleStartRotation=0,r.circleEndRotation=0}),await l.step(i,o=>new Promise((s,a)=>{o.disposer.dispose(a),o.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),o.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(i,e,n,r,o){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,c=this.owner.getPlane(n).pick(r);if(!c)return;const h=d.Cartesian3.distance(s,c),p=o/4,u=p*3/128;if(!(h>=p-u&&h<=p+u))return;const m=d.Cartesian3.distance(e.camera.positionWC,c);i.currentD2c<=m||(i.currentPlaneType=n,i.currentD2c=m,i.currentV=c,i.startRotation=a[ui.rotationNum[n]])}_getStartInfo(i){var p;const{czmViewer:e}=this.owner,n=(p=e.viewer)==null?void 0:p.scene;if(!this.owner.position||!this.owner.cartesian)return;const r=Oi(n,this.owner.cartesian,this.owner.pixelSize);if(!r)return;const{offsetX:o,offsetY:s}=i,a=[o,s],c=i.pointerId,h={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:c};return this._pickPlane(h,n,"heading",a,r),this._pickPlane(h,n,"pitch",a,r),this._pickPlane(h,n,"roll",a,r),h}}function Ng(t,i,e){const n=d.Cartesian3.cross(i,t,new d.Cartesian3);if(n.equals(d.Cartesian3.ZERO))return 0;d.Cartesian3.normalize(n,n);const r=d.Cartesian3.dot(n,e);let o=Math.acos(d.Cartesian3.dot(t,i))*180/Math.PI;return o=r>0?o:-o,o}const Zo=class Zo extends qt{constructor(e){super();v(this,"_hoveredPlaneType",this.disposeVar(l.react("none")));v(this,"_movingPlaneType",this.disposeVar(l.react("none")));v(this,"_circles");v(this,"_czmCameraModel");v(this,"_cartesian");v(this,"_planes",{heading:this.disposeVar(new Ux(this)),pitch:this.disposeVar(new Wx(this)),roll:this.disposeVar(new Gx(this))});v(this,"_rotatorRunningResetting");this._czmViewer=e;const n=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new l.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new $x(this)})),this._circles={heading:this._createRotatorCircle(n,"heading"),pitch:this._createRotatorCircle(n,"pitch"),roll:this._createRotatorCircle(n,"roll")},!!n.viewer){{const o=()=>{this._cartesian=this.position&&Ue(this.position)||void 0};o(),this.dispose(this.positionChanged.disposableOn(o))}this._createCameraModel(n)}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get circles(){return this._circles}get czmCameraModel(){return this._czmCameraModel}get cartesian(){return this._cartesian}get czmViewer(){return this._czmViewer}getPlane(e){return this._planes[e]}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createCameraModel(e){this._czmCameraModel=new ct(e),this._czmCameraModel.url="${earthsdk3-assets-script-dir}/assets/glb/camera1/camera1.gltf",this._czmCameraModel.localRotation=[90,0,0],this._czmCameraModel.allowPicking=!1,this._czmCameraModel.opaquePass="OVERLAY",this.dispose(l.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],n=>n*.1)),this.dispose(l.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(l.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const n=()=>{const r=ke({rotation:this.selfRotation});if(!r)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=d.Matrix4.toArray(r))};n(),this.dispose(this.selfRotationChanged.disposableOn(n))}{const n=()=>{this.circles.heading.show=this.enabled,this.circles.pitch.show=this.enabled,this.circles.roll.show=this.enabled,this._czmCameraModel&&(this._czmCameraModel.show=this.enabled&&this.showHelper)};n(),this.dispose(this.enabledChanged.disposableOn(n)),this.dispose(this.showHelperChanged.disposableOn(n))}}_createRotatorCircle(e,n){const r=this.ad(new es(e));this.dispose(l.track([r,"position"],[this,"position"])),this.dispose(l.track([r,"pixelSize"],[this,"pixelSize"])),this.dispose(l.track([r,"debug"],[this,"debug"])),this.dispose(l.track([r,"rotation"],[this,"rotation"]));{const o=()=>{r.selfRotation=Zo.rotationFuncs[n](this.selfRotation),r.circleRotation=this.selfRotation[Zo.rotationNum[n]]};o(),this.dispose(this.selfRotationChanged.disposableOn(o))}{const o=()=>{const s=this.movingPlaneType===n,a=this.hoveredPlaneType===n,h=[0,0,0,s||a?1:.8];h[Zo.rotationNum[n]]=1,r.color=h};o(),this.dispose(this.movingPlaneTypeChanged.disposableOn(o)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(o))}return r}};v(Zo,"rotationNum",{heading:0,pitch:1,roll:2}),v(Zo,"rotationFuncs",{heading:([e,n,r])=>[0,0,0],pitch:([e,n,r])=>[e,0,-90],roll:([e,n,r])=>[e,n+90,0]});let ui=Zo;(t=>{t.createDefaultProps=()=>({...qt.createDefaultProps(),rotation:l.reactArray([0,0,0]),selfRotation:l.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(ui||(ui={})),l.extendClassProps(ui.prototype,ui.createDefaultProps);const Qo=class Qo extends l.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(i){this.positions=[i??Qo.defaults.positions[0],this.stopPosition??Qo.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(i){this.positions=[this.startPosition??Qo.defaults.positions[0],i??Qo.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(i,e){if(super(),!i.viewer)return;const r=this.ad(new Ie(i,e));r.arcType="RHUMB";const o=this.ad(new Kt(i,e));this.ad(l.track([r,"allowPicking"],[this,"allowPicking"])),this.ad(l.track([o,"allowPicking"],[this,"allowPicking"]));{const s=()=>{r.show=o.show=this.show};s(),this.ad(this.showChanged.don(s))}{const s=()=>{r.width=this.width/2,o.pixelSize=this.width};s(),this.ad(this.widthChanged.don(s))}{const s=()=>{r.color=o.color=this.color};s(),this.ad(this.colorChanged.don(s))}{const s=()=>{r.positions=this.positions,o.position=this.stopPosition};s(),this.dispose(this.startPositionChanged.disposableOn(s)),this.dispose(this.stopPositionChanged.disposableOn(s))}}};v(Qo,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Uo=Qo;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:l.reactPositions(t.defaults.positions),width:10,color:l.reactArray([1,0,0,1])})})(Uo||(Uo={})),l.extendClassProps(Uo.prototype,Uo.createDefaultProps);class rn extends qt{constructor(e){super();v(this,"_lastPosition");v(this,"_opInfo",{step:this.ad(l.react(!1)),moved:this.ad(l.react(!1)),constraintMode:this.disposeVar(l.react("none")),originPosition:this.disposeVar(l.reactArray([0,0,0])),originHeading:this.disposeVar(l.react(0)),originDimensions:this.disposeVar(l.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(l.reactArray([0,0,0])),movingPosition:this.disposeVar(l.reactArray([0,0,0])),targetPosition:this.disposeVar(l.reactArray([0,0,0])),targetHeading:this.disposeVar(l.react(0))});v(this,"_scaleAxis");v(this,"_pickingXYProcessing",e=>this.disposeVar(new l.Processing((n,r,o)=>{const s=[0,0,0],a=new d.Cartographic;return e.pointerMoveEvent.disposableOn(c=>{if(!c.pointerEvent||!e.viewer)return;const h=oi(l.getDomEventCurrentTargetPos(c.pointerEvent));if(!jo(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Jo(a,s),this._opInfo.constraintMode.value==="x"?ro(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?ro(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,s,s):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=s,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const p=[0,0,0];w.geoRhumbDestination(s,o,r,p),this._opInfo.targetPosition.value=p;let u=this.scale[0],f=this.scale[1];const m=w.geoDistance(p,this._opInfo.originPosition.value)-w.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...p];const g=this._opInfo.originDimensions.value[0]/100;m!=0&&this._opInfo.constraintMode.value==="y"&&(m>0?u+=g:u-=g),m!=0&&this._opInfo.constraintMode.value==="x"&&(m>0?f+=g:f-=g),u<=0&&(u+=g),f<=0&&(f+=g),this.scale=[u??1,f??1,this.scale[2]??1]})})));v(this,"_pickingZProcessing",e=>this.disposeVar(new l.Processing(()=>{const n=new d.Cartesian3,r=[0,0,0];return e.pointerMoveEvent.disposableOn(o=>{if(!o.pointerEvent||!e.viewer)return;const s=oi(l.getDomEventCurrentTargetPos(o.pointerEvent));if(!nc(e.viewer.scene,Ue(this._opInfo.originPosition.value),s,n))return;this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(ce(n,r)){this._opInfo.movingPosition.value=r;const c=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[c[0],c[1],r[2]+a];let h=this.scale[2];const p=r[2]-this._lastPosition[2];this._lastPosition=[...r];const u=this._opInfo.originDimensions.value[0]/100;p!=0&&(p>0?h+=u:h-=u),h<=0&&(h+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,h??1]}})})));const n=e.viewer;if(!n)return;const{scene:r}=n;this.ad(new id(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={zAxis:this._createScaleAxis(e,"zAxis"),yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const h=()=>{if(!this._scaleAxis)return;const{zAxis:p,yAxis:u,xAxis:f}=this._scaleAxis,m=this._opInfo.constraintMode.value,g=this._opInfo.step;p.color=[0,0,1,.99],u.color=[0,1,0,.99],f.color=[1,0,0,.99],m==="x"?f.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="y"?u.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="z"&&(p.color=g?[1,1,0,.8]:[1,1,0,.99])};h(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(h)),this.dispose(this._opInfo.step.changed.disposableOn(h))}{const h=()=>{if(!this._scaleAxis)return;const{position:u=rn.defaults.position}=this,{zAxis:f,yAxis:m,xAxis:g}=this._scaleAxis;f.startPosition=m.startPosition=g.startPosition=u;const[y,_,S]=u;f.stopPosition=[y,_,S+this._opInfo.originDimensions.value[2]];const C=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);C&&(g.stopPosition=C);const E=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);E&&(m.stopPosition=E)};h();const p=this.ad(l.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(p.don(h))}{const h=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((p,u)=>p===this._opInfo.targetPosition.value[u])){this._opInfo.moved.value=!0;return}};h(),this.dispose(this._opInfo.originHeading.changed.disposableOn(h)),this.dispose(this._opInfo.originPosition.changed.disposableOn(h)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(h)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(h))}const o=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(l.createProcessingFromAsyncFunc(async h=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await l.step(h,async p=>{const u=()=>{const g=[...this.position??rn.defaults.position];e.editingHeightOffset&&(g[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=g};p.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const f={constraintMode:"none",startDragPos:[0,0,0]},m=g=>{if(!this.position)return;const y={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};qh(g,r,y,this.axisSnapPixelSize,f),this._opInfo.constraintMode.value=f.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=f.startDragPos};p.disposer.dispose(e.pointerMoveEvent.disposableOn(g=>{g.pointerEvent&&m(g.pointerEvent)})),await l.step(p,g=>new Promise((y,_)=>{g.disposer.dispose(_),g.disposer.dispose(e.pointerDownEvent.don(S=>{S.pointerEvent&&m(S.pointerEvent),S.pointerEvent&&S.pointerEvent.button===0&&f.constraintMode!=="none"&&y()}))}))}),this._opInfo.step.value=!1,await l.step(h,async p=>{if(e.incrementDisabledInputStack(),p.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const u=w.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),f=w.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);o.restart(void 0,u,f),p.disposer.dispose(()=>o.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),p.disposer.dispose(()=>s.cancel()));await l.step(p,u=>new Promise((f,m)=>{u.disposer.dispose(m),u.disposer.dispose(e.pointerUpEvent.don(()=>{f()})),u.disposer.dispose(e.pointerOutEvent.don(()=>{f()}))})),this._lastPosition=void 0});while(!0)})),c=()=>{this.enabled?a.restart():a.isRunning&&a.cancel()};c(),this.dispose(this.enabledChanged.disposableOn(c))}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,n){const r=this.ad(new Uo(e));return r.width=10,this.ad(l.track([r,"show"],[this,"enabled"])),r}}(t=>{t.createDefaultProps=()=>({...qt.createDefaultProps(),scale:l.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(rn||(rn={})),l.extendClassProps(rn.prototype,rn.createDefaultProps);const no=class no extends Tt{constructor(e){super();v(this,"_editingPoints",this.disposeVar(new l.ObservableArray));v(this,"_cancelEvent",this.disposeVar(new l.Event));v(this,"_currentProcess");v(this,"_menuPoiEnabled",this.disposeVar(l.react(!1)));v(this,"_status",this.disposeVar(l.react("None")));v(this,"_positionsChanged",this.ad(new l.Event));v(this,"_cursorInfo");this._czmViewer=e,this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(n=>{for(let{start:r,deleteCount:o,items:s}of n){for(const a of s)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=r;a<r+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(l.nextAnimateFrame(()=>{var r;((r=n.pointerEvent)==null?void 0:r.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(n=>{this._currentProcess&&(n?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const n=()=>{this.polylineShow=this.czmViewer.editingLineShow};n(),this.ad(this.czmViewer.editingLineShowChanged.don(n))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let n of this._editingPoints)n.position&&e.push([...n.position]);return e}resetPositions(e){if(this.enabled??no.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((r,o)=>r.every((s,a)=>{const c=this.editingPoints.get(o);return c.position&&c.position[a]===s})))}forceResetPositions(e){(this.enabled??no.defaults.enabled)&&(this.enabled=!1),this.resetPositions(e)}get positions(){return this.getPositions()}set positions(e){this.resetPositions(e)}get positionsChanged(){return this._positionsChanged}get czmViewer(){return this._czmViewer}get cursorInfo(){return this._cursorInfo}createPolyline(e){const n=this.ad(new Ie(e));this.ad(l.track([n,"color"],[this,"polylineColor"])),this.ad(l.track([n,"width"],[this,"polylineWidth"])),this.ad(l.track([n,"show"],[this,"polylineShow"])),this.ad(l.track([n,"arcType"],[this,"polylineArcType"])),this.ad(l.track([n,"loop"],[this,"loop"]));{const r=()=>{const o=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,o.push(s);n.positions=o};r(),this.ad(this.positionsChanged.don(r))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new l.CursorInfo(e.container,l.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const r=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}r==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):r==="Modifying"||r==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):r==="None"&&(n.text="",n.show=!1)}}))}};v(no,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),v(no,"defaults",{...Tt.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:no.baseImageUrl+"point-green.png",otherControlPointImageUrl:no.baseImageUrl+"point-yellow.png"});let ei=no;(t=>{t.createDefaultProps=()=>({...Tt.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:l.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:t.baseImageUrl+"point-green.png",otherControlPointImageUrl:t.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(ei||(ei={})),l.extendClassProps(ei.prototype,ei.createDefaultProps);let Xx=0;class s1 extends l.Destroyable{constructor(e,n){super();v(this,"_position",this.disposeVar(l.reactArrayWithUndefined(void 0)));v(this,"_id",Xx++);v(this,"_menuPoi");n&&(this.position=n),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const r=this._menuPoi=this.ad(new hr(e.czmViewer));r.enabled=!1,this.ad(l.track([r,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){r.position=void 0;return}const s=[...this.position];s[2]-=e.czmViewer.editingHeightOffset??0,r.position=s,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const s=e.editingPoints.indexOf(this)+1;s!==0&&(r.title=`控制点${s}`,s===1?r.imageUri=e.firstControlPointImageUrl??ei.defaults.firstControlPointImageUrl:r.imageUri=e.otherControlPointImageUrl??ei.defaults.otherControlPointImageUrl)};o(),this.dispose(e.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class a1 extends s1{constructor(i,e){super(i,e)}}class Je extends ei{constructor(e){super(e);v(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new l.Event));v(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new di(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??Je.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??Je.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await r.promise(l.step(r,async o=>{const s=o.disposer,a=s.ad(this._addingEditingProcessing());s.dispose(()=>"adding canceled!"),s.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(c=>{s.dispose(a.completeEvent.disposableOnce(c))}))}))})),this.dispose(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new a1(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??Je.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},n=l.createProcessingFromAsyncFunc(async r=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await r.promise(l.step(r,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new Yx(this,o)));const p=a.disposer.disposeVar(new Qx(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>p.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(f=>{f?(o++,u(!0)):u(!1)})),a.disposer.dispose(p.overEvent.disposableOnce(f=>{f?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return n.start(),n}}(t=>{t.createDefaultProps=()=>({...ei.createDefaultProps()})})(Je||(Je={})),l.extendClassProps(Je.prototype,Je.createDefaultProps);class Yx extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));const{placeEditing:r}=e;let o=new a1(e,void 0);e.editingPoints.splice(n,0,o);const s=()=>{(e.debug??Je.defaults.debug)&&console.log("delete currentPosEditor");const h=e.editingPoints.indexOf(o);if(h===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(h,1)};if(r.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(l.track([o,"position"],[r,"position"])),r.enabled=!0;let a=!1;const c=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{r.enabled=!1,!a&&c()}),this.dispose(r.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?c():this._overEvent.emit(!0)})),(e.debug??Je.defaults.debug)&&console.log(`PointAdding creating! index(${n})`),this.dispose(()=>{(e.debug??Je.defaults.debug)&&console.log(`PointAdding destroying! index(${n})`)})}get overEvent(){return this._overEvent}}function Zx(t,i){const e=t.editingPoints,n=i-1;return n<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(n,1),!0)}class Qx extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));v(this,"_doEvent",this.disposeVar(new l.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(Zx(e,n)))),(e.debug??Je.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${n})`),this.dispose(()=>{(e.debug??Je.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${n})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class l1 extends Je{constructor(i){super(i),this.loop=!1}}class c1 extends Je{constructor(i){super(i),this.loop=!0}}class Ah extends s1{constructor(i,e){super(i,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",be.baseImageUrl+"add.png"],["delete","删除当前控制点","",be.baseImageUrl+"delete.png"],["modify","修改当前控制点","",be.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(r=>{i.menuPoiCommand(this,r)})),this.dispose(n.dbclickEvent.disposableOn(()=>{i.menuPoiCommand(this,"dbClick")}))}if(i.middlePointShow){const n=this.ad(new mi(i.czmViewer));{n.imageUri=i.firstControlPointImageUrl??be.defaults.firstControlPointImageUrl,n.tooltip="点击增加一个控制点",n.bgColor=[0,0,0,.6],n.fgColor=[1,1,1,1],n.size=[8,8],n.originRatioAndOffset=[.5,.5,0,0];{const r=()=>{if(!(i.enabled??be.defaults.enabled)){n.enabled=!1,n.show=!1;return}do{const s=i.editingPoints.indexOf(this);if(s===-1)break;const a=i.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(i.loop??be.defaults.loop)&&s+1>=a)break;const h=this.position;if(!h)break;let p=(s+1)%a;const f=i.editingPoints.get(p).position;if(!f)break;const m=Zh(h,f);if(!m)break;m[2]-=i.czmViewer.editingHeightOffset??0,n.position=m;const g=i.editingPoints.length<(i.maxPointsNum??be.defaults.maxPointsNum);n.enabled=g,n.show=g;return}while(!1);n.enabled=!1,n.show=!1};r(),this.dispose(i.positionsChanged.disposableOn(r)),this.dispose(i.loopChanged.disposableOn(r)),this.dispose(i.enabledChanged.disposableOn(r))}this.dispose(n.clickEvent.disposableOn(r=>{if(r.button!==0||i.editingPoints.length>=(i.maxPointsNum??be.defaults.maxPointsNum))return;const o=i.editingPoints.indexOf(this);if(o===-1)return;const s=n.position?[...n.position]:void 0;s&&(s[2]+=i.czmViewer.editingHeightOffset??0);let a=new Ah(i,s);i.editingPoints.splice(o+1,0,a),i.modify(a)}))}}}}class be extends ei{constructor(e){super(e);v(this,"_menuPoiCommand",this.disposeVar(new l.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new l.Event));v(this,"_overEvent",this.disposeVar(new l.Event));v(this,"translationEditing");{const r=this.ad(l.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new l.ObjResettingWithEvent(r,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new Kx(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new on(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??be.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??be.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await r.promise(l.step(r,async s=>{const a=s.disposer,c=a.ad(new Jx(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&c.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>c.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(p=>c.modify(p))),await s.promise(new Promise(p=>{a.dispose(c.overEvent.disposableOnce(u=>{p(u)}))}))})),o===-1){(this.debug??be.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??be.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??be.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let c=o%this.editingPoints.length;const p=this.editingPoints.get(c).position;if(!p)return;const u=Zh(a,p);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let f=new Ah(this,u);this.editingPoints.splice(o,0,f)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,n){this._menuPoiCommand.emit(e,n)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new Ah(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...ei.createDefaultProps(),moveWithFirstPosition:!1})})(be||(be={})),l.extendClassProps(be.prototype,be.createDefaultProps);class Kx extends l.Destroyable{constructor(i,e){super(),this._firstPositionEditor=i,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,r)=>{if(n===void 0||r===void 0)return;var o=[n[0]-r[0],n[1]-r[1],n[2]-r[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const c=this.multiPointsModifyEditing.editingPoints.get(a),h=c.position;h!==void 0&&(c.position=[h[0]+o[0],h[1]+o[1],h[2]+o[2]])}})}}class Jx extends l.Destroyable{constructor(e){super();v(this,"_overEvent",this.disposeVar(new l.Event));v(this,"_cancelEvent",this.disposeVar(new l.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new l.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let n;const r=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(r);const o=s=>{r(),e.status="Modifying_Point",n=new Bx(e,s),n.dispose(n.overEvent.disposableOn(()=>{r()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((s,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const c=e.editingPoints.indexOf(s);if(c===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(c,1)}else if(a==="modify")o(s);else if(a==="add"){const c=e.editingPoints.indexOf(s);if(c===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(c+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(e){this._forceModifyPosEditorEvent.emit(e)}}class Bx extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));this._modifying=e,this._posEditor=n,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:r}=this._modifying;if(r.enabled=!0,r.heading=0,this.dispose(()=>{r.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");r.position=this._posEditor.position,this.dispose(l.track([this._posEditor,"position"],[r,"position"])),this.dispose(r.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class h1 extends be{constructor(i){super(i),this.loop=!1}}class d1 extends be{constructor(i){super(i),this.loop=!0}}class ts extends Je{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(r<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Je.createDefaultProps(),startPosition:l.reactArrayWithUndefined(void 0),endPosition:l.reactArrayWithUndefined(void 0),rotation:l.reactArray([90,0,0]),distance:l.react(1)})})(ts||(ts={})),l.extendClassProps(ts.prototype,ts.createDefaultProps);class Wo extends be{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",be.baseImageUrl+"add.png"],["delete","删除当前控制点","",be.baseImageUrl+"delete.png"],["modify","修改当前控制点","",be.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let c of this.editingPoints)c.menuPoi.commands=[["delete","删除当前控制点","",be.baseImageUrl+"delete.png"],["modify","修改当前控制点","",be.baseImageUrl+"modify.png"]];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(Math.abs(r)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...be.createDefaultProps(),startPosition:l.reactArrayWithUndefined(void 0),endPosition:l.reactArrayWithUndefined(void 0),rotation:l.reactArray([0,0,0]),distance:l.react(0)})})(Wo||(Wo={})),l.extendClassProps(Wo.prototype,Wo.createDefaultProps);class u1 extends Je{constructor(i){super(i),this.loop=!1,this.polylineShow=!1}}class p1 extends be{constructor(i){super(i),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class is extends Je{constructor(i){super(i),i.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(i){const e=this.ad(new si(i));e.topOrBottom="bottom",this.ad(l.track([e,"color"],[this,"polylineColor"])),this.ad(l.track([e,"width"],[this,"polylineWidth"])),this.ad(l.track([e,"show"],[this,"polylineShow"])),this.ad(l.track([e,"arcType"],[this,"polylineArcType"])),this.ad(l.track([e,"loop"],[this,"loop"])),this.ad(l.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Je.createDefaultProps(),visibilityPositions:l.reactPositionsSet(void 0)})})(is||(is={})),l.extendClassProps(is.prototype,is.createDefaultProps);class ns extends be{constructor(i){if(super(i),!!i.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(i){const e=this.ad(new si(i));e.topOrBottom="bottom",this.ad(l.track([e,"color"],[this,"polylineColor"])),this.ad(l.track([e,"width"],[this,"polylineWidth"])),this.ad(l.track([e,"show"],[this,"polylineShow"])),this.ad(l.track([e,"arcType"],[this,"polylineArcType"])),this.ad(l.track([e,"loop"],[this,"loop"])),this.ad(l.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...be.createDefaultProps(),visibilityPositions:l.reactPositionsSet(void 0)})})(ns||(ns={})),l.extendClassProps(ns.prototype,ns.createDefaultProps);class f1 extends Wo{constructor(i){super(i),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.zAxisShow=!0,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class Ct extends w.EngineObject{constructor(e,n,r){super(e,n,r??!0);v(this,"_supportEditing",this.disposeVar(l.react(!0)));v(this,"_currentEditing",this.disposeVar(l.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var o;if(this.currentEditing){if(this.currentEditing instanceof Je&&((o=this.currentEditing.currentProcess)!=null&&o.isRunning))if(this.currentEditing.currentProcess.cancel(),e!=null&&e.position){if(this.currentEditing.positions.length>1)return;e.position=this.currentEditing.positions[0]??[0,0,0],e!=null&&e.rotation&&(e.rotation=[0,0,0]),e!=null&&e.far&&(e.far=1),e!=null&&e.radius&&(e.radius=1),e!=null&&e.distance&&(e.distance=1)}else e.points=this.currentEditing.positions;this.currentEditing instanceof di&&this.currentEditing.enabled&&(e.position=[0,0,0])}}))}get supportEditing(){return this._supportEditing.value}set supportEditing(e){this._supportEditing.value=e}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(e){this._currentEditing.value=e}get currentEditingChanged(){return this._currentEditing.changed}}const Ol=class Ol extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new di(e));this.ad(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)==2&&(n.enabled=!0)}));do{if(Reflect.has(i,"position")){this.ad(l.bind([n,"position"],[i,"position"])),n.enabled=!n.position||w.equalsN3(n.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};v(Ol,"type",Ol.registerEditing("ESCesiumViewer",w.ESJEditingMode.Place,Ol));let Og=Ol;const Vl=class Vl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ui(e));n.rotation=[90,0,0],this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);r&&(this.ad(l.bind([n,"position"],[r.czm3DTiles,"position"])),this.ad(l.bind([n,"selfRotation"],[i,"rotation"])))});break}if(Reflect.has(i,"position")&&Reflect.has(i,"rotation")){this.ad(l.bind([n,"position"],[i,"position"])),this.ad(l.bind([n,"selfRotation"],[i,"rotation"]));break}this.supportEditing=!1}while(!1)}};v(Vl,"type",Vl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Rotation,Vl));let Vg=Vl;const Ul=class Ul extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new rn(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")&&Reflect.has(i,"scale")){this.ad(l.bind([n,"position"],[i,"position"])),this.ad(l.bind([n,"scale"],[i,"scale"]));break}this.supportEditing=!1}while(!1)}};v(Ul,"type",Ul.registerEditing("ESCesiumViewer",w.ESJEditingMode.Scale,Ul));let Ug=Ul;const Wl=class Wl extends Ct{constructor(i,e){super(Array.isArray(i)?i[0]:i,e,!0);const n=this.currentEditing=this.ad(new on(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(i)){const r=[];for(let o=0;o<i.length;o++){const s=i[o];Reflect.has(s,"position")?r.push(s.position):s.points&&r.push(...s.points)}n.position=w.getMinMaxCorner(r).center,this.ad(n.positionChanged.disposableOn((o,s)=>{if(!(!o||!s)){var a=Dt({originPosition:s},[o])[0][0];i.forEach(c=>{if(Reflect.has(c,"position")){const h=Dt({originPosition:s},[c.position])[0][0];c.position=mn({originPosition:s},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(c,"points")&&c.points){const h=Dt({originPosition:s},c.points)[0];c.points=mn({originPosition:s},h.map(p=>[p[0]+a[0],p[1]+a[1],p[2]+a[2]]))[0]}})}}));break}if(Reflect.has(i,"position")){this.ad(l.bind([n,"position"],[i,"position"]));break}if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);this.ad(l.bind([n,"position"],[r.czm3DTiles,"position"]))});break}if(Reflect.has(i,"points")){if(i.points===void 0||i.points.length===0){this.destroy();break}n.position=w.getMinMaxCorner(i.points).center,this.ad(n.positionChanged.disposableOn((r,o)=>{if(r===void 0||o===void 0||i.points===void 0||i.points.length===0){this.destroy();return}var s=Dt({originPosition:o},[r])[0][0];const a=Dt({originPosition:o},i.points)[0];i.points=mn({originPosition:o},a.map(c=>[c[0]+s[0],c[1]+s[1],c[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};v(Wl,"type",Wl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Translation,Wl));let Th=Wl;const Gl=class Gl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ts(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")){this.ad(l.bind([n,"startPosition"],[i,"position"])),this.ad(it([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(l.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(l.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(l.bind([n,"distance"],[i,"distance"]));break}const r=Ue(i.position);if(d.Cartesian3.ZERO.equals(r)||!e.viewer)return;n.distance=Oi(e.viewer.scene,r,100)??1}while(!1);break}if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1);n.startPosition&&!w.equalsN3(n.startPosition,[0,0,0])&&n.init(),n.enabled=!0}};v(Gl,"type",Gl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsAppend,Gl));let Wg=Gl;const Hl=class Hl extends Ct{constructor(i,e){var o;if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new Wo(e));do{if(Reflect.has(i,"position")){this.ad(l.bind([n,"startPosition"],[i,"position"])),this.ad(it([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(l.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(l.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(l.bind([n,"distance"],[i,"distance"]));break}const s=Ue(i.position);if(d.Cartesian3.ZERO.equals(s)||!e.viewer)return;n.distance=Oi(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(i,"points")&&((o=i.points)==null?void 0:o.length)==2){n.moveWithFirstPosition=!1;const s=()=>n.positions=i.points??[];s(),this.ad(i.pointsChanged.don(()=>!n.enabled&&s())),this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Hl,"type",Hl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsModify,Hl));let Gg=Hl;const ql=class ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new c1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(ql,"type",ql.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularAppend,ql));let Hg=ql;const $l=class $l extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new d1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v($l,"type",$l.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularInsert,$l));let qg=$l;const Xl=class Xl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new l1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Xl,"type",Xl.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringAppend,Xl));let $g=Xl;const Yl=class Yl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new h1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Yl,"type",Yl.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringInsert,Yl));let Xg=Yl;const Zl=class Zl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new u1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Zl,"type",Zl.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterAppend,Zl));let Yg=Zl;const Ql=class Ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new p1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Ql,"type",Ql.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterModify,Ql));let Zg=Ql;const Kl=class Kl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new is(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Kl,"type",Kl.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityAppend,Kl));let Qg=Kl;const Jl=class Jl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ns(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Jl,"type",Jl.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityModify,Jl));let Kg=Jl;const Bl=class Bl extends Ct{constructor(i,e){if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new f1(e));do{if(Reflect.has(i,"points")){const o=Reflect.has(i,"extrudedHeight"),s=Reflect.has(i,"height"),a=Reflect.has(i,"perPositionHeight")?i.perPositionHeight:!o,c=i instanceof w.ESClassification||i instanceof w.ESPolygonFence;let h=w.getMinMaxCorner(i.points).center,p=[...h],u=c?i.points[0][2]:0;a?o?p[2]=i.extrudedHeight:p[2]=i.height+u:(s&&(h[2]=i.height),o&&(p[2]=i.extrudedHeight)),n.startPosition=h,n.distance=p[2]-h[2],n.moveWithFirstPosition=!1;let f=[...h];this.ad(n.positionsChanged.don(()=>{n.positions.length===2&&(a?(i.points=i.points.map(m=>[m[0],m[1],m[2]+n.positions[0][2]-f[2]]),o?i.extrudedHeight=n.positions[1][2]:s&&(i.height=n.positions[1][2]-(c?n.positions[0][2]:0))):(s&&(i.height=n.positions[0][2]),o&&(i.extrudedHeight=n.positions[1][2])),f=[...n.positions[0]])}));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Bl,"type",Bl.registerEditing("ESCesiumViewer",w.ESJEditingMode.HeightModify,Bl));let Jg=Bl;const Pt=class Pt extends l.Destroyable{constructor(e,n,r,o=!0){super();v(this,"czmViewer");v(this,"sceneObject");v(this,"editingModes",[]);v(this,"editingID");v(this,"useKeyToSwitch");v(this,"currentIndex",0);const s=this.czmViewer=e,a=this.sceneObject=n,c=this.editingModes=Array.isArray(r)?[...r]:[r],h=this.editingID=a.editingID;this.useKeyToSwitch=o,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:h,type:"start",add:{modes:c}}),this.ad(a.toDestroyEvent.don(Pt.stop)),this.ad(s.keyDownEvent.don(p=>{p.code=="Escape"&&Pt.stop()})),this.createEditingMode(this.currentIndex)}createEditingMode(e){const{sceneObject:n,czmViewer:r,editingID:o}=this,s=new l.Destroyable;this.ad(()=>!s.isDestroyed()&&s.destroy());const a=this.editingModes[e%this.editingModes.length],c=w.EngineObject.contextEditing.getEngineObjConstructor(a,r.typeName);if(!c||!n.supportEditingModes().includes(a))return this._createNextEditingMode(s,a);const h=new c(n,r);if(s.ad(()=>!h.isDestroyed()&&h.destroy()),h.isDestroyed())return this._createNextEditingMode(s,a);const p=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(h.toDestroyEvent.don(p)),this.useKeyToSwitch&&s.ad(r.keyDownEvent.don(u=>{u.code=="Space"&&p()})),s.ad(r.dblclickEvent.donce(()=>this.useKeyToSwitch?Pt.stop():p())),h.supportEditing)r.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:o,type:"changed",add:{cMode:a,cIndex:e}}),r.notSupportEditingCount=0;else return this._createNextEditingMode(s,a)}_createNextEditingMode(e,n){const{sceneObject:r,czmViewer:o,editingID:s}=this;if(!e.isDestroyed()&&e.destroy(),console.log(`未找到编辑模式或不支持当前编辑模式${n},已跳过当前编辑模式,请检查输入`),o.editingEvent.emit({objectIDs:[r.parentID??r.id],editingID:s,type:"changedFailed",add:{cMode:n,cIndex:this.currentIndex}}),o.notSupportEditingCount++,o.notSupportEditingCount==this.editingModes.length)return Pt.stop();l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})}static create(e,n,r,o=!0){Pt.stop(),Pt.currentEditingInstance=new Pt(e,n,r,o)}static stop(){if(Pt.currentEditingInstance&&!Pt.currentEditingInstance.isDestroyed()){if(!Pt.currentEditingInstance)return;const{czmViewer:e,sceneObject:n,editingID:r,editingModes:o}=Pt.currentEditingInstance;Pt.currentEditingInstance.destroy(),e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:r,type:"end",add:{modes:o}})}Pt.currentEditingInstance=void 0}};v(Pt,"currentEditingInstance");let Mh=Pt;function jx(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,r,o=!0)=>{const s=Array.isArray(r)?[...r]:[r],a=n.editingID;e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"start",add:{modes:s}});const c=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"end",add:{modes:s}}),t.isRunning&&t.cancel()};i.disposer.ad(c),i.disposer.ad(n.toDestroyEvent.don(c));const h=u=>{u.code=="Escape"&&c()};i.disposer.ad(e.keyDownEvent.don(h));let p=0;do{const u=s[p%s.length],f=await l.step(i,async m=>{const g=m.disposer,y=w.EngineObject.contextEditing.getEngineObjConstructor(u,e.typeName);if(!y||!n.supportEditingModes().includes(u))return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:p}}),e.notSupportEditingCount++,!1;const _=new y(n,e);if(g.ad(()=>{!_.isDestroyed()&&_.destroy()}),_.supportEditing)e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"changed",add:{cMode:u,cIndex:p}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:p}}),e.notSupportEditingCount++,!1;return await m.promise(new Promise(C=>{if(_.isDestroyed()&&C(!1),g.ad(_.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),C(!1)})),o){const E=M=>{M.code=="Space"&&(console.log(`编辑模式${u}结束`),C(!1))};g.ad(e.keyDownEvent.don(E)),g.ad(e.dblclickEvent.don(()=>C(!0)))}}))});if(o&&f||!o&&p==s.length-1||e.notSupportEditingCount==s.length)break;p++}while(!0)});return t}function g1(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,r)=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:r,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:r,type:"end"}),t.isRunning&&t.cancel()};i.disposer.ad(o);const s=c=>{c.code=="Escape"&&o()};i.disposer.ad(e.keyDownEvent.don(s));const a=new Th(n,e);i.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await i.promise(new Promise(c=>{a.isDestroyed()&&c(),i.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),c()})),i.disposer.ad(e.dblclickEvent.don(()=>c()))}))});return t}R.copyright=void 0;try{const t="earthsdk3-cesium",i="3.3.0-beta.11",e="2025-08-07T03:21:44.000Z",n="北京西部世界科技有限公司",r="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="4fc1c9db95c3d8a08c72995a4328bf2db103b608",a=((Date.now()-1754536904e3)/36e5).toFixed(1),c=`%c🌏 ${t}%c ${i}.${o.slice(0,8)}.${e} (距今${a}个小时)
2294
+ `,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},Fe,t)}class $x extends l.HasOwner{constructor(i){super(i);const{czmViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const r=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const s=n=this._getStartInfo(o.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(o=>{n&&n.currentPlaneType!=="none"&&(r.restart(void 0,e,n),n=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{do{const s=this._getStartInfo(o.pointerEvent);if(!s||s.currentPlaneType==="none")break;const{currentPlaneType:a}=s,c=[...this.owner.selfRotation];c[ui.rotationNum[a]]=0,this.owner.selfRotation=c;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(l.createProcessingFromAsyncFunc(async(i,e,n)=>{const r=this.owner.circles[n.currentPlaneType];e.incrementDisabledInputStack(),i.disposer.dispose(()=>e.decrementDisabledInputStack()),i.disposer.dispose(e.pointerMoveEvent.don(o=>{if(n&&o.pointerEvent){const{offsetX:s,offsetY:a}=o.pointerEvent,c=[s,a],{currentPlaneType:h}=n;if(h==="none")return;const p=this.owner.getPlane(h);if(!n.currentV)return;const u=p.pick(c);if(!u||!this.owner.cartesian)return;const f=d.Cartesian3.subtract(n.currentV,this.owner.cartesian,new d.Cartesian3);d.Cartesian3.normalize(f,f);const m=d.Cartesian3.subtract(u,this.owner.cartesian,new d.Cartesian3);if(d.Cartesian3.normalize(m,m),!p.normal||!p.origin)return;const g=Ng(f,m,p.normal),y=Ng(p.origin,f,p.normal),_=Ng(p.origin,m,p.normal);{const S=[...this.owner.selfRotation];S[ui.rotationNum[h]]=n.startRotation+g,this.owner.selfRotation=S,r.circleStartRotation=y,r.circleEndRotation=_}}})),this.owner.movingPlaneType=n.currentPlaneType,i.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),i.disposer.dispose(()=>{r.circleStartRotation=0,r.circleEndRotation=0}),await l.step(i,o=>new Promise((s,a)=>{o.disposer.dispose(a),o.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),o.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(i,e,n,r,o){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,c=this.owner.getPlane(n).pick(r);if(!c)return;const h=d.Cartesian3.distance(s,c),p=o/4,u=p*3/128;if(!(h>=p-u&&h<=p+u))return;const m=d.Cartesian3.distance(e.camera.positionWC,c);i.currentD2c<=m||(i.currentPlaneType=n,i.currentD2c=m,i.currentV=c,i.startRotation=a[ui.rotationNum[n]])}_getStartInfo(i){var p;const{czmViewer:e}=this.owner,n=(p=e.viewer)==null?void 0:p.scene;if(!this.owner.position||!this.owner.cartesian)return;const r=Oi(n,this.owner.cartesian,this.owner.pixelSize);if(!r)return;const{offsetX:o,offsetY:s}=i,a=[o,s],c=i.pointerId,h={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:c};return this._pickPlane(h,n,"heading",a,r),this._pickPlane(h,n,"pitch",a,r),this._pickPlane(h,n,"roll",a,r),h}}function Ng(t,i,e){const n=d.Cartesian3.cross(i,t,new d.Cartesian3);if(n.equals(d.Cartesian3.ZERO))return 0;d.Cartesian3.normalize(n,n);const r=d.Cartesian3.dot(n,e);let o=Math.acos(d.Cartesian3.dot(t,i))*180/Math.PI;return o=r>0?o:-o,o}const Zo=class Zo extends qt{constructor(e){super();v(this,"_hoveredPlaneType",this.disposeVar(l.react("none")));v(this,"_movingPlaneType",this.disposeVar(l.react("none")));v(this,"_circles");v(this,"_czmCameraModel");v(this,"_cartesian");v(this,"_planes",{heading:this.disposeVar(new Ux(this)),pitch:this.disposeVar(new Wx(this)),roll:this.disposeVar(new Gx(this))});v(this,"_rotatorRunningResetting");this._czmViewer=e;const n=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new l.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new $x(this)})),this._circles={heading:this._createRotatorCircle(n,"heading"),pitch:this._createRotatorCircle(n,"pitch"),roll:this._createRotatorCircle(n,"roll")},!!n.viewer){{const o=()=>{this._cartesian=this.position&&Ue(this.position)||void 0};o(),this.dispose(this.positionChanged.disposableOn(o))}this._createCameraModel(n)}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get circles(){return this._circles}get czmCameraModel(){return this._czmCameraModel}get cartesian(){return this._cartesian}get czmViewer(){return this._czmViewer}getPlane(e){return this._planes[e]}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createCameraModel(e){this._czmCameraModel=new ct(e),this._czmCameraModel.url="${earthsdk3-assets-script-dir}/assets/glb/camera1/camera1.gltf",this._czmCameraModel.localRotation=[90,0,0],this._czmCameraModel.allowPicking=!1,this._czmCameraModel.opaquePass="OVERLAY",this.dispose(l.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],n=>n*.1)),this.dispose(l.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(l.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const n=()=>{const r=ke({rotation:this.selfRotation});if(!r)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=d.Matrix4.toArray(r))};n(),this.dispose(this.selfRotationChanged.disposableOn(n))}{const n=()=>{this.circles.heading.show=this.enabled,this.circles.pitch.show=this.enabled,this.circles.roll.show=this.enabled,this._czmCameraModel&&(this._czmCameraModel.show=this.enabled&&this.showHelper)};n(),this.dispose(this.enabledChanged.disposableOn(n)),this.dispose(this.showHelperChanged.disposableOn(n))}}_createRotatorCircle(e,n){const r=this.ad(new es(e));this.dispose(l.track([r,"position"],[this,"position"])),this.dispose(l.track([r,"pixelSize"],[this,"pixelSize"])),this.dispose(l.track([r,"debug"],[this,"debug"])),this.dispose(l.track([r,"rotation"],[this,"rotation"]));{const o=()=>{r.selfRotation=Zo.rotationFuncs[n](this.selfRotation),r.circleRotation=this.selfRotation[Zo.rotationNum[n]]};o(),this.dispose(this.selfRotationChanged.disposableOn(o))}{const o=()=>{const s=this.movingPlaneType===n,a=this.hoveredPlaneType===n,h=[0,0,0,s||a?1:.8];h[Zo.rotationNum[n]]=1,r.color=h};o(),this.dispose(this.movingPlaneTypeChanged.disposableOn(o)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(o))}return r}};v(Zo,"rotationNum",{heading:0,pitch:1,roll:2}),v(Zo,"rotationFuncs",{heading:([e,n,r])=>[0,0,0],pitch:([e,n,r])=>[e,0,-90],roll:([e,n,r])=>[e,n+90,0]});let ui=Zo;(t=>{t.createDefaultProps=()=>({...qt.createDefaultProps(),rotation:l.reactArray([0,0,0]),selfRotation:l.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(ui||(ui={})),l.extendClassProps(ui.prototype,ui.createDefaultProps);const Qo=class Qo extends l.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(i){this.positions=[i??Qo.defaults.positions[0],this.stopPosition??Qo.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(i){this.positions=[this.startPosition??Qo.defaults.positions[0],i??Qo.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(i,e){if(super(),!i.viewer)return;const r=this.ad(new Ie(i,e));r.arcType="RHUMB";const o=this.ad(new Kt(i,e));this.ad(l.track([r,"allowPicking"],[this,"allowPicking"])),this.ad(l.track([o,"allowPicking"],[this,"allowPicking"]));{const s=()=>{r.show=o.show=this.show};s(),this.ad(this.showChanged.don(s))}{const s=()=>{r.width=this.width/2,o.pixelSize=this.width};s(),this.ad(this.widthChanged.don(s))}{const s=()=>{r.color=o.color=this.color};s(),this.ad(this.colorChanged.don(s))}{const s=()=>{r.positions=this.positions,o.position=this.stopPosition};s(),this.dispose(this.startPositionChanged.disposableOn(s)),this.dispose(this.stopPositionChanged.disposableOn(s))}}};v(Qo,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Uo=Qo;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:l.reactPositions(t.defaults.positions),width:10,color:l.reactArray([1,0,0,1])})})(Uo||(Uo={})),l.extendClassProps(Uo.prototype,Uo.createDefaultProps);class rn extends qt{constructor(e){super();v(this,"_lastPosition");v(this,"_opInfo",{step:this.ad(l.react(!1)),moved:this.ad(l.react(!1)),constraintMode:this.disposeVar(l.react("none")),originPosition:this.disposeVar(l.reactArray([0,0,0])),originHeading:this.disposeVar(l.react(0)),originDimensions:this.disposeVar(l.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(l.reactArray([0,0,0])),movingPosition:this.disposeVar(l.reactArray([0,0,0])),targetPosition:this.disposeVar(l.reactArray([0,0,0])),targetHeading:this.disposeVar(l.react(0))});v(this,"_scaleAxis");v(this,"_pickingXYProcessing",e=>this.disposeVar(new l.Processing((n,r,o)=>{const s=[0,0,0],a=new d.Cartographic;return e.pointerMoveEvent.disposableOn(c=>{if(!c.pointerEvent||!e.viewer)return;const h=oi(l.getDomEventCurrentTargetPos(c.pointerEvent));if(!jo(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Jo(a,s),this._opInfo.constraintMode.value==="x"?ro(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?ro(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,s,s):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=s,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const p=[0,0,0];w.geoRhumbDestination(s,o,r,p),this._opInfo.targetPosition.value=p;let u=this.scale[0],f=this.scale[1];const m=w.geoDistance(p,this._opInfo.originPosition.value)-w.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...p];const g=this._opInfo.originDimensions.value[0]/100;m!=0&&this._opInfo.constraintMode.value==="y"&&(m>0?u+=g:u-=g),m!=0&&this._opInfo.constraintMode.value==="x"&&(m>0?f+=g:f-=g),u<=0&&(u+=g),f<=0&&(f+=g),this.scale=[u??1,f??1,this.scale[2]??1]})})));v(this,"_pickingZProcessing",e=>this.disposeVar(new l.Processing(()=>{const n=new d.Cartesian3,r=[0,0,0];return e.pointerMoveEvent.disposableOn(o=>{if(!o.pointerEvent||!e.viewer)return;const s=oi(l.getDomEventCurrentTargetPos(o.pointerEvent));if(!nc(e.viewer.scene,Ue(this._opInfo.originPosition.value),s,n))return;this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(ce(n,r)){this._opInfo.movingPosition.value=r;const c=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[c[0],c[1],r[2]+a];let h=this.scale[2];const p=r[2]-this._lastPosition[2];this._lastPosition=[...r];const u=this._opInfo.originDimensions.value[0]/100;p!=0&&(p>0?h+=u:h-=u),h<=0&&(h+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,h??1]}})})));const n=e.viewer;if(!n)return;const{scene:r}=n;this.ad(new id(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={zAxis:this._createScaleAxis(e,"zAxis"),yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const h=()=>{if(!this._scaleAxis)return;const{zAxis:p,yAxis:u,xAxis:f}=this._scaleAxis,m=this._opInfo.constraintMode.value,g=this._opInfo.step;p.color=[0,0,1,.99],u.color=[0,1,0,.99],f.color=[1,0,0,.99],m==="x"?f.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="y"?u.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="z"&&(p.color=g?[1,1,0,.8]:[1,1,0,.99])};h(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(h)),this.dispose(this._opInfo.step.changed.disposableOn(h))}{const h=()=>{if(!this._scaleAxis)return;const{position:u=rn.defaults.position}=this,{zAxis:f,yAxis:m,xAxis:g}=this._scaleAxis;f.startPosition=m.startPosition=g.startPosition=u;const[y,_,S]=u;f.stopPosition=[y,_,S+this._opInfo.originDimensions.value[2]];const C=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);C&&(g.stopPosition=C);const E=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);E&&(m.stopPosition=E)};h();const p=this.ad(l.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(p.don(h))}{const h=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((p,u)=>p===this._opInfo.targetPosition.value[u])){this._opInfo.moved.value=!0;return}};h(),this.dispose(this._opInfo.originHeading.changed.disposableOn(h)),this.dispose(this._opInfo.originPosition.changed.disposableOn(h)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(h)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(h))}const o=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(l.createProcessingFromAsyncFunc(async h=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await l.step(h,async p=>{const u=()=>{const g=[...this.position??rn.defaults.position];e.editingHeightOffset&&(g[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=g};p.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const f={constraintMode:"none",startDragPos:[0,0,0]},m=g=>{if(!this.position)return;const y={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};qh(g,r,y,this.axisSnapPixelSize,f),this._opInfo.constraintMode.value=f.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=f.startDragPos};p.disposer.dispose(e.pointerMoveEvent.disposableOn(g=>{g.pointerEvent&&m(g.pointerEvent)})),await l.step(p,g=>new Promise((y,_)=>{g.disposer.dispose(_),g.disposer.dispose(e.pointerDownEvent.don(S=>{S.pointerEvent&&m(S.pointerEvent),S.pointerEvent&&S.pointerEvent.button===0&&f.constraintMode!=="none"&&y()}))}))}),this._opInfo.step.value=!1,await l.step(h,async p=>{if(e.incrementDisabledInputStack(),p.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const u=w.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),f=w.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);o.restart(void 0,u,f),p.disposer.dispose(()=>o.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),p.disposer.dispose(()=>s.cancel()));await l.step(p,u=>new Promise((f,m)=>{u.disposer.dispose(m),u.disposer.dispose(e.pointerUpEvent.don(()=>{f()})),u.disposer.dispose(e.pointerOutEvent.don(()=>{f()}))})),this._lastPosition=void 0});while(!0)})),c=()=>{this.enabled?a.restart():a.isRunning&&a.cancel()};c(),this.dispose(this.enabledChanged.disposableOn(c))}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,n){const r=this.ad(new Uo(e));return r.width=10,this.ad(l.track([r,"show"],[this,"enabled"])),r}}(t=>{t.createDefaultProps=()=>({...qt.createDefaultProps(),scale:l.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(rn||(rn={})),l.extendClassProps(rn.prototype,rn.createDefaultProps);const no=class no extends Tt{constructor(e){super();v(this,"_editingPoints",this.disposeVar(new l.ObservableArray));v(this,"_cancelEvent",this.disposeVar(new l.Event));v(this,"_currentProcess");v(this,"_menuPoiEnabled",this.disposeVar(l.react(!1)));v(this,"_status",this.disposeVar(l.react("None")));v(this,"_positionsChanged",this.ad(new l.Event));v(this,"_cursorInfo");this._czmViewer=e,this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(n=>{for(let{start:r,deleteCount:o,items:s}of n){for(const a of s)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=r;a<r+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(l.nextAnimateFrame(()=>{var r;((r=n.pointerEvent)==null?void 0:r.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(n=>{this._currentProcess&&(n?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const n=()=>{this.polylineShow=this.czmViewer.editingLineShow};n(),this.ad(this.czmViewer.editingLineShowChanged.don(n))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let n of this._editingPoints)n.position&&e.push([...n.position]);return e}resetPositions(e){if(this.enabled??no.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((r,o)=>r.every((s,a)=>{const c=this.editingPoints.get(o);return c.position&&c.position[a]===s})))}forceResetPositions(e){(this.enabled??no.defaults.enabled)&&(this.enabled=!1),this.resetPositions(e)}get positions(){return this.getPositions()}set positions(e){this.resetPositions(e)}get positionsChanged(){return this._positionsChanged}get czmViewer(){return this._czmViewer}get cursorInfo(){return this._cursorInfo}createPolyline(e){const n=this.ad(new Ie(e));this.ad(l.track([n,"color"],[this,"polylineColor"])),this.ad(l.track([n,"width"],[this,"polylineWidth"])),this.ad(l.track([n,"show"],[this,"polylineShow"])),this.ad(l.track([n,"arcType"],[this,"polylineArcType"])),this.ad(l.track([n,"loop"],[this,"loop"]));{const r=()=>{const o=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,o.push(s);n.positions=o};r(),this.ad(this.positionsChanged.don(r))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new l.CursorInfo(e.container,l.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const r=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}r==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):r==="Modifying"||r==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):r==="None"&&(n.text="",n.show=!1)}}))}};v(no,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),v(no,"defaults",{...Tt.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:no.baseImageUrl+"point-green.png",otherControlPointImageUrl:no.baseImageUrl+"point-yellow.png"});let ei=no;(t=>{t.createDefaultProps=()=>({...Tt.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:l.reactArray([1,1,1,1]),polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,firstControlPointImageUrl:t.baseImageUrl+"point-green.png",otherControlPointImageUrl:t.baseImageUrl+"point-yellow.png",hideCursorInfo:!1,middlePointShow:!0})})(ei||(ei={})),l.extendClassProps(ei.prototype,ei.createDefaultProps);let Xx=0;class s1 extends l.Destroyable{constructor(e,n){super();v(this,"_position",this.disposeVar(l.reactArrayWithUndefined(void 0)));v(this,"_id",Xx++);v(this,"_menuPoi");n&&(this.position=n),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const r=this._menuPoi=this.ad(new hr(e.czmViewer));r.enabled=!1,this.ad(l.track([r,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){r.position=void 0;return}const s=[...this.position];s[2]-=e.czmViewer.editingHeightOffset??0,r.position=s,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const s=e.editingPoints.indexOf(this)+1;s!==0&&(r.title=`控制点${s}`,s===1?r.imageUri=e.firstControlPointImageUrl??ei.defaults.firstControlPointImageUrl:r.imageUri=e.otherControlPointImageUrl??ei.defaults.otherControlPointImageUrl)};o(),this.dispose(e.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class a1 extends s1{constructor(i,e){super(i,e)}}class Je extends ei{constructor(e){super(e);v(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new l.Event));v(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new di(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??Je.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??Je.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await r.promise(l.step(r,async o=>{const s=o.disposer,a=s.ad(this._addingEditingProcessing());s.dispose(()=>"adding canceled!"),s.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(c=>{s.dispose(a.completeEvent.disposableOnce(c))}))}))})),this.dispose(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new a1(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??Je.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},n=l.createProcessingFromAsyncFunc(async r=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await r.promise(l.step(r,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new Yx(this,o)));const p=a.disposer.disposeVar(new Qx(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>p.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(f=>{f?(o++,u(!0)):u(!1)})),a.disposer.dispose(p.overEvent.disposableOnce(f=>{f?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return n.start(),n}}(t=>{t.createDefaultProps=()=>({...ei.createDefaultProps()})})(Je||(Je={})),l.extendClassProps(Je.prototype,Je.createDefaultProps);class Yx extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));const{placeEditing:r}=e;let o=new a1(e,void 0);e.editingPoints.splice(n,0,o);const s=()=>{(e.debug??Je.defaults.debug)&&console.log("delete currentPosEditor");const h=e.editingPoints.indexOf(o);if(h===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(h,1)};if(r.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(l.track([o,"position"],[r,"position"])),r.enabled=!0;let a=!1;const c=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{r.enabled=!1,!a&&c()}),this.dispose(r.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?c():this._overEvent.emit(!0)})),(e.debug??Je.defaults.debug)&&console.log(`PointAdding creating! index(${n})`),this.dispose(()=>{(e.debug??Je.defaults.debug)&&console.log(`PointAdding destroying! index(${n})`)})}get overEvent(){return this._overEvent}}function Zx(t,i){const e=t.editingPoints,n=i-1;return n<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(n,1),!0)}class Qx extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));v(this,"_doEvent",this.disposeVar(new l.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(Zx(e,n)))),(e.debug??Je.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${n})`),this.dispose(()=>{(e.debug??Je.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${n})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class l1 extends Je{constructor(i){super(i),this.loop=!1}}class c1 extends Je{constructor(i){super(i),this.loop=!0}}class Ah extends s1{constructor(i,e){super(i,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",be.baseImageUrl+"add.png"],["delete","删除当前控制点","",be.baseImageUrl+"delete.png"],["modify","修改当前控制点","",be.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(r=>{i.menuPoiCommand(this,r)})),this.dispose(n.dbclickEvent.disposableOn(()=>{i.menuPoiCommand(this,"dbClick")}))}if(i.middlePointShow){const n=this.ad(new mi(i.czmViewer));{n.imageUri=i.firstControlPointImageUrl??be.defaults.firstControlPointImageUrl,n.tooltip="点击增加一个控制点",n.bgColor=[0,0,0,.6],n.fgColor=[1,1,1,1],n.size=[8,8],n.originRatioAndOffset=[.5,.5,0,0];{const r=()=>{if(!(i.enabled??be.defaults.enabled)){n.enabled=!1,n.show=!1;return}do{const s=i.editingPoints.indexOf(this);if(s===-1)break;const a=i.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(i.loop??be.defaults.loop)&&s+1>=a)break;const h=this.position;if(!h)break;let p=(s+1)%a;const f=i.editingPoints.get(p).position;if(!f)break;const m=Zh(h,f);if(!m)break;m[2]-=i.czmViewer.editingHeightOffset??0,n.position=m;const g=i.editingPoints.length<(i.maxPointsNum??be.defaults.maxPointsNum);n.enabled=g,n.show=g;return}while(!1);n.enabled=!1,n.show=!1};r(),this.dispose(i.positionsChanged.disposableOn(r)),this.dispose(i.loopChanged.disposableOn(r)),this.dispose(i.enabledChanged.disposableOn(r))}this.dispose(n.clickEvent.disposableOn(r=>{if(r.button!==0||i.editingPoints.length>=(i.maxPointsNum??be.defaults.maxPointsNum))return;const o=i.editingPoints.indexOf(this);if(o===-1)return;const s=n.position?[...n.position]:void 0;s&&(s[2]+=i.czmViewer.editingHeightOffset??0);let a=new Ah(i,s);i.editingPoints.splice(o+1,0,a),i.modify(a)}))}}}}class be extends ei{constructor(e){super(e);v(this,"_menuPoiCommand",this.disposeVar(new l.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new l.Event));v(this,"_overEvent",this.disposeVar(new l.Event));v(this,"translationEditing");{const r=this.ad(l.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new l.ObjResettingWithEvent(r,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new Kx(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new on(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??be.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??be.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await r.promise(l.step(r,async s=>{const a=s.disposer,c=a.ad(new Jx(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&c.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>c.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(p=>c.modify(p))),await s.promise(new Promise(p=>{a.dispose(c.overEvent.disposableOnce(u=>{p(u)}))}))})),o===-1){(this.debug??be.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??be.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??be.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let c=o%this.editingPoints.length;const p=this.editingPoints.get(c).position;if(!p)return;const u=Zh(a,p);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let f=new Ah(this,u);this.editingPoints.splice(o,0,f)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,n){this._menuPoiCommand.emit(e,n)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new Ah(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...ei.createDefaultProps(),moveWithFirstPosition:!1})})(be||(be={})),l.extendClassProps(be.prototype,be.createDefaultProps);class Kx extends l.Destroyable{constructor(i,e){super(),this._firstPositionEditor=i,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,r)=>{if(n===void 0||r===void 0)return;var o=[n[0]-r[0],n[1]-r[1],n[2]-r[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const c=this.multiPointsModifyEditing.editingPoints.get(a),h=c.position;h!==void 0&&(c.position=[h[0]+o[0],h[1]+o[1],h[2]+o[2]])}})}}class Jx extends l.Destroyable{constructor(e){super();v(this,"_overEvent",this.disposeVar(new l.Event));v(this,"_cancelEvent",this.disposeVar(new l.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new l.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let n;const r=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(r);const o=s=>{r(),e.status="Modifying_Point",n=new Bx(e,s),n.dispose(n.overEvent.disposableOn(()=>{r()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((s,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const c=e.editingPoints.indexOf(s);if(c===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(c,1)}else if(a==="modify")o(s);else if(a==="add"){const c=e.editingPoints.indexOf(s);if(c===-1)throw console.error("posEditor not found"),new Error("posEditor not found");this._overEvent.emit(c+1)}else a==="dbClick"?this._overEvent.emit(-1):alert(`未知的commandName(${a})`)})),this.dispose(this._cancelEvent.disposableOn(()=>{this._overEvent.emit(-1)}))}get overEvent(){return this._overEvent}cancel(){this._cancelEvent.emit()}modify(e){this._forceModifyPosEditorEvent.emit(e)}}class Bx extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));this._modifying=e,this._posEditor=n,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:r}=this._modifying;if(r.enabled=!0,r.heading=0,this.dispose(()=>{r.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");r.position=this._posEditor.position,this.dispose(l.track([this._posEditor,"position"],[r,"position"])),this.dispose(r.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class h1 extends be{constructor(i){super(i),this.loop=!1}}class d1 extends be{constructor(i){super(i),this.loop=!0}}class ts extends Je{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(r<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Je.createDefaultProps(),startPosition:l.reactArrayWithUndefined(void 0),endPosition:l.reactArrayWithUndefined(void 0),rotation:l.reactArray([90,0,0]),distance:l.react(1)})})(ts||(ts={})),l.extendClassProps(ts.prototype,ts.createDefaultProps);class Wo extends be{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",be.baseImageUrl+"add.png"],["delete","删除当前控制点","",be.baseImageUrl+"delete.png"],["modify","修改当前控制点","",be.baseImageUrl+"modify.png"]],this.rotation=[90,0,0],this.distance=1;break}this.endPosition=this.positions[1];for(let c of this.editingPoints)c.menuPoi.commands=[["delete","删除当前控制点","",be.baseImageUrl+"delete.png"],["modify","修改当前控制点","",be.baseImageUrl+"modify.png"]];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(Math.abs(r)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...be.createDefaultProps(),startPosition:l.reactArrayWithUndefined(void 0),endPosition:l.reactArrayWithUndefined(void 0),rotation:l.reactArray([0,0,0]),distance:l.react(0)})})(Wo||(Wo={})),l.extendClassProps(Wo.prototype,Wo.createDefaultProps);class u1 extends Je{constructor(i){super(i),this.loop=!1,this.polylineShow=!1}}class p1 extends be{constructor(i){super(i),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class is extends Je{constructor(i){super(i),i.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(i){const e=this.ad(new si(i));e.topOrBottom="bottom",this.ad(l.track([e,"color"],[this,"polylineColor"])),this.ad(l.track([e,"width"],[this,"polylineWidth"])),this.ad(l.track([e,"show"],[this,"polylineShow"])),this.ad(l.track([e,"arcType"],[this,"polylineArcType"])),this.ad(l.track([e,"loop"],[this,"loop"])),this.ad(l.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Je.createDefaultProps(),visibilityPositions:l.reactPositionsSet(void 0)})})(is||(is={})),l.extendClassProps(is.prototype,is.createDefaultProps);class ns extends be{constructor(i){if(super(i),!!i.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(i){const e=this.ad(new si(i));e.topOrBottom="bottom",this.ad(l.track([e,"color"],[this,"polylineColor"])),this.ad(l.track([e,"width"],[this,"polylineWidth"])),this.ad(l.track([e,"show"],[this,"polylineShow"])),this.ad(l.track([e,"arcType"],[this,"polylineArcType"])),this.ad(l.track([e,"loop"],[this,"loop"])),this.ad(l.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...be.createDefaultProps(),visibilityPositions:l.reactPositionsSet(void 0)})})(ns||(ns={})),l.extendClassProps(ns.prototype,ns.createDefaultProps);class f1 extends Wo{constructor(i){super(i),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.zAxisShow=!0,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class Ct extends w.EngineObject{constructor(e,n,r){super(e,n,r??!0);v(this,"_supportEditing",this.disposeVar(l.react(!0)));v(this,"_currentEditing",this.disposeVar(l.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var o;if(this.currentEditing){if(this.currentEditing instanceof Je&&((o=this.currentEditing.currentProcess)!=null&&o.isRunning))if(this.currentEditing.currentProcess.cancel(),e!=null&&e.position){if(this.currentEditing.positions.length>1)return;e.position=this.currentEditing.positions[0]??[0,0,0],e!=null&&e.rotation&&(e.rotation=[0,0,0]),e!=null&&e.far&&(e.far=1),e!=null&&e.radius&&(e.radius=1),e!=null&&e.distance&&(e.distance=1)}else e.points=this.currentEditing.positions;this.currentEditing instanceof di&&this.currentEditing.enabled&&(e.position=[0,0,0])}}))}get supportEditing(){return this._supportEditing.value}set supportEditing(e){this._supportEditing.value=e}get supportEditingChanged(){return this._supportEditing.changed}get currentEditing(){return this._currentEditing.value}set currentEditing(e){this._currentEditing.value=e}get currentEditingChanged(){return this._currentEditing.changed}}const Ol=class Ol extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new di(e));this.ad(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)==2&&(n.enabled=!0)}));do{if(Reflect.has(i,"position")){this.ad(l.bind([n,"position"],[i,"position"])),n.enabled=!n.position||w.equalsN3(n.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};v(Ol,"type",Ol.registerEditing("ESCesiumViewer",w.ESJEditingMode.Place,Ol));let Og=Ol;const Vl=class Vl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ui(e));n.rotation=[90,0,0],this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);r&&(this.ad(l.bind([n,"position"],[r.czm3DTiles,"position"])),this.ad(l.bind([n,"selfRotation"],[i,"rotation"])))});break}if(Reflect.has(i,"position")&&Reflect.has(i,"rotation")){this.ad(l.bind([n,"position"],[i,"position"])),this.ad(l.bind([n,"selfRotation"],[i,"rotation"]));break}this.supportEditing=!1}while(!1)}};v(Vl,"type",Vl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Rotation,Vl));let Vg=Vl;const Ul=class Ul extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new rn(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")&&Reflect.has(i,"scale")){this.ad(l.bind([n,"position"],[i,"position"])),this.ad(l.bind([n,"scale"],[i,"scale"]));break}this.supportEditing=!1}while(!1)}};v(Ul,"type",Ul.registerEditing("ESCesiumViewer",w.ESJEditingMode.Scale,Ul));let Ug=Ul;const Wl=class Wl extends Ct{constructor(i,e){super(Array.isArray(i)?i[0]:i,e,!0);const n=this.currentEditing=this.ad(new on(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(i)){const r=[];for(let o=0;o<i.length;o++){const s=i[o];Reflect.has(s,"position")?r.push(s.position):s.points&&r.push(...s.points)}n.position=w.getMinMaxCorner(r).center,this.ad(n.positionChanged.disposableOn((o,s)=>{if(!(!o||!s)){var a=Dt({originPosition:s},[o])[0][0];i.forEach(c=>{if(Reflect.has(c,"position")){const h=Dt({originPosition:s},[c.position])[0][0];c.position=mn({originPosition:s},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(c,"points")&&c.points){const h=Dt({originPosition:s},c.points)[0];c.points=mn({originPosition:s},h.map(p=>[p[0]+a[0],p[1]+a[1],p[2]+a[2]]))[0]}})}}));break}if(Reflect.has(i,"position")){this.ad(l.bind([n,"position"],[i,"position"]));break}if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);this.ad(l.bind([n,"position"],[r.czm3DTiles,"position"]))});break}if(Reflect.has(i,"points")){if(i.points===void 0||i.points.length===0){this.destroy();break}n.position=w.getMinMaxCorner(i.points).center,this.ad(n.positionChanged.disposableOn((r,o)=>{if(r===void 0||o===void 0||i.points===void 0||i.points.length===0){this.destroy();return}var s=Dt({originPosition:o},[r])[0][0];const a=Dt({originPosition:o},i.points)[0];i.points=mn({originPosition:o},a.map(c=>[c[0]+s[0],c[1]+s[1],c[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};v(Wl,"type",Wl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Translation,Wl));let Th=Wl;const Gl=class Gl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ts(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")){this.ad(l.bind([n,"startPosition"],[i,"position"])),this.ad(it([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(l.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(l.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(l.bind([n,"distance"],[i,"distance"]));break}const r=Ue(i.position);if(d.Cartesian3.ZERO.equals(r)||!e.viewer)return;n.distance=Oi(e.viewer.scene,r,100)??1}while(!1);break}if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1);n.startPosition&&!w.equalsN3(n.startPosition,[0,0,0])&&n.init(),n.enabled=!0}};v(Gl,"type",Gl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsAppend,Gl));let Wg=Gl;const Hl=class Hl extends Ct{constructor(i,e){var o;if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new Wo(e));do{if(Reflect.has(i,"position")){this.ad(l.bind([n,"startPosition"],[i,"position"])),this.ad(it([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(l.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(l.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(l.bind([n,"distance"],[i,"distance"]));break}const s=Ue(i.position);if(d.Cartesian3.ZERO.equals(s)||!e.viewer)return;n.distance=Oi(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(i,"points")&&((o=i.points)==null?void 0:o.length)==2){n.moveWithFirstPosition=!1;const s=()=>n.positions=i.points??[];s(),this.ad(i.pointsChanged.don(()=>!n.enabled&&s())),this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Hl,"type",Hl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsModify,Hl));let Gg=Hl;const ql=class ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new c1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(ql,"type",ql.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularAppend,ql));let Hg=ql;const $l=class $l extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new d1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v($l,"type",$l.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularInsert,$l));let qg=$l;const Xl=class Xl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new l1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Xl,"type",Xl.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringAppend,Xl));let $g=Xl;const Yl=class Yl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new h1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Yl,"type",Yl.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringInsert,Yl));let Xg=Yl;const Zl=class Zl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new u1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Zl,"type",Zl.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterAppend,Zl));let Yg=Zl;const Ql=class Ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new p1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Ql,"type",Ql.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterModify,Ql));let Zg=Ql;const Kl=class Kl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new is(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Kl,"type",Kl.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityAppend,Kl));let Qg=Kl;const Jl=class Jl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ns(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Jl,"type",Jl.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityModify,Jl));let Kg=Jl;const Bl=class Bl extends Ct{constructor(i,e){if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new f1(e));do{if(Reflect.has(i,"points")){const o=Reflect.has(i,"extrudedHeight"),s=Reflect.has(i,"height"),a=Reflect.has(i,"perPositionHeight")?i.perPositionHeight:!o,c=i instanceof w.ESClassification||i instanceof w.ESPolygonFence;let h=w.getMinMaxCorner(i.points).center,p=[...h],u=c?i.points[0][2]:0;a?o?p[2]=i.extrudedHeight:p[2]=i.height+u:(s&&(h[2]=i.height),o&&(p[2]=i.extrudedHeight)),n.startPosition=h,n.distance=p[2]-h[2],n.moveWithFirstPosition=!1;let f=[...h];this.ad(n.positionsChanged.don(()=>{n.positions.length===2&&(a?(i.points=i.points.map(m=>[m[0],m[1],m[2]+n.positions[0][2]-f[2]]),o?i.extrudedHeight=n.positions[1][2]:s&&(i.height=n.positions[1][2]-(c?n.positions[0][2]:0))):(s&&(i.height=n.positions[0][2]),o&&(i.extrudedHeight=n.positions[1][2])),f=[...n.positions[0]])}));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Bl,"type",Bl.registerEditing("ESCesiumViewer",w.ESJEditingMode.HeightModify,Bl));let Jg=Bl;const Pt=class Pt extends l.Destroyable{constructor(e,n,r,o=!0){super();v(this,"czmViewer");v(this,"sceneObject");v(this,"editingModes",[]);v(this,"editingID");v(this,"useKeyToSwitch");v(this,"currentIndex",0);const s=this.czmViewer=e,a=this.sceneObject=n,c=this.editingModes=Array.isArray(r)?[...r]:[r],h=this.editingID=a.editingID;this.useKeyToSwitch=o,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:h,type:"start",add:{modes:c}}),this.ad(a.toDestroyEvent.don(Pt.stop)),this.ad(s.keyDownEvent.don(p=>{p.code=="Escape"&&Pt.stop()})),this.createEditingMode(this.currentIndex)}createEditingMode(e){const{sceneObject:n,czmViewer:r,editingID:o}=this,s=new l.Destroyable;this.ad(()=>!s.isDestroyed()&&s.destroy());const a=this.editingModes[e%this.editingModes.length],c=w.EngineObject.contextEditing.getEngineObjConstructor(a,r.typeName);if(!c||!n.supportEditingModes().includes(a))return this._createNextEditingMode(s,a);const h=new c(n,r);if(s.ad(()=>!h.isDestroyed()&&h.destroy()),h.isDestroyed())return this._createNextEditingMode(s,a);const p=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(h.toDestroyEvent.don(p)),this.useKeyToSwitch&&s.ad(r.keyDownEvent.don(u=>{u.code=="Space"&&p()})),s.ad(r.dblclickEvent.donce(()=>this.useKeyToSwitch?Pt.stop():p())),h.supportEditing)r.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:o,type:"changed",add:{cMode:a,cIndex:e}}),r.notSupportEditingCount=0;else return this._createNextEditingMode(s,a)}_createNextEditingMode(e,n){const{sceneObject:r,czmViewer:o,editingID:s}=this;if(!e.isDestroyed()&&e.destroy(),console.log(`未找到编辑模式或不支持当前编辑模式${n},已跳过当前编辑模式,请检查输入`),o.editingEvent.emit({objectIDs:[r.parentID??r.id],editingID:s,type:"changedFailed",add:{cMode:n,cIndex:this.currentIndex}}),o.notSupportEditingCount++,o.notSupportEditingCount==this.editingModes.length)return Pt.stop();l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})}static create(e,n,r,o=!0){Pt.stop(),Pt.currentEditingInstance=new Pt(e,n,r,o)}static stop(){if(Pt.currentEditingInstance&&!Pt.currentEditingInstance.isDestroyed()){if(!Pt.currentEditingInstance)return;const{czmViewer:e,sceneObject:n,editingID:r,editingModes:o}=Pt.currentEditingInstance;Pt.currentEditingInstance.destroy(),e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:r,type:"end",add:{modes:o}})}Pt.currentEditingInstance=void 0}};v(Pt,"currentEditingInstance");let Mh=Pt;function jx(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,r,o=!0)=>{const s=Array.isArray(r)?[...r]:[r],a=n.editingID;e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"start",add:{modes:s}});const c=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"end",add:{modes:s}}),t.isRunning&&t.cancel()};i.disposer.ad(c),i.disposer.ad(n.toDestroyEvent.don(c));const h=u=>{u.code=="Escape"&&c()};i.disposer.ad(e.keyDownEvent.don(h));let p=0;do{const u=s[p%s.length],f=await l.step(i,async m=>{const g=m.disposer,y=w.EngineObject.contextEditing.getEngineObjConstructor(u,e.typeName);if(!y||!n.supportEditingModes().includes(u))return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:p}}),e.notSupportEditingCount++,!1;const _=new y(n,e);if(g.ad(()=>{!_.isDestroyed()&&_.destroy()}),_.supportEditing)e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"changed",add:{cMode:u,cIndex:p}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:p}}),e.notSupportEditingCount++,!1;return await m.promise(new Promise(C=>{if(_.isDestroyed()&&C(!1),g.ad(_.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),C(!1)})),o){const E=M=>{M.code=="Space"&&(console.log(`编辑模式${u}结束`),C(!1))};g.ad(e.keyDownEvent.don(E)),g.ad(e.dblclickEvent.don(()=>C(!0)))}}))});if(o&&f||!o&&p==s.length-1||e.notSupportEditingCount==s.length)break;p++}while(!0)});return t}function g1(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,r)=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:r,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:r,type:"end"}),t.isRunning&&t.cancel()};i.disposer.ad(o);const s=c=>{c.code=="Escape"&&o()};i.disposer.ad(e.keyDownEvent.don(s));const a=new Th(n,e);i.disposer.ad(()=>{!a.isDestroyed()&&a.destroy()}),await i.promise(new Promise(c=>{a.isDestroyed()&&c(),i.disposer.ad(a.toDestroyEvent.don(()=>{console.log("移动结束"),c()})),i.disposer.ad(e.dblclickEvent.don(()=>c()))}))});return t}R.copyright=void 0;try{const t="earthsdk3-cesium",i="3.3.0-beta.11",e="2025-08-07T03:50:52.000Z",n="北京西部世界科技有限公司",r="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="74763c45d16892034482b10dcc96c5b026d4ad5c",a=((Date.now()-1754538652e3)/36e5).toFixed(1),c=`%c🌏 ${t}%c ${i}.${o.slice(0,8)}.${e} (距今${a}个小时)
2295
2295
  %c${r?r+`
2296
2296
  `:""}当前网站正在使用${t},此软件版权归${n}所有
2297
- `;R.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","4fc1c9db95c3d8a08c72995a4328bf2db103b608")},get info(){return c},get date(){return"2025-08-07T03:21:44.000Z"},get author(){return"suplyang"},get version(){return"3.3.0-beta.11"},get name(){return"earthsdk3-cesium"},get commitId(){return"4fc1c9db95c3d8a08c72995a4328bf2db103b608"},print(){console.info(this.info,`
2297
+ `;R.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","74763c45d16892034482b10dcc96c5b026d4ad5c")},get info(){return c},get date(){return"2025-08-07T03:50:52.000Z"},get author(){return"suplyang"},get version(){return"3.3.0-beta.11"},get name(){return"earthsdk3-cesium"},get commitId(){return"74763c45d16892034482b10dcc96c5b026d4ad5c"},print(){console.info(this.info,`
2298
2298
  font-size: 18px;
2299
2299
  font-weight: 1000;
2300
2300
  line-height: 1;
@@ -1 +1 @@
1
- {"version":3,"file":"ViewerCreating.d.ts","sourceRoot":"","sources":["../../../src/ESCesiumViewer/ViewerCreating.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAA0D,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,OAAO,oBAAoB,CAAC;AAM5B,qBAAa,cAAe,SAAQ,WAAW;gBAC/B,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,SAAS,KAAK,IAAI,EAAE,UAAU,CAAC,EAAE,SAAS;CAwE1J"}
1
+ {"version":3,"file":"ViewerCreating.d.ts","sourceRoot":"","sources":["../../../src/ESCesiumViewer/ViewerCreating.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAA0D,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,OAAO,oBAAoB,CAAC;AAM5B,qBAAa,cAAe,SAAQ,WAAW;gBAC/B,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,SAAS,KAAK,IAAI,EAAE,UAAU,CAAC,EAAE,SAAS;CAyE1J"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "earthsdk3-cesium",
3
- "version": "3.3.0-beta.11",
3
+ "version": "3.3.0-beta.12",
4
4
  "description": "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",
5
5
  "type": "module",
6
6
  "main": "./dist/earthsdk3-cesium.umd.cjs",
@@ -1,148 +0,0 @@
1
- import * as Cesium from 'cesium';
2
-
3
- // declare class GroundPolylinePrimitive extends Destroyable {
4
- // constructor()
5
- // }
6
-
7
- type GeometryInstance = Cesium.GeometryInstance;
8
- type Appearance = Cesium.Appearance;
9
- type ClassificationType = Cesium.ClassificationType;
10
- type Scene = Cesium.Scene;
11
-
12
- declare class GroundPolylinePrimitive {
13
- constructor(options?: {
14
- geometryInstances?: any[] | GeometryInstance;
15
- appearance?: Appearance;
16
- show?: boolean;
17
- interleave?: boolean;
18
- releaseGeometryInstances?: boolean;
19
- allowPicking?: boolean;
20
- asynchronous?: boolean;
21
- classificationType?: ClassificationType;
22
- debugShowBoundingVolume?: boolean;
23
- debugShowShadowVolume?: boolean;
24
- });
25
- /**
26
- * The geometry instances rendered with this primitive. This may
27
- * be <code>undefined</code> if <code>options.releaseGeometryInstances</code>
28
- * is <code>true</code> when the primitive is constructed.
29
- * <p>
30
- * Changing this property after the primitive is rendered has no effect.
31
- * </p>
32
- */
33
- readonly geometryInstances: any[] | GeometryInstance;
34
- /**
35
- * The {@link Appearance} used to shade this primitive. Each geometry
36
- * instance is shaded with the same appearance. Some appearances, like
37
- * {@link PolylineColorAppearance} allow giving each instance unique
38
- * properties.
39
- */
40
- appearance: Appearance;
41
- /**
42
- * Determines if the primitive will be shown. This affects all geometry
43
- * instances in the primitive.
44
- */
45
- show: boolean;
46
- /**
47
- * Determines whether terrain, 3D Tiles or both will be classified.
48
- */
49
- classificationType: ClassificationType;
50
- /**
51
- * This property is for debugging only; it is not for production use nor is it optimized.
52
- * <p>
53
- * Draws the bounding sphere for each draw command in the primitive.
54
- * </p>
55
- */
56
- debugShowBoundingVolume: boolean;
57
- /**
58
- * Determines if geometry vertex attributes are interleaved, which can slightly improve rendering performance.
59
- */
60
- readonly interleave: boolean;
61
- /**
62
- * When <code>true</code>, the primitive does not keep a reference to the input <code>geometryInstances</code> to save memory.
63
- */
64
- readonly releaseGeometryInstances: boolean;
65
- /**
66
- * When <code>true</code>, each geometry instance will only be pickable with {@link Scene#pick}. When <code>false</code>, GPU memory is saved.
67
- */
68
- readonly allowPicking: boolean;
69
- /**
70
- * Determines if the geometry instances will be created and batched on a web worker.
71
- */
72
- readonly asynchronous: boolean;
73
- /**
74
- * Determines if the primitive is complete and ready to render. If this property is
75
- * true, the primitive will be rendered the next time that {@link GroundPolylinePrimitive#update}
76
- * is called.
77
- */
78
- readonly ready: boolean;
79
- /**
80
- * Gets a promise that resolves when the primitive is ready to render.
81
- */
82
- readonly readyPromise: Promise<GroundPolylinePrimitive>;
83
- /**
84
- * This property is for debugging only; it is not for production use nor is it optimized.
85
- * <p>
86
- * If true, draws the shadow volume for each geometry in the primitive.
87
- * </p>
88
- */
89
- readonly debugShowShadowVolume: boolean;
90
- /**
91
- * Initializes the minimum and maximum terrain heights. This only needs to be called if you are creating the
92
- * GroundPolylinePrimitive synchronously.
93
- * @returns A promise that will resolve once the terrain heights have been loaded.
94
- */
95
- static initializeTerrainHeights(): Promise<void>;
96
- /**
97
- * Called when {@link Viewer} or {@link CesiumWidget} render the scene to
98
- * get the draw commands needed to render this primitive.
99
- * <p>
100
- * Do not call this function directly. This is documented just to
101
- * list the exceptions that may be propagated when the scene is rendered:
102
- * </p>
103
- */
104
- update(): void;
105
- /**
106
- * Returns the modifiable per-instance attributes for a {@link GeometryInstance}.
107
- * @example
108
- * const attributes = primitive.getGeometryInstanceAttributes('an id');
109
- * attributes.color = Cesium.ColorGeometryInstanceAttribute.toValue(Cesium.Color.AQUA);
110
- * attributes.show = Cesium.ShowGeometryInstanceAttribute.toValue(true);
111
- * @param id - The id of the {@link GeometryInstance}.
112
- * @returns The typed array in the attribute's format or undefined if the is no instance with id.
113
- */
114
- getGeometryInstanceAttributes(id: any): any;
115
- /**
116
- * Checks if the given Scene supports GroundPolylinePrimitives.
117
- * GroundPolylinePrimitives require support for the WEBGL_depth_texture extension.
118
- * @param scene - The current scene.
119
- * @returns Whether or not the current scene supports GroundPolylinePrimitives.
120
- */
121
- static isSupported(scene: Scene): boolean;
122
- /**
123
- * Returns true if this object was destroyed; otherwise, false.
124
- * <p>
125
- * If this object was destroyed, it should not be used; calling any function other than
126
- * <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
127
- * </p>
128
- * @returns <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
129
- */
130
- isDestroyed(): boolean;
131
- /**
132
- * Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
133
- * release of WebGL resources, instead of relying on the garbage collector to destroy this object.
134
- * <p>
135
- * Once an object is destroyed, it should not be used; calling any function other than
136
- * <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
137
- * assign the return value (<code>undefined</code>) to the object as done in the example.
138
- * </p>
139
- * @example
140
- * e = e && e.destroy();
141
- */
142
- destroy(): void;
143
- }
144
-
145
- export default GroundPolylinePrimitive;
146
-
147
-
148
-