earthsdk3-cesium 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/earthsdk3-cesium.iife.js +2 -2
- package/dist/earthsdk3-cesium.js +2 -2
- package/dist/earthsdk3-cesium.umd.cjs +2 -2
- package/package.json +2 -2
- package/dist/types/CzmObjects/general/CzmESSignalTransmission/XbsjPolyline/XbsjPolylineGeometry.d.ts +0 -3
- package/dist/types/CzmObjects/general/CzmESSignalTransmission/XbsjPolyline/xbsjCreateODLinesPrimitive.d.ts +0 -29
- package/dist/types/CzmObjects/general/CzmESVideoFusion/XbsjCameraVideo/XbsjCameraVideo.d.ts +0 -18
- package/dist/types/CzmObjects/general/CzmESViewShed/XbsjViewshed/XbsjViewshed.d.ts +0 -16
- package/dist/types/ESCesiumViewer/BackGroundImage/BackGroundImage.d.ts +0 -5
- package/dist/types/ESCesiumViewer/LocalSkyBox/SkyAtmosphere.d.ts +0 -14
- package/dist/types/ESCesiumViewer/initCesiumViewer/GaussianSplattingExtend/GaussianSplatPipelineStage.d.ts +0 -12
- package/dist/types/ESCesiumViewer/initCesiumViewer/GaussianSplattingExtend/GaussianSplatTexturePipelineStage.d.ts +0 -11
- package/dist/types/ESCesiumViewer/initCesiumViewer/fixGoogleEarth/cesiumFixGoogleEarth.d.ts +0 -1
- package/dist/types/__declares/cesium.d.ts +0 -405
- package/dist/types/utils/czmUtils/todo/generateCartesianArc/czm/generateCartesianArc.d.ts +0 -8
- package/dist/types/utils/generalUtils/geoPolylineToBezierSpline/bezierSpline/index.d.ts +0 -37
- package/dist/types/utils/generalUtils/geoPolylineToBezierSpline/bezierSpline/lib/spline.d.ts +0 -62
|
@@ -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 sV extends f.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[li.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(f.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:u}=i;if(u==="none")return;const h=this.owner.getPlane(u);if(!i.currentV)return;const c=h.pick(l);if(!c||!this.owner.cartesian)return;const A=C.Cartesian3.subtract(i.currentV,this.owner.cartesian,new C.Cartesian3);C.Cartesian3.normalize(A,A);const p=C.Cartesian3.subtract(c,this.owner.cartesian,new C.Cartesian3);if(C.Cartesian3.normalize(p,p),!h.normal||!h.origin)return;const d=Fv(A,p,h.normal),g=Fv(h.origin,A,h.normal),v=Fv(h.origin,p,h.normal);{const y=[...this.owner.selfRotation];y[li.rotationNum[u]]=i.startRotation+d,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 f.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 u=C.Cartesian3.distance(s,l),h=r/4,c=h*3/128;if(!(u>=h-c&&u<=h+c))return;const p=C.Cartesian3.distance(e.camera.positionWC,l);n.currentD2c<=p||(n.currentPlaneType=i,n.currentD2c=p,n.currentV=l,n.startRotation=a[li.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=zi(i,this.owner.cartesian,this.owner.pixelSize);if(!o)return;const{offsetX:r,offsetY:s}=n,a=[r,s],l=n.pointerId,u={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(u,i,"heading",a,o),this._pickPlane(u,i,"pitch",a,o),this._pickPlane(u,i,"roll",a,o),u}}function Fv(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 fa=class fa extends Dn{constructor(e){super();L(this,"_hoveredPlaneType",this.disposeVar(f.react("none")));L(this,"_movingPlaneType",this.disposeVar(f.react("none")));L(this,"_circles");L(this,"_czmCameraModel");L(this,"_cartesian");L(this,"_planes",{heading:this.disposeVar(new nV(this)),pitch:this.disposeVar(new iV(this)),roll:this.disposeVar(new rV(this))});L(this,"_rotatorRunningResetting");this._czmViewer=e;const i=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new f.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new sV(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 Nt(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(f.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],i=>i*.1)),this.dispose(f.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(f.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 Bs(e));this.dispose(f.track([o,"position"],[this,"position"])),this.dispose(f.track([o,"pixelSize"],[this,"pixelSize"])),this.dispose(f.track([o,"debug"],[this,"debug"])),this.dispose(f.track([o,"rotation"],[this,"rotation"]));{const r=()=>{o.selfRotation=fa.rotationFuncs[i](this.selfRotation),o.circleRotation=this.selfRotation[fa.rotationNum[i]]};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{const s=this.movingPlaneType===i,a=this.hoveredPlaneType===i,u=[0,0,0,s||a?1:.8];u[fa.rotationNum[i]]=1,o.color=u};r(),this.dispose(this.movingPlaneTypeChanged.disposableOn(r)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(r))}return o}};L(fa,"rotationNum",{heading:0,pitch:1,roll:2}),L(fa,"rotationFuncs",{heading:([e,i,o])=>[0,0,0],pitch:([e,i,o])=>[e,0,-90],roll:([e,i,o])=>[e,i+90,0]});let li=fa;(t=>{t.createDefaultProps=()=>({...Dn.createDefaultProps(),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(li||(li={})),f.extendClassProps(li.prototype,li.createDefaultProps);const da=class da extends f.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(n){this.positions=[n??da.defaults.positions[0],this.stopPosition??da.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(n){this.positions=[this.startPosition??da.defaults.positions[0],n??da.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 Qn(n,e));this.ad(f.track([o,"allowPicking"],[this,"allowPicking"])),this.ad(f.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(da,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let oa=da;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(t.defaults.positions),width:10,color:f.reactArray([1,0,0,1])})})(oa||(oa={})),f.extendClassProps(oa.prototype,oa.createDefaultProps);class ur extends Dn{constructor(e){super();L(this,"_lastPosition");L(this,"_opInfo",{step:this.ad(f.react(!1)),moved:this.ad(f.react(!1)),constraintMode:this.disposeVar(f.react("none")),originPosition:this.disposeVar(f.reactArray([0,0,0])),originHeading:this.disposeVar(f.react(0)),originDimensions:this.disposeVar(f.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(f.reactArray([0,0,0])),movingPosition:this.disposeVar(f.reactArray([0,0,0])),targetPosition:this.disposeVar(f.reactArray([0,0,0])),targetHeading:this.disposeVar(f.react(0))});L(this,"_scaleAxis");L(this,"_pickingXYProcessing",e=>this.disposeVar(new f.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 u=Jn(f.getDomEventCurrentTargetPos(l.pointerEvent));if(!ya(e.viewer.scene,u,this._opInfo.originPosition.value[2],a))return;ma(a,s),this._opInfo.constraintMode.value==="x"?wo(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?wo(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 c=this.scale[0],A=this.scale[1];const p=Q.geoDistance(h,this._opInfo.originPosition.value)-Q.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...h];const d=this._opInfo.originDimensions.value[0]/100;p!=0&&this._opInfo.constraintMode.value==="y"&&(p>0?c+=d:c-=d),p!=0&&this._opInfo.constraintMode.value==="x"&&(p>0?A+=d:A-=d),c<=0&&(c+=d),A<=0&&(A+=d),this.scale=[c??1,A??1,this.scale[2]??1]})})));L(this,"_pickingZProcessing",e=>this.disposeVar(new f.Processing(()=>{const i=new C.Cartesian3,o=[0,0,0];return e.pointerMoveEvent.disposableOn(r=>{if(!r.pointerEvent||!e.viewer)return;const s=Jn(f.getDomEventCurrentTargetPos(r.pointerEvent));if(!rh(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 u=this.scale[2];const h=o[2]-this._lastPosition[2];this._lastPosition=[...o];const c=this._opInfo.originDimensions.value[0]/100;h!=0&&(h>0?u+=c:u-=c),u<=0&&(u+=c),this.scale=[this.scale[0]??1,this.scale[1]??1,u??1]}})})));const i=e.viewer;if(!i)return;const{scene:o}=i;this.ad(new qf(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 u=()=>{if(!this._scaleAxis)return;const{zAxis:h,yAxis:c,xAxis:A}=this._scaleAxis,p=this._opInfo.constraintMode.value,d=this._opInfo.step;h.color=[0,0,1,.99],c.color=[0,1,0,.99],A.color=[1,0,0,.99],p==="x"?A.color=d?[1,1,0,.8]:[1,1,0,.99]:p==="y"?c.color=d?[1,1,0,.8]:[1,1,0,.99]:p==="z"&&(h.color=d?[1,1,0,.8]:[1,1,0,.99])};u(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(u)),this.dispose(this._opInfo.step.changed.disposableOn(u))}{const u=()=>{if(!this._scaleAxis)return;const{position:c=ur.defaults.position}=this,{zAxis:A,yAxis:p,xAxis:d}=this._scaleAxis;A.startPosition=p.startPosition=d.startPosition=c;const[g,v,y]=c;A.stopPosition=[g,v,y+this._opInfo.originDimensions.value[2]];const m=Q.geoRhumbDestination(c,this._opInfo.originDimensions.value[0],90);m&&(d.stopPosition=m);const w=Q.geoRhumbDestination(c,this._opInfo.originDimensions.value[1],0);w&&(p.stopPosition=w)};u();const h=this.ad(f.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(h.don(u))}{const u=()=>{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,c)=>h===this._opInfo.targetPosition.value[c])){this._opInfo.moved.value=!0;return}};u(),this.dispose(this._opInfo.originHeading.changed.disposableOn(u)),this.dispose(this._opInfo.originPosition.changed.disposableOn(u)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(u)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(u))}const r=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(f.createProcessingFromAsyncFunc(async u=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",u.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(u,async h=>{const c=()=>{const d=[...this.position??ur.defaults.position];e.editingHeightOffset&&(d[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=d};h.disposer.dispose((c(),this.positionChanged.disposableOn(c)));const A={constraintMode:"none",startDragPos:[0,0,0]},p=d=>{if(!this.position)return;const g={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Df(d,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(d=>{d.pointerEvent&&p(d.pointerEvent)})),await f.step(h,d=>new Promise((g,v)=>{d.disposer.dispose(v),d.disposer.dispose(e.pointerDownEvent.don(y=>{y.pointerEvent&&p(y.pointerEvent),y.pointerEvent&&y.pointerEvent.button===0&&A.constraintMode!=="none"&&g()}))}))}),this._opInfo.step.value=!1,await f.step(u,async h=>{if(e.incrementDisabledInputStack(),h.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const c=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,c,A),h.disposer.dispose(()=>r.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),h.disposer.dispose(()=>s.cancel()));await f.step(h,c=>new Promise((A,p)=>{c.disposer.dispose(p),c.disposer.dispose(e.pointerUpEvent.don(()=>{A()})),c.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 oa(e));return o.width=10,this.ad(f.track([o,"show"],[this,"enabled"])),o}}(t=>{t.createDefaultProps=()=>({...Dn.createDefaultProps(),scale:f.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(ur||(ur={})),f.extendClassProps(ur.prototype,ur.createDefaultProps);const yo=class yo extends fn{constructor(e){super();L(this,"_editingPoints",this.disposeVar(new f.ObservableArray));L(this,"_cancelEvent",this.disposeVar(new f.Event));L(this,"_currentProcess");L(this,"_menuPoiEnabled",this.disposeVar(f.react(!1)));L(this,"_status",this.disposeVar(f.react("None")));L(this,"_positionsChanged",this.ad(new f.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(f.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??yo.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??yo.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(f.track([i,"color"],[this,"polylineColor"])),this.ad(f.track([i,"width"],[this,"polylineWidth"])),this.ad(f.track([i,"show"],[this,"polylineShow"])),this.ad(f.track([i,"arcType"],[this,"polylineArcType"])),this.ad(f.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 f.CursorInfo(e.container,f.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(yo,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),L(yo,"defaults",{...fn.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:yo.baseImageUrl+"point-green.png",otherControlPointImageUrl:yo.baseImageUrl+"point-yellow.png"});let Zn=yo;(t=>{t.createDefaultProps=()=>({...fn.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:f.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})})(Zn||(Zn={})),f.extendClassProps(Zn.prototype,Zn.createDefaultProps);let lV=0;class gE extends f.Destroyable{constructor(e,i){super();L(this,"_position",this.disposeVar(f.reactArrayWithUndefined(void 0)));L(this,"_id",lV++);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 Ia(e.czmViewer));o.enabled=!1,this.ad(f.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??Zn.defaults.firstControlPointImageUrl:o.imageUri=e.otherControlPointImageUrl??Zn.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 yE extends gE{constructor(n,e){super(n,e)}}class Pt extends Zn{constructor(e){super(e);L(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new f.Event));L(this,"placeEditing");if(!e.viewer)return;const i=this.placeEditing=this.ad(new si(e));i.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.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 yE(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=f.createProcessingFromAsyncFunc(async o=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await o.promise(f.step(o,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new uV(this,r)));const h=a.disposer.disposeVar(new hV(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(c=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(A=>{A?(r++,c(!0)):c(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(A=>{A?(r--,c(!0)):c(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>c(!1)))}))})))break;while(!0)});return i.start(),i}}(t=>{t.createDefaultProps=()=>({...Zn.createDefaultProps()})})(Pt||(Pt={})),f.extendClassProps(Pt.prototype,Pt.createDefaultProps);class uV extends f.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new f.Event));const{placeEditing:o}=e;let r=new yE(e,void 0);e.editingPoints.splice(i,0,r);const s=()=>{(e.debug??Pt.defaults.debug)&&console.log("delete currentPosEditor");const u=e.editingPoints.indexOf(r);if(u===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(u,1)};if(o.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(f.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 cV(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 hV extends f.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new f.Event));L(this,"_doEvent",this.disposeVar(new f.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(cV(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 vE extends Pt{constructor(n){super(n),this.loop=!1}}class wE extends Pt{constructor(n){super(n),this.loop=!0}}class _f extends gE{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 fi(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 u=this.position;if(!u)break;let h=(s+1)%a;const A=n.editingPoints.get(h).position;if(!A)break;const p=Lf(u,A);if(!p)break;p[2]-=n.czmViewer.editingHeightOffset??0,i.position=p;const d=n.editingPoints.length<(n.maxPointsNum??tt.defaults.maxPointsNum);i.enabled=d,i.show=d;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 _f(n,s);n.editingPoints.splice(r+1,0,a),n.modify(a)}))}}}}class tt extends Zn{constructor(e){super(e);L(this,"_menuPoiCommand",this.disposeVar(new f.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.Event));L(this,"_overEvent",this.disposeVar(new f.Event));L(this,"translationEditing");{const o=this.ad(f.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new f.ObjResettingWithEvent(o,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new AV(this.editingPoints.get(0),this)}))}const i=this.translationEditing=this.disposeVar(new lr(e));i.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.step(o,async s=>{const a=s.disposer,l=a.ad(new fV(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(c=>{h(c)}))}))})),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 c=Lf(a,h);if(!c)return;c&&(c[2]+=this.czmViewer.editingHeightOffset??0);let A=new _f(this,c);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 _f(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...Zn.createDefaultProps(),moveWithFirstPosition:!1})})(tt||(tt={})),f.extendClassProps(tt.prototype,tt.createDefaultProps);class AV extends f.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),u=l.position;u!==void 0&&(l.position=[u[0]+r[0],u[1]+r[1],u[2]+r[2]])}})}}class fV extends f.Destroyable{constructor(e){super();L(this,"_overEvent",this.disposeVar(new f.Event));L(this,"_cancelEvent",this.disposeVar(new f.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.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 dV(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 dV extends f.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new f.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(f.track([this._posEditor,"position"],[o,"position"])),this.dispose(o.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class bE extends tt{constructor(n){super(n),this.loop=!1}}class _E extends tt{constructor(n){super(n),this.loop=!0}}class Ms 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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([90,0,0]),distance:f.react(1)})})(Ms||(Ms={})),f.extendClassProps(Ms.prototype,Ms.createDefaultProps);class aa 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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),distance:f.react(0)})})(aa||(aa={})),f.extendClassProps(aa.prototype,aa.createDefaultProps);class CE extends Pt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1}}class xE extends tt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Ds 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 ei(n));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Pt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Ds||(Ds={})),f.extendClassProps(Ds.prototype,Ds.createDefaultProps);class Rs 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 ei(n));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...tt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Rs||(Rs={})),f.extendClassProps(Rs.prototype,Rs.createDefaultProps);class SE extends aa{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(f.react(!0)));L(this,"_currentEditing",this.disposeVar(f.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 si&&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 Qc=class Qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new si(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(f.bind([i,"position"],[n,"position"])),i.enabled=!i.position||Q.equalsN3(i.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};L(Qc,"type",Qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Place,Qc));let Bv=Qc;const Vc=class Vc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new li(e));i.rotation=[90,0,0],this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))}));do{if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);o&&(this.ad(f.bind([i,"position"],[o.czm3DTiles,"position"])),this.ad(f.bind([i,"selfRotation"],[n,"rotation"])))});break}if(Reflect.has(n,"position")&&Reflect.has(n,"rotation")){this.ad(f.bind([i,"position"],[n,"position"])),this.ad(f.bind([i,"selfRotation"],[n,"rotation"]));break}this.supportEditing=!1}while(!1)}};L(Vc,"type",Vc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Rotation,Vc));let Mv=Vc;const Nc=class Nc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ur(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")&&Reflect.has(n,"scale")){this.ad(f.bind([i,"position"],[n,"position"])),this.ad(f.bind([i,"scale"],[n,"scale"]));break}this.supportEditing=!1}while(!1)}};L(Nc,"type",Nc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Scale,Nc));let Dv=Nc;const Hc=class Hc extends rn{constructor(n,e){super(Array.isArray(n)?n[0]:n,e,!0);const i=this.currentEditing=this.ad(new lr(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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=pn({originPosition:s},[r])[0][0];n.forEach(l=>{if(Reflect.has(l,"position")){const u=pn({originPosition:s},[l.position])[0][0];l.position=wr({originPosition:s},[[u[0]+a[0],u[1]+a[1],u[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const u=pn({originPosition:s},l.points)[0];l.points=wr({originPosition:s},u.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}})}}));break}if(Reflect.has(n,"position")){this.ad(f.bind([i,"position"],[n,"position"]));break}if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);this.ad(f.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=pn({originPosition:r},[o])[0][0];const a=pn({originPosition:r},n.points)[0];n.points=wr({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(Hc,"type",Hc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Translation,Hc));let Cf=Hc;const Gc=class Gc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Ms(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")){this.ad(f.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(f.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(f.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(f.bind([i,"distance"],[n,"distance"]));break}const o=dt(n.position);if(C.Cartesian3.ZERO.equals(o)||!e.viewer)return;i.distance=zi(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(f.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(Gc,"type",Gc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsAppend,Gc));let Rv=Gc;const Wc=class Wc extends rn{constructor(n,e){var r;if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new aa(e));do{if(Reflect.has(n,"position")){this.ad(f.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(f.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(f.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(f.bind([i,"distance"],[n,"distance"]));break}const s=dt(n.position);if(C.Cartesian3.ZERO.equals(s)||!e.viewer)return;i.distance=zi(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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1;return}while(!1);i.init(),i.enabled=!0;const o=this.ad(f.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L(Wc,"type",Wc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsModify,Wc));let Uv=Wc;const qc=class qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new wE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(qc,"type",qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularAppend,qc));let Ov=qc;const Kc=class Kc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new _E(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Kc,"type",Kc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularInsert,Kc));let Lv=Kc;const Zc=class Zc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new vE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Zc,"type",Zc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringAppend,Zc));let zv=Zc;const Xc=class Xc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new bE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Xc,"type",Xc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringInsert,Xc));let Qv=Xc;const $c=class $c extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new CE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L($c,"type",$c.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterAppend,$c));let Vv=$c;const Yc=class Yc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new xE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Yc,"type",Yc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterModify,Yc));let Nv=Yc;const Jc=class Jc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Ds(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Jc,"type",Jc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityAppend,Jc));let Hv=Jc;const jc=class jc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Rs(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(jc,"type",jc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityModify,jc));let Gv=jc;const eh=class eh extends rn{constructor(n,e){if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new SE(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 u=Q.getMinMaxCorner(n.points).center,h=[...u],c=l?n.points[0][2]:0;a?r?h[2]=n.extrudedHeight:h[2]=n.height+c:(s&&(u[2]=n.height),r&&(h[2]=n.extrudedHeight)),i.startPosition=u,i.distance=h[2]-u[2],i.moveWithFirstPosition=!1;let A=[...u];this.ad(i.positionsChanged.don(()=>{i.positions.length===2&&(a?(n.points=n.points.map(p=>[p[0],p[1],p[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(f.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L(eh,"type",eh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.HeightModify,eh));let Wv=eh;const on=class on extends f.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],u=this.editingID=a.editingID;this.useKeyToSwitch=r,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:u,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 f.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 u=new l(i,o);if(s.ad(()=>!u.isDestroyed()&&u.destroy()),u.isDestroyed())return this._createNextEditingMode(s,a);const h=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),f.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(u.toDestroyEvent.don(h)),this.useKeyToSwitch&&s.ad(o.keyDownEvent.don(c=>{c.code=="Space"&&h()})),s.ad(o.dblclickEvent.donce(()=>this.useKeyToSwitch?on.stop():h())),u.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();f.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 qv=on;function EE(){const t=f.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 u=c=>{c.code=="Escape"&&l()};n.disposer.ad(e.keyDownEvent.don(u));let h=0;do{const c=s[h%s.length],A=await f.step(n,async p=>{const d=p.disposer,g=Q.EngineObject.contextEditing.getEngineObjConstructor(c,e.typeName);if(!g||!i.supportEditingModes().includes(c))return console.log(`未找到编辑模式或不支持当前编辑模式${c},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:c,cIndex:h}}),e.notSupportEditingCount++,!1;const v=new g(i,e);if(d.ad(()=>{!v.isDestroyed()&&v.destroy()}),v.supportEditing)e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changed",add:{cMode:c,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${c},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:c,cIndex:h}}),e.notSupportEditingCount++,!1;return await p.promise(new Promise(m=>{if(v.isDestroyed()&&m(!1),d.ad(v.toDestroyEvent.don(()=>{console.log(`编辑模式${c}结束`),m(!1)})),r){const w=_=>{_.code=="Space"&&(console.log(`编辑模式${c}结束`),m(!1))};d.ad(e.keyDownEvent.don(w)),d.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 PE(){const t=f.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 Cf(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",e="2025-08-14T09:06:32.000Z",i="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="60921cbcff46cfbed33163bca9f10cb47aa8cd65",a=((Date.now()-1755162392e3)/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 sV extends f.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[li.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(f.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:u}=i;if(u==="none")return;const h=this.owner.getPlane(u);if(!i.currentV)return;const c=h.pick(l);if(!c||!this.owner.cartesian)return;const A=C.Cartesian3.subtract(i.currentV,this.owner.cartesian,new C.Cartesian3);C.Cartesian3.normalize(A,A);const p=C.Cartesian3.subtract(c,this.owner.cartesian,new C.Cartesian3);if(C.Cartesian3.normalize(p,p),!h.normal||!h.origin)return;const d=Fv(A,p,h.normal),g=Fv(h.origin,A,h.normal),v=Fv(h.origin,p,h.normal);{const y=[...this.owner.selfRotation];y[li.rotationNum[u]]=i.startRotation+d,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 f.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 u=C.Cartesian3.distance(s,l),h=r/4,c=h*3/128;if(!(u>=h-c&&u<=h+c))return;const p=C.Cartesian3.distance(e.camera.positionWC,l);n.currentD2c<=p||(n.currentPlaneType=i,n.currentD2c=p,n.currentV=l,n.startRotation=a[li.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=zi(i,this.owner.cartesian,this.owner.pixelSize);if(!o)return;const{offsetX:r,offsetY:s}=n,a=[r,s],l=n.pointerId,u={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(u,i,"heading",a,o),this._pickPlane(u,i,"pitch",a,o),this._pickPlane(u,i,"roll",a,o),u}}function Fv(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 fa=class fa extends Dn{constructor(e){super();L(this,"_hoveredPlaneType",this.disposeVar(f.react("none")));L(this,"_movingPlaneType",this.disposeVar(f.react("none")));L(this,"_circles");L(this,"_czmCameraModel");L(this,"_cartesian");L(this,"_planes",{heading:this.disposeVar(new nV(this)),pitch:this.disposeVar(new iV(this)),roll:this.disposeVar(new rV(this))});L(this,"_rotatorRunningResetting");this._czmViewer=e;const i=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new f.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new sV(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 Nt(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(f.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],i=>i*.1)),this.dispose(f.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(f.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 Bs(e));this.dispose(f.track([o,"position"],[this,"position"])),this.dispose(f.track([o,"pixelSize"],[this,"pixelSize"])),this.dispose(f.track([o,"debug"],[this,"debug"])),this.dispose(f.track([o,"rotation"],[this,"rotation"]));{const r=()=>{o.selfRotation=fa.rotationFuncs[i](this.selfRotation),o.circleRotation=this.selfRotation[fa.rotationNum[i]]};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{const s=this.movingPlaneType===i,a=this.hoveredPlaneType===i,u=[0,0,0,s||a?1:.8];u[fa.rotationNum[i]]=1,o.color=u};r(),this.dispose(this.movingPlaneTypeChanged.disposableOn(r)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(r))}return o}};L(fa,"rotationNum",{heading:0,pitch:1,roll:2}),L(fa,"rotationFuncs",{heading:([e,i,o])=>[0,0,0],pitch:([e,i,o])=>[e,0,-90],roll:([e,i,o])=>[e,i+90,0]});let li=fa;(t=>{t.createDefaultProps=()=>({...Dn.createDefaultProps(),rotation:f.reactArray([0,0,0]),selfRotation:f.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(li||(li={})),f.extendClassProps(li.prototype,li.createDefaultProps);const da=class da extends f.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(n){this.positions=[n??da.defaults.positions[0],this.stopPosition??da.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(n){this.positions=[this.startPosition??da.defaults.positions[0],n??da.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 Qn(n,e));this.ad(f.track([o,"allowPicking"],[this,"allowPicking"])),this.ad(f.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(da,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let oa=da;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:f.reactPositions(t.defaults.positions),width:10,color:f.reactArray([1,0,0,1])})})(oa||(oa={})),f.extendClassProps(oa.prototype,oa.createDefaultProps);class ur extends Dn{constructor(e){super();L(this,"_lastPosition");L(this,"_opInfo",{step:this.ad(f.react(!1)),moved:this.ad(f.react(!1)),constraintMode:this.disposeVar(f.react("none")),originPosition:this.disposeVar(f.reactArray([0,0,0])),originHeading:this.disposeVar(f.react(0)),originDimensions:this.disposeVar(f.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(f.reactArray([0,0,0])),movingPosition:this.disposeVar(f.reactArray([0,0,0])),targetPosition:this.disposeVar(f.reactArray([0,0,0])),targetHeading:this.disposeVar(f.react(0))});L(this,"_scaleAxis");L(this,"_pickingXYProcessing",e=>this.disposeVar(new f.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 u=Jn(f.getDomEventCurrentTargetPos(l.pointerEvent));if(!ya(e.viewer.scene,u,this._opInfo.originPosition.value[2],a))return;ma(a,s),this._opInfo.constraintMode.value==="x"?wo(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?wo(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 c=this.scale[0],A=this.scale[1];const p=Q.geoDistance(h,this._opInfo.originPosition.value)-Q.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...h];const d=this._opInfo.originDimensions.value[0]/100;p!=0&&this._opInfo.constraintMode.value==="y"&&(p>0?c+=d:c-=d),p!=0&&this._opInfo.constraintMode.value==="x"&&(p>0?A+=d:A-=d),c<=0&&(c+=d),A<=0&&(A+=d),this.scale=[c??1,A??1,this.scale[2]??1]})})));L(this,"_pickingZProcessing",e=>this.disposeVar(new f.Processing(()=>{const i=new C.Cartesian3,o=[0,0,0];return e.pointerMoveEvent.disposableOn(r=>{if(!r.pointerEvent||!e.viewer)return;const s=Jn(f.getDomEventCurrentTargetPos(r.pointerEvent));if(!rh(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 u=this.scale[2];const h=o[2]-this._lastPosition[2];this._lastPosition=[...o];const c=this._opInfo.originDimensions.value[0]/100;h!=0&&(h>0?u+=c:u-=c),u<=0&&(u+=c),this.scale=[this.scale[0]??1,this.scale[1]??1,u??1]}})})));const i=e.viewer;if(!i)return;const{scene:o}=i;this.ad(new qf(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 u=()=>{if(!this._scaleAxis)return;const{zAxis:h,yAxis:c,xAxis:A}=this._scaleAxis,p=this._opInfo.constraintMode.value,d=this._opInfo.step;h.color=[0,0,1,.99],c.color=[0,1,0,.99],A.color=[1,0,0,.99],p==="x"?A.color=d?[1,1,0,.8]:[1,1,0,.99]:p==="y"?c.color=d?[1,1,0,.8]:[1,1,0,.99]:p==="z"&&(h.color=d?[1,1,0,.8]:[1,1,0,.99])};u(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(u)),this.dispose(this._opInfo.step.changed.disposableOn(u))}{const u=()=>{if(!this._scaleAxis)return;const{position:c=ur.defaults.position}=this,{zAxis:A,yAxis:p,xAxis:d}=this._scaleAxis;A.startPosition=p.startPosition=d.startPosition=c;const[g,v,y]=c;A.stopPosition=[g,v,y+this._opInfo.originDimensions.value[2]];const m=Q.geoRhumbDestination(c,this._opInfo.originDimensions.value[0],90);m&&(d.stopPosition=m);const w=Q.geoRhumbDestination(c,this._opInfo.originDimensions.value[1],0);w&&(p.stopPosition=w)};u();const h=this.ad(f.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(h.don(u))}{const u=()=>{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,c)=>h===this._opInfo.targetPosition.value[c])){this._opInfo.moved.value=!0;return}};u(),this.dispose(this._opInfo.originHeading.changed.disposableOn(u)),this.dispose(this._opInfo.originPosition.changed.disposableOn(u)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(u)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(u))}const r=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(f.createProcessingFromAsyncFunc(async u=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",u.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await f.step(u,async h=>{const c=()=>{const d=[...this.position??ur.defaults.position];e.editingHeightOffset&&(d[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=d};h.disposer.dispose((c(),this.positionChanged.disposableOn(c)));const A={constraintMode:"none",startDragPos:[0,0,0]},p=d=>{if(!this.position)return;const g={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Df(d,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(d=>{d.pointerEvent&&p(d.pointerEvent)})),await f.step(h,d=>new Promise((g,v)=>{d.disposer.dispose(v),d.disposer.dispose(e.pointerDownEvent.don(y=>{y.pointerEvent&&p(y.pointerEvent),y.pointerEvent&&y.pointerEvent.button===0&&A.constraintMode!=="none"&&g()}))}))}),this._opInfo.step.value=!1,await f.step(u,async h=>{if(e.incrementDisabledInputStack(),h.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const c=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,c,A),h.disposer.dispose(()=>r.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),h.disposer.dispose(()=>s.cancel()));await f.step(h,c=>new Promise((A,p)=>{c.disposer.dispose(p),c.disposer.dispose(e.pointerUpEvent.don(()=>{A()})),c.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 oa(e));return o.width=10,this.ad(f.track([o,"show"],[this,"enabled"])),o}}(t=>{t.createDefaultProps=()=>({...Dn.createDefaultProps(),scale:f.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(ur||(ur={})),f.extendClassProps(ur.prototype,ur.createDefaultProps);const yo=class yo extends fn{constructor(e){super();L(this,"_editingPoints",this.disposeVar(new f.ObservableArray));L(this,"_cancelEvent",this.disposeVar(new f.Event));L(this,"_currentProcess");L(this,"_menuPoiEnabled",this.disposeVar(f.react(!1)));L(this,"_status",this.disposeVar(f.react("None")));L(this,"_positionsChanged",this.ad(new f.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(f.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??yo.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??yo.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(f.track([i,"color"],[this,"polylineColor"])),this.ad(f.track([i,"width"],[this,"polylineWidth"])),this.ad(f.track([i,"show"],[this,"polylineShow"])),this.ad(f.track([i,"arcType"],[this,"polylineArcType"])),this.ad(f.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 f.CursorInfo(e.container,f.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(yo,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),L(yo,"defaults",{...fn.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:yo.baseImageUrl+"point-green.png",otherControlPointImageUrl:yo.baseImageUrl+"point-yellow.png"});let Zn=yo;(t=>{t.createDefaultProps=()=>({...fn.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:f.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})})(Zn||(Zn={})),f.extendClassProps(Zn.prototype,Zn.createDefaultProps);let lV=0;class gE extends f.Destroyable{constructor(e,i){super();L(this,"_position",this.disposeVar(f.reactArrayWithUndefined(void 0)));L(this,"_id",lV++);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 Ia(e.czmViewer));o.enabled=!1,this.ad(f.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??Zn.defaults.firstControlPointImageUrl:o.imageUri=e.otherControlPointImageUrl??Zn.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 yE extends gE{constructor(n,e){super(n,e)}}class Pt extends Zn{constructor(e){super(e);L(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new f.Event));L(this,"placeEditing");if(!e.viewer)return;const i=this.placeEditing=this.ad(new si(e));i.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.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 yE(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=f.createProcessingFromAsyncFunc(async o=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await o.promise(f.step(o,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new uV(this,r)));const h=a.disposer.disposeVar(new hV(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>h.do())),await a.promise(new Promise(c=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(A=>{A?(r++,c(!0)):c(!1)})),a.disposer.dispose(h.overEvent.disposableOnce(A=>{A?(r--,c(!0)):c(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>c(!1)))}))})))break;while(!0)});return i.start(),i}}(t=>{t.createDefaultProps=()=>({...Zn.createDefaultProps()})})(Pt||(Pt={})),f.extendClassProps(Pt.prototype,Pt.createDefaultProps);class uV extends f.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new f.Event));const{placeEditing:o}=e;let r=new yE(e,void 0);e.editingPoints.splice(i,0,r);const s=()=>{(e.debug??Pt.defaults.debug)&&console.log("delete currentPosEditor");const u=e.editingPoints.indexOf(r);if(u===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(u,1)};if(o.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(f.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 cV(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 hV extends f.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new f.Event));L(this,"_doEvent",this.disposeVar(new f.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(cV(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 vE extends Pt{constructor(n){super(n),this.loop=!1}}class wE extends Pt{constructor(n){super(n),this.loop=!0}}class _f extends gE{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 fi(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 u=this.position;if(!u)break;let h=(s+1)%a;const A=n.editingPoints.get(h).position;if(!A)break;const p=Lf(u,A);if(!p)break;p[2]-=n.czmViewer.editingHeightOffset??0,i.position=p;const d=n.editingPoints.length<(n.maxPointsNum??tt.defaults.maxPointsNum);i.enabled=d,i.show=d;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 _f(n,s);n.editingPoints.splice(r+1,0,a),n.modify(a)}))}}}}class tt extends Zn{constructor(e){super(e);L(this,"_menuPoiCommand",this.disposeVar(new f.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.Event));L(this,"_overEvent",this.disposeVar(new f.Event));L(this,"translationEditing");{const o=this.ad(f.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new f.ObjResettingWithEvent(o,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new AV(this.editingPoints.get(0),this)}))}const i=this.translationEditing=this.disposeVar(new lr(e));i.enabled=!1,this.currentProcess=this.disposeVar(f.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(f.step(o,async s=>{const a=s.disposer,l=a.ad(new fV(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(c=>{h(c)}))}))})),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 c=Lf(a,h);if(!c)return;c&&(c[2]+=this.czmViewer.editingHeightOffset??0);let A=new _f(this,c);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 _f(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...i),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...Zn.createDefaultProps(),moveWithFirstPosition:!1})})(tt||(tt={})),f.extendClassProps(tt.prototype,tt.createDefaultProps);class AV extends f.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),u=l.position;u!==void 0&&(l.position=[u[0]+r[0],u[1]+r[1],u[2]+r[2]])}})}}class fV extends f.Destroyable{constructor(e){super();L(this,"_overEvent",this.disposeVar(new f.Event));L(this,"_cancelEvent",this.disposeVar(new f.Event));L(this,"_forceModifyPosEditorEvent",this.disposeVar(new f.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 dV(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 dV extends f.Destroyable{constructor(e,i){super();L(this,"_overEvent",this.disposeVar(new f.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(f.track([this._posEditor,"position"],[o,"position"])),this.dispose(o.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class bE extends tt{constructor(n){super(n),this.loop=!1}}class _E extends tt{constructor(n){super(n),this.loop=!0}}class Ms 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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([90,0,0]),distance:f.react(1)})})(Ms||(Ms={})),f.extendClassProps(Ms.prototype,Ms.createDefaultProps);class aa 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:f.reactArrayWithUndefined(void 0),endPosition:f.reactArrayWithUndefined(void 0),rotation:f.reactArray([0,0,0]),distance:f.react(0)})})(aa||(aa={})),f.extendClassProps(aa.prototype,aa.createDefaultProps);class CE extends Pt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1}}class xE extends tt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Ds 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 ei(n));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Pt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Ds||(Ds={})),f.extendClassProps(Ds.prototype,Ds.createDefaultProps);class Rs 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 ei(n));e.topOrBottom="bottom",this.ad(f.track([e,"color"],[this,"polylineColor"])),this.ad(f.track([e,"width"],[this,"polylineWidth"])),this.ad(f.track([e,"show"],[this,"polylineShow"])),this.ad(f.track([e,"arcType"],[this,"polylineArcType"])),this.ad(f.track([e,"loop"],[this,"loop"])),this.ad(f.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...tt.createDefaultProps(),visibilityPositions:f.reactPositionsSet(void 0)})})(Rs||(Rs={})),f.extendClassProps(Rs.prototype,Rs.createDefaultProps);class SE extends aa{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(f.react(!0)));L(this,"_currentEditing",this.disposeVar(f.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 si&&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 Qc=class Qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new si(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(f.bind([i,"position"],[n,"position"])),i.enabled=!i.position||Q.equalsN3(i.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};L(Qc,"type",Qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Place,Qc));let Bv=Qc;const Vc=class Vc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new li(e));i.rotation=[90,0,0],this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))}));do{if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);o&&(this.ad(f.bind([i,"position"],[o.czm3DTiles,"position"])),this.ad(f.bind([i,"selfRotation"],[n,"rotation"])))});break}if(Reflect.has(n,"position")&&Reflect.has(n,"rotation")){this.ad(f.bind([i,"position"],[n,"position"])),this.ad(f.bind([i,"selfRotation"],[n,"rotation"]));break}this.supportEditing=!1}while(!1)}};L(Vc,"type",Vc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Rotation,Vc));let Mv=Vc;const Nc=class Nc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new ur(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")&&Reflect.has(n,"scale")){this.ad(f.bind([i,"position"],[n,"position"])),this.ad(f.bind([i,"scale"],[n,"scale"]));break}this.supportEditing=!1}while(!1)}};L(Nc,"type",Nc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Scale,Nc));let Dv=Nc;const Hc=class Hc extends rn{constructor(n,e){super(Array.isArray(n)?n[0]:n,e,!0);const i=this.currentEditing=this.ad(new lr(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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=pn({originPosition:s},[r])[0][0];n.forEach(l=>{if(Reflect.has(l,"position")){const u=pn({originPosition:s},[l.position])[0][0];l.position=wr({originPosition:s},[[u[0]+a[0],u[1]+a[1],u[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const u=pn({originPosition:s},l.points)[0];l.points=wr({originPosition:s},u.map(h=>[h[0]+a[0],h[1]+a[1],h[2]+a[2]]))[0]}})}}));break}if(Reflect.has(n,"position")){this.ad(f.bind([i,"position"],[n,"position"]));break}if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const o=e.getEngineObject(n);this.ad(f.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=pn({originPosition:r},[o])[0][0];const a=pn({originPosition:r},n.points)[0];n.points=wr({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(Hc,"type",Hc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Translation,Hc));let Cf=Hc;const Gc=class Gc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Ms(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")){this.ad(f.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(f.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(f.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(f.bind([i,"distance"],[n,"distance"]));break}const o=dt(n.position);if(C.Cartesian3.ZERO.equals(o)||!e.viewer)return;i.distance=zi(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(f.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(Gc,"type",Gc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsAppend,Gc));let Rv=Gc;const Wc=class Wc extends rn{constructor(n,e){var r;if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new aa(e));do{if(Reflect.has(n,"position")){this.ad(f.bind([i,"startPosition"],[n,"position"])),this.ad(Dt([i,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(f.bind([i,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(f.bind([i,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(f.bind([i,"distance"],[n,"distance"]));break}const s=dt(n.position);if(C.Cartesian3.ZERO.equals(s)||!e.viewer)return;i.distance=zi(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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1;return}while(!1);i.init(),i.enabled=!0;const o=this.ad(f.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L(Wc,"type",Wc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsModify,Wc));let Uv=Wc;const qc=class qc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new wE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(qc,"type",qc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularAppend,qc));let Ov=qc;const Kc=class Kc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new _E(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Kc,"type",Kc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularInsert,Kc));let Lv=Kc;const Zc=class Zc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new vE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Zc,"type",Zc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringAppend,Zc));let zv=Zc;const Xc=class Xc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new bE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Xc,"type",Xc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringInsert,Xc));let Qv=Xc;const $c=class $c extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new CE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L($c,"type",$c.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterAppend,$c));let Vv=$c;const Yc=class Yc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new xE(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Yc,"type",Yc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterModify,Yc));let Nv=Yc;const Jc=class Jc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Ds(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(Jc,"type",Jc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityAppend,Jc));let Hv=Jc;const jc=class jc extends rn{constructor(n,e){super(n,e,!0);const i=this.currentEditing=this.ad(new Rs(e));this.ad(i.enabledChanged.don(o=>{!o&&this.ad(f.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(f.track([n,"points"],[i,"positions"]));break}this.supportEditing=!1}while(!1)}};L(jc,"type",jc.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityModify,jc));let Gv=jc;const eh=class eh extends rn{constructor(n,e){if(super(n,e,!0),!e.viewer)return;const i=this.currentEditing=this.ad(new SE(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 u=Q.getMinMaxCorner(n.points).center,h=[...u],c=l?n.points[0][2]:0;a?r?h[2]=n.extrudedHeight:h[2]=n.height+c:(s&&(u[2]=n.height),r&&(h[2]=n.extrudedHeight)),i.startPosition=u,i.distance=h[2]-u[2],i.moveWithFirstPosition=!1;let A=[...u];this.ad(i.positionsChanged.don(()=>{i.positions.length===2&&(a?(n.points=n.points.map(p=>[p[0],p[1],p[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(f.createNextAnimateFrameEvent(i.enabledChanged,i.startPositionChanged));this.ad(o.don(()=>{(!i.enabled||!i.startPosition||Q.equalsN3(i.startPosition,[0,0,0]))&&this.destroy()}))}};L(eh,"type",eh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.HeightModify,eh));let Wv=eh;const on=class on extends f.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],u=this.editingID=a.editingID;this.useKeyToSwitch=r,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:u,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 f.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 u=new l(i,o);if(s.ad(()=>!u.isDestroyed()&&u.destroy()),u.isDestroyed())return this._createNextEditingMode(s,a);const h=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),f.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(u.toDestroyEvent.don(h)),this.useKeyToSwitch&&s.ad(o.keyDownEvent.don(c=>{c.code=="Space"&&h()})),s.ad(o.dblclickEvent.donce(()=>this.useKeyToSwitch?on.stop():h())),u.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();f.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 qv=on;function EE(){const t=f.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 u=c=>{c.code=="Escape"&&l()};n.disposer.ad(e.keyDownEvent.don(u));let h=0;do{const c=s[h%s.length],A=await f.step(n,async p=>{const d=p.disposer,g=Q.EngineObject.contextEditing.getEngineObjConstructor(c,e.typeName);if(!g||!i.supportEditingModes().includes(c))return console.log(`未找到编辑模式或不支持当前编辑模式${c},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:c,cIndex:h}}),e.notSupportEditingCount++,!1;const v=new g(i,e);if(d.ad(()=>{!v.isDestroyed()&&v.destroy()}),v.supportEditing)e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changed",add:{cMode:c,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${c},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[i.parentID??i.id],editingID:a,type:"changedFailed",add:{cMode:c,cIndex:h}}),e.notSupportEditingCount++,!1;return await p.promise(new Promise(m=>{if(v.isDestroyed()&&m(!1),d.ad(v.toDestroyEvent.don(()=>{console.log(`编辑模式${c}结束`),m(!1)})),r){const w=_=>{_.code=="Space"&&(console.log(`编辑模式${c}结束`),m(!1))};d.ad(e.keyDownEvent.don(w)),d.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 PE(){const t=f.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 Cf(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.1",e="2025-08-14T09:06:32.000Z",i="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="60921cbcff46cfbed33163bca9f10cb47aa8cd65",a=((Date.now()-1755162392e3)/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}","60921cbcff46cfbed33163bca9f10cb47aa8cd65")},get info(){return l},get date(){return"2025-08-14T09:06:32.000Z"},get author(){return"suplyang"},get version(){return"3.3.
|
|
4148
|
+
`;ae.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","60921cbcff46cfbed33163bca9f10cb47aa8cd65")},get info(){return l},get date(){return"2025-08-14T09:06:32.000Z"},get author(){return"suplyang"},get version(){return"3.3.1"},get name(){return"earthsdk3-cesium"},get commitId(){return"60921cbcff46cfbed33163bca9f10cb47aa8cd65"},print(){console.info(this.info,`
|
|
4149
4149
|
font-size: 18px;
|
|
4150
4150
|
font-weight: 1000;
|
|
4151
4151
|
line-height: 1;
|
package/dist/earthsdk3-cesium.js
CHANGED
|
@@ -50558,7 +50558,7 @@ function M4() {
|
|
|
50558
50558
|
}
|
|
50559
50559
|
let of;
|
|
50560
50560
|
try {
|
|
50561
|
-
const t = "earthsdk3-cesium", i = "3.3.
|
|
50561
|
+
const t = "earthsdk3-cesium", i = "3.3.1", e = "2025-08-14T09:06:32.000Z", s = "北京西部世界科技有限公司", o = "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn", n = "60921cbcff46cfbed33163bca9f10cb47aa8cd65", a = ((Date.now() - 1755162392e3) / 36e5).toFixed(1), l = `%c🌏 ${t}%c ${i}.${n.slice(0, 8)}.${e} (距今${a}个小时)
|
|
50562
50562
|
%c${o ? o + `
|
|
50563
50563
|
` : ""}当前网站正在使用${t},此软件版权归${s}所有
|
|
50564
50564
|
`;
|
|
@@ -50588,7 +50588,7 @@ try {
|
|
|
50588
50588
|
},
|
|
50589
50589
|
// @ts-ignore
|
|
50590
50590
|
get version() {
|
|
50591
|
-
return "3.3.
|
|
50591
|
+
return "3.3.1";
|
|
50592
50592
|
},
|
|
50593
50593
|
// @ts-ignore
|
|
50594
50594
|
get name() {
|
|
@@ -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 WF extends l.HasOwner{constructor(i){super(i);const{czmViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const o=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(r=>{const s=n=this._getStartInfo(r.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(r=>{n&&n.currentPlaneType!=="none"&&(o.restart(void 0,e,n),n=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,c=[...this.owner.selfRotation];c[gi.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 o=this.owner.circles[n.currentPlaneType];e.incrementDisabledInputStack(),i.disposer.dispose(()=>e.decrementDisabledInputStack()),i.disposer.dispose(e.pointerMoveEvent.don(r=>{if(n&&r.pointerEvent){const{offsetX:s,offsetY:a}=r.pointerEvent,c=[s,a],{currentPlaneType:d}=n;if(d==="none")return;const p=this.owner.getPlane(d);if(!n.currentV)return;const u=p.pick(c);if(!u||!this.owner.cartesian)return;const f=h.Cartesian3.subtract(n.currentV,this.owner.cartesian,new h.Cartesian3);h.Cartesian3.normalize(f,f);const g=h.Cartesian3.subtract(u,this.owner.cartesian,new h.Cartesian3);if(h.Cartesian3.normalize(g,g),!p.normal||!p.origin)return;const m=$g(f,g,p.normal),y=$g(p.origin,f,p.normal),P=$g(p.origin,g,p.normal);{const S=[...this.owner.selfRotation];S[gi.rotationNum[d]]=n.startRotation+m,this.owner.selfRotation=S,o.circleStartRotation=y,o.circleEndRotation=P}}})),this.owner.movingPlaneType=n.currentPlaneType,i.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),i.disposer.dispose(()=>{o.circleStartRotation=0,o.circleEndRotation=0}),await l.step(i,r=>new Promise((s,a)=>{r.disposer.dispose(a),r.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),r.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(i,e,n,o,r){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,c=this.owner.getPlane(n).pick(o);if(!c)return;const d=h.Cartesian3.distance(s,c),p=r/4,u=p*3/128;if(!(d>=p-u&&d<=p+u))return;const g=h.Cartesian3.distance(e.camera.positionWC,c);i.currentD2c<=g||(i.currentPlaneType=n,i.currentD2c=g,i.currentV=c,i.startRotation=a[gi.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 o=Wi(n,this.owner.cartesian,this.owner.pixelSize);if(!o)return;const{offsetX:r,offsetY:s}=i,a=[r,s],c=i.pointerId,d={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:c};return this._pickPlane(d,n,"heading",a,o),this._pickPlane(d,n,"pitch",a,o),this._pickPlane(d,n,"roll",a,o),d}}function $g(t,i,e){const n=h.Cartesian3.cross(i,t,new h.Cartesian3);if(n.equals(h.Cartesian3.ZERO))return 0;h.Cartesian3.normalize(n,n);const o=h.Cartesian3.dot(n,e);let r=Math.acos(h.Cartesian3.dot(t,i))*180/Math.PI;return r=o>0?r:-r,r}const Bo=class Bo extends Yt{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 LF(this)),pitch:this.disposeVar(new NF(this)),roll:this.disposeVar(new OF(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 WF(this)})),this._circles={heading:this._createRotatorCircle(n,"heading"),pitch:this._createRotatorCircle(n,"pitch"),roll:this._createRotatorCircle(n,"roll")},!!n.viewer){{const r=()=>{this._cartesian=this.position&&Ue(this.position)||void 0};r(),this.dispose(this.positionChanged.disposableOn(r))}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 o=ke({rotation:this.selfRotation});if(!o)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=h.Matrix4.toArray(o))};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 o=this.ad(new os(e));this.dispose(l.track([o,"position"],[this,"position"])),this.dispose(l.track([o,"pixelSize"],[this,"pixelSize"])),this.dispose(l.track([o,"debug"],[this,"debug"])),this.dispose(l.track([o,"rotation"],[this,"rotation"]));{const r=()=>{o.selfRotation=Bo.rotationFuncs[n](this.selfRotation),o.circleRotation=this.selfRotation[Bo.rotationNum[n]]};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{const s=this.movingPlaneType===n,a=this.hoveredPlaneType===n,d=[0,0,0,s||a?1:.8];d[Bo.rotationNum[n]]=1,o.color=d};r(),this.dispose(this.movingPlaneTypeChanged.disposableOn(r)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(r))}return o}};v(Bo,"rotationNum",{heading:0,pitch:1,roll:2}),v(Bo,"rotationFuncs",{heading:([e,n,o])=>[0,0,0],pitch:([e,n,o])=>[e,0,-90],roll:([e,n,o])=>[e,n+90,0]});let gi=Bo;(t=>{t.createDefaultProps=()=>({...Yt.createDefaultProps(),rotation:l.reactArray([0,0,0]),selfRotation:l.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(gi||(gi={})),l.extendClassProps(gi.prototype,gi.createDefaultProps);const jo=class jo extends l.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(i){this.positions=[i??jo.defaults.positions[0],this.stopPosition??jo.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(i){this.positions=[this.startPosition??jo.defaults.positions[0],i??jo.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(i,e){if(super(),!i.viewer)return;const o=this.ad(new De(i,e));o.arcType="RHUMB";const r=this.ad(new jt(i,e));this.ad(l.track([o,"allowPicking"],[this,"allowPicking"])),this.ad(l.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))}}};v(jo,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let qo=jo;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:l.reactPositions(t.defaults.positions),width:10,color:l.reactArray([1,0,0,1])})})(qo||(qo={})),l.extendClassProps(qo.prototype,qo.createDefaultProps);class ln extends Yt{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,o,r)=>{const s=[0,0,0],a=new h.Cartographic;return e.pointerMoveEvent.disposableOn(c=>{if(!c.pointerEvent||!e.viewer)return;const d=ai(l.getDomEventCurrentTargetPos(c.pointerEvent));if(!nr(e.viewer.scene,d,this._opInfo.originPosition.value[2],a))return;tr(a,s),this._opInfo.constraintMode.value==="x"?co(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?co(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,r,o,p),this._opInfo.targetPosition.value=p;let u=this.scale[0],f=this.scale[1];const g=w.geoDistance(p,this._opInfo.originPosition.value)-w.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...p];const m=this._opInfo.originDimensions.value[0]/100;g!=0&&this._opInfo.constraintMode.value==="y"&&(g>0?u+=m:u-=m),g!=0&&this._opInfo.constraintMode.value==="x"&&(g>0?f+=m:f-=m),u<=0&&(u+=m),f<=0&&(f+=m),this.scale=[u??1,f??1,this.scale[2]??1]})})));v(this,"_pickingZProcessing",e=>this.disposeVar(new l.Processing(()=>{const n=new h.Cartesian3,o=[0,0,0];return e.pointerMoveEvent.disposableOn(r=>{if(!r.pointerEvent||!e.viewer)return;const s=ai(l.getDomEventCurrentTargetPos(r.pointerEvent));if(!ac(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,o)){this._opInfo.movingPosition.value=o;const c=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[c[0],c[1],o[2]+a];let d=this.scale[2];const p=o[2]-this._lastPosition[2];this._lastPosition=[...o];const u=this._opInfo.originDimensions.value[0]/100;p!=0&&(p>0?d+=u:d-=u),d<=0&&(d+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,d??1]}})})));const n=e.viewer;if(!n)return;const{scene:o}=n;this.ad(new sd(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 d=()=>{if(!this._scaleAxis)return;const{zAxis:p,yAxis:u,xAxis:f}=this._scaleAxis,g=this._opInfo.constraintMode.value,m=this._opInfo.step;p.color=[0,0,1,.99],u.color=[0,1,0,.99],f.color=[1,0,0,.99],g==="x"?f.color=m?[1,1,0,.8]:[1,1,0,.99]:g==="y"?u.color=m?[1,1,0,.8]:[1,1,0,.99]:g==="z"&&(p.color=m?[1,1,0,.8]:[1,1,0,.99])};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d)),this.dispose(this._opInfo.step.changed.disposableOn(d))}{const d=()=>{if(!this._scaleAxis)return;const{position:u=ln.defaults.position}=this,{zAxis:f,yAxis:g,xAxis:m}=this._scaleAxis;f.startPosition=g.startPosition=m.startPosition=u;const[y,P,S]=u;f.stopPosition=[y,P,S+this._opInfo.originDimensions.value[2]];const C=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);C&&(m.stopPosition=C);const E=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);E&&(g.stopPosition=E)};d();const p=this.ad(l.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(p.don(d))}{const d=()=>{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}};d(),this.dispose(this._opInfo.originHeading.changed.disposableOn(d)),this.dispose(this._opInfo.originPosition.changed.disposableOn(d)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(d)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(d))}const r=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(l.createProcessingFromAsyncFunc(async d=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",d.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await l.step(d,async p=>{const u=()=>{const m=[...this.position??ln.defaults.position];e.editingHeightOffset&&(m[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=m};p.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const f={constraintMode:"none",startDragPos:[0,0,0]},g=m=>{if(!this.position)return;const y={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Zh(m,o,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(m=>{m.pointerEvent&&g(m.pointerEvent)})),await l.step(p,m=>new Promise((y,P)=>{m.disposer.dispose(P),m.disposer.dispose(e.pointerDownEvent.don(S=>{S.pointerEvent&&g(S.pointerEvent),S.pointerEvent&&S.pointerEvent.button===0&&f.constraintMode!=="none"&&y()}))}))}),this._opInfo.step.value=!1,await l.step(d,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);r.restart(void 0,u,f),p.disposer.dispose(()=>r.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),p.disposer.dispose(()=>s.cancel()));await l.step(p,u=>new Promise((f,g)=>{u.disposer.dispose(g),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 o=this.ad(new qo(e));return o.width=10,this.ad(l.track([o,"show"],[this,"enabled"])),o}}(t=>{t.createDefaultProps=()=>({...Yt.createDefaultProps(),scale:l.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(ln||(ln={})),l.extendClassProps(ln.prototype,ln.createDefaultProps);const ao=class ao extends Mt{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:o,deleteCount:r,items:s}of n){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 n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(l.nextAnimateFrame(()=>{var o;((o=n.pointerEvent)==null?void 0:o.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??ao.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((o,r)=>o.every((s,a)=>{const c=this.editingPoints.get(r);return c.position&&c.position[a]===s})))}forceResetPositions(e){(this.enabled??ao.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 De(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 o=()=>{const r=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,r.push(s);n.positions=r};o(),this.ad(this.positionsChanged.don(o))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new l.CursorInfo(e.container,l.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const o=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}o==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):o==="Modifying"||o==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):o==="None"&&(n.text="",n.show=!1)}}))}};v(ao,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),v(ao,"defaults",{...Mt.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:ao.baseImageUrl+"point-green.png",otherControlPointImageUrl:ao.baseImageUrl+"point-yellow.png"});let ni=ao;(t=>{t.createDefaultProps=()=>({...Mt.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})})(ni||(ni={})),l.extendClassProps(ni.prototype,ni.createDefaultProps);let GF=0;class I1 extends l.Destroyable{constructor(e,n){super();v(this,"_position",this.disposeVar(l.reactArrayWithUndefined(void 0)));v(this,"_id",GF++);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 o=this._menuPoi=this.ad(new fr(e.czmViewer));o.enabled=!1,this.ad(l.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??ni.defaults.firstControlPointImageUrl:o.imageUri=e.otherControlPointImageUrl??ni.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 D1 extends I1{constructor(i,e){super(i,e)}}class Je extends ni{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 fi(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async o=>{o.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 o.promise(l.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(c=>{s.dispose(a.completeEvent.disposableOnce(c))}))}))})),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 n=e?e.map(o=>new D1(this,o)):[];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 o=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await o.promise(l.step(o,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new HF(this,r)));const p=a.disposer.disposeVar(new $F(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>p.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(f=>{f?(r++,u(!0)):u(!1)})),a.disposer.dispose(p.overEvent.disposableOnce(f=>{f?(r--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return n.start(),n}}(t=>{t.createDefaultProps=()=>({...ni.createDefaultProps()})})(Je||(Je={})),l.extendClassProps(Je.prototype,Je.createDefaultProps);class HF extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));const{placeEditing:o}=e;let r=new D1(e,void 0);e.editingPoints.splice(n,0,r);const s=()=>{(e.debug??Je.defaults.debug)&&console.log("delete currentPosEditor");const d=e.editingPoints.indexOf(r);if(d===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(d,1)};if(o.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(l.track([r,"position"],[o,"position"])),o.enabled=!0;let a=!1;const c=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{o.enabled=!1,!a&&c()}),this.dispose(o.overEvent.disposableOnce(()=>{a=!0,r.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 qF(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 $F 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(qF(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 b1 extends Je{constructor(i){super(i),this.loop=!1}}class R1 extends Je{constructor(i){super(i),this.loop=!0}}class bh extends I1{constructor(i,e){super(i,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",Re.baseImageUrl+"add.png"],["delete","删除当前控制点","",Re.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Re.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(o=>{i.menuPoiCommand(this,o)})),this.dispose(n.dbclickEvent.disposableOn(()=>{i.menuPoiCommand(this,"dbClick")}))}if(i.middlePointShow){const n=this.ad(new wi(i.czmViewer));{n.imageUri=i.firstControlPointImageUrl??Re.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 o=()=>{if(!(i.enabled??Re.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??Re.defaults.loop)&&s+1>=a)break;const d=this.position;if(!d)break;let p=(s+1)%a;const f=i.editingPoints.get(p).position;if(!f)break;const g=Bh(d,f);if(!g)break;g[2]-=i.czmViewer.editingHeightOffset??0,n.position=g;const m=i.editingPoints.length<(i.maxPointsNum??Re.defaults.maxPointsNum);n.enabled=m,n.show=m;return}while(!1);n.enabled=!1,n.show=!1};o(),this.dispose(i.positionsChanged.disposableOn(o)),this.dispose(i.loopChanged.disposableOn(o)),this.dispose(i.enabledChanged.disposableOn(o))}this.dispose(n.clickEvent.disposableOn(o=>{if(o.button!==0||i.editingPoints.length>=(i.maxPointsNum??Re.defaults.maxPointsNum))return;const r=i.editingPoints.indexOf(this);if(r===-1)return;const s=n.position?[...n.position]:void 0;s&&(s[2]+=i.czmViewer.editingHeightOffset??0);let a=new bh(i,s);i.editingPoints.splice(r+1,0,a),i.modify(a)}))}}}}class Re extends ni{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 o=this.ad(l.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new l.ObjResettingWithEvent(o,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new XF(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new an(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async o=>{o.disposer.dispose(()=>{(this.debug??Re.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let r=-1;do if((this.debug??Re.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",r=await o.promise(l.step(o,async s=>{const a=s.disposer,c=a.ad(new YF(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&c.modify(this.editingPoints.get(r===-1||r>=this.editingPoints.length?0:r)),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)}))}))})),r===-1){(this.debug??Re.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??Re.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??Re.defaults.loop;const a=this.editingPoints.get(r-1).position;if(!a)return;let c=r%this.editingPoints.length;const p=this.editingPoints.get(c).position;if(!p)return;const u=Bh(a,p);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let f=new bh(this,u);this.editingPoints.splice(r,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(o=>new bh(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...ni.createDefaultProps(),moveWithFirstPosition:!1})})(Re||(Re={})),l.extendClassProps(Re.prototype,Re.createDefaultProps);class XF extends l.Destroyable{constructor(i,e){super(),this._firstPositionEditor=i,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,o)=>{if(n===void 0||o===void 0)return;var r=[n[0]-o[0],n[1]-o[1],n[2]-o[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const c=this.multiPointsModifyEditing.editingPoints.get(a),d=c.position;d!==void 0&&(c.position=[d[0]+r[0],d[1]+r[1],d[2]+r[2]])}})}}class YF 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 o=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(o);const r=s=>{o(),e.status="Modifying_Point",n=new ZF(e,s),n.dispose(n.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 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")r(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 ZF 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: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(l.track([this._posEditor,"position"],[o,"position"])),this.dispose(o.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class x1 extends Re{constructor(i){super(i),this.loop=!1}}class k1 extends Re{constructor(i){super(i),this.loop=!0}}class rs extends Je{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,o=e*Math.cos(n[1]*Math.PI/180),r=w.geoDestination(i,o,n[0]);if(!r){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);r[2]+=s,this.positions=[i,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=r)}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),o=w.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=[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)})})(rs||(rs={})),l.extendClassProps(rs.prototype,rs.createDefaultProps);class $o extends Re{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,o=e*Math.cos(n[1]*Math.PI/180),r=w.geoDestination(i,o,n[0]);if(!r){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);r[2]+=s,this.positions=[i,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=r)}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","增加控制点","",Re.baseImageUrl+"add.png"],["delete","删除当前控制点","",Re.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Re.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","删除当前控制点","",Re.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Re.baseImageUrl+"modify.png"]];const n=w.geoHeading(this.startPosition,this.endPosition),o=w.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=[n,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Re.createDefaultProps(),startPosition:l.reactArrayWithUndefined(void 0),endPosition:l.reactArrayWithUndefined(void 0),rotation:l.reactArray([0,0,0]),distance:l.react(0)})})($o||($o={})),l.extendClassProps($o.prototype,$o.createDefaultProps);class F1 extends Je{constructor(i){super(i),this.loop=!1,this.polylineShow=!1}}class z1 extends Re{constructor(i){super(i),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class ss 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(o=>(o[2]-=i.editingHeightOffset??0,[n,o]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(i){const e=this.ad(new ci(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)})})(ss||(ss={})),l.extendClassProps(ss.prototype,ss.createDefaultProps);class as extends Re{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(o=>(o[2]-=i.editingHeightOffset??0,[n,o]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(i){const e=this.ad(new ci(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=()=>({...Re.createDefaultProps(),visibilityPositions:l.reactPositionsSet(void 0)})})(as||(as={})),l.extendClassProps(as.prototype,as.createDefaultProps);class L1 extends $o{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,o){super(e,n,o??!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 r;if(this.currentEditing){if(this.currentEditing instanceof Je&&((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 fi&&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 Gl=class Gl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new fi(e));this.ad(e.clickEvent.don(o=>{var r;((r=o.pointerEvent)==null?void 0:r.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(Gl,"type",Gl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Place,Gl));let Xg=Gl;const Hl=class Hl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new gi(e));n.rotation=[90,0,0],this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const o=e.getEngineObject(i);o&&(this.ad(l.bind([n,"position"],[o.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(Hl,"type",Hl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Rotation,Hl));let Yg=Hl;const ql=class ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ln(e));this.ad(n.enabledChanged.don(o=>{!o&&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(ql,"type",ql.registerEditing("ESCesiumViewer",w.ESJEditingMode.Scale,ql));let Zg=ql;const $l=class $l extends Ct{constructor(i,e){super(Array.isArray(i)?i[0]:i,e,!0);const n=this.currentEditing=this.ad(new an(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(i)){const o=[];for(let r=0;r<i.length;r++){const s=i[r];Reflect.has(s,"position")?o.push(s.position):s.points&&o.push(...s.points)}n.position=w.getMinMaxCorner(o).center,this.ad(n.positionChanged.disposableOn((r,s)=>{if(!(!r||!s)){var a=Dt({originPosition:s},[r])[0][0];i.forEach(c=>{if(Reflect.has(c,"position")){const d=Dt({originPosition:s},[c.position])[0][0];c.position=wn({originPosition:s},[[d[0]+a[0],d[1]+a[1],d[2]+a[2]]])[0][0]}else if(Reflect.has(c,"points")&&c.points){const d=Dt({originPosition:s},c.points)[0];c.points=wn({originPosition:s},d.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 o=e.getEngineObject(i);this.ad(l.bind([n,"position"],[o.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((o,r)=>{if(o===void 0||r===void 0||i.points===void 0||i.points.length===0){this.destroy();return}var s=Dt({originPosition:r},[o])[0][0];const a=Dt({originPosition:r},i.points)[0];i.points=wn({originPosition:r},a.map(c=>[c[0]+s[0],c[1]+s[1],c[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};v($l,"type",$l.registerEditing("ESCesiumViewer",w.ESJEditingMode.Translation,$l));let Rh=$l;const Xl=class Xl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new rs(e));this.ad(n.enabledChanged.don(o=>{!o&&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 o=Ue(i.position);if(h.Cartesian3.ZERO.equals(o)||!e.viewer)return;n.distance=Wi(e.viewer.scene,o,100)??1}while(!1);break}if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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(Xl,"type",Xl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsAppend,Xl));let Qg=Xl;const Yl=class Yl extends Ct{constructor(i,e){var r;if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new $o(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(h.Cartesian3.ZERO.equals(s)||!e.viewer)return;n.distance=Wi(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(i,"points")&&((r=i.points)==null?void 0:r.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 o=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(o.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Yl,"type",Yl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsModify,Yl));let Kg=Yl;const Zl=class Zl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new R1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.CircularAppend,Zl));let Jg=Zl;const Ql=class Ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new k1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.CircularInsert,Ql));let Bg=Ql;const Kl=class Kl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new b1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.LineStringAppend,Kl));let jg=Kl;const Jl=class Jl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new x1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.LineStringInsert,Jl));let em=Jl;const Bl=class Bl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new F1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Bl,"type",Bl.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterAppend,Bl));let tm=Bl;const jl=class jl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new z1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.ScatterModify,jl));let im=jl;const ec=class ec extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ss(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(ec,"type",ec.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityAppend,ec));let nm=ec;const tc=class tc extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new as(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(tc,"type",tc.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityModify,tc));let om=tc;const ic=class ic extends Ct{constructor(i,e){if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new L1(e));do{if(Reflect.has(i,"points")){const r=Reflect.has(i,"extrudedHeight"),s=Reflect.has(i,"height"),a=Reflect.has(i,"perPositionHeight")?i.perPositionHeight:!r,c=i instanceof w.ESClassification||i instanceof w.ESPolygonFence;let d=w.getMinMaxCorner(i.points).center,p=[...d],u=c?i.points[0][2]:0;a?r?p[2]=i.extrudedHeight:p[2]=i.height+u:(s&&(d[2]=i.height),r&&(p[2]=i.extrudedHeight)),n.startPosition=d,n.distance=p[2]-d[2],n.moveWithFirstPosition=!1;let f=[...d];this.ad(n.positionsChanged.don(()=>{n.positions.length===2&&(a?(i.points=i.points.map(g=>[g[0],g[1],g[2]+n.positions[0][2]-f[2]]),r?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]),r&&(i.extrudedHeight=n.positions[1][2])),f=[...n.positions[0]])}));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const o=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(o.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(ic,"type",ic.registerEditing("ESCesiumViewer",w.ESJEditingMode.HeightModify,ic));let rm=ic;const _t=class _t extends l.Destroyable{constructor(e,n,o,r=!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(o)?[...o]:[o],d=this.editingID=a.editingID;this.useKeyToSwitch=r,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:d,type:"start",add:{modes:c}}),this.ad(a.toDestroyEvent.don(_t.stop)),this.ad(s.keyDownEvent.don(p=>{p.code=="Escape"&&_t.stop()})),this.createEditingMode(this.currentIndex)}createEditingMode(e){const{sceneObject:n,czmViewer:o,editingID:r}=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,o.typeName);if(!c||!n.supportEditingModes().includes(a))return this._createNextEditingMode(s,a);const d=new c(n,o);if(s.ad(()=>!d.isDestroyed()&&d.destroy()),d.isDestroyed())return this._createNextEditingMode(s,a);const p=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(d.toDestroyEvent.don(p)),this.useKeyToSwitch&&s.ad(o.keyDownEvent.don(u=>{u.code=="Space"&&p()})),s.ad(o.dblclickEvent.donce(()=>this.useKeyToSwitch?_t.stop():p())),d.supportEditing)o.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:r,type:"changed",add:{cMode:a,cIndex:e}}),o.notSupportEditingCount=0;else return this._createNextEditingMode(s,a)}_createNextEditingMode(e,n){const{sceneObject:o,czmViewer:r,editingID:s}=this;if(!e.isDestroyed()&&e.destroy(),console.log(`未找到编辑模式或不支持当前编辑模式${n},已跳过当前编辑模式,请检查输入`),r.editingEvent.emit({objectIDs:[o.parentID??o.id],editingID:s,type:"changedFailed",add:{cMode:n,cIndex:this.currentIndex}}),r.notSupportEditingCount++,r.notSupportEditingCount==this.editingModes.length)return _t.stop();l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})}static create(e,n,o,r=!0){_t.stop(),_t.currentEditingInstance=new _t(e,n,o,r)}static stop(){if(_t.currentEditingInstance&&!_t.currentEditingInstance.isDestroyed()){if(!_t.currentEditingInstance)return;const{czmViewer:e,sceneObject:n,editingID:o,editingModes:r}=_t.currentEditingInstance;_t.currentEditingInstance.destroy(),e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:o,type:"end",add:{modes:r}})}_t.currentEditingInstance=void 0}};v(_t,"currentEditingInstance");let sm=_t;function N1(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,o,r=!0)=>{const s=Array.isArray(o)?[...o]:[o],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 d=u=>{u.code=="Escape"&&c()};i.disposer.ad(e.keyDownEvent.don(d));let p=0;do{const u=s[p%s.length],f=await l.step(i,async g=>{const m=g.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 P=new y(n,e);if(m.ad(()=>{!P.isDestroyed()&&P.destroy()}),P.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 g.promise(new Promise(C=>{if(P.isDestroyed()&&C(!1),m.ad(P.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),C(!1)})),r){const E=M=>{M.code=="Space"&&(console.log(`编辑模式${u}结束`),C(!1))};m.ad(e.keyDownEvent.don(E)),m.ad(e.dblclickEvent.don(()=>C(!0)))}}))});if(r&&f||!r&&p==s.length-1||e.notSupportEditingCount==s.length)break;p++}while(!0)});return t}function O1(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,o)=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:o,type:"start"});const r=()=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:o,type:"end"}),t.isRunning&&t.cancel()};i.disposer.ad(r);const s=c=>{c.code=="Escape"&&r()};i.disposer.ad(e.keyDownEvent.don(s));const a=new Rh(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",e="2025-08-14T09:06:32.000Z",n="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="60921cbcff46cfbed33163bca9f10cb47aa8cd65",a=((Date.now()-1755162392e3)/36e5).toFixed(1),c=`%c🌏 ${t}%c ${i}.${r.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 WF extends l.HasOwner{constructor(i){super(i);const{czmViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const o=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(r=>{const s=n=this._getStartInfo(r.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(r=>{n&&n.currentPlaneType!=="none"&&(o.restart(void 0,e,n),n=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,c=[...this.owner.selfRotation];c[gi.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 o=this.owner.circles[n.currentPlaneType];e.incrementDisabledInputStack(),i.disposer.dispose(()=>e.decrementDisabledInputStack()),i.disposer.dispose(e.pointerMoveEvent.don(r=>{if(n&&r.pointerEvent){const{offsetX:s,offsetY:a}=r.pointerEvent,c=[s,a],{currentPlaneType:d}=n;if(d==="none")return;const p=this.owner.getPlane(d);if(!n.currentV)return;const u=p.pick(c);if(!u||!this.owner.cartesian)return;const f=h.Cartesian3.subtract(n.currentV,this.owner.cartesian,new h.Cartesian3);h.Cartesian3.normalize(f,f);const g=h.Cartesian3.subtract(u,this.owner.cartesian,new h.Cartesian3);if(h.Cartesian3.normalize(g,g),!p.normal||!p.origin)return;const m=$g(f,g,p.normal),y=$g(p.origin,f,p.normal),P=$g(p.origin,g,p.normal);{const S=[...this.owner.selfRotation];S[gi.rotationNum[d]]=n.startRotation+m,this.owner.selfRotation=S,o.circleStartRotation=y,o.circleEndRotation=P}}})),this.owner.movingPlaneType=n.currentPlaneType,i.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),i.disposer.dispose(()=>{o.circleStartRotation=0,o.circleEndRotation=0}),await l.step(i,r=>new Promise((s,a)=>{r.disposer.dispose(a),r.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),r.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(i,e,n,o,r){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,c=this.owner.getPlane(n).pick(o);if(!c)return;const d=h.Cartesian3.distance(s,c),p=r/4,u=p*3/128;if(!(d>=p-u&&d<=p+u))return;const g=h.Cartesian3.distance(e.camera.positionWC,c);i.currentD2c<=g||(i.currentPlaneType=n,i.currentD2c=g,i.currentV=c,i.startRotation=a[gi.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 o=Wi(n,this.owner.cartesian,this.owner.pixelSize);if(!o)return;const{offsetX:r,offsetY:s}=i,a=[r,s],c=i.pointerId,d={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:c};return this._pickPlane(d,n,"heading",a,o),this._pickPlane(d,n,"pitch",a,o),this._pickPlane(d,n,"roll",a,o),d}}function $g(t,i,e){const n=h.Cartesian3.cross(i,t,new h.Cartesian3);if(n.equals(h.Cartesian3.ZERO))return 0;h.Cartesian3.normalize(n,n);const o=h.Cartesian3.dot(n,e);let r=Math.acos(h.Cartesian3.dot(t,i))*180/Math.PI;return r=o>0?r:-r,r}const Bo=class Bo extends Yt{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 LF(this)),pitch:this.disposeVar(new NF(this)),roll:this.disposeVar(new OF(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 WF(this)})),this._circles={heading:this._createRotatorCircle(n,"heading"),pitch:this._createRotatorCircle(n,"pitch"),roll:this._createRotatorCircle(n,"roll")},!!n.viewer){{const r=()=>{this._cartesian=this.position&&Ue(this.position)||void 0};r(),this.dispose(this.positionChanged.disposableOn(r))}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 o=ke({rotation:this.selfRotation});if(!o)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=h.Matrix4.toArray(o))};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 o=this.ad(new os(e));this.dispose(l.track([o,"position"],[this,"position"])),this.dispose(l.track([o,"pixelSize"],[this,"pixelSize"])),this.dispose(l.track([o,"debug"],[this,"debug"])),this.dispose(l.track([o,"rotation"],[this,"rotation"]));{const r=()=>{o.selfRotation=Bo.rotationFuncs[n](this.selfRotation),o.circleRotation=this.selfRotation[Bo.rotationNum[n]]};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{const s=this.movingPlaneType===n,a=this.hoveredPlaneType===n,d=[0,0,0,s||a?1:.8];d[Bo.rotationNum[n]]=1,o.color=d};r(),this.dispose(this.movingPlaneTypeChanged.disposableOn(r)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(r))}return o}};v(Bo,"rotationNum",{heading:0,pitch:1,roll:2}),v(Bo,"rotationFuncs",{heading:([e,n,o])=>[0,0,0],pitch:([e,n,o])=>[e,0,-90],roll:([e,n,o])=>[e,n+90,0]});let gi=Bo;(t=>{t.createDefaultProps=()=>({...Yt.createDefaultProps(),rotation:l.reactArray([0,0,0]),selfRotation:l.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(gi||(gi={})),l.extendClassProps(gi.prototype,gi.createDefaultProps);const jo=class jo extends l.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(i){this.positions=[i??jo.defaults.positions[0],this.stopPosition??jo.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(i){this.positions=[this.startPosition??jo.defaults.positions[0],i??jo.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(i,e){if(super(),!i.viewer)return;const o=this.ad(new De(i,e));o.arcType="RHUMB";const r=this.ad(new jt(i,e));this.ad(l.track([o,"allowPicking"],[this,"allowPicking"])),this.ad(l.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))}}};v(jo,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let qo=jo;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:l.reactPositions(t.defaults.positions),width:10,color:l.reactArray([1,0,0,1])})})(qo||(qo={})),l.extendClassProps(qo.prototype,qo.createDefaultProps);class ln extends Yt{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,o,r)=>{const s=[0,0,0],a=new h.Cartographic;return e.pointerMoveEvent.disposableOn(c=>{if(!c.pointerEvent||!e.viewer)return;const d=ai(l.getDomEventCurrentTargetPos(c.pointerEvent));if(!nr(e.viewer.scene,d,this._opInfo.originPosition.value[2],a))return;tr(a,s),this._opInfo.constraintMode.value==="x"?co(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?co(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,r,o,p),this._opInfo.targetPosition.value=p;let u=this.scale[0],f=this.scale[1];const g=w.geoDistance(p,this._opInfo.originPosition.value)-w.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...p];const m=this._opInfo.originDimensions.value[0]/100;g!=0&&this._opInfo.constraintMode.value==="y"&&(g>0?u+=m:u-=m),g!=0&&this._opInfo.constraintMode.value==="x"&&(g>0?f+=m:f-=m),u<=0&&(u+=m),f<=0&&(f+=m),this.scale=[u??1,f??1,this.scale[2]??1]})})));v(this,"_pickingZProcessing",e=>this.disposeVar(new l.Processing(()=>{const n=new h.Cartesian3,o=[0,0,0];return e.pointerMoveEvent.disposableOn(r=>{if(!r.pointerEvent||!e.viewer)return;const s=ai(l.getDomEventCurrentTargetPos(r.pointerEvent));if(!ac(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,o)){this._opInfo.movingPosition.value=o;const c=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[c[0],c[1],o[2]+a];let d=this.scale[2];const p=o[2]-this._lastPosition[2];this._lastPosition=[...o];const u=this._opInfo.originDimensions.value[0]/100;p!=0&&(p>0?d+=u:d-=u),d<=0&&(d+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,d??1]}})})));const n=e.viewer;if(!n)return;const{scene:o}=n;this.ad(new sd(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 d=()=>{if(!this._scaleAxis)return;const{zAxis:p,yAxis:u,xAxis:f}=this._scaleAxis,g=this._opInfo.constraintMode.value,m=this._opInfo.step;p.color=[0,0,1,.99],u.color=[0,1,0,.99],f.color=[1,0,0,.99],g==="x"?f.color=m?[1,1,0,.8]:[1,1,0,.99]:g==="y"?u.color=m?[1,1,0,.8]:[1,1,0,.99]:g==="z"&&(p.color=m?[1,1,0,.8]:[1,1,0,.99])};d(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(d)),this.dispose(this._opInfo.step.changed.disposableOn(d))}{const d=()=>{if(!this._scaleAxis)return;const{position:u=ln.defaults.position}=this,{zAxis:f,yAxis:g,xAxis:m}=this._scaleAxis;f.startPosition=g.startPosition=m.startPosition=u;const[y,P,S]=u;f.stopPosition=[y,P,S+this._opInfo.originDimensions.value[2]];const C=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);C&&(m.stopPosition=C);const E=w.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);E&&(g.stopPosition=E)};d();const p=this.ad(l.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(p.don(d))}{const d=()=>{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}};d(),this.dispose(this._opInfo.originHeading.changed.disposableOn(d)),this.dispose(this._opInfo.originPosition.changed.disposableOn(d)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(d)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(d))}const r=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(l.createProcessingFromAsyncFunc(async d=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",d.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await l.step(d,async p=>{const u=()=>{const m=[...this.position??ln.defaults.position];e.editingHeightOffset&&(m[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=m};p.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const f={constraintMode:"none",startDragPos:[0,0,0]},g=m=>{if(!this.position)return;const y={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Zh(m,o,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(m=>{m.pointerEvent&&g(m.pointerEvent)})),await l.step(p,m=>new Promise((y,P)=>{m.disposer.dispose(P),m.disposer.dispose(e.pointerDownEvent.don(S=>{S.pointerEvent&&g(S.pointerEvent),S.pointerEvent&&S.pointerEvent.button===0&&f.constraintMode!=="none"&&y()}))}))}),this._opInfo.step.value=!1,await l.step(d,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);r.restart(void 0,u,f),p.disposer.dispose(()=>r.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),p.disposer.dispose(()=>s.cancel()));await l.step(p,u=>new Promise((f,g)=>{u.disposer.dispose(g),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 o=this.ad(new qo(e));return o.width=10,this.ad(l.track([o,"show"],[this,"enabled"])),o}}(t=>{t.createDefaultProps=()=>({...Yt.createDefaultProps(),scale:l.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(ln||(ln={})),l.extendClassProps(ln.prototype,ln.createDefaultProps);const ao=class ao extends Mt{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:o,deleteCount:r,items:s}of n){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 n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(l.nextAnimateFrame(()=>{var o;((o=n.pointerEvent)==null?void 0:o.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??ao.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((o,r)=>o.every((s,a)=>{const c=this.editingPoints.get(r);return c.position&&c.position[a]===s})))}forceResetPositions(e){(this.enabled??ao.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 De(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 o=()=>{const r=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,r.push(s);n.positions=r};o(),this.ad(this.positionsChanged.don(o))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new l.CursorInfo(e.container,l.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const o=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}o==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):o==="Modifying"||o==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):o==="None"&&(n.text="",n.show=!1)}}))}};v(ao,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),v(ao,"defaults",{...Mt.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:ao.baseImageUrl+"point-green.png",otherControlPointImageUrl:ao.baseImageUrl+"point-yellow.png"});let ni=ao;(t=>{t.createDefaultProps=()=>({...Mt.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})})(ni||(ni={})),l.extendClassProps(ni.prototype,ni.createDefaultProps);let GF=0;class I1 extends l.Destroyable{constructor(e,n){super();v(this,"_position",this.disposeVar(l.reactArrayWithUndefined(void 0)));v(this,"_id",GF++);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 o=this._menuPoi=this.ad(new fr(e.czmViewer));o.enabled=!1,this.ad(l.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??ni.defaults.firstControlPointImageUrl:o.imageUri=e.otherControlPointImageUrl??ni.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 D1 extends I1{constructor(i,e){super(i,e)}}class Je extends ni{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 fi(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async o=>{o.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 o.promise(l.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(c=>{s.dispose(a.completeEvent.disposableOnce(c))}))}))})),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 n=e?e.map(o=>new D1(this,o)):[];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 o=>{let r=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await o.promise(l.step(o,async a=>{let c;!e()&&(c=a.disposer.disposeVar(new HF(this,r)));const p=a.disposer.disposeVar(new $F(this,r));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>p.do())),await a.promise(new Promise(u=>{c&&a.disposer.dispose(c.overEvent.disposableOnce(f=>{f?(r++,u(!0)):u(!1)})),a.disposer.dispose(p.overEvent.disposableOnce(f=>{f?(r--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return n.start(),n}}(t=>{t.createDefaultProps=()=>({...ni.createDefaultProps()})})(Je||(Je={})),l.extendClassProps(Je.prototype,Je.createDefaultProps);class HF extends l.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new l.Event));const{placeEditing:o}=e;let r=new D1(e,void 0);e.editingPoints.splice(n,0,r);const s=()=>{(e.debug??Je.defaults.debug)&&console.log("delete currentPosEditor");const d=e.editingPoints.indexOf(r);if(d===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(d,1)};if(o.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(l.track([r,"position"],[o,"position"])),o.enabled=!0;let a=!1;const c=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{o.enabled=!1,!a&&c()}),this.dispose(o.overEvent.disposableOnce(()=>{a=!0,r.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 qF(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 $F 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(qF(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 b1 extends Je{constructor(i){super(i),this.loop=!1}}class R1 extends Je{constructor(i){super(i),this.loop=!0}}class bh extends I1{constructor(i,e){super(i,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",Re.baseImageUrl+"add.png"],["delete","删除当前控制点","",Re.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Re.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(o=>{i.menuPoiCommand(this,o)})),this.dispose(n.dbclickEvent.disposableOn(()=>{i.menuPoiCommand(this,"dbClick")}))}if(i.middlePointShow){const n=this.ad(new wi(i.czmViewer));{n.imageUri=i.firstControlPointImageUrl??Re.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 o=()=>{if(!(i.enabled??Re.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??Re.defaults.loop)&&s+1>=a)break;const d=this.position;if(!d)break;let p=(s+1)%a;const f=i.editingPoints.get(p).position;if(!f)break;const g=Bh(d,f);if(!g)break;g[2]-=i.czmViewer.editingHeightOffset??0,n.position=g;const m=i.editingPoints.length<(i.maxPointsNum??Re.defaults.maxPointsNum);n.enabled=m,n.show=m;return}while(!1);n.enabled=!1,n.show=!1};o(),this.dispose(i.positionsChanged.disposableOn(o)),this.dispose(i.loopChanged.disposableOn(o)),this.dispose(i.enabledChanged.disposableOn(o))}this.dispose(n.clickEvent.disposableOn(o=>{if(o.button!==0||i.editingPoints.length>=(i.maxPointsNum??Re.defaults.maxPointsNum))return;const r=i.editingPoints.indexOf(this);if(r===-1)return;const s=n.position?[...n.position]:void 0;s&&(s[2]+=i.czmViewer.editingHeightOffset??0);let a=new bh(i,s);i.editingPoints.splice(r+1,0,a),i.modify(a)}))}}}}class Re extends ni{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 o=this.ad(l.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new l.ObjResettingWithEvent(o,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new XF(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new an(e));n.enabled=!1,this.currentProcess=this.disposeVar(l.createProcessingFromAsyncFunc(async o=>{o.disposer.dispose(()=>{(this.debug??Re.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let r=-1;do if((this.debug??Re.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",r=await o.promise(l.step(o,async s=>{const a=s.disposer,c=a.ad(new YF(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&c.modify(this.editingPoints.get(r===-1||r>=this.editingPoints.length?0:r)),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)}))}))})),r===-1){(this.debug??Re.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??Re.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??Re.defaults.loop;const a=this.editingPoints.get(r-1).position;if(!a)return;let c=r%this.editingPoints.length;const p=this.editingPoints.get(c).position;if(!p)return;const u=Bh(a,p);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let f=new bh(this,u);this.editingPoints.splice(r,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(o=>new bh(this,o)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...ni.createDefaultProps(),moveWithFirstPosition:!1})})(Re||(Re={})),l.extendClassProps(Re.prototype,Re.createDefaultProps);class XF extends l.Destroyable{constructor(i,e){super(),this._firstPositionEditor=i,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,o)=>{if(n===void 0||o===void 0)return;var r=[n[0]-o[0],n[1]-o[1],n[2]-o[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const c=this.multiPointsModifyEditing.editingPoints.get(a),d=c.position;d!==void 0&&(c.position=[d[0]+r[0],d[1]+r[1],d[2]+r[2]])}})}}class YF 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 o=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(o);const r=s=>{o(),e.status="Modifying_Point",n=new ZF(e,s),n.dispose(n.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 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")r(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 ZF 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: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(l.track([this._posEditor,"position"],[o,"position"])),this.dispose(o.enabledChanged.disposableOnce(r=>{r||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class x1 extends Re{constructor(i){super(i),this.loop=!1}}class k1 extends Re{constructor(i){super(i),this.loop=!0}}class rs extends Je{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,o=e*Math.cos(n[1]*Math.PI/180),r=w.geoDestination(i,o,n[0]);if(!r){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);r[2]+=s,this.positions=[i,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=r)}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),o=w.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=[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)})})(rs||(rs={})),l.extendClassProps(rs.prototype,rs.createDefaultProps);class $o extends Re{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,o=e*Math.cos(n[1]*Math.PI/180),r=w.geoDestination(i,o,n[0]);if(!r){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);r[2]+=s,this.positions=[i,r],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=r)}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","增加控制点","",Re.baseImageUrl+"add.png"],["delete","删除当前控制点","",Re.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Re.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","删除当前控制点","",Re.baseImageUrl+"delete.png"],["modify","修改当前控制点","",Re.baseImageUrl+"modify.png"]];const n=w.geoHeading(this.startPosition,this.endPosition),o=w.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=[n,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Re.createDefaultProps(),startPosition:l.reactArrayWithUndefined(void 0),endPosition:l.reactArrayWithUndefined(void 0),rotation:l.reactArray([0,0,0]),distance:l.react(0)})})($o||($o={})),l.extendClassProps($o.prototype,$o.createDefaultProps);class F1 extends Je{constructor(i){super(i),this.loop=!1,this.polylineShow=!1}}class z1 extends Re{constructor(i){super(i),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class ss 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(o=>(o[2]-=i.editingHeightOffset??0,[n,o]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(i){const e=this.ad(new ci(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)})})(ss||(ss={})),l.extendClassProps(ss.prototype,ss.createDefaultProps);class as extends Re{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(o=>(o[2]-=i.editingHeightOffset??0,[n,o]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(i){const e=this.ad(new ci(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=()=>({...Re.createDefaultProps(),visibilityPositions:l.reactPositionsSet(void 0)})})(as||(as={})),l.extendClassProps(as.prototype,as.createDefaultProps);class L1 extends $o{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,o){super(e,n,o??!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 r;if(this.currentEditing){if(this.currentEditing instanceof Je&&((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 fi&&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 Gl=class Gl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new fi(e));this.ad(e.clickEvent.don(o=>{var r;((r=o.pointerEvent)==null?void 0:r.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(Gl,"type",Gl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Place,Gl));let Xg=Gl;const Hl=class Hl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new gi(e));n.rotation=[90,0,0],this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const o=e.getEngineObject(i);o&&(this.ad(l.bind([n,"position"],[o.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(Hl,"type",Hl.registerEditing("ESCesiumViewer",w.ESJEditingMode.Rotation,Hl));let Yg=Hl;const ql=class ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ln(e));this.ad(n.enabledChanged.don(o=>{!o&&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(ql,"type",ql.registerEditing("ESCesiumViewer",w.ESJEditingMode.Scale,ql));let Zg=ql;const $l=class $l extends Ct{constructor(i,e){super(Array.isArray(i)?i[0]:i,e,!0);const n=this.currentEditing=this.ad(new an(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(i)){const o=[];for(let r=0;r<i.length;r++){const s=i[r];Reflect.has(s,"position")?o.push(s.position):s.points&&o.push(...s.points)}n.position=w.getMinMaxCorner(o).center,this.ad(n.positionChanged.disposableOn((r,s)=>{if(!(!r||!s)){var a=Dt({originPosition:s},[r])[0][0];i.forEach(c=>{if(Reflect.has(c,"position")){const d=Dt({originPosition:s},[c.position])[0][0];c.position=wn({originPosition:s},[[d[0]+a[0],d[1]+a[1],d[2]+a[2]]])[0][0]}else if(Reflect.has(c,"points")&&c.points){const d=Dt({originPosition:s},c.points)[0];c.points=wn({originPosition:s},d.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 o=e.getEngineObject(i);this.ad(l.bind([n,"position"],[o.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((o,r)=>{if(o===void 0||r===void 0||i.points===void 0||i.points.length===0){this.destroy();return}var s=Dt({originPosition:r},[o])[0][0];const a=Dt({originPosition:r},i.points)[0];i.points=wn({originPosition:r},a.map(c=>[c[0]+s[0],c[1]+s[1],c[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};v($l,"type",$l.registerEditing("ESCesiumViewer",w.ESJEditingMode.Translation,$l));let Rh=$l;const Xl=class Xl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new rs(e));this.ad(n.enabledChanged.don(o=>{!o&&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 o=Ue(i.position);if(h.Cartesian3.ZERO.equals(o)||!e.viewer)return;n.distance=Wi(e.viewer.scene,o,100)??1}while(!1);break}if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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(Xl,"type",Xl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsAppend,Xl));let Qg=Xl;const Yl=class Yl extends Ct{constructor(i,e){var r;if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new $o(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(h.Cartesian3.ZERO.equals(s)||!e.viewer)return;n.distance=Wi(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(i,"points")&&((r=i.points)==null?void 0:r.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 o=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(o.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Yl,"type",Yl.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsModify,Yl));let Kg=Yl;const Zl=class Zl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new R1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.CircularAppend,Zl));let Jg=Zl;const Ql=class Ql extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new k1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.CircularInsert,Ql));let Bg=Ql;const Kl=class Kl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new b1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.LineStringAppend,Kl));let jg=Kl;const Jl=class Jl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new x1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.LineStringInsert,Jl));let em=Jl;const Bl=class Bl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new F1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Bl,"type",Bl.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterAppend,Bl));let tm=Bl;const jl=class jl extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new z1(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),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.ScatterModify,jl));let im=jl;const ec=class ec extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ss(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(ec,"type",ec.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityAppend,ec));let nm=ec;const tc=class tc extends Ct{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new as(e));this.ad(n.enabledChanged.don(o=>{!o&&this.ad(l.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const o=()=>n.positions=i.points??[];o(),this.ad(i.pointsChanged.don(()=>!n.enabled&&o())),n.enabled=!0,this.ad(l.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(tc,"type",tc.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityModify,tc));let om=tc;const ic=class ic extends Ct{constructor(i,e){if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new L1(e));do{if(Reflect.has(i,"points")){const r=Reflect.has(i,"extrudedHeight"),s=Reflect.has(i,"height"),a=Reflect.has(i,"perPositionHeight")?i.perPositionHeight:!r,c=i instanceof w.ESClassification||i instanceof w.ESPolygonFence;let d=w.getMinMaxCorner(i.points).center,p=[...d],u=c?i.points[0][2]:0;a?r?p[2]=i.extrudedHeight:p[2]=i.height+u:(s&&(d[2]=i.height),r&&(p[2]=i.extrudedHeight)),n.startPosition=d,n.distance=p[2]-d[2],n.moveWithFirstPosition=!1;let f=[...d];this.ad(n.positionsChanged.don(()=>{n.positions.length===2&&(a?(i.points=i.points.map(g=>[g[0],g[1],g[2]+n.positions[0][2]-f[2]]),r?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]),r&&(i.extrudedHeight=n.positions[1][2])),f=[...n.positions[0]])}));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const o=this.ad(l.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(o.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(ic,"type",ic.registerEditing("ESCesiumViewer",w.ESJEditingMode.HeightModify,ic));let rm=ic;const _t=class _t extends l.Destroyable{constructor(e,n,o,r=!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(o)?[...o]:[o],d=this.editingID=a.editingID;this.useKeyToSwitch=r,s.editingEvent.emit({objectIDs:[a.parentID??a.id],editingID:d,type:"start",add:{modes:c}}),this.ad(a.toDestroyEvent.don(_t.stop)),this.ad(s.keyDownEvent.don(p=>{p.code=="Escape"&&_t.stop()})),this.createEditingMode(this.currentIndex)}createEditingMode(e){const{sceneObject:n,czmViewer:o,editingID:r}=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,o.typeName);if(!c||!n.supportEditingModes().includes(a))return this._createNextEditingMode(s,a);const d=new c(n,o);if(s.ad(()=>!d.isDestroyed()&&d.destroy()),d.isDestroyed())return this._createNextEditingMode(s,a);const p=()=>{console.log(`编辑模式${a}结束`),!s.isDestroyed()&&s.destroy(),l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})};if(s.ad(d.toDestroyEvent.don(p)),this.useKeyToSwitch&&s.ad(o.keyDownEvent.don(u=>{u.code=="Space"&&p()})),s.ad(o.dblclickEvent.donce(()=>this.useKeyToSwitch?_t.stop():p())),d.supportEditing)o.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:r,type:"changed",add:{cMode:a,cIndex:e}}),o.notSupportEditingCount=0;else return this._createNextEditingMode(s,a)}_createNextEditingMode(e,n){const{sceneObject:o,czmViewer:r,editingID:s}=this;if(!e.isDestroyed()&&e.destroy(),console.log(`未找到编辑模式或不支持当前编辑模式${n},已跳过当前编辑模式,请检查输入`),r.editingEvent.emit({objectIDs:[o.parentID??o.id],editingID:s,type:"changedFailed",add:{cMode:n,cIndex:this.currentIndex}}),r.notSupportEditingCount++,r.notSupportEditingCount==this.editingModes.length)return _t.stop();l.nextAnimateFrame(()=>{this.createEditingMode(++this.currentIndex)})}static create(e,n,o,r=!0){_t.stop(),_t.currentEditingInstance=new _t(e,n,o,r)}static stop(){if(_t.currentEditingInstance&&!_t.currentEditingInstance.isDestroyed()){if(!_t.currentEditingInstance)return;const{czmViewer:e,sceneObject:n,editingID:o,editingModes:r}=_t.currentEditingInstance;_t.currentEditingInstance.destroy(),e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.parentID??n.id],editingID:o,type:"end",add:{modes:r}})}_t.currentEditingInstance=void 0}};v(_t,"currentEditingInstance");let sm=_t;function N1(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,o,r=!0)=>{const s=Array.isArray(o)?[...o]:[o],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 d=u=>{u.code=="Escape"&&c()};i.disposer.ad(e.keyDownEvent.don(d));let p=0;do{const u=s[p%s.length],f=await l.step(i,async g=>{const m=g.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 P=new y(n,e);if(m.ad(()=>{!P.isDestroyed()&&P.destroy()}),P.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 g.promise(new Promise(C=>{if(P.isDestroyed()&&C(!1),m.ad(P.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),C(!1)})),r){const E=M=>{M.code=="Space"&&(console.log(`编辑模式${u}结束`),C(!1))};m.ad(e.keyDownEvent.don(E)),m.ad(e.dblclickEvent.don(()=>C(!0)))}}))});if(r&&f||!r&&p==s.length-1||e.notSupportEditingCount==s.length)break;p++}while(!0)});return t}function O1(){const t=l.createProcessingFromAsyncFunc(async(i,e,n,o)=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:o,type:"start"});const r=()=>{e.editingEvent.emit({objectIDs:n.map(c=>c.parentID??c.id),editingID:o,type:"end"}),t.isRunning&&t.cancel()};i.disposer.ad(r);const s=c=>{c.code=="Escape"&&r()};i.disposer.ad(e.keyDownEvent.don(s));const a=new Rh(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.1",e="2025-08-14T09:06:32.000Z",n="北京西部世界科技有限公司",o="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",r="60921cbcff46cfbed33163bca9f10cb47aa8cd65",a=((Date.now()-1755162392e3)/36e5).toFixed(1),c=`%c🌏 ${t}%c ${i}.${r.slice(0,8)}.${e} (距今${a}个小时)
|
|
2295
2295
|
%c${o?o+`
|
|
2296
2296
|
`:""}当前网站正在使用${t},此软件版权归${n}所有
|
|
2297
|
-
`;R.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","60921cbcff46cfbed33163bca9f10cb47aa8cd65")},get info(){return c},get date(){return"2025-08-14T09:06:32.000Z"},get author(){return"suplyang"},get version(){return"3.3.
|
|
2297
|
+
`;R.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","60921cbcff46cfbed33163bca9f10cb47aa8cd65")},get info(){return c},get date(){return"2025-08-14T09:06:32.000Z"},get author(){return"suplyang"},get version(){return"3.3.1"},get name(){return"earthsdk3-cesium"},get commitId(){return"60921cbcff46cfbed33163bca9f10cb47aa8cd65"},print(){console.info(this.info,`
|
|
2298
2298
|
font-size: 18px;
|
|
2299
2299
|
font-weight: 1000;
|
|
2300
2300
|
line-height: 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "earthsdk3-cesium",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/earthsdk3-cesium.umd.cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"cesium": "1.132",
|
|
40
|
-
"earthsdk3": "3.3.
|
|
40
|
+
"earthsdk3": "3.3.1",
|
|
41
41
|
"xbsj-base": "1.0.3"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium';
|
|
2
|
-
import { XbsjRoutePath } from './XbsjRoutePath';
|
|
3
|
-
import { SceneObjectKey } from 'xbsj-base';
|
|
4
|
-
|
|
5
|
-
export type XbsjPositionCallbackResultType = {
|
|
6
|
-
timeRatio: number;
|
|
7
|
-
repeat: number;
|
|
8
|
-
color: [number, number, number, number];
|
|
9
|
-
bgColor: [number, number, number, number];
|
|
10
|
-
bidirectional: 0 | 1 | 2 | 3; // 0/1表示单向,2表示双向, 3表示无信号
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type XbsjODLinesPostionCallback = (
|
|
14
|
-
instanceIndex: number,
|
|
15
|
-
frameState: Cesium.FrameState,
|
|
16
|
-
result: XbsjPositionCallbackResultType,
|
|
17
|
-
) => XbsjPositionCallbackResultType;
|
|
18
|
-
|
|
19
|
-
export default function xbsjCreateODLinesPrimitive(
|
|
20
|
-
routePaths: XbsjRoutePath[],
|
|
21
|
-
color: [number, number, number, number],
|
|
22
|
-
arcType: Cesium.ArcType,
|
|
23
|
-
postionCallback: (instanceIndex: number, frameState: Cesium.FrameState | undefined, result: XbsjPositionCallbackResultType) => XbsjPositionCallbackResultType,
|
|
24
|
-
brightening?: boolean,
|
|
25
|
-
depthTest?: boolean,
|
|
26
|
-
getTextureFunc?: () => Cesium.Texture,
|
|
27
|
-
id?: SceneObjectKey
|
|
28
|
-
): Cesium.Primitive;
|
|
29
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium';
|
|
2
|
-
|
|
3
|
-
export declare class XbsjCameraVideo {
|
|
4
|
-
constructor(options: {
|
|
5
|
-
inverseViewMatrix: Cesium.Matrix4,
|
|
6
|
-
frustum: Cesium.PerspectiveFrustum,
|
|
7
|
-
// videoElement: HTMLVideoElement | string | undefined,
|
|
8
|
-
videoTextureFunc?: (() => Cesium.Texture | undefined) | undefined,
|
|
9
|
-
alphaTextureFunc?: (() => Cesium.Texture | undefined) | undefined,
|
|
10
|
-
showHelperPrimitive: true,
|
|
11
|
-
});
|
|
12
|
-
// videoElement: HTMLVideoElement | string | undefined;
|
|
13
|
-
// alphaImage: string;
|
|
14
|
-
videoTextureFunc: (() => Cesium.Texture | undefined) | undefined;
|
|
15
|
-
alphaTextureFunc: (() => Cesium.Texture | undefined) | undefined;
|
|
16
|
-
showHelperPrimitive: boolean;
|
|
17
|
-
destroy(): void;
|
|
18
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium';
|
|
2
|
-
|
|
3
|
-
export declare class XbsjViewshed {
|
|
4
|
-
constructor(scene: Cesium.Scene, id?: string);
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
showHelper: boolean;
|
|
7
|
-
fovH: number;
|
|
8
|
-
fovV: number;
|
|
9
|
-
near: number;
|
|
10
|
-
far: number;
|
|
11
|
-
position: Cesium.Cartesian3;
|
|
12
|
-
heading: number;
|
|
13
|
-
pitch: number;
|
|
14
|
-
roll: number;
|
|
15
|
-
destroy(): void;
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium';
|
|
2
|
-
|
|
3
|
-
declare class SkyAtmosphere {
|
|
4
|
-
constructor(ellipsoid: Cesium.Ellipsoid | undefined, sources: {
|
|
5
|
-
positiveX: string;
|
|
6
|
-
negativeX: string;
|
|
7
|
-
positiveY: string;
|
|
8
|
-
negativeY: string;
|
|
9
|
-
positiveZ: string;
|
|
10
|
-
negativeZ: string;
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export = SkyAtmosphere;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium';
|
|
2
|
-
|
|
3
|
-
declare const GaussianSplatPipelineStage: {
|
|
4
|
-
name: string;
|
|
5
|
-
process: (
|
|
6
|
-
renderResources: any,
|
|
7
|
-
primitive: Cesium.Primitive,
|
|
8
|
-
frameState: Cesium.FrameState
|
|
9
|
-
) => void;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default GaussianSplatPipelineStage;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as Cesium from 'cesium';
|
|
2
|
-
declare const GaussianSplatTexturePipelineStage: {
|
|
3
|
-
name: string;
|
|
4
|
-
process: (
|
|
5
|
-
renderResources: any,
|
|
6
|
-
primitive: Cesium.Primitive,
|
|
7
|
-
frameState: Cesium.FrameState
|
|
8
|
-
) => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default GaussianSplatTexturePipelineStage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cesiumFixGoogleEarth(Cesium: any): void;
|
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
// cesium声明文件补充
|
|
2
|
-
// 注意此声明文件不全,用到哪儿写到哪儿
|
|
3
|
-
// vtxf 20211215
|
|
4
|
-
|
|
5
|
-
declare module 'cesium' {
|
|
6
|
-
interface Destroyable {
|
|
7
|
-
isDestroyed(): boolean;
|
|
8
|
-
destroy(): undefined;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface Context {
|
|
12
|
-
defaultTexture: Texture;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
type TextureOptions = {
|
|
17
|
-
context: Context;
|
|
18
|
-
pixelFormat?: number;
|
|
19
|
-
width: number;
|
|
20
|
-
height: number;
|
|
21
|
-
flipY?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const enum MipmapHint {
|
|
25
|
-
DONT_CARE = WebGLConstants.DONT_CARE,
|
|
26
|
-
FASTEST = WebGLConstants.FASTEST,
|
|
27
|
-
NICEST = WebGLConstants.NICEST,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface Texture extends Destroyable {
|
|
31
|
-
copyFrom(options: {
|
|
32
|
-
// arrayBufferView: ArrayBufferView,
|
|
33
|
-
// width: number;
|
|
34
|
-
// height: number;
|
|
35
|
-
source: {
|
|
36
|
-
width: number;
|
|
37
|
-
height: number;
|
|
38
|
-
arrayBufferView: ArrayBufferView;
|
|
39
|
-
} | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
|
|
40
|
-
xOffset?: number;
|
|
41
|
-
yOffset?: number;
|
|
42
|
-
skipColorSpaceConversion?: boolean; // false
|
|
43
|
-
}): void;
|
|
44
|
-
|
|
45
|
-
generateMipmap(hint: MipmapHint): void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
var Texture: {
|
|
49
|
-
prototype: Texture;
|
|
50
|
-
new(options: TextureOptions): Texture;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
interface Scene {
|
|
54
|
-
context: Context;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
interface AttributeLocations {
|
|
58
|
-
[k: string]: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const enum BufferUsage {
|
|
62
|
-
STREAM_DRAW = WebGLConstants.STREAM_DRAW,
|
|
63
|
-
STATIC_DRAW = WebGLConstants.STATIC_DRAW,
|
|
64
|
-
DYNAMIC_DRAW = WebGLConstants.DYNAMIC_DRAW,
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
interface VertexArrayOptions {
|
|
68
|
-
context: Context;
|
|
69
|
-
attributes: {
|
|
70
|
-
index: number,
|
|
71
|
-
vertexBuffer: Buffer,
|
|
72
|
-
componentsPerAttribute: number,
|
|
73
|
-
componentDatatype: ComponentDatatype,
|
|
74
|
-
normalize?: boolean, // false
|
|
75
|
-
}[];
|
|
76
|
-
attributeLocations: AttributeLocations;
|
|
77
|
-
bufferUsage: BufferUsage;
|
|
78
|
-
indexBuffer?: Buffer;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
namespace ComponentDatatype {
|
|
82
|
-
function createTypedArray(componentDatatype: ComponentDatatype, valuesOrLength: number | number[]): Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface VertexArray extends Destroyable {
|
|
86
|
-
isDestroyed(): boolean;
|
|
87
|
-
destroy(): undefined;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var VertexArray: {
|
|
91
|
-
prototype: VertexArray;
|
|
92
|
-
new(options: VertexArrayOptions): VertexArray;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// interface ShaderProgramOptions {
|
|
96
|
-
// gl: WebGLRenderingContext | WebGL2RenderingContext;
|
|
97
|
-
// // debugShaders: boolean;
|
|
98
|
-
// vertexShaderText: string;
|
|
99
|
-
// fragmentShaderText: string;
|
|
100
|
-
// attributeLocations: AttributeLocations;
|
|
101
|
-
// }
|
|
102
|
-
|
|
103
|
-
interface ShaderProgram extends Destroyable {
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// var ShaderProgram: {
|
|
108
|
-
// prototype: ShaderProgram;
|
|
109
|
-
// new(options: ShaderProgramOptions): ShaderProgram;
|
|
110
|
-
// }
|
|
111
|
-
|
|
112
|
-
interface ShaderSource {
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
var ShaderSource: {
|
|
117
|
-
prototype: ShaderSource;
|
|
118
|
-
new(options: {
|
|
119
|
-
defines?: string[];
|
|
120
|
-
sources: string[];
|
|
121
|
-
includeBuiltIns?: boolean;
|
|
122
|
-
}): ShaderSource;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
namespace ShaderProgram {
|
|
126
|
-
function fromCache(options: {
|
|
127
|
-
context: Context,
|
|
128
|
-
vertexShaderSource: ShaderSource,
|
|
129
|
-
fragmentShaderSource: ShaderSource,
|
|
130
|
-
attributeLocations: AttributeLocations,
|
|
131
|
-
}): ShaderProgram;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface UniformMap {
|
|
135
|
-
[k: string]: () => Texture | number | Cartesian2 | Cartesian3 | Cartesian4;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
interface RenderState {
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
interface RenderStateOptions {
|
|
143
|
-
frontFace?: WindingOrder, // WindingOrder.COUNTER_CLOCKWISE,
|
|
144
|
-
cull?: {
|
|
145
|
-
enabled?: boolean, // false
|
|
146
|
-
face?: CullFace, // CullFace.BACK
|
|
147
|
-
},
|
|
148
|
-
lineWidth?: number, // 1
|
|
149
|
-
polygonOffset?: {
|
|
150
|
-
enabled?: boolean, // false
|
|
151
|
-
factor?: number, // 0,
|
|
152
|
-
units?: number, // 0
|
|
153
|
-
},
|
|
154
|
-
scissorTest?: {
|
|
155
|
-
enabled?: boolean, // false,
|
|
156
|
-
rectangle?: {
|
|
157
|
-
x?: number, // 0,
|
|
158
|
-
y?: number, // 0,
|
|
159
|
-
width?: number, // 0,
|
|
160
|
-
height?: number, // 0
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
depthRange?: {
|
|
164
|
-
near?: number, // 0,
|
|
165
|
-
far?: number, // 1
|
|
166
|
-
},
|
|
167
|
-
depthTest?: {
|
|
168
|
-
enabled?: boolean; // false,
|
|
169
|
-
func?: DepthFunction; //DepthFunction.LESS
|
|
170
|
-
},
|
|
171
|
-
colorMask?: {
|
|
172
|
-
red?: boolean, // true,
|
|
173
|
-
green?: boolean, // true,
|
|
174
|
-
blue?: boolean, // true,
|
|
175
|
-
alpha?: boolean, // true
|
|
176
|
-
},
|
|
177
|
-
depthMask?: boolean, // true,
|
|
178
|
-
stencilMask?: number, // ~0
|
|
179
|
-
blending?: {
|
|
180
|
-
enabled?: boolean, // false,
|
|
181
|
-
color?: {
|
|
182
|
-
red?: number, // 0.0,
|
|
183
|
-
green?: number, // 0.0,
|
|
184
|
-
blue?: number, // 0.0,
|
|
185
|
-
alpha?: number, // 0.0
|
|
186
|
-
},
|
|
187
|
-
equationRgb?: BlendEquation, // BlendEquation.ADD,
|
|
188
|
-
equationAlpha?: BlendEquation, // BlendEquation.ADD,
|
|
189
|
-
functionSourceRgb?: BlendFunction, // BlendFunction.ONE,
|
|
190
|
-
functionSourceAlpha?: BlendFunction, // BlendFunction.ONE,
|
|
191
|
-
functionDestinationRgb?: BlendFunction, // BlendFunction.ZERO,
|
|
192
|
-
functionDestinationAlpha?: BlendFunction, // BlendFunction.ZERO
|
|
193
|
-
},
|
|
194
|
-
stencilTest?: {
|
|
195
|
-
enabled?: boolean, // false,
|
|
196
|
-
frontFunction?: StencilFunction, // StencilFunction.ALWAYS,
|
|
197
|
-
backFunction?: StencilFunction, // StencilFunction.ALWAYS,
|
|
198
|
-
reference?: number; // 0,
|
|
199
|
-
mask?: number; // ~0,
|
|
200
|
-
frontOperation?: {
|
|
201
|
-
fail?: StencilOperation, // StencilOperation.KEEP,
|
|
202
|
-
zFail?: StencilOperation, // StencilOperation.KEEP,
|
|
203
|
-
zPass?: StencilOperation, // StencilOperation.KEEP
|
|
204
|
-
},
|
|
205
|
-
backOperation?: {
|
|
206
|
-
fail?: StencilOperation, // StencilOperation.KEEP,
|
|
207
|
-
zFail?: StencilOperation, // StencilOperation.KEEP,
|
|
208
|
-
zPass?: StencilOperation, // StencilOperation.KEEP
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
sampleCoverage?: {
|
|
212
|
-
enabled?: boolean, // false,
|
|
213
|
-
value?: number, // 1.0,
|
|
214
|
-
invert?: boolean, // false
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
namespace RenderState {
|
|
219
|
-
function fromCache(options: RenderStateOptions): RenderState;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
namespace Appearance {
|
|
223
|
-
/**
|
|
224
|
-
*
|
|
225
|
-
* @param translucent 是否是透明的?透明对象的depthMask设为false,blending设为ALPHA_BLEND
|
|
226
|
-
* @param closed 是否为封闭体,如果是封闭体,会开启背面裁剪 cull { enabled: true, face: CullFace.BACK }
|
|
227
|
-
* @param existing 是否和一个已存在的RenderState进行合并,已存在的RenderState不做修改
|
|
228
|
-
*/
|
|
229
|
-
function getDefaultRenderState(translucent: boolean, closed: boolean, existing?: RenderStateOptions): RenderStateOptions;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const enum Pass {
|
|
234
|
-
ENVIRONMENT = 0,
|
|
235
|
-
COMPUTE = 1,
|
|
236
|
-
GLOBE = 2,
|
|
237
|
-
TERRAIN_CLASSIFICATION = 3,
|
|
238
|
-
CESIUM_3D_TILE = 4,
|
|
239
|
-
CESIUM_3D_TILE_CLASSIFICATION = 5,
|
|
240
|
-
CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW = 6,
|
|
241
|
-
OPAQUE = 7,
|
|
242
|
-
TRANSLUCENT = 8,
|
|
243
|
-
OVERLAY = 9,
|
|
244
|
-
NUMBER_OF_PASSES = 10,
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// interface DrawCommandOptions
|
|
248
|
-
|
|
249
|
-
interface PickId {
|
|
250
|
-
key: number;
|
|
251
|
-
color: Cesium.Color;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
interface DrawCommand {
|
|
255
|
-
boundingVolume: BoundingRectangle | BoundingSphere | OrientedBoundingBox | undefined;
|
|
256
|
-
orientedBoundingBox: OrientedBoundingBox | undefined;
|
|
257
|
-
cull: boolean; // deafult true
|
|
258
|
-
occlude: boolean; // default true
|
|
259
|
-
modelMatrix: Cesium.Matrix4 | undefined; // default undefined
|
|
260
|
-
primitiveType: PrimitiveType; // default TRIANGLES
|
|
261
|
-
vertexArray: VertexArray | undefined; // default undefined
|
|
262
|
-
count: number | undefined;
|
|
263
|
-
offset: number; // default 0
|
|
264
|
-
instanceCount: number; // default 0
|
|
265
|
-
shaderProgram: ShaderProgram | undefined; // default undefined
|
|
266
|
-
castShadows: boolean; // default false
|
|
267
|
-
receiveShadows: boolean; // default false
|
|
268
|
-
uniformMap: UniformMap | undefined; // default undefine
|
|
269
|
-
renderState: RenderState | undefined; // default undefined
|
|
270
|
-
// framebuffer: FrameB
|
|
271
|
-
pass: Pass | undefined; // default undefined
|
|
272
|
-
executeInClosestFrustum: boolean;
|
|
273
|
-
owner: Object | undefined;
|
|
274
|
-
debugShowBoundingVolume: boolean;
|
|
275
|
-
debugOverlappingFrustums: number;
|
|
276
|
-
pickId: string | undefined;
|
|
277
|
-
pickOnly: boolean;
|
|
278
|
-
depthForTranslucentClassification: boolean;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
var DrawCommand: {
|
|
282
|
-
prototype: DrawCommand;
|
|
283
|
-
new(options: {
|
|
284
|
-
// boundingVolume: BoundingVoluem;
|
|
285
|
-
cull?: boolean;
|
|
286
|
-
occlude?: boolean;
|
|
287
|
-
modelMatrix: Matrix4;
|
|
288
|
-
primitiveType?: PrimitiveType; // TRIANGLES
|
|
289
|
-
vertexArray: VertexArray;
|
|
290
|
-
count?: number;
|
|
291
|
-
offset?: number;
|
|
292
|
-
instanceCount?: number; // 0
|
|
293
|
-
shaderProgram: ShaderProgram;
|
|
294
|
-
uniformMap?: UniformMap;
|
|
295
|
-
renderState: RenderState;
|
|
296
|
-
// framebuffer: ;
|
|
297
|
-
pass: Pass;
|
|
298
|
-
executeInClosestFrustum: boolean;
|
|
299
|
-
owner?: any;
|
|
300
|
-
debugShowBoundingVolume?: boolean;
|
|
301
|
-
castShadows?: boolean; // false;
|
|
302
|
-
receiveShadows?: boolean; // false
|
|
303
|
-
pickId?: string;
|
|
304
|
-
pickOnly?: boolean; // false
|
|
305
|
-
depthForTranslucentClassification?: boolean; // false
|
|
306
|
-
boundingVolume?: BoundingRectangle | BoundingSphere | OrientedBoundingBox;
|
|
307
|
-
orientedBoundingBox?: OrientedBoundingBox;
|
|
308
|
-
}): DrawCommand;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
interface ShadowMap {
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
interface FrameState {
|
|
316
|
-
context: Context;
|
|
317
|
-
commandList: DrawCommand[];
|
|
318
|
-
shadowMaps: ShadowMap[];
|
|
319
|
-
// brdfLutGenerator
|
|
320
|
-
// environmentMap
|
|
321
|
-
// sphericalHarmonicCoefficients
|
|
322
|
-
// specularEnvironmentMaps
|
|
323
|
-
mode: SceneMode;
|
|
324
|
-
morphTime: number;
|
|
325
|
-
frameNumber: number; // 0
|
|
326
|
-
newFrame: boolean;
|
|
327
|
-
time: JulianDate;
|
|
328
|
-
// jobScheduler
|
|
329
|
-
// mapProjection
|
|
330
|
-
camera: Camera;
|
|
331
|
-
cameraUnderground: boolean;
|
|
332
|
-
// globeTranslucencyState
|
|
333
|
-
// cullingVolume
|
|
334
|
-
// occluder
|
|
335
|
-
maximumScreenSpaceError: number; // 2
|
|
336
|
-
pixelRatio: number; // 1.0
|
|
337
|
-
passes: {
|
|
338
|
-
render: boolean;
|
|
339
|
-
pick: boolean;
|
|
340
|
-
depth: boolean;
|
|
341
|
-
postProcess: boolean;
|
|
342
|
-
offscreen: boolean;
|
|
343
|
-
};
|
|
344
|
-
// creditDisplay
|
|
345
|
-
afterRender: (() => void)[];
|
|
346
|
-
scene3DOnly: boolean;
|
|
347
|
-
// fog: FrameState.Fog
|
|
348
|
-
terrainExaggeration: number; // 1.0
|
|
349
|
-
imagerySplitPosition: number;
|
|
350
|
-
// frustumSplits
|
|
351
|
-
// light
|
|
352
|
-
// minimumDisableDepthTestDistance
|
|
353
|
-
// invertClassification
|
|
354
|
-
useLogDepth: boolean;
|
|
355
|
-
// tilesetPassState
|
|
356
|
-
minimumTerrainHeight: number; // 0.0
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
interface Buffer {
|
|
360
|
-
copyFromArrayView(arrayView: ArrayBufferView, offsetInBytes?: number): void;
|
|
361
|
-
readonly sizeInBytes: number;
|
|
362
|
-
readonly usage: BufferUsage;
|
|
363
|
-
isDestroyed(): boolean;
|
|
364
|
-
destroy(): undefined;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// const enum IndexDatatype {
|
|
368
|
-
// /**
|
|
369
|
-
// * 8-bit unsigned byte corresponding to <code>UNSIGNED_BYTE</code> and the type
|
|
370
|
-
// * of an element in <code>Uint8Array</code>.
|
|
371
|
-
// */
|
|
372
|
-
// UNSIGNED_BYTE = WebGLConstants.UNSIGNED_BYTE,
|
|
373
|
-
// /**
|
|
374
|
-
// * 16-bit unsigned short corresponding to <code>UNSIGNED_SHORT</code> and the type
|
|
375
|
-
// * of an element in <code>Uint16Array</code>.
|
|
376
|
-
// */
|
|
377
|
-
// UNSIGNED_SHORT = WebGLConstants.UNSIGNED_SHORT,
|
|
378
|
-
// /**
|
|
379
|
-
// * 32-bit unsigned int corresponding to <code>UNSIGNED_INT</code> and the type
|
|
380
|
-
// * of an element in <code>Uint32Array</code>.
|
|
381
|
-
// */
|
|
382
|
-
// UNSIGNED_INT = WebGLConstants.UNSIGNED_INT
|
|
383
|
-
// }
|
|
384
|
-
|
|
385
|
-
interface IndexBuffer extends Buffer {
|
|
386
|
-
indexDatatype: IndexDatatype;
|
|
387
|
-
bytesPerIndex: number;
|
|
388
|
-
numberOfIndices: number;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
namespace Buffer {
|
|
392
|
-
function createVertexBuffer(options: {
|
|
393
|
-
context: Context;
|
|
394
|
-
typedArray: ArrayBufferView;
|
|
395
|
-
usage: BufferUsage;
|
|
396
|
-
}): Buffer;
|
|
397
|
-
|
|
398
|
-
function createIndexBuffer(options: {
|
|
399
|
-
context: Context;
|
|
400
|
-
typedArray: Uint8Array | Uint16Array | Uint32Array;
|
|
401
|
-
usage: BufferUsage;
|
|
402
|
-
indexDatatype: IndexDatatype;
|
|
403
|
-
}): IndexBuffer;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Feature, LineString, Properties } from "@turf/helpers";
|
|
2
|
-
/**
|
|
3
|
-
* Takes a {@link LineString|line} and returns a curved version
|
|
4
|
-
* by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline)
|
|
5
|
-
* algorithm.
|
|
6
|
-
*
|
|
7
|
-
* The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).
|
|
8
|
-
*
|
|
9
|
-
* @name bezierSpline
|
|
10
|
-
* @param {Feature<LineString>} line input LineString
|
|
11
|
-
* @param {Object} [options={}] Optional parameters
|
|
12
|
-
* @param {Object} [options.properties={}] Translate properties to output
|
|
13
|
-
* @param {number} [options.resolution=10000] time in milliseconds between points
|
|
14
|
-
* @param {number} [options.sharpness=0.85] a measure of how curvy the path should be between splines
|
|
15
|
-
* @returns {Feature<LineString>} curved line
|
|
16
|
-
* @example
|
|
17
|
-
* var line = turf.lineString([
|
|
18
|
-
* [-76.091308, 18.427501],
|
|
19
|
-
* [-76.695556, 18.729501],
|
|
20
|
-
* [-76.552734, 19.40443],
|
|
21
|
-
* [-74.61914, 19.134789],
|
|
22
|
-
* [-73.652343, 20.07657],
|
|
23
|
-
* [-73.157958, 20.210656]
|
|
24
|
-
* ]);
|
|
25
|
-
*
|
|
26
|
-
* var curved = turf.bezierSpline(line);
|
|
27
|
-
*
|
|
28
|
-
* //addToMap
|
|
29
|
-
* var addToMap = [line, curved]
|
|
30
|
-
* curved.properties = { stroke: '#0F0' };
|
|
31
|
-
*/
|
|
32
|
-
declare function bezier<P = Properties>(line: Feature<LineString> | LineString, options?: {
|
|
33
|
-
properties?: P;
|
|
34
|
-
resolution?: number;
|
|
35
|
-
sharpness?: number;
|
|
36
|
-
}): Feature<LineString, P>;
|
|
37
|
-
export default bezier;
|
package/dist/types/utils/generalUtils/geoPolylineToBezierSpline/bezierSpline/lib/spline.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export interface Point {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
z: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* BezierSpline
|
|
8
|
-
* https://github.com/leszekr/bezier-spline-js
|
|
9
|
-
*
|
|
10
|
-
* @private
|
|
11
|
-
* @copyright
|
|
12
|
-
* Copyright (c) 2013 Leszek Rybicki
|
|
13
|
-
*
|
|
14
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
-
* in the Software without restriction, including without limitation the rights
|
|
17
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
-
* furnished to do so, subject to the following conditions:
|
|
20
|
-
*
|
|
21
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
22
|
-
* copies or substantial portions of the Software.
|
|
23
|
-
*
|
|
24
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
-
* SOFTWARE.
|
|
31
|
-
*/
|
|
32
|
-
export default class Spline {
|
|
33
|
-
duration: number;
|
|
34
|
-
points: Point[];
|
|
35
|
-
sharpness: number;
|
|
36
|
-
centers: Point[];
|
|
37
|
-
controls: Array<[Point, Point]>;
|
|
38
|
-
stepLength: number;
|
|
39
|
-
length: number;
|
|
40
|
-
delay: number;
|
|
41
|
-
steps: number[];
|
|
42
|
-
constructor(options?: any);
|
|
43
|
-
/**
|
|
44
|
-
* Caches an array of equidistant (more or less) points on the curve.
|
|
45
|
-
*/
|
|
46
|
-
cacheSteps(mindist: number): number[];
|
|
47
|
-
/**
|
|
48
|
-
* returns angle and speed in the given point in the curve
|
|
49
|
-
*/
|
|
50
|
-
vector(t: number): {
|
|
51
|
-
angle: number;
|
|
52
|
-
speed: number;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Gets the position of the point, given time.
|
|
56
|
-
*
|
|
57
|
-
* WARNING: The speed is not constant. The time it takes between control points is constant.
|
|
58
|
-
*
|
|
59
|
-
* For constant speed, use Spline.steps[i];
|
|
60
|
-
*/
|
|
61
|
-
pos(time: number): Point;
|
|
62
|
-
}
|