earthsdk3-cesium 3.0.8-beta.8 → 3.2.0-beta.2
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/README.md +75 -2
- package/dist/earthsdk3-cesium.iife.js +4 -4
- package/dist/earthsdk3-cesium.js +7 -6
- package/dist/earthsdk3-cesium.umd.cjs +4 -4
- package/dist/types/CzmObjects/base/InnerClass/XbsjGroundPolylinePrimitive/GroundPolylinePrimitive.d.ts +148 -0
- package/dist/types/CzmObjects/general/CzmES3DTileset/index.d.ts.map +1 -1
- package/dist/types/CzmObjects/general/CzmESSignalTransmission/XbsjPolyline/XbsjPolylineGeometry.d.ts +3 -0
- package/dist/types/CzmObjects/general/CzmESSignalTransmission/XbsjPolyline/xbsjCreateODLinesPrimitive.d.ts +29 -0
- package/dist/types/CzmObjects/general/CzmESVideoFusion/XbsjCameraVideo/XbsjCameraVideo.d.ts +18 -0
- package/dist/types/CzmObjects/general/CzmESViewShed/XbsjViewshed/XbsjViewshed.d.ts +16 -0
- package/dist/types/ESCesiumViewer/BackGroundImage/BackGroundImage.d.ts +5 -0
- package/dist/types/ESCesiumViewer/LocalSkyBox/SkyAtmosphere.d.ts +14 -0
- package/dist/types/ESCesiumViewer/ViewerExtensions/TerrainManager.d.ts.map +1 -1
- package/dist/types/ESCesiumViewer/initCesiumViewer/GaussianSplattingExtend/GaussianSplatPipelineStage.d.ts +12 -0
- package/dist/types/ESCesiumViewer/initCesiumViewer/GaussianSplattingExtend/GaussianSplatTexturePipelineStage.d.ts +11 -0
- package/dist/types/ESCesiumViewer/initCesiumViewer/fixGoogleEarth/cesiumFixGoogleEarth.d.ts +1 -0
- package/dist/types/__declares/cesium.d.ts +405 -0
- package/dist/types/utils/czmUtils/todo/generateCartesianArc/czm/generateCartesianArc.d.ts +8 -0
- package/dist/types/utils/generalUtils/geoPolylineToBezierSpline/bezierSpline/index.d.ts +37 -0
- package/dist/types/utils/generalUtils/geoPolylineToBezierSpline/bezierSpline/lib/spline.d.ts +62 -0
- package/package.json +3 -4
|
@@ -735,7 +735,7 @@ void gaussianSplatStage(ProcessedAttributes attributes, inout vec4 positionClip)
|
|
|
735
735
|
`,sa={GAUSSIAN_SPLATS:11},Qy={name:"GaussianSplatPipelineStage"};Qy.process=function(t,i,e){const{shaderBuilder:n}=t,r=t.renderStateOptions;r.cull.enabled=!1,r.depthMask=!1,r.depthTest.enabled=!1,r.blending=re.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,t.alphaOptions.pass=sa.GAUSSIAN_SPLATS,n.addDefine("HAS_GAUSSIAN_SPLATS",void 0,re.ShaderDestination.BOTH),i.hasAttributeTexture&&n.addDefine("HAS_SPLAT_TEXTURE",void 0,re.ShaderDestination.BOTH),n.addAttribute("vec2","a_screenQuadPosition"),n.addAttribute("vec3","a_splatPosition"),n.addAttribute("vec4","a_splatColor"),n.addVarying("vec4","v_splatColor"),n.addVarying("vec2","v_vertPos"),n.addVarying("float","v_splatOpacity"),n.addVarying("vec4","v_splatScale"),n.addVarying("vec4","v_splatRot"),n.addUniform("float","u_tan_fovX",re.ShaderDestination.VERTEX),n.addUniform("float","u_tan_fovY",re.ShaderDestination.VERTEX),n.addUniform("float","u_focalX",re.ShaderDestination.VERTEX),n.addUniform("float","u_focalY",re.ShaderDestination.VERTEX),n.addUniform("float","u_splatScale",re.ShaderDestination.VERTEX),n.addUniform("mat4","u_scalingMatrix",re.ShaderDestination.VERTEX);const o=t.uniformMap,s=e.camera,a=e.context.drawingBufferWidth,l=e.context.drawingBufferHeight,h=Math.tan(s.frustum.fov*.5),u=Math.tan(s.frustum.fovy*.5),p=a/(h*2),f=l/(u*2);o.u_tan_fovX=function(){return h},o.u_tan_fovY=function(){return u},o.u_focalX=function(){return p},o.u_focalY=function(){return f},o.u_splatScale=function(){var g,y;return((y=(g=t.model)==null?void 0:g.style)==null?void 0:y.splatScale)??1},o.u_scalingMatrix=function(){return t.model.sceneGraph.components.nodes[0].matrix},(()=>{const g=new re.Matrix4,y=t.model.modelMatrix;re.Matrix4.multiply(s.viewMatrix,y,g);const P=re.ModelUtility.getAttributeBySemantic(i,oe.POSITION),S=re.ModelUtility.getAttributeBySemantic(i,oe.SCALE),C=re.ModelUtility.getAttributeBySemantic(i,oe.ROTATION),E=re.ModelUtility.getAttributeBySemantic(i,oe.COLOR),T=P.typedArray,I=S.typedArray,D=C.typedArray,R=E.typedArray,k=new T.constructor(T.length),O=new I.constructor(I.length),U=new D.constructor(D.length),z=new R.constructor(R.length),V=W=>T[W*3]*g[2]+T[W*3+1]*g[6]+T[W*3+2]*g[10],_=new Int32Array(t.count);let M=1/0;for(let W=0;W<t.count;W++){const $=V(W)*4096|0;_[W]=$,M=Math.min(M,$)}const F=-M;for(let W=0;W<t.count;W++)_[W]+=F;const N=new Uint32Array(t.count);for(let W=0;W<t.count;W++)N[W]=W;const H=new Int32Array(t.count),X=new Uint32Array(t.count);for(let W=0;W<32;W+=8){const $=new Uint32Array(256);for(let B=0;B<t.count;B++){const ce=_[B]>>W&255;$[ce]++}let Q=0;for(let B=0;B<256;B++){const ce=$[B];$[B]=Q,Q+=ce}for(let B=0;B<t.count;B++){const ce=_[B]>>W&255,we=$[ce]++;H[we]=_[B],X[we]=N[B]}_.set(H),N.set(X)}for(let W=0;W<t.count;W++){const $=N[W];k[W*3]=T[$*3],k[W*3+1]=T[$*3+1],k[W*3+2]=T[$*3+2],O[W*3]=I[$*3],O[W*3+1]=I[$*3+1],O[W*3+2]=I[$*3+2],U[W*4]=D[$*4],U[W*4+1]=D[$*4+1],U[W*4+2]=D[$*4+2],U[W*4+3]=D[$*4+3],z[W*4]=R[$*4],z[W*4+1]=R[$*4+1],z[W*4+2]=R[$*4+2],z[W*4+3]=R[$*4+3]}P.typedArray=k,S.typedArray=O,C.typedArray=U,E.typedArray=z})(),t.instanceCount=t.count,t.count=4,t.primitiveType=re.PrimitiveType.TRIANGLE_STRIP,n.addVertexLines(Yy),n.addFragmentLines(Zy)};const Ky={name:"GaussianSplatTexturePipelineStage"};Ky.process=function(t,i,e){const{shaderBuilder:n}=t,r=t.renderStateOptions;r.cull.enabled=!1,r.depthMask=!1,r.depthTest.enabled=!1,r.blending=re.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,t.alphaOptions.pass=sa.GAUSSIAN_SPLATS,n.addDefine("HAS_GAUSSIAN_SPLATS",void 0,re.ShaderDestination.BOTH),n.addDefine("HAS_SPLAT_TEXTURE",void 0,re.ShaderDestination.BOTH),t.model.content.tileset.debugShowBoundingVolume&&n.addDefine("DEBUG_BOUNDING_VOLUMES",void 0,re.ShaderDestination.BOTH),n.addAttribute("float","a_splatIndex"),n.addVarying("vec4","v_splatColor"),n.addVarying("vec2","v_vertPos"),n.addUniform("highp usampler2D","u_splatAttributeTexture",re.ShaderDestination.VERTEX),n.addUniform("float","u_splatScale",re.ShaderDestination.VERTEX);const o=t.uniformMap;o.u_splatScale=function(){var s,a;return((a=(s=t.model)==null?void 0:s.style)==null?void 0:a.splatScale)??1},o.u_splatAttributeTexture=function(){return i.gaussianSplatTexture},t.instanceCount=t.count,t.count=4,t.primitiveType=re.PrimitiveType.TRIANGLE_STRIP,n.addVertexLines(Yy),n.addFragmentLines(Zy)};function _I(){d.ModelRuntimePrimitive.prototype.configurePipeline=function(t){var U;const i=this.pipelineStages;i.length=0;const e=this.primitive,n=this.node,r=this.model,o=r.customShader,s=r.style,a=t.context.webgl2,h=t.mode!==d.SceneMode.SCENE3D&&!t.scene3DOnly&&r._projectTo2D,u=t.verticalExaggeration!==1&&r.hasVerticalExaggeration,p=d.defined(e.morphTargets)&&e.morphTargets.length>0,f=d.defined(n.skin),m=d.defined(o),y=!(m&&d.defined(o.fragmentShaderText))||o.mode!==d.CustomShaderMode.REPLACE_MATERIAL,P=d.ModelUtility.hasQuantizedAttributes(e.attributes),S=r.debugWireframe&&d.PrimitiveType.isTriangles(e.primitiveType)&&(r._enableDebugWireframe||a),C=r.pointCloudShading,E=d.defined(C)&&C.attenuation,T=d.defined(C)&&C.backFaceCulling,I=e.primitiveType===d.PrimitiveType.POINTS&&(d.defined(s)||E||T),D=r._enableShowOutline&&d.defined(e.outlineCoordinates),R=PI(r,n,e),k=d.defined(r.classificationType),O=(((U=r==null?void 0:r.style)==null?void 0:U.showGaussianSplatting)??r.showGaussianSplatting)&&((e==null?void 0:e.isGaussianSplatPrimitive)??!1);h&&i.push(d.SceneMode2DPipelineStage),i.push(d.GeometryPipelineStage),S&&i.push(d.WireframePipelineStage),k&&i.push(d.ClassificationPipelineStage),p&&i.push(d.MorphTargetsPipelineStage),f&&i.push(d.SkinningPipelineStage),I&&i.push(d.PointCloudStylingPipelineStage),P&&i.push(d.DequantizationPipelineStage),y&&i.push(d.MaterialPipelineStage),i.push(d.FeatureIdPipelineStage),i.push(d.MetadataPipelineStage),i.push(d.MetadataPickingPipelineStage),R.hasPropertyTable&&(i.push(d.SelectedFeatureIdPipelineStage),i.push(d.BatchTexturePipelineStage),i.push(d.CPUStylingPipelineStage)),u&&i.push(d.VerticalExaggerationPipelineStage),m&&i.push(d.CustomShaderPipelineStage),i.push(d.LightingPipelineStage),r.allowPicking&&i.push(d.PickingPipelineStage),D&&i.push(d.PrimitiveOutlinePipelineStage),i.push(d.AlphaPipelineStage),i.push(d.PrimitiveStatisticsPipelineStage),O&&(d.defined(e.needsGaussianSplatTexture)?e.needsGaussianSplatTexture===!1&&((e==null?void 0:e.hasGaussianSplatTexture)??!1)&&i.push(Ky):i.push(Qy))}}function PI(t,i,e){let n;return d.defined(i.instances)&&(n=d.ModelUtility.getFeatureIdsByLabel(i.instances.featureIds,t.instanceFeatureIdLabel),d.defined(n))?{hasFeatureIds:!0,hasPropertyTable:d.defined(n.propertyTableId)}:(n=d.ModelUtility.getFeatureIdsByLabel(e.featureIds,t.featureIdLabel),d.defined(n)?{hasFeatureIds:!0,hasPropertyTable:d.defined(n.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}const{defined:Jy,AttributeType:By}=d;function SI(){const t=d.ModelUtility.supportedExtensions;d.ModelUtility.supportedExtensions={...t,KHR_gaussian_splatting:!0},d.ModelUtility.getAttributeInfo=function(i){const e=i.semantic,n=i.setIndex;let r,o=!1;Jy(e)?(r=oe.getVariableName(e,n),o=!0):(r=i.name,r=r.replace(/^_/,""),r=r.toLowerCase());const s=/^color_\d+$/.test(r),a=i.type;let l=By.getGlslType(a);s&&(l="vec4");const h=Jy(i.quantization);let u;return h&&(u=s?"vec4":By.getGlslType(i.quantization.type)),{attribute:i,isQuantized:h,variableName:r,hasSemantic:o,glslType:l,quantizedGlslType:u}}}const{PrimitiveLoadPlan:jy,PrimitiveOutlineGenerator:EI,IndexDatatype:AI,ModelComponents:TI,ComponentDatatype:Or,AttributeType:e0,AttributeLoadPlan:MI,defined:II,BufferUsage:t0,Cartesian3:Ou,AttributeCompression:bI}=d;function DI(){Object.defineProperties(jy,{needGaussianSplats:{value:!1},generateGaussianSplatTexture:{value:!1}}),jy.prototype.postProcess=function(e){this.needsOutlines&&(RI(this),FI(this,e)),this.needsGaussianSplats&&(this.primitive.isGaussianSplatPrimitive=!0,i(this),this.generateGaussianSplatTexture&&this.attributePlans.forEach(n=>{t(n),this.primitive.needsGaussianSplatTexture=!0}))};function t(e){if(e.name==="_ROTATION"&&e.componentDatatype===Or.SHORT&&(e.typedArray=bI.dequantize(e.typedArray,Or.SHORT,e0.VEC4,e.count),e.componentDatatype=Or.FLOAT),e.name==="POSITION"&&e.componentDatatype===Or.UNSIGNED_SHORT){const n=Float32Array.from(e.typedArray,o=>o/e.max.x);e.typedArray=n,e.componentDatatype=Or.FLOAT,e.normalized=!1,e.constant=new Ou(0,0,0);const r=o=>{let s=1/0,a=-1/0,l=1/0,h=-1/0,u=1/0,p=-1/0;for(let f=0;f<o.length;f+=3){const m=o[f],g=o[f+1],y=o[f+2];s=Math.min(s,m),a=Math.max(a,m),l=Math.min(l,g),h=Math.max(h,g),u=Math.min(u,y),p=Math.max(p,y)}return[new Ou(s,l,u),new Ou(a,h,p)]};[e.min,e.max]=r(e.typedArray)}}function i(e,n){const r=e.attributePlans,o=r.length;for(let s=0;s<o;s++){const a=r[s];a.loadBuffer=!1,a.loadTypedArray=!0;const l=a.attribute;t(l)}}}function RI(t){const i=t.primitive,e=i.indices,n=i.attributes[0].count,r=new EI({triangleIndices:e.typedArray,outlineIndices:t.outlineIndices,originalVertexCount:n});e.typedArray=r.updatedTriangleIndices,e.indexDatatype=AI.fromTypedArray(e.typedArray);const o=xI(r.outlineCoordinates),s=new MI(o);s.loadBuffer=!0,s.loadTypedArray=!1,t.attributePlans.push(s),i.outlineCoordinates=s.attribute;const a=t.attributePlans,l=t.attributePlans.length;for(let h=0;h<l;h++){const u=a[h].attribute;u.typedArray=r.updateAttribute(u.typedArray)}}function xI(t){const i=new TI.Attribute;return i.name="_OUTLINE_COORDINATES",i.typedArray=t,i.componentDatatype=Or.FLOAT,i.type=e0.VEC3,i.normalized=!1,i.count=t.length/3,i}function FI(t,i){kI(t.attributePlans,i),II(t.indicesPlan)&&LI(t.indicesPlan,i)}function kI(t,i){const e=t.length;for(let n=0;n<e;n++){const r=t[n],o=r.attribute,s=o.typedArray;if(r.loadBuffer){const a=Buffer.createVertexBuffer({typedArray:s,context:i,usage:t0.STATIC_DRAW});a.vertexArrayDestroyable=!1,o.buffer=a}r.loadTypedArray||(o.typedArray=void 0)}}function LI(t,i){const e=t.indices;if(t.loadBuffer){const n=Buffer.createIndexBuffer({typedArray:e.typedArray,context:i,usage:t0.STATIC_DRAW,indexDatatype:e.indexDatatype});e.buffer=n,n.vertexArrayDestroyable=!1}t.loadTypedArray||(e.typedArray=void 0)}const{Scene:zI,defined:Se,SceneMode:aa,MapMode2D:OI,Cartesian3:_t,BoundingRectangle:i0,Cartographic:NI,Math:ah,Matrix4:Li,Transforms:VI,DebugCameraPrimitive:UI,Pass:Oe,ClearCommand:GI,EllipsoidGeometry:n0,Camera:o0,defaultValue:r0,PerspectiveFrustum:WI,PerspectiveOffCenterFrustum:HI,OrthographicFrustum:qI,OrthographicOffCenterFrustum:$I,mergeSort:lh,PerInstanceColorAppearance:Nu,BoxGeometry:s0,Primitive:XI,GeometryInstance:YI,GeometryPipeline:ZI,ColorGeometryInstanceAttribute:QI,SunPostProcess:KI,DerivedCommand:JI,Color:BI}=d,jI=new i0,eb=new _t,tb=new NI(Math.PI,ah.PI_OVER_TWO),ib=new _t,nb=new Li,ob=new Li,rb=new _t,sb=new _t;function ab(){zI.prototype.updateAndExecuteCommands=function(o,s){Eb(this,o,s),this._environmentState.useWebVR?n(this,o):this._frameState.mode!==aa.SCENE2D||this._mapMode2D===OI.ROTATE?i(!0,this,o):t(this,o)};function t(o,s){const{frameState:a,camera:l}=o,{uniformState:h}=o.context,u=s.viewport,p=i0.clone(u,jI);s.viewport=p;const f=tb,m=ib;o.mapProjection.project(f,m);const y=_t.clone(l.position,eb),P=Li.clone(l.transform,nb),S=l.frustum.clone();l._setTransform(Li.IDENTITY);const C=Li.computeViewportTransformation(p,0,1,ob),E=l.frustum.projectionMatrix,T=l.positionWC.y,I=_t.fromElements(ah.sign(T)*m.x-T,0,-l.positionWC.x,rb),D=VI.pointToGLWindowCoordinates(E,C,I,sb);D.x=Math.floor(D.x);const R=p.x,k=p.width;if(T===0||D.x<=R||D.x>=R+k)i(!0,o,s);else if(Math.abs(R+k*.5-D.x)<1)p.width=D.x-p.x,l.position.x*=ah.sign(l.position.x),l.frustum.right=0,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),i(!0,o,s),p.x=D.x,l.position.x=-l.position.x,l.frustum.right=-l.frustum.left,l.frustum.left=0,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),i(!1,o,s);else if(D.x>R+k*.5){p.width=D.x-R;const O=l.frustum.right;l.frustum.right=m.x-T,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),i(!0,o,s),p.x=D.x,p.width=R+k-D.x,l.position.x=-l.position.x,l.frustum.left=-l.frustum.right,l.frustum.right=O-l.frustum.right*2,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),i(!1,o,s)}else{p.x=D.x,p.width=R+k-D.x;const O=l.frustum.left;l.frustum.left=-m.x-T,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),i(!0,o,s),p.x=R,p.width=D.x-R,l.position.x=-l.position.x,l.frustum.right=-l.frustum.left,l.frustum.left=O-l.frustum.left*2,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),i(!1,o,s)}l._setTransform(P),_t.clone(y,l.position),l.frustum=S.clone(),s.viewport=u}function i(o,s,a){const l=s._view,{renderTranslucentDepthForPick:h}=s._environmentState;o||(s.frameState.commandList.length=0),u0(s),l.createPotentiallyVisibleSet(s),o&&(d0(s),h||h0(s)),r(s,a)}const e=new _t;function n(o,s){const a=o._view,l=a.camera,u=o._environmentState.renderTranslucentDepthForPick;u0(o),a.createPotentiallyVisibleSet(o),d0(o),u||h0(o);const p=s.viewport;p.x=0,p.y=0,p.width=p.width*.5;const f=o0.clone(l,o._cameraVR);f.frustum=l.frustum;const m=l.frustum.near,g=m*r0(o.focalLength,5),y=r0(o.eyeSeparation,g/30),P=_t.multiplyByScalar(f.right,y*.5,e);l.frustum.aspectRatio=p.width/p.height;const S=.5*y*m/g;_t.add(f.position,P,l.position),l.frustum.xOffset=S,r(o,s),p.x=p.width,_t.subtract(f.position,P,l.position),l.frustum.xOffset=-S,r(o,s),o0.clone(f,l)}function r(o,s){const{camera:a,context:l,frameState:h}=o,{uniformState:u}=l;u.updateCamera(a);const p=bb(a);p.near=a.frustum.near,p.far=a.frustum.far;const f=h.passes,m=f.pick||f.pickVoxel;m||yb(o,s);const{clearGlobeDepth:g,renderTranslucentDepthForPick:y,useDepthPlane:P,useGlobeDepthFramebuffer:S,useInvertClassification:C,usePostProcessSelected:E}=o._environmentState,{globeDepth:T,globeTranslucencyFramebuffer:I,sceneFramebuffer:D,frustumCommandsList:R}=o._view,k=R.length,O=o._globeTranslucencyState,U=o._depthClearCommand,z=o._stencilClearCommand,V=o._classificationStencilClearCommand,_=o._depthPlane,M=a.position.z;function F(H,X){u.updatePass(X);const W=H.commands[X],$=H.indices[X];for(let Q=0;Q<$;++Q)Si(W[Q],o,s);return $}function N(H,X){u.updatePass(X);const W=H.commands[X],$=H.indices[X];for(let Q=0;Q<$;++Q)c0(W[Q],o,s)}for(let H=0;H<k;++H){const X=k-H-1,W=R[X];o.mode===aa.SCENE2D?(a.position.z=M-W.near+1,p.far=Math.max(1,W.far-W.near),p.near=1,u.update(h),u.updateFrustum(p)):(p.near=X!==0?W.near*o.opaqueFrustumNearOffset:W.near,p.far=W.far,u.updateFrustum(p)),U.execute(l,s),l.stencilBuffer&&z.execute(l,s),O.translucent?(u.updatePass(Oe.GLOBE),O.executeGlobeCommands(W,Si,I,o,s)):F(W,Oe.GLOBE),S&&T.executeCopyDepth(l,s),y||(O.translucent?(u.updatePass(Oe.TERRAIN_CLASSIFICATION),O.executeGlobeClassificationCommands(W,Si,I,o,s)):F(W,Oe.TERRAIN_CLASSIFICATION)),g&&(U.execute(l,s),P&&_.execute(l,s));let $;if(!C||m||y)$=F(W,Oe.CESIUM_3D_TILE),$>0&&(S&&(T.prepareColorTextures(l,g),T.executeUpdateDepth(l,s,T.depthStencilTexture)),y||($=F(W,Oe.CESIUM_3D_TILE_CLASSIFICATION)));else{o._invertClassification.clear(l,s);const B=s.framebuffer;s.framebuffer=o._invertClassification._fbo.framebuffer,$=F(W,Oe.CESIUM_3D_TILE),S&&(o._invertClassification.prepareTextures(l),T.executeUpdateDepth(l,s,o._invertClassification._fbo.getDepthStencilTexture())),$=F(W,Oe.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),s.framebuffer=B,o._invertClassification.executeClassified(l,s),h.invertClassificationColor.alpha===1&&o._invertClassification.executeUnclassified(l,s),$>0&&l.stencilBuffer&&V.execute(l,s),$=F(W,Oe.CESIUM_3D_TILE_CLASSIFICATION)}if($>0&&l.stencilBuffer&&z.execute(l,s),fb(o,s,W),F(W,Oe.OPAQUE),vb(o,s,W),X!==0&&o.mode!==aa.SCENE2D&&(p.near=W.near,u.updateFrustum(p)),cb(o,s,W),lb(o,s,W),l.depthTexture&&o.useDepthPicking&&(S||y)){const B=o._picking.getPickDepth(o,X);B.update(l,T.depthStencilTexture),B.executeCopyDepth(l,s)}if(m||!E)continue;const Q=s.framebuffer;s.framebuffer=D.getIdFramebuffer(),p.near=X!==0?W.near*o.opaqueFrustumNearOffset:W.near,p.far=W.far,u.updateFrustum(p),O.translucent?(u.updatePass(Oe.GLOBE),O.executeGlobeCommands(W,c0,I,o,s)):N(W,Oe.GLOBE),g&&(U.framebuffer=s.framebuffer,U.execute(l,s),U.framebuffer=void 0),g&&P&&_.execute(l,s),N(W,Oe.CESIUM_3D_TILE),N(W,Oe.OPAQUE),N(W,Oe.TRANSLUCENT),s.framebuffer=Q}}}function lb(t,i,e){const{translucentTileClassification:n,globeDepth:r}=t._view;if(!(e.indices[Oe.CESIUM_3D_TILE_CLASSIFICATION]>0)||!n.isSupported())return;const s=e.commands[Oe.TRANSLUCENT];n.executeTranslucentCommands(t,Si,i,s,r.depthStencilTexture),n.executeClassificationCommands(t,Si,i,e)}function cb(t,i,e){const{frameState:n,context:r}=t,{pick:o,pickVoxel:s}=n.passes,a=o||s;let l;!a&&t._environmentState.useInvertClassification&&n.invertClassificationColor.alpha<1&&(l=t._invertClassification);const h=hb(t);r.uniformState.updatePass(Oe.TRANSLUCENT);const u=e.commands[Oe.TRANSLUCENT];u.length=e.indices[Oe.TRANSLUCENT],h(t,Si,i,u,l)}function hb(t){if(t._environmentState.useOIT){if(!Se(t._executeOITFunction)){const{view:i,context:e}=t;t._executeOITFunction=function(n,r,o,s,a){i.globeDepth.prepareColorTextures(e),i.oit.executeCommands(n,r,o,s,a)}}return t._executeOITFunction}return t.frameState.passes.render?db:pb}function a0(t,i,e){return i.boundingVolume.distanceSquaredTo(e)-t.boundingVolume.distanceSquaredTo(e)}function db(t,i,e,n,r){lh(n,a0,t.camera.positionWC),Se(r)&&i(r.unclassifiedCommand,t,e);for(let o=0;o<n.length;++o)i(n[o],t,e)}function ub(t,i,e){return t.boundingVolume.distanceSquaredTo(e)-i.boundingVolume.distanceSquaredTo(e)+ah.EPSILON12}function pb(t,i,e,n,r){lh(n,ub,t.camera.positionWC),Se(r)&&i(r.unclassifiedCommand,t,e);for(let o=0;o<n.length;++o)i(n[o],t,e)}function fb(t,i,e){t.context.uniformState.updatePass(Oe.VOXELS);const n=e.commands[Oe.VOXELS];n.length=e.indices[Oe.VOXELS],lh(n,a0,t.camera.positionWC);for(let r=0;r<n.length;++r)Si(n[r],t,i)}const mb=new _t;function l0(t,i){const e=_t.subtract(t,i,mb),n=Math.max(0,_t.magnitude(e));return n*n}function gb(t,i,e){const n=t.boundingVolume,r=i.boundingVolume;return l0(r.center,e)-l0(n.center,e)}function vb(t,i,e){t.context.uniformState.updatePass(sa.GAUSSIAN_SPLATS);const n=e.commands[sa.GAUSSIAN_SPLATS];n.length=e.indices[sa.GAUSSIAN_SPLATS],lh(n,gb,t.camera.positionWC);for(let r=0;r<n.length;++r)Si(n[r],t,i)}function c0(t,i,e){const{derivedCommands:n}=t;if(!Se(n))return;const r=i._frameState,o=i._context;r.useLogDepth&&Se(n.logDepth)&&(t=n.logDepth.command);const{picking:s,pickingMetadata:a,depth:l}=t.derivedCommands;Se(a)&&(t=n.pickingMetadata.pickMetadataCommand,t.execute(o,e)),Se(s)?(t=s.pickCommand,t.execute(o,e)):Se(l)&&(t=l.depthOnlyCommand,t.execute(o,e))}function yb(t,i){const{context:e,environmentState:n,view:r}=t;if(e.uniformState.updatePass(Oe.ENVIRONMENT),Se(n.skyBoxCommand)&&Si(n.skyBoxCommand,t,i),n.isSkyAtmosphereVisible&&Si(n.skyAtmosphereCommand,t,i),n.isSunVisible&&(n.sunDrawCommand.execute(e,i),t.sunBloom&&!n.useWebVR)){let o;n.useGlobeDepthFramebuffer?o=r.globeDepth.framebuffer:n.usePostProcess?o=r.sceneFramebuffer.framebuffer:o=n.originalFramebuffer,t._sunPostProcess.execute(e),t._sunPostProcess.copy(e,o),i.framebuffer=o}n.isMoonVisible&&n.moonCommand.execute(e,i)}function wb(t,i,e){const{shadowMapCullingVolume:n,isPointLight:r,passes:o}=e,s=o.length,a=[Oe.GLOBE,Oe.CESIUM_3D_TILE,Oe.OPAQUE,Oe.TRANSLUCENT];for(let l=0;l<i.length;++l){const h=i[l];if(t.updateDerivedCommands(h),!(!h.castShadows||a.indexOf(h.pass)<0||!t.isVisible(n,h)))if(r)for(let u=0;u<s;++u)o[u].commandList.push(h);else if(s===1)o[0].commandList.push(h);else{let u=!1;for(let p=s-1;p>=0;--p){const f=o[p].cullingVolume;if(t.isVisible(f,h))o[p].commandList.push(h),u=!0;else if(u)break}}}}function h0(t){const{shadowState:i,commandList:e}=t.frameState,{shadowsEnabled:n,shadowMaps:r}=i;if(!n)return;const{context:o}=t,{uniformState:s}=o;for(let a=0;a<r.length;++a){const l=r[a];if(l.outOfView)continue;const{passes:h}=l;for(let u=0;u<h.length;++u)h[u].commandList.length=0;wb(t,e,l);for(let u=0;u<h.length;++u){const p=l.passes[u],{camera:f,commandList:m}=p;s.updateCamera(f),l.updatePass(o,u);for(let g=0;g<m.length;++g){const y=m[g];s.updatePass(y.pass);const P=y.derivedCommands.shadows.castCommands[a];Si(P,t,p.passState)}}}}function Si(t,i,e,n){const r=i._frameState,o=i._context;if(Se(i.debugCommandFilter)&&!i.debugCommandFilter(t))return;if(t instanceof GI){t.execute(o,e);return}t.debugShowBoundingVolume&&Se(t.boundingVolume)&&_b(t,i,e,n),r.useLogDepth&&Se(t.derivedCommands.logDepth)&&(t=t.derivedCommands.logDepth.command);const s=r.passes;if(!s.pick&&!s.pickVoxel&&!s.depth&&i._hdr&&Se(t.derivedCommands)&&Se(t.derivedCommands.hdr)&&(t=t.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth){if(r.pickingMetadata&&Se(t.derivedCommands.pickingMetadata)){t=t.derivedCommands.pickingMetadata.pickMetadataCommand,t.execute(o,e);return}if(!r.pickingMetadata&&Se(t.derivedCommands.picking)){t=t.derivedCommands.picking.pickCommand,t.execute(o,e);return}}else if(Se(t.derivedCommands.depth)){t=t.derivedCommands.depth.depthOnlyCommand,t.execute(o,e);return}}if(i.debugShowCommands||i.debugShowFrustums){i._debugInspector.executeDebugShowFrustumsCommand(i,t,e);return}r.shadowState.lightShadowsEnabled&&t.receiveShadows&&Se(t.derivedCommands.shadows)?t.derivedCommands.shadows.receiveCommand.execute(o,e):t.execute(o,e)}let Cb=new Li(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function _b(t,i,e,n){const r=i._frameState,o=r.context,s=t.boundingVolume;Se(i._debugVolume)&&i._debugVolume.destroy();let a=_t.clone(s.center);if(r.mode!==aa.SCENE3D){a=Li.multiplyByPoint(Cb,a,a);const g=r.mapProjection,y=g.unproject(a);a=g.ellipsoid.cartographicToCartesian(y)}let l,h;const{radius:u}=s;Se(u)?(l=n0.createGeometry(new n0({radii:new _t(u,u,u),vertexFormat:Nu.FLAT_VERTEX_FORMAT})),h=Li.fromTranslation(a)):(l=s0.createGeometry(s0.fromDimensions({dimensions:new _t(2,2,2),vertexFormat:Nu.FLAT_VERTEX_FORMAT})),h=Li.fromRotationTranslation(s.halfAxes,a,new Li)),i._debugVolume=new XI({geometryInstances:new YI({geometry:ZI.toWireframe(l),modelMatrix:h,attributes:{color:new QI(1,0,0,1)}}),appearance:new Nu({flat:!0,translucent:!1}),asynchronous:!1});const p=r.commandList,f=r.commandList=[];i._debugVolume.update(r),t=f[0],r.useLogDepth&&(t=JI.createLogDepthCommand(t,o).command);let m;Se(n)&&(m=e.framebuffer,e.framebuffer=n),t.execute(o,e),Se(m)&&(e.framebuffer=m),r.commandList=p}function d0(t){t.context.uniformState.updatePass(Oe.COMPUTE);const i=t._environmentState.sunComputeCommand;Se(i)&&i.execute(t._computeEngine);const e=t._computeCommandList;for(let n=0;n<e.length;++n)e[n].execute(t._computeEngine)}function u0(t){const i=t._frameState;t._groundPrimitives.update(i),t._primitives.update(i),Pb(t),Sb(t),t._globe&&t._globe.render(i)}function Pb(t){const i=t._frameState;t.debugShowFrustumPlanes!==t._debugShowFrustumPlanes&&(t.debugShowFrustumPlanes?t._debugFrustumPlanes=new UI({camera:t.camera,updateOnChange:!1,frustumSplits:i.frustumSplits}):t._debugFrustumPlanes=t._debugFrustumPlanes&&t._debugFrustumPlanes.destroy(),t._debugShowFrustumPlanes=t.debugShowFrustumPlanes),Se(t._debugFrustumPlanes)&&t._debugFrustumPlanes.update(i)}function Sb(t){const i=t._frameState,{passes:e,shadowState:n,shadowMaps:r}=i,o=r.length,s=o>0&&!e.pick&&!e.pickVoxel&&t.mode===aa.SCENE3D;if(s!==n.shadowsEnabled&&(++n.lastDirtyTime,n.shadowsEnabled=s),n.lightShadowsEnabled=!1,!!s){for(let a=0;a<o;++a)if(r[a]!==n.shadowMaps[a]){++n.lastDirtyTime;break}n.shadowMaps.length=0,n.lightShadowMaps.length=0;for(let a=0;a<o;++a){const l=r[a];l.update(i),n.shadowMaps.push(l),l.fromLightSource&&(n.lightShadowMaps.push(l),n.lightShadowsEnabled=!0),l.dirty&&(++n.lastDirtyTime,l.dirty=!1)}}}function Eb(t,i,e){const n=t._context,r=t._frameState,o=t._environmentState,s=t._view,a=r.passes,l=a.pick||a.pickVoxel;Se(s.globeDepth)&&(s.globeDepth.picking=l);const h=o.useWebVR;o.originalFramebuffer=i.framebuffer,Se(t.sun)&&t.sunBloom!==t._sunBloom?(t.sunBloom&&!h?t._sunPostProcess=new KI:Se(t._sunPostProcess)&&(t._sunPostProcess=t._sunPostProcess.destroy()),t._sunBloom=t.sunBloom):!Se(t.sun)&&Se(t._sunPostProcess)&&(t._sunPostProcess=t._sunPostProcess.destroy(),t._sunBloom=!1);const u=t._clearColorCommand;BI.clone(e,u.color),u.execute(n,i);const p=o.useGlobeDepthFramebuffer=Se(s.globeDepth);p&&(s.globeDepth.update(n,i,s.viewport,t.msaaSamples,t._hdr,o.clearGlobeDepth),s.globeDepth.clear(n,i,e));const f=s.oit,m=o.useOIT=!l&&Se(f)&&f.isSupported();m&&(f.update(n,i,s.globeDepth.colorFramebufferManager,t._hdr,t.msaaSamples),f.clear(n,i,e),o.useOIT=f.isSupported());const g=t.postProcessStages;let y=o.usePostProcess=!l&&(t._hdr||g.length>0||g.ambientOcclusion.enabled||g.fxaa.enabled||g.bloom.enabled);if(o.usePostProcessSelected=!1,y&&(s.sceneFramebuffer.update(n,s.viewport,t._hdr,t.msaaSamples),s.sceneFramebuffer.clear(n,i,e),g.update(n,r.useLogDepth,t._hdr),g.clear(n),y=o.usePostProcess=g.ready,o.usePostProcessSelected=y&&g.hasSelected),o.isSunVisible&&t.sunBloom&&!h?(i.framebuffer=t._sunPostProcess.update(i),t._sunPostProcess.clear(n,i,e)):p?i.framebuffer=s.globeDepth.framebuffer:y&&(i.framebuffer=s.sceneFramebuffer.framebuffer),Se(i.framebuffer)&&u.execute(n,i),o.useInvertClassification=!l&&Se(i.framebuffer)&&t.invertClassification){let S;if(r.invertClassificationColor.alpha===1&&p&&(S=s.globeDepth.framebuffer),Se(S)||n.depthTexture){if(t._invertClassification.previousFramebuffer=S,t._invertClassification.update(n,t.msaaSamples,s.globeDepth.colorFramebufferManager),t._invertClassification.clear(n,i),r.invertClassificationColor.alpha<1&&m){const C=t._invertClassification.unclassifiedCommand,E=C.derivedCommands;E.oit=f.createDerivedCommands(C,n,E.oit)}}else o.useInvertClassification=!1}t._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(t._hdr,s.viewport,n,i)}const Ab=new WI,Tb=new HI,Mb=new qI,Ib=new $I;function bb(t){const{frustum:i}=t;return Se(i.fov)?i.clone(Ab):Se(i.infiniteProjectionMatrix)?i.clone(Tb):Se(i.width)?i.clone(Mb):i.clone(Ib)}class Db{constructor(i,e,n,r){v(this,"name");v(this,"value");v(this,"_gl");v(this,"_location");v(this,"textureUnitIndex");v(this,"_setSampler",i=>(this.textureUnitIndex=i,this._gl.uniform1i(this._location,i),i+1));v(this,"set",()=>{const i=this._gl;i.activeTexture(i.TEXTURE0+this.textureUnitIndex);const e=this.value;i.bindTexture(e._target,e._texture)});this.uniformName=n,this._gl=i,this.name=n,this._location=r}}class Rb{constructor(i,e,n,r){v(this,"name");v(this,"value");v(this,"_value");v(this,"_gl");v(this,"_locations");v(this,"textureUnitIndex");v(this,"_setSampler",i=>{this.textureUnitIndex=i;const e=this._locations,n=e.length;for(let r=0;r<n;++r){const o=i+r;this._gl.uniform1i(e[r],o)}return i+n});v(this,"set",()=>{const i=this._gl,e=i.TEXTURE0+this.textureUnitIndex,n=this.value,r=n.length;for(let o=0;o<r;++o){const s=n[o];i.activeTexture(e+o),i.bindTexture(s._target,s._texture)}});this.uniformName=n;const o=r.length;this._gl=i,this.value=new Array(o),this._value=new Float32Array(o),this.name=n,this._locations=r,this.textureUnitIndex=void 0}}const{defined:un,RuntimeError:xb,AutomaticUniforms:Fb,createUniform:kb,createUniformArray:Lb}=d;function zb(){Object.defineProperties(d.ShaderProgram,{fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return ch(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return ch(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return ch(this),this._uniformsByName}}}),d.ShaderProgram.prototype._bind=function(){ch(this),this._gl.useProgram(this._program)}}function ch(t){un(t._program)||p0(t)}function p0(t){const i=t._program,e=t._gl,n=Ob(e,t,t._debugShaders),r=e.getProgramParameter(n,e.ACTIVE_ATTRIBUTES),o=Nb(e,n),s=Vb(t,o.uniformsByName);t._program=n,t._numberOfVertexAttributes=r,t._vertexAttributes=Ub(e,n,r),t._uniformsByName=o.uniformsByName,t._uniforms=o.uniforms,t._automaticUniforms=s.automaticUniforms,t._manualUniforms=s.manualUniforms,t.maximumTextureUnitIndex=Gb(e,n,o.samplerUniforms),i&&t._gl.deleteProgram(i),typeof spector<"u"&&(t._program.__SPECTOR_rebuildProgram=function(a,l,h,u){const p=t._vertexShaderText,f=t._fragmentShaderText,m=/ ! = /g;t._vertexShaderText=a.replace(m," != "),t._fragmentShaderText=l.replace(m," != ");try{p0(t),h(t._program)}catch(g){t._vertexShaderText=p,t._fragmentShaderText=f;const P=/(?:Compile|Link) error: ([^]*)/.exec(g.message);u(P?P[1]:g.message)}})}const zi="[Cesium WebGL] ";function Ob(t,i){const e=i._vertexShaderText,n=i._fragmentShaderText,r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,n),t.compileShader(o);const s=t.createProgram();t.attachShader(s,r),t.attachShader(s,o);const a=i._attributeLocations;if(un(a))for(const f in a)a.hasOwnProperty(f)&&t.bindAttribLocation(s,a[f],f);t.linkProgram(s);let l;if(t.getProgramParameter(s,t.LINK_STATUS))return i._logShaderCompilation&&(l=t.getShaderInfoLog(r),un(l)&&l.length>0&&console.log(`${zi}Vertex shader compile log: ${l}`),l=t.getShaderInfoLog(o),un(l)&&l.length>0&&console.log(`${zi}Fragment shader compile log: ${l}`),l=t.getProgramInfoLog(s),un(l)&&l.length>0&&console.log(`${zi}Shader program link log: ${l}`)),t.deleteShader(r),t.deleteShader(o),s;let h;const u=i._debugShaders;throw t.getShaderParameter(o,t.COMPILE_STATUS)?t.getShaderParameter(r,t.COMPILE_STATUS)?(l=t.getProgramInfoLog(s),console.error(`${zi}Shader program link log: ${l}`),p(r,"vertex"),p(o,"fragment"),h=`Program failed to link. Link log: ${l}`):(l=t.getShaderInfoLog(r),console.error(`${zi}Vertex shader compile log: ${l}`),console.error(`${zi} Vertex shader source:
|
|
736
736
|
${e}`),h=`Vertex shader failed to compile. Compile log: ${l}`):(l=t.getShaderInfoLog(o),console.error(`${zi}Fragment shader compile log: ${l}`),console.error(`${zi} Fragment shader source:
|
|
737
737
|
${n}`),h=`Fragment shader failed to compile. Compile log: ${l}`),t.deleteShader(r),t.deleteShader(o),t.deleteProgram(s),new xb(h);function p(f,m){if(!un(u))return;const g=u.getTranslatedShaderSource(f);if(g===""){console.error(`${zi}${m} shader translation failed.`);return}console.error(`${zi}Translated ${m} shaderSource:
|
|
738
|
-
${g}`)}}function Nb(t,i){const e={},n=[],r=[],o=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<o;++s){const a=t.getActiveUniform(i,s),l="[0]",h=a.name.indexOf(l,a.name.length-l.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(h.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){const u=t.getUniformLocation(i,h);if(u!==null){const p=a.type!=t.UNSIGNED_INT_SAMPLER_2D?kb(t,a,h,u):new Db(t,a,h,u);e[h]=p,n.push(p),p._setSampler&&r.push(p)}}else{let u,p,f,m;const g=h.indexOf("[");if(g>=0){if(u=e[h.slice(0,g)],!un(u))continue;p=u._locations,p.length<=1&&(f=u.value,m=t.getUniformLocation(i,h),m!==null&&(p.push(m),f.push(t.getUniform(i,m))))}else{p=[];for(let y=0;y<a.size;++y)m=t.getUniformLocation(i,`${h}[${y}]`),m!==null&&p.push(m);u=a.type!=t.UNSIGNED_INT_SAMPLER_2D?Lb(t,a,h,p):new Rb(t,a,h,p),e[h]=u,n.push(u),u._setSampler&&r.push(u)}}}return{uniformsByName:e,uniforms:n,samplerUniforms:r}}function Vb(t,i){const e=[],n=[];for(const r in i)if(i.hasOwnProperty(r)){const o=i[r];let s=r;const a=t._duplicateUniformNames[s];un(a)&&(o.name=a,s=a);const l=Fb[s];un(l)?e.push({uniform:o,automaticUniform:l}):n.push(o)}return{automaticUniforms:e,manualUniforms:n}}function Ub(t,i,e){const n={};for(let r=0;r<e;++r){const o=t.getActiveAttrib(i,r),s=t.getAttribLocation(i,o.name);n[o.name]={name:o.name,type:o.type,index:s}}return n}function Gb(t,i,e){t.useProgram(i);let n=0;const r=e.length;for(let o=0;o<r;++o)n=e[o]._setSampler(n);return t.useProgram(null),n}const{defaultValue:qn,BufferUsage:Wb,defined:Oi,ComponentDatatype:ii,Geometry:Hb,Math:qb,IndexDatatype:f0,VertexArray:$b,RuntimeError:Xb,Buffer:la,AttributeType:Yb}=d;function Zb(){d.VertexArray.fromGeometry=function(t){t=qn(t,qn.EMPTY_OBJECT),d.Check.defined("options.context",t.context);const i=t.context,e=qn(t.geometry,qn.EMPTY_OBJECT),n=qn(t.bufferUsage,Wb.DYNAMIC_DRAW),r=qn(t.attributeLocations,qn.EMPTY_OBJECT),o=qn(t.interleave,!1),s=t.vertexArrayAttributes;let a,l,h;const u=Oi(s)?s:[],p=e.attributes;if(o){const g=Qb(p);if(Oi(g)){h=la.createVertexBuffer({context:i,typedArray:g.buffer,usage:n});const y=g.offsetsInBytes,P=g.vertexSizeInBytes;for(a in p)p.hasOwnProperty(a)&&Oi(p[a])&&(l=p[a],Oi(l.values)?u.push({index:r[a],vertexBuffer:h,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize,offsetInBytes:y[a],strideInBytes:P}):u.push({index:r[a],value:l.value,componentDatatype:l.componentDatatype,normalize:l.normalize}))}}else for(a in p)if(p.hasOwnProperty(a)&&Oi(p[a])){l=p[a];let g=l.componentDatatype;g===ii.DOUBLE&&(g=ii.FLOAT);let y={};h=void 0,Oi(l.values)&&(h=la.createVertexBuffer({context:i,typedArray:ii.createTypedArray(g,l.values),usage:n}),y={index:r[a],vertexBuffer:h,value:l.value,componentDatatype:g,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize}),Oi(l.typedArray)&&(h=la.createVertexBuffer({context:i,typedArray:l.typedArray,usage:n}),y={index:r[a],vertexBuffer:h,value:void 0,componentDatatype:g,componentsPerAttribute:Yb.getNumberOfComponents(l.type),normalize:l.normalized,instanceDivisor:l.instanceDivisor}),u.push(y)}let f;const m=e.indices;return Oi(m)&&(Hb.computeNumberOfVertices(e)>=qb.SIXTY_FOUR_KILOBYTES&&i.elementIndexUint?f=la.createIndexBuffer({context:i,typedArray:new Uint32Array(m),usage:n,indexDatatype:f0.UNSIGNED_INT}):f=la.createIndexBuffer({context:i,typedArray:new Uint16Array(m),usage:n,indexDatatype:f0.UNSIGNED_SHORT})),new $b({context:i,attributes:u,indexBuffer:f})}}function Qb(t){let i,e,n;const r=[];for(e in t)t.hasOwnProperty(e)&&Oi(t[e])&&Oi(t[e].values)&&(r.push(e),t[e].componentDatatype===ii.DOUBLE&&(t[e].componentDatatype=ii.FLOAT,t[e].values=ii.createTypedArray(ii.FLOAT,t[e].values)));let o;const s=r.length;if(s>0)for(o=m0(t[r[0]]),i=1;i<s;++i){const h=m0(t[r[i]]);if(h!==o)throw new Xb(`Each attribute list must have the same number of vertices. Attribute ${r[i]} has a different number of vertices (${h.toString()}) than attribute ${r[0]} (${o.toString()}).`)}r.sort(function(h,u){return ii.getSizeInBytes(t[u].componentDatatype)-ii.getSizeInBytes(t[h].componentDatatype)});let a=0;const l={};for(i=0;i<s;++i)e=r[i],n=t[e],l[e]=a,a+=Kb(n);if(a>0){const h=ii.getSizeInBytes(t[r[0]].componentDatatype),u=a%h;u!==0&&(a+=h-u);const p=o*a,f=new ArrayBuffer(p),m={};for(i=0;i<s;++i){e=r[i];const g=ii.getSizeInBytes(t[e].componentDatatype);m[e]={pointer:ii.createTypedArray(t[e].componentDatatype,f),index:l[e]/g,strideInComponentType:a/g}}for(i=0;i<o;++i)for(let g=0;g<s;++g){e=r[g],n=t[e];const y=n.values,P=m[e],S=P.pointer,C=n.componentsPerAttribute;for(let E=0;E<C;++E)S[P.index+E]=y[i*C+E];P.index+=P.strideInComponentType}return{buffer:f,offsetsInBytes:l,vertexSizeInBytes:a}}}function m0(t){return t.values.length/t.componentsPerAttribute}function Kb(t){return ii.getSizeInBytes(t.componentDatatype)*t.componentsPerAttribute}const{defaultValue:g0}=d;class Jb extends d.FrustumCommands{constructor(i,e){super(i,e),this.near=g0(i,0),this.far=g0(e,0);const n=12,r=new Array(n),o=new Array(n);for(let s=0;s<n;++s)r[s]=[],o[s]=0;this.commands=r,this.indices=o}}const{SceneMode:v0,CullingVolume:Bb,Interval:jb,Pass:hh,defined:ca,ShadowMap:eD,Math:tD,ClearCommand:iD}=d,y0=new Bb,nD=new jb;function oD(){d.View.prototype.createPotentiallyVisibleSet=function(t){const{frameState:i}=t,{camera:e,commandList:n,shadowState:r}=i,{positionWC:o,directionWC:s,frustum:a}=e,l=t._computeCommandList,h=t._overlayCommandList;t.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const u=this.frustumCommandsList;for(let O=0;O<u.length;++O)for(let U=0;U<12;++U)u[O].indices[U]=0;l.length=0,h.length=0;const p=this._commandExtents,f=p.length;let m=0,g=+Number.MAX_VALUE,y=-Number.MAX_VALUE;const{shadowsEnabled:P}=r;let S=+Number.MAX_VALUE,C=-Number.MAX_VALUE,E=Number.MAX_VALUE;const T=i.mode===v0.SCENE3D?i.occluder:void 0;let{cullingVolume:I}=i;const D=y0.planes;for(let O=0;O<5;++O)D[O]=I.planes[O];I=y0;for(let O=0;O<n.length;++O){const U=n[O],{pass:z,boundingVolume:V}=U;if(z===hh.COMPUTE)l.push(U);else if(z===hh.OVERLAY)h.push(U);else{let _,M;if(ca(V)){if(!t.isVisible(I,U,T))continue;const N=V.computePlaneDistances(o,s,nD);if(_=N.start,M=N.stop,g=Math.min(g,_),y=Math.max(y,M),P&&U.receiveShadows&&_<eD.MAXIMUM_DISTANCE&&!(z===hh.GLOBE&&_<-100&&M>100)){const H=M-_;z!==hh.GLOBE&&_<100&&(E=Math.min(E,H)),S=Math.min(S,_),C=Math.max(C,M)}}else U instanceof iD?(_=a.near,M=a.far):(_=a.near,M=a.far,g=Math.min(g,_),y=Math.max(y,M));let F=p[m];ca(F)||(F=p[m]=new aD),F.command=U,F.near=_,F.far=M,m++}}P&&(S=Math.min(Math.max(S,a.near),a.far),C=Math.max(Math.min(C,a.far),S),r.nearPlane=S,r.farPlane=C,r.closestObjectSize=E),rD(this,t,g,y);for(let O=0;O<m;O++)sD(this,t,p[O]);if(m<f)for(let O=m;O<f;O++){const U=p[O];if(!ca(U.command))break;U.command=void 0}const R=u.length,{frustumSplits:k}=i;k.length=R+1;for(let O=0;O<R;++O)k[O]=u[O].near,O===R-1&&(k[O+1]=u[O].far)}}function rD(t,i,e,n){const{frameState:r}=i,{camera:o,useLogDepth:s}=r,a=s?i.logarithmicDepthFarToNearRatio:i.farToNearRatio,l=i.mode===v0.SCENE2D,h=i.nearToFarDistance2D;n*=1+tD.EPSILON2,e=Math.min(Math.max(e,o.frustum.near),o.frustum.far),n=Math.max(Math.min(n,o.frustum.far),e);let u;l?(n=Math.min(n,o.position.z+i.nearToFarDistance2D),e=Math.min(e,n),u=Math.ceil(Math.max(1,n-e)/i.nearToFarDistance2D)):u=Math.ceil(Math.log(n/e)/Math.log(a));const{frustumCommandsList:p}=t;p.length=u;for(let f=0;f<u;++f){let m,g;l?(m=Math.min(n-h,e+f*h),g=Math.min(n,m+h)):(m=Math.max(e,Math.pow(a,f)*e),g=Math.min(n,a*m));let y=p[f];ca(y)?(y.near=m,y.far=g):y=p[f]=new Jb(m,g)}}function sD(t,i,e){const{command:n,near:r,far:o}=e;i.debugShowFrustums&&(n.debugOverlappingFrustums=0);const{frustumCommandsList:s}=t;for(let a=0;a<s.length;++a){const l=s[a];if(r>l.far)continue;if(o<l.near)break;const h=n.pass,u=l.indices[h]++;if(l.commands[h][u]=n,i.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(i.debugShowFrustums){const{debugFrustumStatistics:a}=t,{debugOverlappingFrustums:l}=n,h=a.commandsInFrustums;h[l]=ca(h[l])?h[l]+1:1,++a.totalCommands}i.updateDerivedCommands(n)}class aD{constructor(){v(this,"command");v(this,"near");v(this,"far")}}pA(),fA(),AA(),mT(),SM(),uI(),yI(),_I(),SI(),DI(),ab(),oD(),Zb(),zb(),$E(),XE(),YE(),JE(),BE(),jE(),eA(),qE(),dA(),uA(),d.Camera.DEFAULT_VIEW_RECTANGLE=d.Rectangle.fromDegrees(70,5,140,55);function lD(){return new Promise((t,i)=>d.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class cD extends c.Destroyable{constructor(i,e,n,r){super();const o=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=ni(a);if(l&&(l.destroy(),Vu(a,void 0)),d.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let h=a.scene.context._originalGLContext;h.canvas.width=h.canvas.height=1,h.getExtension("WEBGL_lose_context").loseContext(),h=null}a.destroy(),n(void 0)}};this.d(o);const s=this.dv(c.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const h=HE;await a.promise(lD());const u=await a.promise(c.createCancelablePromise(h(l,r)));u.scene._xbsjOriginSkyAtmosphere=u.scene.skyAtmosphere,u.scene._xbsjOriginSkyBox=u.scene.skyBox,u.clockViewModel.currentTime=d.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const p=d.JulianDate.fromDate(new Date(e.currentTime));d.JulianDate.equals(p,u.clockViewModel.currentTime)||(u.clockViewModel.currentTime=p)})),this.dispose(Fi(u.clockViewModel,"currentTime",p=>{const f=d.JulianDate.toDate(u.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const p=new S0(u,e);Vu(u,p)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),n(u)}));s.start(i),s.errorEvent.don(()=>{e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const hD=new d.EllipsoidTerrainProvider;class w0 extends c.Destroyable{constructor(e){super();v(this,"_terrainMap",new Map);v(this,"_nextAnimateFrame",this.dv(c.createNextAnimateFrame()));v(this,"selectedTerrain");this._viewer=e;const n=this._viewer,r=n.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{r&&r()}),this.dispose(this._changed.disposableOn(()=>{let o=Number.MIN_SAFE_INTEGER;for(let s of this._terrainMap.keys())s.sceneObject.activate=!1,(s.sceneObject.show??!0)&&s.sceneObject.zIndex>=o&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${s.sceneObject.name}(${s.sceneObject.id})`),o=s.sceneObject.zIndex,this.selectedTerrain=s);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),n.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??hD,n.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,n.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,n.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?c.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,n.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?c.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1}))}_makeDirty(){this._nextAnimateFrame.restartIfNotRunning()}get _changed(){return this._nextAnimateFrame.completeEvent}add(e){if(this._terrainMap.has(e)){console.warn("this._terrainMap.has(imagery)");return}const n=new c.Destroyable;n.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),n.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>n.destroy()),this._makeDirty();const r=this.ad(c.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));this.d(r.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const n=this._terrainMap.get(e);if(!n){console.error("!disposeFunc");return}n(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class C0 extends c.Destroyable{constructor(e){super();v(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const n=e instanceof je?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`this._labelMap[${n}].has(poi)`,e);return}const r=new c.Destroyable;{const o=r.dv(c.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));r.dispose(o.don(()=>{this._updateZOrder()}))}this._labelMap[n].set(e,()=>r.destroy()),this._updateZOrder()}delete(e){const n=e instanceof je?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`!this._labelMap[${n}].has(poi)`,e);return}const r=this._labelMap[n].get(e);if(!r){console.error("!disposeFunc");return}r(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){const r={};for(const a of e.keys())r[a.zOrder]||(r[a.zOrder]=new Map),r[a.zOrder].set(a,a instanceof je?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const o=Object.keys(r).sort((a,l)=>n=="div"?Number(l)-Number(a):Number(a)-Number(l));let s=e.size;for(let a=0;a<o.length;a++)new Map([...r[o[a]]].sort((h,u)=>Number(u[1])-Number(h[1]))).forEach((h,u)=>{u instanceof je&&u.czmDivPoi&&(u.czmDivPoi.zOrder=s),u instanceof mn&&u.canvasObj&&(u.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class dD extends c.Destroyable{constructor(e){super();v(this,"_czmImageryLayerWrappers",new Set);v(this,"_zIndexChangedEvent",this.dv(new c.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const n=[...this.czmImageryLayerWrappers.values()];n.sort((r,o)=>{const s=r.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex,a=o.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex;return s-a});for(const r of n)this.viewer.imageryLayers.raiseToTop(r.imageryLayer)}))}get viewer(){return this._viewer}get czmImageryLayerWrappers(){return this._czmImageryLayerWrappers}add(e){this._czmImageryLayerWrappers.add(e),this.viewer.imageryLayers.add(e.imageryLayer),this.zIndexChange()}delete(e){this.viewer.imageryLayers.remove(e.imageryLayer,!1),this._czmImageryLayerWrappers.delete(e)}zIndexChange(){this._zIndexChangedEvent.emit()}}class uD extends c.Destroyable{constructor(e){super();v(this,"_imageryLayer");if(this._czmImageryWrapper=e,!this._czmImageryWrapper.imagery.layer)throw new Error("this._czmCzmImageryWrapper.imagery.czmImagery");this._imageryLayer=this._czmImageryWrapper.imagery.layer;const{czmImageryWrapper:n}=this,r=n.manager.czmImageriesManager;r.add(this),this.d(()=>r.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>r.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class pD extends c.Destroyable{constructor(e){super();v(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new c.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new uD(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class fD extends c.Destroyable{constructor(e,n){super();v(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=n,this._czmImageryLayerWrapperObjResetting=this.dv(new c.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new pD(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class _0 extends c.Destroyable{constructor(e){super();v(this,"_czmImageryWrappers",new Set);v(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new dD(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let n of this.czmImageryWrappers)if(n.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new fD(e,this))}delete(e){for(const n of this.czmImageryWrappers)if(n.imagery===e){this.czmImageryWrappers.delete(n);return}console.warn("imageriesManager delete error!",e)}}class P0 extends c.Destroyable{constructor(e){super();v(this,"_pause",this.disposeVar(c.react(!1)));v(this,"_pickPositionTasks",[]);v(this,"_pickTasks",[]);v(this,"pickHeightMustGreaterThanZero",!0);v(this,"objectsToExclude",[]);const n=e.viewer;{this.dispose(()=>{this._pickPositionTasks.length>0&&(this._pickPositionTasks.forEach(a=>a[3]("CzmViewer销毁,任务不再执行!")),this._pickPositionTasks.length=0),this._pickTasks.length>0&&(this._pickTasks.forEach(a=>a[4]("CzmViewer销毁,任务不再执行!")),this._pickTasks.length=0)});const r=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let h of a){const[u,p,f,m]=h;try{(async()=>{const{scene:g,camera:y}=n,P=be(u),S=y.getPickRay(P);do{if(!S)break;let C;if(p?C=await g.pickFromRayMostDetailed(S,this.objectsToExclude):C=g.pickFromRay(S,this.objectsToExclude),!C||!C.position)break;const E=pe(C.position);if(!E){m(new Error("positionFromCartesian failed"));return}f(E);return}while(!1);if(S&&!(g.terrainProvider instanceof d.EllipsoidTerrainProvider)){const C=g.globe.pick(S,g);if(!C){m(new Error("scene.globe.pick failed"));return}const E=pe(C);if(!E){m(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&E[2]<0&&(E[2]=0),f(E);return}{const C=g.terrainProvider instanceof d.EllipsoidTerrainProvider?g.terrainProvider.tilingScheme.ellipsoid:n.scene.globe.ellipsoid,E=n.camera.pickEllipsoid(be(u),C);if(!E){m(new Error("Pick failed"));return}const T=pe(E);if(!T){m(new Error("positionFromCartesian failed"));return}f(T)}})()}catch(g){m(g)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let h of l){const[u,p,f,m,g]=h;e.pickCustomAttachedInfo=f;try{(async()=>{var I,D,R;let y=n.scene.pick(be(u),p&&p[0],p&&p[1]);!y&&d.defined(n.scene.globe)&&(y=await mD(n,be(u)));let P;if(y&&y instanceof d.Cesium3DTileFeature){P={};try{y&&y.getPropertyIds().forEach(O=>{P&&(P[O]=y.getProperty(O))})}catch(k){console.warn(k)}}let S;do{if(!y)break;if(y.id&&y.id instanceof d.Entity&&y.id.ESSceneObjectID){S=y.id.ESSceneObjectID;break}if(y.primitive&&y.primitive.ESSceneObjectID){S=y.primitive.ESSceneObjectID;break}}while(!1);const C=S?w.ESSceneObject.getSceneObject(S):void 0;let E={};if(C&&Reflect.has(C,"allowPicking")&&Reflect.has(C,"pickedEvent")&&(C.allowPicking??!1)){do{if(C instanceof w.ESEntityCluster){const k=new d.JulianDate;E=y.id instanceof d.Entity?{name:y.id.label.text.getValue(k),properties:(I=y.id.properties)==null?void 0:I.getValue(k),coordinates:$s(y.id.position.getValue(k))}:(D=y.id)==null?void 0:D.map(O=>{var U;return{name:O.id,properties:(U=O.properties)==null?void 0:U.getValue(k),coordinates:$s(O.position.getValue(k))}});break}if(C instanceof w.ESGeoJson){const k=new d.JulianDate;if(!y.id.entityCollection)return;const O=y.id.polygon?"Polygon":y.id.polyline?"LineString":"Point",U=((R=y.id.properties)==null?void 0:R.getValue(k))??{},z=O=="Point"?pe(y.id.position.getValue(k)):O=="LineString"?y.id.polyline.positions.getValue(k).map(V=>pe(V)):Bd(y.id.polygon.hierarchy.getValue(k));E=C.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:O,coordinates:z},properties:U}:{type:O,coordinates:z,properties:U};break}if(C instanceof w.ESGltfModel){let k;Reflect.has(y,"featureId")?k=y.featureId:Reflect.has(y,"instanceId")&&(k=y.instanceId),k&&(y.id=y.primitive.structuralMetadata.getPropertyTable(0).getProperty(y.instanceId,"id"))}}while(!1);C.pickedEvent.emit(new w.ESJPickedResult(y,C,P,E,f,u))}C&&Reflect.has(C,"allowPicking")&&!C.allowPicking&&m(new w.ESJPickedResult);const T=new w.ESJPickedResult(y,C,P,E,f,u);m(T)})()}catch(y){g(y)}}};let o=n.scene.postRender.addEventListener(r);const s=()=>{o&&o(),o=void 0};this.ad(s),this.ad(this.pauseChanged.don(a=>{a?s():o=n.scene.postRender.addEventListener(r)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((n,r)=>{this._pickPositionTasks.push([e,!0,n,r])})}quickPickPosition(e){return new Promise((n,r)=>{this._pickPositionTasks.push([e,!1,n,r])})}pick(e,n,r){return new Promise((o,s)=>{this._pickTasks.push([e,n,r,o,s])})}}function mD(t,i){const e=t.scene,n=e.camera.getPickRay(i);if(!n)return;const r=e.imageryLayers.pickImageryLayerFeatures(n,e);if(d.defined(r))return r}class gD extends c.Destroyable{constructor(e){super();v(this,"_enabled",this.disposeVar(c.react(!1)));v(this,"_cursorPosition",c.react(void 0));v(this,"quickPickPosition",!0);let n=new c.Destroyable;const r=()=>{n&&(n.destroy(),n=void 0)};this.dispose(r);const o=()=>{if(r(),!this._enabled.value||!e)return;const s=ni(e);if(!s)return;n=new c.Destroyable;const a=n.disposeVar(c.react(void 0)),l=n.disposeVar(c.createNextAnimateFrameEvent(a.changed));n.dispose(s.czmViewer.pointerMoveEvent.disposableOn(u=>{u.pointerEvent&&(a.value=c.getDomEventCurrentTargetPos(u.pointerEvent))}));const h=n.disposeVar(c.createProcessingFromAsyncFunc(async u=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const p=await u.promise(c.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=p}else{const p=await u.promise(c.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=p}}));n.dispose(l.disposableOn(()=>{h.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}function ni(t){return c.getExtProp(t,"_viewerExtensions")}function Vu(t,i){c.setExtProp(t,"_viewerExtensions",i)}class S0 extends c.Destroyable{constructor(e,n){super();v(this,"_imageriesManager");v(this,"_terrainManager");v(this,"_labelManager");v(this,"_pickingManager");v(this,"_poiContext");v(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=n,this._imageriesManager=this.dv(new _0(this.viewer)),this._terrainManager=this.dv(new w0(this.viewer)),this._labelManager=this.dv(new C0(this.viewer)),this._poiContext=this.disposeVar(new q0(this._viewer)),this._cursorPositionInfo=this.disposeVar(new gD(this._viewer)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new P0(n))}))}get viewer(){return this._viewer}get czmViewer(){return this._czmViewer}get imageriesManager(){return this._imageriesManager}get terrainManager(){return this._terrainManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}var E0=new d.Cartesian3,A0=new d.Cartesian3;function T0(t,i,e){let n=d.Matrix4.clone(t.transform);t.lookAtTransform(d.Matrix4.IDENTITY);var r=t.positionCartographic.height,o=t.positionWC,s=d.Cartesian3.normalize(o,E0),a=d.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var l=d.Cartesian3.cross(t.direction,s,A0);else var l=d.Cartesian3.cross(t.up,s,A0);var h=l;if(e){var u=d.Cartesian3.cross(s,l,E0);h=u}var p=d.Cartesian3.magnitude(o);t.rotate(h,i/p);var f=t.positionCartographic,m=f.longitude,g=f.latitude;d.Cartesian3.fromRadians(m,g,r,void 0,t.position),t.lookAtTransform(n)}function M0(t,i){T0(t,i,!1)}function I0(t,i){T0(t,-i,!0)}class vD extends c.Destroyable{constructor(e){super();v(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:n}=this,{viewer:r}=n.firstPersonController,{camera:o}=r;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:a[s.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:s}=this;let a=Date.now();const l=()=>{const h=Date.now(),u=h-a;a=h;const p=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&o.moveForward(u*p),s.MoveBackword&&o.moveBackward(u*p),s.MoveLeft&&o.moveLeft(u*p),s.MoveRight&&o.moveRight(u*p)):(s.MoveForward&&M0(o,u*p),s.MoveBackword&&M0(o,-u*p),s.MoveLeft&&I0(o,-u*p),s.MoveRight&&I0(o,u*p));{const{rotateSpeed:f}=this.controller,m=d.Math.toRadians(f*u);s.RotateRight?o.lookRight(m):s.RotateLeft?o.lookRight(-m):s.RotateUp?o.lookDown(-m):s.RotateDown&&o.lookDown(m)}};r.scene.preUpdate.addEventListener(l),this.dispose(()=>r.scene.preUpdate.removeEventListener(l))}}get running(){return this._running}get controller(){return this.running.keyboardCameraController}get actions(){return this._actions}_resetActions(){const e=Object.keys(this._actions);for(let n of e)this._actions[n]=!1}_updateActions(){const{running:e}=this,{keyStatus:n}=e,{actions:r}=this;this._resetActions();const{keyStatusMap:o}=this.running.keyboardCameraController;for(let s of n.currentKeyIds)r[o[s]]=!0}}class dh extends c.Destroyable{constructor(e){super();v(this,"_currentKeyIds",new Set);v(this,"_currentKeyIdsChanged",this.dv(new c.Event));v(this,"_debug",this.dv(c.react(!1)));v(this,"_debugResetting",this.dv(new c.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends c.Destroyable{constructor(e){super();const n=()=>{console.log([...e.currentKeyIds].join(`
|
|
738
|
+
${g}`)}}function Nb(t,i){const e={},n=[],r=[],o=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<o;++s){const a=t.getActiveUniform(i,s),l="[0]",h=a.name.indexOf(l,a.name.length-l.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(h.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){const u=t.getUniformLocation(i,h);if(u!==null){const p=a.type!=t.UNSIGNED_INT_SAMPLER_2D?kb(t,a,h,u):new Db(t,a,h,u);e[h]=p,n.push(p),p._setSampler&&r.push(p)}}else{let u,p,f,m;const g=h.indexOf("[");if(g>=0){if(u=e[h.slice(0,g)],!un(u))continue;p=u._locations,p.length<=1&&(f=u.value,m=t.getUniformLocation(i,h),m!==null&&(p.push(m),f.push(t.getUniform(i,m))))}else{p=[];for(let y=0;y<a.size;++y)m=t.getUniformLocation(i,`${h}[${y}]`),m!==null&&p.push(m);u=a.type!=t.UNSIGNED_INT_SAMPLER_2D?Lb(t,a,h,p):new Rb(t,a,h,p),e[h]=u,n.push(u),u._setSampler&&r.push(u)}}}return{uniformsByName:e,uniforms:n,samplerUniforms:r}}function Vb(t,i){const e=[],n=[];for(const r in i)if(i.hasOwnProperty(r)){const o=i[r];let s=r;const a=t._duplicateUniformNames[s];un(a)&&(o.name=a,s=a);const l=Fb[s];un(l)?e.push({uniform:o,automaticUniform:l}):n.push(o)}return{automaticUniforms:e,manualUniforms:n}}function Ub(t,i,e){const n={};for(let r=0;r<e;++r){const o=t.getActiveAttrib(i,r),s=t.getAttribLocation(i,o.name);n[o.name]={name:o.name,type:o.type,index:s}}return n}function Gb(t,i,e){t.useProgram(i);let n=0;const r=e.length;for(let o=0;o<r;++o)n=e[o]._setSampler(n);return t.useProgram(null),n}const{defaultValue:qn,BufferUsage:Wb,defined:Oi,ComponentDatatype:ii,Geometry:Hb,Math:qb,IndexDatatype:f0,VertexArray:$b,RuntimeError:Xb,Buffer:la,AttributeType:Yb}=d;function Zb(){d.VertexArray.fromGeometry=function(t){t=qn(t,qn.EMPTY_OBJECT),d.Check.defined("options.context",t.context);const i=t.context,e=qn(t.geometry,qn.EMPTY_OBJECT),n=qn(t.bufferUsage,Wb.DYNAMIC_DRAW),r=qn(t.attributeLocations,qn.EMPTY_OBJECT),o=qn(t.interleave,!1),s=t.vertexArrayAttributes;let a,l,h;const u=Oi(s)?s:[],p=e.attributes;if(o){const g=Qb(p);if(Oi(g)){h=la.createVertexBuffer({context:i,typedArray:g.buffer,usage:n});const y=g.offsetsInBytes,P=g.vertexSizeInBytes;for(a in p)p.hasOwnProperty(a)&&Oi(p[a])&&(l=p[a],Oi(l.values)?u.push({index:r[a],vertexBuffer:h,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize,offsetInBytes:y[a],strideInBytes:P}):u.push({index:r[a],value:l.value,componentDatatype:l.componentDatatype,normalize:l.normalize}))}}else for(a in p)if(p.hasOwnProperty(a)&&Oi(p[a])){l=p[a];let g=l.componentDatatype;g===ii.DOUBLE&&(g=ii.FLOAT);let y={};h=void 0,Oi(l.values)&&(h=la.createVertexBuffer({context:i,typedArray:ii.createTypedArray(g,l.values),usage:n}),y={index:r[a],vertexBuffer:h,value:l.value,componentDatatype:g,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize}),Oi(l.typedArray)&&(h=la.createVertexBuffer({context:i,typedArray:l.typedArray,usage:n}),y={index:r[a],vertexBuffer:h,value:void 0,componentDatatype:g,componentsPerAttribute:Yb.getNumberOfComponents(l.type),normalize:l.normalized,instanceDivisor:l.instanceDivisor}),u.push(y)}let f;const m=e.indices;return Oi(m)&&(Hb.computeNumberOfVertices(e)>=qb.SIXTY_FOUR_KILOBYTES&&i.elementIndexUint?f=la.createIndexBuffer({context:i,typedArray:new Uint32Array(m),usage:n,indexDatatype:f0.UNSIGNED_INT}):f=la.createIndexBuffer({context:i,typedArray:new Uint16Array(m),usage:n,indexDatatype:f0.UNSIGNED_SHORT})),new $b({context:i,attributes:u,indexBuffer:f})}}function Qb(t){let i,e,n;const r=[];for(e in t)t.hasOwnProperty(e)&&Oi(t[e])&&Oi(t[e].values)&&(r.push(e),t[e].componentDatatype===ii.DOUBLE&&(t[e].componentDatatype=ii.FLOAT,t[e].values=ii.createTypedArray(ii.FLOAT,t[e].values)));let o;const s=r.length;if(s>0)for(o=m0(t[r[0]]),i=1;i<s;++i){const h=m0(t[r[i]]);if(h!==o)throw new Xb(`Each attribute list must have the same number of vertices. Attribute ${r[i]} has a different number of vertices (${h.toString()}) than attribute ${r[0]} (${o.toString()}).`)}r.sort(function(h,u){return ii.getSizeInBytes(t[u].componentDatatype)-ii.getSizeInBytes(t[h].componentDatatype)});let a=0;const l={};for(i=0;i<s;++i)e=r[i],n=t[e],l[e]=a,a+=Kb(n);if(a>0){const h=ii.getSizeInBytes(t[r[0]].componentDatatype),u=a%h;u!==0&&(a+=h-u);const p=o*a,f=new ArrayBuffer(p),m={};for(i=0;i<s;++i){e=r[i];const g=ii.getSizeInBytes(t[e].componentDatatype);m[e]={pointer:ii.createTypedArray(t[e].componentDatatype,f),index:l[e]/g,strideInComponentType:a/g}}for(i=0;i<o;++i)for(let g=0;g<s;++g){e=r[g],n=t[e];const y=n.values,P=m[e],S=P.pointer,C=n.componentsPerAttribute;for(let E=0;E<C;++E)S[P.index+E]=y[i*C+E];P.index+=P.strideInComponentType}return{buffer:f,offsetsInBytes:l,vertexSizeInBytes:a}}}function m0(t){return t.values.length/t.componentsPerAttribute}function Kb(t){return ii.getSizeInBytes(t.componentDatatype)*t.componentsPerAttribute}const{defaultValue:g0}=d;class Jb extends d.FrustumCommands{constructor(i,e){super(i,e),this.near=g0(i,0),this.far=g0(e,0);const n=12,r=new Array(n),o=new Array(n);for(let s=0;s<n;++s)r[s]=[],o[s]=0;this.commands=r,this.indices=o}}const{SceneMode:v0,CullingVolume:Bb,Interval:jb,Pass:hh,defined:ca,ShadowMap:eD,Math:tD,ClearCommand:iD}=d,y0=new Bb,nD=new jb;function oD(){d.View.prototype.createPotentiallyVisibleSet=function(t){const{frameState:i}=t,{camera:e,commandList:n,shadowState:r}=i,{positionWC:o,directionWC:s,frustum:a}=e,l=t._computeCommandList,h=t._overlayCommandList;t.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const u=this.frustumCommandsList;for(let O=0;O<u.length;++O)for(let U=0;U<12;++U)u[O].indices[U]=0;l.length=0,h.length=0;const p=this._commandExtents,f=p.length;let m=0,g=+Number.MAX_VALUE,y=-Number.MAX_VALUE;const{shadowsEnabled:P}=r;let S=+Number.MAX_VALUE,C=-Number.MAX_VALUE,E=Number.MAX_VALUE;const T=i.mode===v0.SCENE3D?i.occluder:void 0;let{cullingVolume:I}=i;const D=y0.planes;for(let O=0;O<5;++O)D[O]=I.planes[O];I=y0;for(let O=0;O<n.length;++O){const U=n[O],{pass:z,boundingVolume:V}=U;if(z===hh.COMPUTE)l.push(U);else if(z===hh.OVERLAY)h.push(U);else{let _,M;if(ca(V)){if(!t.isVisible(I,U,T))continue;const N=V.computePlaneDistances(o,s,nD);if(_=N.start,M=N.stop,g=Math.min(g,_),y=Math.max(y,M),P&&U.receiveShadows&&_<eD.MAXIMUM_DISTANCE&&!(z===hh.GLOBE&&_<-100&&M>100)){const H=M-_;z!==hh.GLOBE&&_<100&&(E=Math.min(E,H)),S=Math.min(S,_),C=Math.max(C,M)}}else U instanceof iD?(_=a.near,M=a.far):(_=a.near,M=a.far,g=Math.min(g,_),y=Math.max(y,M));let F=p[m];ca(F)||(F=p[m]=new aD),F.command=U,F.near=_,F.far=M,m++}}P&&(S=Math.min(Math.max(S,a.near),a.far),C=Math.max(Math.min(C,a.far),S),r.nearPlane=S,r.farPlane=C,r.closestObjectSize=E),rD(this,t,g,y);for(let O=0;O<m;O++)sD(this,t,p[O]);if(m<f)for(let O=m;O<f;O++){const U=p[O];if(!ca(U.command))break;U.command=void 0}const R=u.length,{frustumSplits:k}=i;k.length=R+1;for(let O=0;O<R;++O)k[O]=u[O].near,O===R-1&&(k[O+1]=u[O].far)}}function rD(t,i,e,n){const{frameState:r}=i,{camera:o,useLogDepth:s}=r,a=s?i.logarithmicDepthFarToNearRatio:i.farToNearRatio,l=i.mode===v0.SCENE2D,h=i.nearToFarDistance2D;n*=1+tD.EPSILON2,e=Math.min(Math.max(e,o.frustum.near),o.frustum.far),n=Math.max(Math.min(n,o.frustum.far),e);let u;l?(n=Math.min(n,o.position.z+i.nearToFarDistance2D),e=Math.min(e,n),u=Math.ceil(Math.max(1,n-e)/i.nearToFarDistance2D)):u=Math.ceil(Math.log(n/e)/Math.log(a));const{frustumCommandsList:p}=t;p.length=u;for(let f=0;f<u;++f){let m,g;l?(m=Math.min(n-h,e+f*h),g=Math.min(n,m+h)):(m=Math.max(e,Math.pow(a,f)*e),g=Math.min(n,a*m));let y=p[f];ca(y)?(y.near=m,y.far=g):y=p[f]=new Jb(m,g)}}function sD(t,i,e){const{command:n,near:r,far:o}=e;i.debugShowFrustums&&(n.debugOverlappingFrustums=0);const{frustumCommandsList:s}=t;for(let a=0;a<s.length;++a){const l=s[a];if(r>l.far)continue;if(o<l.near)break;const h=n.pass,u=l.indices[h]++;if(l.commands[h][u]=n,i.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(i.debugShowFrustums){const{debugFrustumStatistics:a}=t,{debugOverlappingFrustums:l}=n,h=a.commandsInFrustums;h[l]=ca(h[l])?h[l]+1:1,++a.totalCommands}i.updateDerivedCommands(n)}class aD{constructor(){v(this,"command");v(this,"near");v(this,"far")}}pA(),fA(),AA(),mT(),SM(),uI(),yI(),_I(),SI(),DI(),ab(),oD(),Zb(),zb(),$E(),XE(),YE(),JE(),BE(),jE(),eA(),qE(),dA(),uA(),d.Camera.DEFAULT_VIEW_RECTANGLE=d.Rectangle.fromDegrees(70,5,140,55);function lD(){return new Promise((t,i)=>d.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class cD extends c.Destroyable{constructor(i,e,n,r){super();const o=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=ni(a);if(l&&(l.destroy(),Vu(a,void 0)),d.defined(a)){a.entities.removeAll(),a.dataSources.removeAll(),a.imageryLayers.removeAll(),a.scene.primitives.removeAll(),a.scene.groundPrimitives.removeAll(),a.scene.postProcessStages.removeAll();let h=a.scene.context._originalGLContext;h.canvas.width=h.canvas.height=1,h.getExtension("WEBGL_lose_context").loseContext(),h=null}a.destroy(),n(void 0)}};this.d(o);const s=this.dv(c.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const h=HE;await a.promise(lD());const u=await a.promise(c.createCancelablePromise(h(l,r)));u.scene._xbsjOriginSkyAtmosphere=u.scene.skyAtmosphere,u.scene._xbsjOriginSkyBox=u.scene.skyBox,u.clockViewModel.currentTime=d.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const p=d.JulianDate.fromDate(new Date(e.currentTime));d.JulianDate.equals(p,u.clockViewModel.currentTime)||(u.clockViewModel.currentTime=p)})),this.dispose(Fi(u.clockViewModel,"currentTime",p=>{const f=d.JulianDate.toDate(u.clockViewModel.currentTime).getTime();f!==e.currentTime&&(e.currentTime=f)}));{const p=new S0(u,e);Vu(u,p)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),n(u)}));s.start(i),s.errorEvent.don(()=>{e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const hD=new d.EllipsoidTerrainProvider;class w0 extends c.Destroyable{constructor(e){super();v(this,"_terrainMap",new Map);v(this,"_nextAnimateFrame",this.dv(c.createNextAnimateFrame()));v(this,"selectedTerrain");this._viewer=e;const n=this._viewer,r=n.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{r&&r()}),this.dispose(this._changed.disposableOn(()=>{this.selectedTerrain=void 0;let o=Number.MIN_SAFE_INTEGER;for(let s of this._terrainMap.keys())s.sceneObject.activate=!1,(s.sceneObject.show??!0)&&s.sceneObject.zIndex>=o&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${s.sceneObject.name}(${s.sceneObject.id})`),o=s.sceneObject.zIndex,this.selectedTerrain=s);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),n.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??hD,n.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,n.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,n.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?c.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,n.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?c.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1}))}_makeDirty(){this._nextAnimateFrame.restartIfNotRunning()}get _changed(){return this._nextAnimateFrame.completeEvent}add(e){if(this._terrainMap.has(e)){console.warn("this._terrainMap.has(imagery)");return}const n=new c.Destroyable;n.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),n.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>n.destroy()),this._makeDirty();const r=this.ad(c.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));this.d(r.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const n=this._terrainMap.get(e);if(!n){console.error("!disposeFunc");return}n(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class C0 extends c.Destroyable{constructor(e){super();v(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const n=e instanceof je?"div":"canvas";if(this._labelMap[n].has(e)){console.warn(`this._labelMap[${n}].has(poi)`,e);return}const r=new c.Destroyable;{const o=r.dv(c.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));r.dispose(o.don(()=>{this._updateZOrder()}))}this._labelMap[n].set(e,()=>r.destroy()),this._updateZOrder()}delete(e){const n=e instanceof je?"div":"canvas";if(!this._labelMap[n].has(e)){console.warn(`!this._labelMap[${n}].has(poi)`,e);return}const r=this._labelMap[n].get(e);if(!r){console.error("!disposeFunc");return}r(),this._labelMap[n].delete(e),this._updateZOrder()}_updateZOrder(){for(const e in this._labelMap)Object.prototype.hasOwnProperty.call(this._labelMap,e)&&this._updateLabelZOrder(this._labelMap[e],e)}_updateLabelZOrder(e,n){const r={};for(const a of e.keys())r[a.zOrder]||(r[a.zOrder]=new Map),r[a.zOrder].set(a,a instanceof je?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const o=Object.keys(r).sort((a,l)=>n=="div"?Number(l)-Number(a):Number(a)-Number(l));let s=e.size;for(let a=0;a<o.length;a++)new Map([...r[o[a]]].sort((h,u)=>Number(u[1])-Number(h[1]))).forEach((h,u)=>{u instanceof je&&u.czmDivPoi&&(u.czmDivPoi.zOrder=s),u instanceof mn&&u.canvasObj&&(u.canvasObj.czmCanvasPoi.zOrder=s),s--})}}class dD extends c.Destroyable{constructor(e){super();v(this,"_czmImageryLayerWrappers",new Set);v(this,"_zIndexChangedEvent",this.dv(new c.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const n=[...this.czmImageryLayerWrappers.values()];n.sort((r,o)=>{const s=r.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex,a=o.czmImageryWrapper.imagery.zIndex??w.ESImageryLayer.defaults.zIndex;return s-a});for(const r of n)this.viewer.imageryLayers.raiseToTop(r.imageryLayer)}))}get viewer(){return this._viewer}get czmImageryLayerWrappers(){return this._czmImageryLayerWrappers}add(e){this._czmImageryLayerWrappers.add(e),this.viewer.imageryLayers.add(e.imageryLayer),this.zIndexChange()}delete(e){this.viewer.imageryLayers.remove(e.imageryLayer,!1),this._czmImageryLayerWrappers.delete(e)}zIndexChange(){this._zIndexChangedEvent.emit()}}class uD extends c.Destroyable{constructor(e){super();v(this,"_imageryLayer");if(this._czmImageryWrapper=e,!this._czmImageryWrapper.imagery.layer)throw new Error("this._czmCzmImageryWrapper.imagery.czmImagery");this._imageryLayer=this._czmImageryWrapper.imagery.layer;const{czmImageryWrapper:n}=this,r=n.manager.czmImageriesManager;r.add(this),this.d(()=>r.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>r.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class pD extends c.Destroyable{constructor(e){super();v(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new c.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new uD(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class fD extends c.Destroyable{constructor(e,n){super();v(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=n,this._czmImageryLayerWrapperObjResetting=this.dv(new c.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new pD(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class _0 extends c.Destroyable{constructor(e){super();v(this,"_czmImageryWrappers",new Set);v(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new dD(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let n of this.czmImageryWrappers)if(n.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new fD(e,this))}delete(e){for(const n of this.czmImageryWrappers)if(n.imagery===e){this.czmImageryWrappers.delete(n);return}console.warn("imageriesManager delete error!",e)}}class P0 extends c.Destroyable{constructor(e){super();v(this,"_pause",this.disposeVar(c.react(!1)));v(this,"_pickPositionTasks",[]);v(this,"_pickTasks",[]);v(this,"pickHeightMustGreaterThanZero",!0);v(this,"objectsToExclude",[]);const n=e.viewer;{this.dispose(()=>{this._pickPositionTasks.length>0&&(this._pickPositionTasks.forEach(a=>a[3]("CzmViewer销毁,任务不再执行!")),this._pickPositionTasks.length=0),this._pickTasks.length>0&&(this._pickTasks.forEach(a=>a[4]("CzmViewer销毁,任务不再执行!")),this._pickTasks.length=0)});const r=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let h of a){const[u,p,f,m]=h;try{(async()=>{const{scene:g,camera:y}=n,P=be(u),S=y.getPickRay(P);do{if(!S)break;let C;if(p?C=await g.pickFromRayMostDetailed(S,this.objectsToExclude):C=g.pickFromRay(S,this.objectsToExclude),!C||!C.position)break;const E=pe(C.position);if(!E){m(new Error("positionFromCartesian failed"));return}f(E);return}while(!1);if(S&&!(g.terrainProvider instanceof d.EllipsoidTerrainProvider)){const C=g.globe.pick(S,g);if(!C){m(new Error("scene.globe.pick failed"));return}const E=pe(C);if(!E){m(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&E[2]<0&&(E[2]=0),f(E);return}{const C=g.terrainProvider instanceof d.EllipsoidTerrainProvider?g.terrainProvider.tilingScheme.ellipsoid:n.scene.globe.ellipsoid,E=n.camera.pickEllipsoid(be(u),C);if(!E){m(new Error("Pick failed"));return}const T=pe(E);if(!T){m(new Error("positionFromCartesian failed"));return}f(T)}})()}catch(g){m(g)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let h of l){const[u,p,f,m,g]=h;e.pickCustomAttachedInfo=f;try{(async()=>{var I,D,R;let y=n.scene.pick(be(u),p&&p[0],p&&p[1]);!y&&d.defined(n.scene.globe)&&(y=await mD(n,be(u)));let P;if(y&&y instanceof d.Cesium3DTileFeature){P={};try{y&&y.getPropertyIds().forEach(O=>{P&&(P[O]=y.getProperty(O))})}catch(k){console.warn(k)}}let S;do{if(!y)break;if(y.id&&y.id instanceof d.Entity&&y.id.ESSceneObjectID){S=y.id.ESSceneObjectID;break}if(y.primitive&&y.primitive.ESSceneObjectID){S=y.primitive.ESSceneObjectID;break}}while(!1);const C=S?w.ESSceneObject.getSceneObject(S):void 0;let E={};if(C&&Reflect.has(C,"allowPicking")&&Reflect.has(C,"pickedEvent")&&(C.allowPicking??!1)){do{if(C instanceof w.ESEntityCluster){const k=new d.JulianDate;E=y.id instanceof d.Entity?{name:y.id.label.text.getValue(k),properties:(I=y.id.properties)==null?void 0:I.getValue(k),coordinates:$s(y.id.position.getValue(k))}:(D=y.id)==null?void 0:D.map(O=>{var U;return{name:O.id,properties:(U=O.properties)==null?void 0:U.getValue(k),coordinates:$s(O.position.getValue(k))}});break}if(C instanceof w.ESGeoJson){const k=new d.JulianDate;if(!y.id.entityCollection)return;const O=y.id.polygon?"Polygon":y.id.polyline?"LineString":"Point",U=((R=y.id.properties)==null?void 0:R.getValue(k))??{},z=O=="Point"?pe(y.id.position.getValue(k)):O=="LineString"?y.id.polyline.positions.getValue(k).map(V=>pe(V)):Bd(y.id.polygon.hierarchy.getValue(k));E=C.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:O,coordinates:z},properties:U}:{type:O,coordinates:z,properties:U};break}if(C instanceof w.ESGltfModel){let k;Reflect.has(y,"featureId")?k=y.featureId:Reflect.has(y,"instanceId")&&(k=y.instanceId),k&&(y.id=y.primitive.structuralMetadata.getPropertyTable(0).getProperty(y.instanceId,"id"))}}while(!1);C.pickedEvent.emit(new w.ESJPickedResult(y,C,P,E,f,u))}C&&Reflect.has(C,"allowPicking")&&!C.allowPicking&&m(new w.ESJPickedResult);const T=new w.ESJPickedResult(y,C,P,E,f,u);m(T)})()}catch(y){g(y)}}};let o=n.scene.postRender.addEventListener(r);const s=()=>{o&&o(),o=void 0};this.ad(s),this.ad(this.pauseChanged.don(a=>{a?s():o=n.scene.postRender.addEventListener(r)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((n,r)=>{this._pickPositionTasks.push([e,!0,n,r])})}quickPickPosition(e){return new Promise((n,r)=>{this._pickPositionTasks.push([e,!1,n,r])})}pick(e,n,r){return new Promise((o,s)=>{this._pickTasks.push([e,n,r,o,s])})}}function mD(t,i){const e=t.scene,n=e.camera.getPickRay(i);if(!n)return;const r=e.imageryLayers.pickImageryLayerFeatures(n,e);if(d.defined(r))return r}class gD extends c.Destroyable{constructor(e){super();v(this,"_enabled",this.disposeVar(c.react(!1)));v(this,"_cursorPosition",c.react(void 0));v(this,"quickPickPosition",!0);let n=new c.Destroyable;const r=()=>{n&&(n.destroy(),n=void 0)};this.dispose(r);const o=()=>{if(r(),!this._enabled.value||!e)return;const s=ni(e);if(!s)return;n=new c.Destroyable;const a=n.disposeVar(c.react(void 0)),l=n.disposeVar(c.createNextAnimateFrameEvent(a.changed));n.dispose(s.czmViewer.pointerMoveEvent.disposableOn(u=>{u.pointerEvent&&(a.value=c.getDomEventCurrentTargetPos(u.pointerEvent))}));const h=n.disposeVar(c.createProcessingFromAsyncFunc(async u=>{if(s.pickingManager&&a.value)if(this.quickPickPosition){const p=await u.promise(c.createCancelablePromise(s.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=p}else{const p=await u.promise(c.createCancelablePromise(s.pickingManager.pickPosition(a.value)));this._cursorPosition.value=p}}));n.dispose(l.disposableOn(()=>{h.restart()}))};o(),this.dispose(this._enabled.changed.disposableOn(o))}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get cursorPosition(){return this._cursorPosition.value}get cursorPositionChanged(){return this._cursorPosition.changed}}function ni(t){return c.getExtProp(t,"_viewerExtensions")}function Vu(t,i){c.setExtProp(t,"_viewerExtensions",i)}class S0 extends c.Destroyable{constructor(e,n){super();v(this,"_imageriesManager");v(this,"_terrainManager");v(this,"_labelManager");v(this,"_pickingManager");v(this,"_poiContext");v(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=n,this._imageriesManager=this.dv(new _0(this.viewer)),this._terrainManager=this.dv(new w0(this.viewer)),this._labelManager=this.dv(new C0(this.viewer)),this._poiContext=this.disposeVar(new q0(this._viewer)),this._cursorPositionInfo=this.disposeVar(new gD(this._viewer)),this.ad(n.viewerChanged.don(()=>{this._pickingManager=this.dv(new P0(n))}))}get viewer(){return this._viewer}get czmViewer(){return this._czmViewer}get imageriesManager(){return this._imageriesManager}get terrainManager(){return this._terrainManager}get labelManager(){return this._labelManager}get pickingManager(){return this._pickingManager}get poiContext(){return this._poiContext}get cursorPositionInfo(){return this._cursorPositionInfo}}var E0=new d.Cartesian3,A0=new d.Cartesian3;function T0(t,i,e){let n=d.Matrix4.clone(t.transform);t.lookAtTransform(d.Matrix4.IDENTITY);var r=t.positionCartographic.height,o=t.positionWC,s=d.Cartesian3.normalize(o,E0),a=d.Cartesian3.dot(t.direction,s);if(a>-.9&&a<.9)var l=d.Cartesian3.cross(t.direction,s,A0);else var l=d.Cartesian3.cross(t.up,s,A0);var h=l;if(e){var u=d.Cartesian3.cross(s,l,E0);h=u}var p=d.Cartesian3.magnitude(o);t.rotate(h,i/p);var f=t.positionCartographic,m=f.longitude,g=f.latitude;d.Cartesian3.fromRadians(m,g,r,void 0,t.position),t.lookAtTransform(n)}function M0(t,i){T0(t,i,!1)}function I0(t,i){T0(t,-i,!0)}class vD extends c.Destroyable{constructor(e){super();v(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:n}=this,{viewer:r}=n.firstPersonController,{camera:o}=r;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:a[s.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(s=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[s.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:s}=this;let a=Date.now();const l=()=>{const h=Date.now(),u=h-a;a=h;const p=this.controller.speed;s.WithCamera||this.controller.alwaysWithCamera?(s.MoveForward&&o.moveForward(u*p),s.MoveBackword&&o.moveBackward(u*p),s.MoveLeft&&o.moveLeft(u*p),s.MoveRight&&o.moveRight(u*p)):(s.MoveForward&&M0(o,u*p),s.MoveBackword&&M0(o,-u*p),s.MoveLeft&&I0(o,-u*p),s.MoveRight&&I0(o,u*p));{const{rotateSpeed:f}=this.controller,m=d.Math.toRadians(f*u);s.RotateRight?o.lookRight(m):s.RotateLeft?o.lookRight(-m):s.RotateUp?o.lookDown(-m):s.RotateDown&&o.lookDown(m)}};r.scene.preUpdate.addEventListener(l),this.dispose(()=>r.scene.preUpdate.removeEventListener(l))}}get running(){return this._running}get controller(){return this.running.keyboardCameraController}get actions(){return this._actions}_resetActions(){const e=Object.keys(this._actions);for(let n of e)this._actions[n]=!1}_updateActions(){const{running:e}=this,{keyStatus:n}=e,{actions:r}=this;this._resetActions();const{keyStatusMap:o}=this.running.keyboardCameraController;for(let s of n.currentKeyIds)r[o[s]]=!0}}class dh extends c.Destroyable{constructor(e){super();v(this,"_currentKeyIds",new Set);v(this,"_currentKeyIdsChanged",this.dv(new c.Event));v(this,"_debug",this.dv(c.react(!1)));v(this,"_debugResetting",this.dv(new c.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends c.Destroyable{constructor(e){super();const n=()=>{console.log([...e.currentKeyIds].join(`
|
|
739
739
|
`))};n(),this.d(e.currentKeyIdsChanged.don(n))}}(this)})));this._keyboardCameraControllerRunning=e;const{keyboardCameraController:n}=this._keyboardCameraControllerRunning;{const r=o=>{const s=dh.getKeyId(o);this._currentKeyIds.has(s)||(this._currentKeyIds.add(s),this._currentKeyIdsChanged.emit())};this.d(n.keyDownEvent.don(r))}{const r=o=>{const s=dh.getKeyId(o);this._currentKeyIds.has(s)&&(this._currentKeyIds.delete(s),this._currentKeyIdsChanged.emit())};this.d(n.keyUpEvent.don(r))}{const r=()=>{this._currentKeyIds.clear(),this._currentKeyIdsChanged.emit()};this.d(n.abortEvent.don(r))}}static getKeyId(e){return e.code}get currentKeyIds(){return this._currentKeyIds}get currentKeyIdsChanged(){return this._currentKeyIdsChanged}get debug(){return this._debug.value}set debug(e){this._debug.value=e}get debugChanged(){return this._debug.changed}}class yD extends c.Destroyable{constructor(e){super();v(this,"_keyStatus");v(this,"_cameraOp");this._keyboardCameraController=e,this._keyStatus=this.dv(new dh(this)),this._cameraOp=this.dv(new vD(this))}get keyboardCameraController(){return this._keyboardCameraController}get keyStatus(){return this._keyStatus}get cameraOp(){return this._cameraOp}}const Ad=class Ad extends c.Destroyable{constructor(e){super();v(this,"_enabled",this.dv(c.react(!1)));v(this,"_keyStatusMap",this.dv(c.react(Ad.defaultKeyStatusMap)));v(this,"_speed",this.dv(c.react(1)));v(this,"_rotateSpeed",this.dv(c.react(.01)));v(this,"_alwaysWithCamera",this.dv(c.react(!1)));v(this,"_keyDownEvent",this.dv(new c.Event));v(this,"_keyUpEvent",this.dv(new c.Event));v(this,"_abortEvent",this.dv(new c.Event));this._firstPersonController=e,this.dv(new c.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new yD(this)}))}get firstPersonController(){return this._firstPersonController}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get keyStatusMap(){return this._keyStatusMap.value}set keyStatusMap(e){this._keyStatusMap.value=e}get keyStatusMapChanged(){return this._keyStatusMap.changed}get speed(){return this._speed.value}set speed(e){this._speed.value=e}get speedChanged(){return this._speed.changed}get rotateSpeed(){return this._rotateSpeed.value}set rotateSpeed(e){this._rotateSpeed.value=e}get rotateSpeedChanged(){return this._rotateSpeed.changed}get alwaysWithCamera(){return this._alwaysWithCamera.value}set alwaysWithCamera(e){this._alwaysWithCamera.value=e}get alwaysWithCameraChanged(){return this._alwaysWithCamera.changed}get keyDownEvent(){return this._keyDownEvent}keyDown(e){this._keyDownEvent.emit(e)}get keyUpEvent(){return this._keyUpEvent}keyUp(e){this._keyUpEvent.emit(e)}get abortEvent(){return this._abortEvent}abort(){this._abortEvent.emit()}};v(Ad,"defaultKeyStatusMap",{ShiftLeft:"WithCamera",ShiftRight:"WithCamera",KeyW:"MoveForward",KeyS:"MoveBackword",KeyA:"MoveLeft",KeyD:"MoveRight",ArrowUp:"MoveForward",ArrowDown:"MoveBackword",ArrowLeft:"MoveLeft",ArrowRight:"MoveRight",KeyR:"SpeedUp",KeyF:"SpeedDown",KeyQ:"SwitchAlwaysWithCamera"});let uh=Ad;function wD(t,i){t.lookRight(d.Math.toRadians(i.movementX)*.1),t.lookDown(d.Math.toRadians(i.movementY)*.1);const e=t.pitch,n=d.Math.clamp(e,-d.Math.PI_OVER_TWO,d.Math.PI_OVER_TWO);n!==e&&t.setView({destination:t.positionWC,orientation:{heading:t.heading,pitch:n,roll:t.roll}})}class CD extends c.Destroyable{constructor(i,e){super(),this._firstPersonController=i,this._mouseCameraController=e;const{canvas:n}=this._firstPersonController.viewer;{const r=o=>{const{camera:s}=this._firstPersonController.viewer.scene;wD(s,o)};n.addEventListener("pointermove",r),this.dispose(()=>n.removeEventListener("pointermove",r))}}}const Td=class Td extends c.Destroyable{constructor(e){super();v(this,"_mouseMoving",this.dv(new CD(this.firstPersonController,this.mouseCameraController)));this._mouseCameraController=e;const{viewer:n}=this.firstPersonController;this.mouseCameraController.enableViewerOriginInputs(!1),this.dispose(()=>this.mouseCameraController.enableViewerOriginInputs(!0)),Element.prototype.setPointerCapture=()=>{},this.dispose(()=>Element.prototype.setPointerCapture=Td.origin_setPointerCapture);const r=n.canvas;r.requestPointerLock(),this.dispose(()=>document.exitPointerLock());{const o=()=>{document.pointerLockElement!==r&&(this.firstPersonController.mouseEnabled=!1)};document.addEventListener("pointerlockchange",o,!1),this.dispose(()=>document.removeEventListener("pointerlockchange",o,!1))}{const o=()=>{this.firstPersonController.mouseEnabled=!1,console.log("Error locking pointer")};document.addEventListener("pointerlockerror",o)}}get mouseCameraController(){return this._mouseCameraController}get firstPersonController(){return this.mouseCameraController.firstPersonController}get mouseMoving(){return this._mouseMoving}};v(Td,"origin_setPointerCapture",Element.prototype.setPointerCapture);let Uu=Td;class _D extends c.Destroyable{constructor(e){super();v(this,"_enabled",this.dv(c.react(!1)));v(this,"enableViewerOriginInputs",e=>{e?this.firstPersonController.czmViewer.incrementDisabledInputStack():this.firstPersonController.czmViewer.decrementDisabledInputStack()});v(this,"_mouseResetting",this.dv(new c.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Uu(this)})));this._firstPersonController=e}get firstPersonController(){return this._firstPersonController}get enabled(){return this._enabled.value}set enabled(e){this._enabled.value=e}get enabledChanged(){return this._enabled.changed}get mouseResetting(){return this._mouseResetting}}class PD extends c.Destroyable{constructor(e){super();v(this,"viewer");v(this,"_mouseCameraController",this.dv(new _D(this)));v(this,"_keyboardCameraController",this.dv(new uh(this)));if(this._viewer=e,!this._viewer.viewer)throw new Error("Cesium.Viewer不存在!");this.viewer=this._viewer.viewer}get czmViewer(){return this._viewer}get mouseCameraController(){return this._mouseCameraController}get mouseEnabled(){return this.mouseCameraController.enabled}set mouseEnabled(e){this.mouseCameraController.enabled=e}get mouseEnabledChanged(){return this.mouseCameraController.enabledChanged}get keyboardCameraController(){return this._keyboardCameraController}get keyboardEnabled(){return this.keyboardCameraController.enabled}set keyboardEnabled(e){this.keyboardCameraController.enabled=e}get keyboardEnabledChanged(){return this.keyboardCameraController.enabledChanged}}function b0(t){t.removeInputAction(d.ScreenSpaceEventType.LEFT_DOWN),t.removeInputAction(d.ScreenSpaceEventType.RIGHT_DOWN),t.removeInputAction(d.ScreenSpaceEventType.MIDDLE_DOWN),t.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),t.removeInputAction(d.ScreenSpaceEventType.LEFT_UP),t.removeInputAction(d.ScreenSpaceEventType.RIGHT_UP),t.removeInputAction(d.ScreenSpaceEventType.MIDDLE_UP)}function Gu(t,i,e,n=void 0){const o=t.camera,s=new d.Cartesian2;s.x=i.startPosition.x,s.y=0;const a=new d.Cartesian2;a.x=i.endPosition.x,a.y=0;let l=o.getPickRay(s,new d.Ray),h=o.getPickRay(a,new d.Ray),u=0,p,f;if(!l||!h)return;o.frustum instanceof d.OrthographicFrustum?(p=l.origin,f=h.origin,d.Cartesian3.add(o.direction,p,p),d.Cartesian3.add(o.direction,f,f),d.Cartesian3.subtract(p,o.position,p),d.Cartesian3.subtract(f,o.position,f),d.Cartesian3.normalize(p,p),d.Cartesian3.normalize(f,f)):(p=l.direction,f=h.direction);let m=d.Cartesian3.dot(p,f);m<1&&(u=Math.acos(m)),u=i.startPosition.x>i.endPosition.x?u:-u;const g=e._horizontalRotationAxis;if(d.defined(n)?o.look(n,-u):d.defined(g)?o.look(g,-u):o.lookLeft(u),s.x=0,s.y=i.startPosition.y,a.x=0,a.y=i.endPosition.y,l=o.getPickRay(s,new d.Ray),h=o.getPickRay(a,new d.Ray),u=0,!(!l||!h))if(o.frustum instanceof d.OrthographicFrustum?(p=l.origin,f=h.origin,d.Cartesian3.add(o.direction,p,p),d.Cartesian3.add(o.direction,f,f),d.Cartesian3.subtract(p,o.position,p),d.Cartesian3.subtract(f,o.position,f),d.Cartesian3.normalize(p,p),d.Cartesian3.normalize(f,f)):(p=l.direction,f=h.direction),m=d.Cartesian3.dot(p,f),m<1&&(u=Math.acos(m)),u=i.startPosition.y>i.endPosition.y?u:-u,n=d.defaultValue(n,g),d.defined(n)){const y=o.direction,P=d.Cartesian3.negate(n,new d.Cartesian3),S=d.Cartesian3.equalsEpsilon(y,n,d.Math.EPSILON2),C=d.Cartesian3.equalsEpsilon(y,P,d.Math.EPSILON2);if(!S&&!C){m=d.Cartesian3.dot(y,n);let E=d.Math.acosClamped(m);u>0&&u>E&&(u=E-d.Math.EPSILON4),m=d.Cartesian3.dot(y,P),E=d.Math.acosClamped(m),u<0&&-u>E&&(u=-E+d.Math.EPSILON4);const T=d.Cartesian3.cross(n,y,new d.Cartesian3);o.look(T,u)}else(S&&u<0||C&&u>0)&&o.look(o.right,-u)}else o.lookUp(u)}class SD extends c.Destroyable{constructor(i,e){super();const n=e.viewer;if(!n)throw new Error("viewer is undefined");let r=!0;this.d(i.positionChanged.don(()=>r=!0)),this.d(i.rotationChanged.don(()=>r=!0)),this.d(i.offsetHeightChanged.don(()=>r=!0)),this.d(i.viewDistanceChanged.don(()=>r=!0)),this.d(i.offsetRotationChanged.don(()=>r=!0)),this.d(i.relativeRotationChanged.don(()=>r=!0));const o=[0,0,0],s=[0,0,0];this.d(n.clock.onTick.addEventListener(()=>{if(!r)return;if(r=!1,!i.position){console.warn("相机控制器未能设置位置,无法启用!");return}if(i.viewDistance===void 0){console.warn("相机控制器未能设置视距,将自动设置视距!");const p=Be(i.position),f=n.camera.positionWC,m=d.Cartesian3.distance(p,f);i.viewDistance=m}c.Vector.clone(i.position,s),i.offsetHeight&&(s[2]+=i.offsetHeight);const{rotation:a,offsetRotation:l=Ni.defaults.offsetRotation}=i,h=[...l];c.Vector.set(o,0,0,0),a&&(i.relativeRotation??Ni.defaults.relativeRotation)&&(c.Vector.add(a,o,o),h[0]+=90),c.Vector.add(h,o,o);const u={distance:i.viewDistance,heading:o[0],pitch:o[1],flyDuration:0,hDelta:0,pDelta:0};e.flyTo(u,s)})),e.incrementDisabledInputStack(),this.d(()=>{e.decrementDisabledInputStack()}),this.d(e.pointerMoveEvent.don(a=>{const l=a==null?void 0:a.pointerEvent;if(l&&i.enabledRotationInput&&(l.buttons===1||l.buttons===2)){const{movementX:h,movementY:u}=l;i.offsetRotation=c.Vector.add(i.offsetRotation??Ni.defaults.offsetRotation,[h*.2,u*-.2,0])}})),this.d(e.wheelEvent.don(a=>{if(!i.enabledScaleInput)return;const l=a.deltaY,u=Math.max(1,i.viewDistance)*(l*.001);i.viewDistance=i.viewDistance+u}))}}class Ni extends c.Destroyable{constructor(e){super();v(this,"_resetWithCameraEvent",this.dv(new c.Event));const n=e.viewer;if(!n)throw new Error("viewer is undefined");const r=this;let o;const s=()=>{o&&(o.destroy(),o=void 0)};this.d(s);const a=()=>{s(),r.enabled&&(o=new SD(r,e))};a(),this.d(r.enabledChanged.don(a)),this.d(r.resetWithCameraEvent.don(l=>{if(!e.actived)return;const h=Mr(n.camera);if(!h)return;const u=r.rotation;r.offsetRotation=[h[0]-(r.relativeRotation?u[0]:90),h[1]-(r.relativeRotation?u[1]:0),h[2]-(r.relativeRotation?u[2]:0)]}))}get resetWithCameraEvent(){return this._resetWithCameraEvent}resetWithCamera(e){this._resetWithCameraEvent.emit(e)}}v(Ni,"defaults",{position:[116.39,39.9,0],rotation:[0,0,0],offsetRotation:[0,-60,0],relativeRotation:!0}),(t=>{t.createDefaultProps=()=>({enabled:!1,showTarget:!1,position:c.reactArrayWithUndefined(void 0),rotation:c.reactArrayWithUndefined(void 0),positionEditing:!1,rotationEditing:!1,viewDistance:1e3,offsetHeight:0,offsetRotation:c.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,relativeRotation:!0})})(Ni||(Ni={})),c.extendClassProps(Ni.prototype,Ni.createDefaultProps);class ha extends c.Destroyable{constructor(e){super();v(this,"_geoCameraController");v(this,"_geoPolylinePath");this._geoCameraController=this.dv(new Ni(e)),this._geoPolylinePath=this.dv(new ps(e)),this._geoPolylinePath.show=!1,this._geoPolylinePath.currentTime=0;const n=()=>{(this.usePathPosition??!0)&&(this._geoCameraController.position=this._geoPolylinePath.currentPosition),(this.usePathRotation??!0)&&(this._geoCameraController.rotation=this._geoPolylinePath.currentRotation)};n(),this.d(this._geoPolylinePath.currentPositionChanged.don(n)),this.d(this._geoPolylinePath.currentRotationChanged.don(n)),this.dispose(c.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dispose(c.bind([this._geoCameraController,"viewDistance"],[this,"viewDistance"])),this.dispose(c.bind([this._geoCameraController,"offsetHeight"],[this,"offsetHeight"])),this.dispose(c.bind([this._geoCameraController,"offsetRotation"],[this,"offsetRotation"])),this.dispose(c.track([this._geoCameraController,"enabledRotationInput"],[this,"enabledRotationInput"])),this.dispose(c.track([this._geoCameraController,"enabledScaleInput"],[this,"enabledScaleInput"])),this.dv(new c.ObjResettingWithEvent(this.lineModeChanged,()=>{if(this.lineMode!==void 0){if(this.lineMode==="auto")return new ED(this,e);if(this.lineMode==="manual")return new AD(this,e)}}))}get geoCameraController(){return this._geoCameraController}get polylinePath(){return this._geoPolylinePath}get position(){return this._geoCameraController.position}get positionChanged(){return this._geoCameraController.positionChanged}get rotation(){return this._geoCameraController.rotation}get roataionChanged(){return this._geoCameraController.rotationChanged}}(t=>{t.createDefaultProps=()=>({enabled:!1,usePathPosition:!0,usePathRotation:!0,viewDistance:1e3,offsetHeight:0,offsetRotation:c.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,lineMode:void 0})})(ha||(ha={})),c.extendClassProps(ha.prototype,ha.createDefaultProps);class ED extends c.Destroyable{constructor(i,e){if(super(),!e.viewer)throw new Error("viewer is undefined");i.offsetRotation=[-90,0,0]}}class AD extends c.Destroyable{constructor(i,e){if(super(),!e.viewer)throw new Error("viewer is undefined");const r=o=>{(o.key==="w"||o.key==="s")&&(i.polylinePath.playing=o.type==="keydown",i.polylinePath.speed=o.key==="w"||o.type==="keyup"?1:-1)};this.dispose(e.keyDownEvent.don(r)),this.dispose(e.keyUpEvent.don(r))}}class TD extends c.Destroyable{constructor(i,e){super();const n=e.positionPropertyName??"position",r=e.positionChangedPropertyName??n+"Changed",o=e.rotationPropertyName??"rotation",s=e.rotationChangedPropertyName??o+"Changed",a=(e.positionTracking??!0)&&Reflect.has(i,n)&&Reflect.has(i,r),l=(e.rotationTracking??!0)&&Reflect.has(i,o)&&Reflect.has(i,s);if(!(!a&&!l)){if(a){const h=()=>{e.geoCameraController.position=i[n]};h();const u=i[r];this.d(u.don(h))}if(l){const h=()=>{e.geoCameraController.rotation=i[o]};h();const u=i[r];this.d(u.don(h))}}}}class MD extends c.Destroyable{constructor(i,e){super();const n=this.dv(new w.ESSceneObjectWithId);n.id=i;const r=this.dv(c.createNextAnimateFrameEvent(e.enabledChanged,e.positionTrackingChanged,e.rotationTrackingChanged,e.positionPropertyNameChanged,e.positionChangedPropertyNameChanged,e.rotationPropertyNameChanged,e.rotationChangedPropertyNameChanged,n.sceneObjectChanged));this.disposeVar(new c.ObjResettingWithEvent(r,()=>{const{sceneObject:o}=n;if(!(!e.enabled||!o))return new TD(o,e)}))}}class da extends c.Destroyable{constructor(e){super();v(this,"_geoCameraController");this._geoCameraController=this.dv(new Ni(e)),this.d(c.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dv(new c.ObjResettingWithEvent(this.sceneObjectIdChanged,()=>{if(this.sceneObjectId)return new MD(this.sceneObjectId,this)}))}get geoCameraController(){return this._geoCameraController}}(t=>{t.createDefaultProps=()=>({enabled:void 0,sceneObjectId:void 0,positionTracking:void 0,rotationTracking:void 0,positionPropertyName:void 0,positionChangedPropertyName:void 0,rotationPropertyName:void 0,rotationChangedPropertyName:void 0})})(da||(da={})),c.extendClassProps(da.prototype,da.createDefaultProps);class ID extends c.Destroyable{constructor(e){super();v(this,"height",1e7);v(this,"cycle",60);v(this,"latitude",38*3.1415926/18);v(this,"_running",!1);v(this,"_sseh");v(this,"_eventDisposer");v(this,"leftDownCancel",!0);this._viewer=e,this._sseh=this.dv(new d.ScreenSpaceEventHandler(this._viewer.canvas)),this._sseh.setInputAction(()=>{this.leftDownCancel&&this.cancel()},d.ScreenSpaceEventType.LEFT_DOWN),this.d(()=>{this.cancel()})}get viewer(){return this._viewer}get sseh(){return this._sseh}start(){if(this._running)return;const e=this._viewer.camera,n=e.positionCartographic;e.flyTo({destination:d.Cartesian3.fromRadians(n.longitude,this.latitude,this.height),orientation:{heading:0,pitch:-.5*d.Math.PI,roll:0},complete:()=>{this._running=!0;var r=void 0;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((o,s)=>{if(!r){r=new Date().getTime();return}const a=(new Date().getTime()-r)/1e3,l=e.positionCartographic.longitude+a*d.Math.PI*2/this.cycle;e.setView({destination:d.Cartesian3.fromRadians(l,this.latitude,this.height),orientation:{heading:0,pitch:-.5*d.Math.PI,roll:0}}),r=new Date().getTime()})},duration:.5})}cancel(){this._running&&(this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1)}}class bD extends c.Destroyable{constructor(e){super();v(this,"_height",this.dv(c.react(1e7)));v(this,"_cycle",this.dv(c.react(60)));v(this,"_latitude",this.dv(c.react(38)));v(this,"_inner");this._czmViewer=e;const n=this._czmViewer.viewer;if(!n)throw new Error("未初始化viewer");this._inner=this.dv(new ID(n)),this._inner.leftDownCancel=!1;{const r=()=>{this._inner.height=this.height,this._inner.cycle=this.cycle,this._inner.latitude=this.latitude*Math.PI/180};r(),this.d(this.heightChanged.don(r)),this.d(this.cycleChanged.don(r)),this.d(this.latitudeChanged.don(r))}}get height(){return this._height.value}set height(e){this._height.value=e}get heightChanged(){return this._height.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get latitude(){return this._latitude.value}set latitude(e){this._latitude.value=e}get latitudeChanged(){return this._latitude.changed}get inner(){return this._inner}start(){return this._inner.start()}cancel(){return this._inner.cancel()}}class DD extends c.Destroyable{constructor(e){super();v(this,"_position",this.dv(c.reactArrayWithUndefined(void 0)));v(this,"_distance",this.dv(c.react(5e4)));v(this,"_cycle",this.dv(c.react(60)));v(this,"_heading",this.dv(c.react(0)));v(this,"_pitch",this.dv(c.react(-30)));v(this,"_transform");v(this,"_headingRadius");v(this,"_pitchRadius");v(this,"_running",!1);v(this,"_sseh");v(this,"_eventDisposer");this._viewer=e;const n=this.viewer.scene,r=this.viewer.camera;this._sseh=this.dv(new d.ScreenSpaceEventHandler(this.viewer.canvas)),this.d(()=>{this.cancel()});{const o=()=>{let s;if(this.position==null){var a=r.getPickRay(new d.Cartesian2(n.canvas.width*.5,n.canvas.height*.5));if(!a)return;s=n.globe.pick(a,n)}else s=d.Cartesian3.fromDegrees(...this.position);s&&(this._transform=d.Transforms.eastNorthUpToFixedFrame(s),this.start())};o(),this.d(this.positionChanged.don(o))}{const o=()=>{this._headingRadius=d.Math.toRadians(this.heading)};o(),this.d(this.headingChanged.don(o))}{const o=()=>{this._pitchRadius=d.Math.toRadians(this.pitch)};o(),this.d(this.pitchChanged.don(o))}}get viewer(){return this._viewer}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get distance(){return this._distance.value}set distance(e){this._distance.value=e}get distanceChanged(){return this._distance.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get heading(){return this._heading.value}set heading(e){this._heading.value=e}get headingChanged(){return this._heading.changed}get pitch(){return this._pitch.value}set pitch(e){this._pitch.value=e}get pitchChanged(){return this._pitch.changed}get sseh(){return this._sseh}start(){if(this._running)return;const e=this.viewer.camera;e.lookAtTransform(this._transform);var n=this.distance*Math.sin(this._pitchRadius),r=this.distance*Math.cos(this._pitchRadius),o=new d.Cartesian3(0,n,r);e.flyTo({destination:d.Matrix4.multiplyByPoint(this._transform,o,new d.Cartesian3),orientation:{heading:this._headingRadius,pitch:this._pitchRadius,roll:0},endTransform:this._transform,complete:()=>{this._running=!0;let s;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((a,l)=>{if(!s){s=new Date().getTime();return}const h=(new Date().getTime()-s)/1e3;this._headingRadius+=h*d.Math.PI*2/this.cycle,e.lookAtTransform(this._transform,new d.HeadingPitchRange(this._headingRadius,this._pitchRadius,this.distance)),s=new Date().getTime()})},duration:.5,maximumHeight:e.positionCartographic.height})}cancel(){if(!this._running)return;this.viewer.camera.lookAtTransform(d.Matrix4.IDENTITY),this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1}}class RD extends c.Destroyable{constructor(e){super();v(this,"_position",this.dv(c.reactArrayWithUndefined(void 0)));v(this,"_distance",this.dv(c.react(5e4)));v(this,"_cycle",this.dv(c.react(60)));v(this,"_heading",this.dv(c.react(0)));v(this,"_pitch",this.dv(c.react(-30)));v(this,"_inner");this._czmViewer=e;const n=this._czmViewer.viewer;if(!n)throw new Error("viewer is undefined");this._inner=this.dv(new DD(n));{const r=()=>{this.inner.distance=this.distance,this.inner.cycle=this.cycle,this.inner.position=this.position,this.inner.heading=this.heading,this.inner.pitch=this.pitch};r(),this.d(this.distanceChanged.don(r)),this.d(this.cycleChanged.don(r)),this.d(this.positionChanged.don(r)),this.d(this.headingChanged.don(r)),this.d(this.pitchChanged.don(r))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get distance(){return this._distance.value}set distance(e){this._distance.value=e}get distanceChanged(){return this._distance.changed}get cycle(){return this._cycle.value}set cycle(e){this._cycle.value=e}get cycleChanged(){return this._cycle.changed}get heading(){return this._heading.value}set heading(e){this._heading.value=e}get headingChanged(){return this._heading.changed}get pitch(){return this._pitch.value}set pitch(e){this._pitch.value=e}get pitchChanged(){return this._pitch.changed}get inner(){return this._inner}start(){return this._inner.start()}cancel(){return this._inner.cancel()}}class xD extends c.Destroyable{constructor(e){super();v(this,"_firstPersonController");v(this,"_rotateGlobe");v(this,"_rotatePoint");v(this,"_followController");v(this,"_pathCameraController");v(this,"_handler");this._viewer=e;{this._firstPersonController=this.dv(new PD(e)),this.d(this._viewer.keyDownEvent.don(n=>this._firstPersonController.keyboardCameraController.keyDown(n))),this.d(this._viewer.keyUpEvent.don(n=>this._firstPersonController.keyboardCameraController.keyUp(n)));{const{subContainer:n}=this._viewer;if(!n)throw new Error("_firstPersonControllerInit error!");const r=()=>this._firstPersonController.keyboardCameraController.abort();n.addEventListener("blur",r,!1),this.d(()=>n.removeEventListener("blur",r,!1))}this._firstPersonController.keyboardEnabled=!1,this._firstPersonController.mouseEnabled=!1,this._firstPersonController.keyboardCameraController.speed=1,this._firstPersonController.keyboardCameraController.rotateSpeed=.01,this._firstPersonController.keyboardCameraController.alwaysWithCamera=!1,this._firstPersonController.keyboardCameraController.keyStatusMap=uh.defaultKeyStatusMap,this.d(this._firstPersonController.keyboardEnabledChanged.don(()=>{var n;(n=this._viewer.subContainer)==null||n.focus()}))}this._rotateGlobe=this.dv(new bD(e)),this._rotatePoint=this.dv(new RD(e)),this._followController=this.dv(new da(e)),this._pathCameraController=this.dv(new ha(e))}get firstPersonController(){return this._firstPersonController}get rotateGlobe(){return this._rotateGlobe}get rotatePoint(){return this._rotatePoint}get followController(){return this._followController}get pathCameraController(){return this._pathCameraController}resetNavigation(){this._firstPersonController.keyboardEnabled=!1,this._rotateGlobe.cancel(),this._rotatePoint.cancel(),this._followController.enabled=!1,this._followController.sceneObjectId=void 0,this._followController.geoCameraController.offsetRotation=[-90,0,0],this._followController.geoCameraController.viewDistance=0,this._pathCameraController.enabled=!1,this._pathCameraController.polylinePath.playing=!1,this._pathCameraController.polylinePath.currentTime=0,this._pathCameraController.polylinePath.loop=!1,this._pathCameraController.geoCameraController.offsetHeight=0,this._pathCameraController.polylinePath.positions=void 0,this._pathCameraController.lineMode=void 0}changeToMap(){this.resetNavigation(),this._changedMouseEvent("Map")}changeToWalk(e,n=4.2){this.resetNavigation(),this._changedMouseEvent("Walk");const r=this._viewer.getCameraInfo(),o=[(r==null?void 0:r.rotation[0])??0,0,0];this._viewer.flyIn(e,o),this.firstPersonController.keyboardEnabled=!0,this.firstPersonController.keyboardCameraController.speed=.006,this.firstPersonController.keyboardCameraController.keyStatusMap={ShiftLeft:"WithCamera",ShiftRight:"WithCamera",KeyW:"MoveForward",KeyS:"MoveBackword",KeyA:"MoveLeft",KeyD:"MoveRight",ArrowUp:"MoveForward",ArrowDown:"MoveBackword",ArrowLeft:"RotateLeft",ArrowRight:"RotateRight",KeyR:"SpeedUp",KeyF:"SpeedDown",KeyQ:"SwitchAlwaysWithCamera"}}changeToRotateGlobe(e=38,n=1e7,r=60){this.resetNavigation(),this._changedMouseEvent("RotateGlobe"),this._rotateGlobe.latitude=e,this._rotateGlobe.height=n,this._rotateGlobe.cycle=r,this._rotateGlobe.start()}changeToRotatePoint(e,n=5e4,r=60,o=0,s=-30){this.resetNavigation(),this._changedMouseEvent("RotatePoint"),this._rotatePoint.position=e,this._rotatePoint.distance=n,this._rotatePoint.cycle=r,this._rotatePoint.heading=o,this._rotatePoint.pitch=s,this._rotatePoint.start()}changeToFollow(e,n=0,r=0,o=-30,s=!0){this.resetNavigation(),this._changedMouseEvent("Follow"),this._followController.sceneObjectId=e,this._followController.geoCameraController.offsetRotation=[r,o,0],this._followController.geoCameraController.relativeRotation=s,n!==0?this._followController.geoCameraController.viewDistance=n:this._followController.geoCameraController.viewDistance=1e3,this._followController.enabled=!0}changeToLine(e,n=10,r=10,o=!0,s=10,a="auto"){this.resetNavigation(),this._changedMouseEvent("Line");const l=a==="auto",h=w.ESSceneObject.getSceneObjById(e);if(!h)return;const{points:u}=h;if(!u)return;const p=w.getDistancesFromPositions(u,"NONE"),f=p[p.length-1];this._pathCameraController.viewDistance=0,this._pathCameraController.polylinePath.positions=[...u],this._pathCameraController.polylinePath.duration=f/n*1e3,this._pathCameraController.polylinePath.loop=o,this._pathCameraController.offsetHeight=r;const m=Xv(u);this._pathCameraController.polylinePath.rotationRadius=!l||m==!1?[0]:m.map(g=>g/s*n),this._pathCameraController.enabledRotationInput=!l,this._pathCameraController.enabledScaleInput=!1,this._pathCameraController.polylinePath.playing=l,this._pathCameraController.lineMode=a,this._pathCameraController.enabled=!0}_changedMouseEvent(e){const n=this._viewer.viewer;if(!n)return;this._handler||(this._handler=new d.ScreenSpaceEventHandler(n.scene.canvas));const r=this._handler,o=n.scene.screenSpaceCameraController;this.d(()=>{r&&b0(r)}),e=="Walk"||e=="RotateGlobe"?(o.lookEventTypes=void 0,o.rotateEventTypes=void 0,o.tiltEventTypes=void 0,o.zoomEventTypes=void 0,o.translateEventTypes=void 0,r&&e=="Walk"&&(r.setInputAction(s=>{r.setInputAction(a=>{Gu(n.scene,a,o)},d.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(a=>{r.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),r.removeInputAction(d.ScreenSpaceEventType.LEFT_UP)},d.ScreenSpaceEventType.LEFT_UP)},d.ScreenSpaceEventType.LEFT_DOWN),r.setInputAction(s=>{r.setInputAction(a=>{Gu(n.scene,a,o)},d.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(a=>{r.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),r.removeInputAction(d.ScreenSpaceEventType.RIGHT_UP)},d.ScreenSpaceEventType.RIGHT_UP)},d.ScreenSpaceEventType.RIGHT_DOWN),r.setInputAction(s=>{r.setInputAction(a=>{Gu(n.scene,a,o)},d.ScreenSpaceEventType.MOUSE_MOVE),r.setInputAction(a=>{r.removeInputAction(d.ScreenSpaceEventType.MOUSE_MOVE),r.removeInputAction(d.ScreenSpaceEventType.MIDDLE_UP)},d.ScreenSpaceEventType.MIDDLE_UP)},d.ScreenSpaceEventType.MIDDLE_DOWN))):(r&&b0(r),o.lookEventTypes=d.CameraEventType.RIGHT_DRAG,o.rotateEventTypes=d.CameraEventType.LEFT_DRAG,o.tiltEventTypes=[d.CameraEventType.MIDDLE_DRAG,d.CameraEventType.PINCH,{eventType:d.CameraEventType.LEFT_DRAG,modifier:d.KeyboardEventModifier.CTRL},{eventType:d.CameraEventType.RIGHT_DRAG,modifier:d.KeyboardEventModifier.CTRL}],o.translateEventTypes=d.CameraEventType.LEFT_DRAG,o.zoomEventTypes=[d.CameraEventType.WHEEL,d.CameraEventType.PINCH,{eventType:d.CameraEventType.RIGHT_DRAG,modifier:d.KeyboardEventModifier.SHIFT}])}}const FD=[{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3558367297943,39.93163726456884,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30223283037274,39.92688664316035,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.43707387584969,39.922782714050356,3300]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.27929428317248,39.895318074706246,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.36181901056395,39.89720944386167,3553.618347252562]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.40050587550184,39.87565113086582,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.31629153797958,39.88888615917464,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.38662084727662,39.93026695192356,5222.983612030221]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.35985958294472,39.879559968940974,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30061281533665,39.86521469244785,3500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.33589491695909,39.85251691437225,3400]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3978491755026,39.92191230041099,3e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.404556165088,39.901554635269065,3400]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.3371677114933,39.90666589456628,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.30329238580244,39.90598342431921,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.25047545555285,39.927295935589235,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.33129680063607,39.98205319015022,5500]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.38241622722414,39.864780790627634,5800]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.24126681456984,39.85629130246847,6e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.4476299820832,39.9015287845667,5233.181711832771]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.33116617802452,39.824241891065384,6e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.15206905891218,39.90872966468676,5e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.24197212869294,39.88630968655299,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.43381133281572,39.96058832885812,5700]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[4e4,1e4],position:[116.21635435523064,39.966450178376924,7e3]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.17908072725879,39.87211951629164,3200]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.32516866705241,39.94534681561764,3300]},{slice:-1,brightness:1,maximumSize:[25,9,10],color:[1,1,1,1],scale:[1e4,5e3],position:[116.36086721251684,39.948381883306446,3400]}];class kD extends c.Destroyable{constructor(e){super();v(this,"_show",this.dv(c.react(!1)));v(this,"cloudsPostProcess");const n=e.viewer;if(!n)throw new Error("Cesium Viewer is not initialized");const r=new d.CloudCollection;n.scene.primitives.add(r),this.dispose(()=>n.scene.primitives.remove(r));{const o=()=>{r.show=this.show};o(),this.dispose(this.showChanged.disposableOn(o))}{const o=a=>({slice:a.slice,brightness:a.brightness,scale:be(a.scale),maximumSize:Ri(a.maximumSize),color:se(a.color),position:Be(a.position)});(()=>{r.removeAll();for(let a of FD)r.add(o(a))})()}}get show(){return this._show.value}set show(e){this._show.value=e}get showChanged(){return this._show.changed}}class ua extends c.Destroyable{constructor(i){super();const e=i.viewer;if(!e){console.warn("viewer is undefined!");return}const n=e.scene.postProcessStages.add(d.PostProcessStageLibrary.createDepthOfFieldStage());this.d(()=>e.scene.postProcessStages.remove(n));{const r=()=>{n.enabled=this.show};r(),this.d(this.showChanged.don(r))}{const r=()=>{n.uniforms.fogByDistance=this.focalDistance};r(),this.d(this.focalDistanceChanged.don(r))}{const r=()=>{n.uniforms.delta=this.delta};r(),this.d(this.deltaChanged.don(r))}{const r=()=>{n.uniforms.sigma=this.sigma};r(),this.d(this.sigmaChanged.don(r))}{const r=()=>{n.uniforms.stepSize=this.stepSize};r(),this.d(this.stepSizeChanged.don(r))}}}(t=>{t.createDefaultProps=()=>({show:!1,focalDistance:87,delta:1,sigma:3.78,stepSize:2.46})})(ua||(ua={})),c.extendClassProps(ua.prototype,ua.createDefaultProps);const LD=`
|
|
740
740
|
float getDistance(sampler2D depthTexture, vec2 texCoords)
|
|
741
741
|
{
|
|
@@ -1473,7 +1473,7 @@ class CityShaderInstance extends xbsj['xr-base-utils'].Destroyable {
|
|
|
1473
1473
|
//material.diffuse = vec3(0.0, 0.0, 1.0);
|
|
1474
1474
|
//material.diffuse.g = -fsInput.attributes.positionEC.z / 1.0e4;
|
|
1475
1475
|
}
|
|
1476
|
-
`});this._customShader=r}update(){alert("暂未实现!")}get customShader(){return this._customShader}}const x3=(t,i)=>{if(!t)return;const e=6378137*Math.PI/180,[n,r,o]=t,a=1/(e*Math.cos(r*Math.PI/180));return[i[0]/a,i[1]/a,i[2]]},F3=(t,i)=>{const e=6378137*Math.PI/180,[n,r,o]=t,s=i,l=1/(e*Math.cos(r*Math.PI/180));return[n+l*s[0],r+l*s[1],o+s[2]]};function sd(t){return`rgba(${t[0]*255},${t[1]*255},${t[2]*255},${t[3]})`}function k3(t,i){const e=Reflect.has(t,"value"),n=Reflect.has(t,"minValue"),r=Reflect.has(t,"maxValue");try{const o=typeof t.value=="string"?`'${t.value}'`:t.value;if(e)return[`\${${i}} === `+o,sd(t.rgba)];if(n&&r)return[`\${${i}} >= ${t.minValue} && \${${i}} <= ${t.maxValue}`,sd(t.rgba)];if(n)return[`\${${i}} >= ${t.minValue}`,sd(t.rgba)];if(r)return[`\${${i}} <= ${t.maxValue}`,sd(t.rgba)];if(!e&&!n&&!r)throw new Error(`Feature Color JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, rgba值为0~1且必须存在!`)}catch(o){throw new Error(`Feature Color JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, rgba值为0~1且必须存在! ${o}`)}}function L3(t,i){const e=Reflect.has(t,"value"),n=Reflect.has(t,"minValue"),r=Reflect.has(t,"maxValue");try{const o=typeof t.value=="string"?`'${t.value}'`:t.value;if(e)return[`\${${i}} === `+o,t.visable.toString()];if(n&&r)return[`\${${i}} >= ${t.minValue} && \${${i}} <= ${t.maxValue}`,t.visable.toString()];if(n)return[`\${${i}} >= ${t.minValue}`,t.visable.toString()];if(r)return[`\${${i}} <= ${t.maxValue}`,t.visable.toString()];if(!e&&!n&&!r)throw new Error(`Feature Visable JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, visable必须存在!`)}catch(o){throw new Error(`Feature Visable JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, visable必须存在! ${o}`)}}const tl=class tl extends ci{constructor(e,n){super(e,n);v(this,"_czm3DTiles");v(this,"_clippingPlanes");v(this,"_flattenedPlane");v(this,"_styleColor",this.dv(c.react(void 0)));v(this,"_highlightStyleColor",this.dv(c.react(void 0)));v(this,"_styleVisable",this.dv(c.react(void 0)));this._flattenedPlane=this.dv(new ho(n,e.id)),this._czm3DTiles=this.dv(new De(n,this,e.id)),this._clippingPlanes=this.dv(new fs(n,e.id));const r=n.viewer;if(!r){console.warn("viewer is undefined!");return}const o=this._czm3DTiles;this.ad(e.setMaterialEvent.don(l=>{o.setMaterial(l)}));{const l=()=>{o.origin&&(e.offset||(e.offset=[0,0,0]),o.position=F3(o.origin,e.offset))};l(),this.d(e.offsetChanged.don(l)),this.d(o.originChanged.don(l))}{const l=()=>{if(!o.position)return;const u=o.position.map((p,f)=>{if(o.origin)return p-o.origin[f]});o.origin&&(e.offset=x3(o.origin,u))};l();const h=this.ad(c.createNextAnimateFrameEvent(o.positionChanged));this.d(h.don(l))}const s=this._clippingPlanes,a=this._flattenedPlane;this.d(e.setFeatureColorEvent.don((l,h)=>{const p=h.reverse().map(f=>k3(f,l));this.setFeatureColor(p)})),this.d(e.setFeatureVisableEvent.don((l,h)=>{const p=h.reverse().map(f=>L3(f,l));this.setFeatureVisable(p)})),this.d(e.resetFeatureStyleEvent.don(()=>{this.resetFeatureStyle()})),this.d(e.highlightFeatureEvent.don((l,h)=>{this.highlightFeature(l,h)})),this.d(e.highlightFeatureAndFlyToEvent.don((l,h,u,p)=>{u&&this.highlightFeature(l,u);const f=new d.Cartesian3(h[0],h[1],h[2]),m=new d.BoundingSphere(f,h[3]);r.camera.flyToBoundingSphere(m,{duration:p??1})})),this.d(o.czmTilesetReadyEvent.don(l=>{const h=u=>{if(l.style=void 0,u.length===0)return;const p=[...u],f=[],m=[];let g;p.forEach(y=>{Array.isArray(y.condition)?(f.push({condition:y.condition,color:y.color??[1,1,1,1]}),m.push({condition:y.condition,show:y.show??!0})):(f.push({condition:[y.condition],color:y.color??[1,1,1,1]}),m.push({condition:[y.condition],show:y.show??!0}))});{const y=(S,C)=>{try{let E;return f.forEach(T=>{if(E===void 0){const I=M3(T,S);I.length>0&&!I.includes(!1)&&(E=E3(T.color,C))}}),E||d.Color.clone(d.Color.WHITE,C)}catch{return d.Color.clone(d.Color.WHITE,C)}},P=S=>{try{let C;return m.forEach(E=>{if(C===void 0){const T=I3(E,S);T.length>0&&!T.includes(!1)&&(C=E.show)}}),C!==void 0?C:!0}catch{return!0}};g=new d.Cesium3DTileStyle({color:{evaluateColor:function(S,C){return y(S,C)}},show:{evaluate:function(S){return P(S)}}})}l.style=g};this.d(e.setFeatureStyleEvent.don(u=>{h(u)})),this.d(e.resetFeatureStyleEvent.don(()=>{l.style=void 0}));{const u=this,p=[],f=l.tileLoad.addEventListener(function(g){try{const P=g.content.getFeature(0),C=P.getPropertyIds().map(I=>{const D=P.getProperty(I);return{key:I,type:typeof D}}),E=p.map(I=>I.key),T=C.filter(I=>!E.includes(I.key));p.push(...T)}catch{}});this.d(()=>{f()});const m=async()=>{try{p.length>0?e._featureTableResultEvent.emit(p):e._featureTableResultEvent.emit(void 0)}catch(g){console.warn(`CzmES3DTileset GetFeatureTable: ${g}`),e._featureTableResultEvent.emit(void 0)}};u.d(e.getFeatureTableEvent.don(()=>{m()}))}{const u=p=>{o.tileset.featureIdLabel=`featureId_${p}`};this.ad(e.featureIdLabelChanged.don(p=>{u(p)}))}})),this.d(o.czmTilesetReadyEvent.don((l,h)=>{e.supportEdit=o.supportEdit,e.tilesetReady.emit(l)})),o.absoluteClippingPlanes=!0,o.czmFlattenedPlaneId=this.flattenedPlane.id,e.flattenedPlaneId=this.flattenedPlane.id,o.clippingPlanesId=this.clippingPlanes.id,this.d(c.track([a,"enabled"],[e,"flattenedPlaneEnabled"])),this.d(c.track([s,"enabled"],[e,"clippingPlaneEnabled"])),this.d(c.track([s,"planeIds"],[e,"clippingPlaneIds"])),this.d(c.track([s,"unionClippingRegions"],[e,"unionClippingRegions"])),this.d(c.track([s,"edgeColor"],[e,"clippingPlaneEdgeColor"])),this.d(c.track([s,"edgeWidth"],[e,"clippingPlaneEdgeWidth"])),this.d(e.clippingPlaneIdChanged.don(()=>{o.clippingPlanesId=e.clippingPlaneId})),this.d(e.excavateIdChanged.don(()=>{o.clippingPolygonsId=e.excavateId}));{const l=()=>{typeof e.url=="string"?e.url=w.ESSceneObject.context.getStrFromEnv(e.url):e.url&&(e.url.url=w.ESSceneObject.context.getStrFromEnv(e.url.url)),o.url=e.url};l(),this.d(e.urlChanged.don(l))}this.d(c.track([o,"show"],[e,"show"])),this.d(c.track([o,"colorBlendMode"],[e,"colorBlendMode"])),this.d(c.track([o,"cacheBytes"],[e,"cacheBytes"])),this.d(c.track([o,"maximumCacheOverflowBytes"],[e,"cacheBytes"])),this.d(c.track([o,"allowPicking"],[e,"allowPicking"])),this.d(c.bind([o,"imageBasedLightingFactor"],[e,"czmImageBasedLightingFactor"])),this.d(c.track([o,"environmentMapManager"],[e,"czmEnvironmentMapManager"])),this.d(c.track([o,"maximumScreenSpaceError"],[e,"maximumScreenSpaceError"])),this.d(c.track([o,"maximumMemoryUsage"],[e,"czmMaximumMemoryUsage"])),this.d(c.track([o,"classificationType"],[e,"czmClassificationType"])),this.d(c.track([o,"styleJson"],[e,"czmStyleJson"])),this.d(c.bind([o,"rotation"],[e,"rotation"])),this.d(c.track([o,"backFaceCulling"],[e,"czmBackFaceCulling"])),this.d(c.track([o,"debugShowBoundingVolume"],[e,"czmDebugShowBoundingVolume"])),this.d(c.track([o,"debugShowContentBoundingVolume"],[e,"czmDebugShowContentBoundingVolume"])),this.d(c.track([o,"skipLevelOfDetail"],[e,"czmSkipLevelOfDetail"]));{const l=h=>{e.czmEnvironmentMapManager=e.czmEnvironmentMapManager?{...e.czmEnvironmentMapManager,atmosphereScatteringIntensity:h}:{atmosphereScatteringIntensity:h}};l(e.czmAtmosphereScatteringIntensity),l(e.czmLuminanceAtZenith),this.ad(e.czmAtmosphereScatteringIntensityChanged.don(h=>l(h))),this.ad(e.czmLuminanceAtZenithChanged.don(h=>l(h)))}{const l=()=>{var h,u;(h=e.czmEnvironmentMapManager)!=null&&h.atmosphereScatteringIntensity&&(e.czmAtmosphereScatteringIntensity=e.czmLuminanceAtZenith=(u=e.czmEnvironmentMapManager)==null?void 0:u.atmosphereScatteringIntensity)};l(),this.ad(e.czmEnvironmentMapManagerChanged.don(l))}{const l=()=>{const h=e.materialMode??w.ES3DTileset.defaults.materialMode;LC=e.materialParams.baseColor??[1,1,1],h==="normal"?o.customShaderInstanceClass=void 0:h==="technology"&&(o.customShaderInstanceClass=void 0,o.customShaderInstanceClass=R3)};this.d(e.materialModeChanged.don(h=>{l()})),this.d(e.materialParamsChanged.don(()=>{l()})),l()}}get czm3DTiles(){return this._czm3DTiles}get clippingPlanes(){return this._clippingPlanes}get flattenedPlane(){return this._flattenedPlane}get styleColor(){return this._styleColor.value}set styleColor(e){this._styleColor.value=e}get highlightStyleColor(){return this._highlightStyleColor.value}set highlightStyleColor(e){this._highlightStyleColor.value=e}get styleVisable(){return this._styleVisable.value}set styleVisable(e){this._styleVisable.value=e}highlightFeature(e,n){const r=n??"rgba(255,0,0,1)",a=["${id} === "+(typeof e=="string"?`'${e}'`:e),r];let l={};const h=this.styleColor?[a,...this.styleColor]:[a];this.styleVisable?l={show:{conditions:[...this.styleVisable]},color:{conditions:[...h]}}:l={color:{conditions:[...h]}},console.log("style",l),this._czm3DTiles.styleJson=l,this.highlightStyleColor=[...a]}setFeatureColor(e){const n=this.highlightStyleColor,r=this.styleColor?[...e,...this.styleColor]:[...e];let o={};this.styleVisable?n?o={show:{conditions:[...this.styleVisable]},color:{conditions:[...r,n]}}:o={show:{conditions:[...this.styleVisable]},color:{conditions:[...r]}}:n?o={color:{conditions:[...r,n]}}:o={color:{conditions:[...r]}},console.log("style",o),this._czm3DTiles.styleJson=o,this.styleColor=[...r]}setFeatureVisable(e){let n={};const r=this.highlightStyleColor,o=this.styleVisable?[...e,...this.styleVisable]:[...e];this.styleColor?r?n={show:{conditions:[...o]},color:{conditions:[r,...this.styleColor]}}:n={show:{conditions:[...o]},color:{conditions:[...this.styleColor]}}:r?n={show:{conditions:[...o]},color:{conditions:[r]}}:n={show:{conditions:[...o]}},console.log("style",n),this._czm3DTiles.styleJson=n,this.styleVisable=[...o]}resetFeatureStyle(){this.czm3DTiles.styleJson=void 0,this.styleColor=void 0,this.highlightStyleColor=void 0,this.styleVisable=void 0}flyTo(e,n){const{sceneObject:r,czmViewer:o,czm3DTiles:s}=this;return o.actived?r.flyToParam||r.flyInParam?super.flyTo(e,n):(s.flyTo(e&&e*1e3),r.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(e,n){const{sceneObject:r,czmViewer:o,czm3DTiles:s}=this;return o.actived?r.flyInParam?super.flyIn(e,n):(s.flyTo(e&&e*1e3),r.flyOverEvent.emit(n,"over",o),!0):!1}};v(tl,"type",tl.register("ESCesiumViewer",w.ES3DTileset.type,tl));let ms=tl;const il=class il extends Ee{constructor(e,n){super(e,n);v(this,"_czmModelPrimitive");if(!n.viewer){console.warn("viewer is undefined!");return}const o=w.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/glb/warning/warning_b.glb"),s=w.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/glb/warning/warning_a.glb");this._czmModelPrimitive=this.disposeVar(new Ct(this.czmViewer,this.sceneObject.id));const a=this._czmModelPrimitive;this.ad(c.bind([a,"position"],[e,"position"])),this.ad(ht([a,"rotation"],[e,"rotation"])),this.ad(c.track([a,"show"],[e,"show"])),a.activeAnimationsAnimateWhilePaused=!0,a.activeAnimationsJson=w.ESAlarm.defaults.czmAnimations;{const l=this.dv(c.createNextAnimateFrameEvent(e.allowPickingChanged,e.editingChanged)),h=()=>{e.allowPicking&&!e.editing?a.allowPicking=!0:a.allowPicking=!1};h(),this.d(l.don(h))}{const l=()=>{const h=e.mode;h==="circle"?a.url=o:(h==="cylinder"||h===void 0)&&(a.url=s)};l(),this.dispose(e.modeChanged.disposableOn(()=>{l()}))}{const l=()=>{const u=e.radius??w.ESAlarm.defaults.radius;a.scale=[u*e.scale[0],u*e.scale[1],u*e.scale[2]]};l();const h=this.dv(c.createNextAnimateFrameEvent(e.radiusChanged,e.scaleChanged));this.dispose(h.disposableOn(()=>{l()}))}}get czmModelPrimitive(){return this._czmModelPrimitive}flyTo(e,n){const{sceneObject:r,czmViewer:o,czmModelPrimitive:s}=this;return!o.actived||!o.viewer?!1:r.flyToParam||r.flyInParam?super.flyTo(e,n):(s&&Gt(o,r,n,e,s,!0),!0)}};v(il,"type",il.register("ESCesiumViewer",w.ESAlarm.type,il));let Kp=il;const nl=class nl extends Ee{constructor(e,n){super(e,n);v(this,"_czmCustomPrimitive");if(this._czmCustomPrimitive=this.disposeVar(new Ue(n,this.sceneObject.id)),!n.viewer){console.warn("viewer is undefined!");return}const{czmCustomPrimitive:o}=this;this.dispose(c.track([o,"show"],[e,"show"])),this.dispose(c.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(ht([o,"rotation"],[e,"rotation"])),this.dispose(c.bind([o,"position"],[e,"position"])),this.dispose(c.track([o,"scale"],[e,"scale"])),o.indexTypedArray=new Uint16Array([0,1,2,0,2,3]),o.uniformMap={u_color:[0,.7,1,1]},o.fragmentShaderSource=`
|
|
1476
|
+
`});this._customShader=r}update(){alert("暂未实现!")}get customShader(){return this._customShader}}const x3=(t,i)=>{if(!t)return;const e=6378137*Math.PI/180,[n,r,o]=t,a=1/(e*Math.cos(r*Math.PI/180));return[i[0]/a,i[1]/a,i[2]]},F3=(t,i)=>{const e=6378137*Math.PI/180,[n,r,o]=t,s=i,l=1/(e*Math.cos(r*Math.PI/180));return[n+l*s[0],r+l*s[1],o+s[2]]};function sd(t){return`rgba(${t[0]*255},${t[1]*255},${t[2]*255},${t[3]})`}function k3(t,i){const e=Reflect.has(t,"value"),n=Reflect.has(t,"minValue"),r=Reflect.has(t,"maxValue");try{const o=typeof t.value=="string"?`'${t.value}'`:t.value;if(e)return[`\${${i}} === `+o,sd(t.rgba)];if(n&&r)return[`\${${i}} >= ${t.minValue} && \${${i}} <= ${t.maxValue}`,sd(t.rgba)];if(n)return[`\${${i}} >= ${t.minValue}`,sd(t.rgba)];if(r)return[`\${${i}} <= ${t.maxValue}`,sd(t.rgba)];if(!e&&!n&&!r)throw new Error(`Feature Color JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, rgba值为0~1且必须存在!`)}catch(o){throw new Error(`Feature Color JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, rgba值为0~1且必须存在! ${o}`)}}function L3(t,i){const e=Reflect.has(t,"value"),n=Reflect.has(t,"minValue"),r=Reflect.has(t,"maxValue");try{const o=typeof t.value=="string"?`'${t.value}'`:t.value;if(e)return[`\${${i}} === `+o,t.visable.toString()];if(n&&r)return[`\${${i}} >= ${t.minValue} && \${${i}} <= ${t.maxValue}`,t.visable.toString()];if(n)return[`\${${i}} >= ${t.minValue}`,t.visable.toString()];if(r)return[`\${${i}} <= ${t.maxValue}`,t.visable.toString()];if(!e&&!n&&!r)throw new Error(`Feature Visable JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, visable必须存在!`)}catch(o){throw new Error(`Feature Visable JSON错误,${t}中至少应该有一个属性,value|minValue|maxValue, visable必须存在! ${o}`)}}const tl=class tl extends ci{constructor(e,n){super(e,n);v(this,"_czm3DTiles");v(this,"_clippingPlanes");v(this,"_flattenedPlane");v(this,"_styleColor",this.dv(c.react(void 0)));v(this,"_highlightStyleColor",this.dv(c.react(void 0)));v(this,"_styleVisable",this.dv(c.react(void 0)));this._flattenedPlane=this.dv(new ho(n,e.id)),this._czm3DTiles=this.dv(new De(n,this,e.id)),this._clippingPlanes=this.dv(new fs(n,e.id));const r=n.viewer;if(!r){console.warn("viewer is undefined!");return}const o=this._czm3DTiles;this.ad(e.setMaterialEvent.don(l=>{o.setMaterial(l)}));{const l=()=>{o.origin&&(e.offset||(e.offset=[0,0,0]),o.position=F3(o.origin,e.offset))};l(),this.d(e.offsetChanged.don(l)),this.d(o.originChanged.don(l))}{const l=()=>{if(!o.position)return;const u=o.position.map((p,f)=>{if(o.origin)return p-o.origin[f]});o.origin&&(e.offset=x3(o.origin,u))};l();const h=this.ad(c.createNextAnimateFrameEvent(o.positionChanged));this.d(h.don(l))}const s=this._clippingPlanes,a=this._flattenedPlane;this.d(e.setFeatureColorEvent.don((l,h)=>{const p=h.reverse().map(f=>k3(f,l));this.setFeatureColor(p)})),this.d(e.setFeatureVisableEvent.don((l,h)=>{const p=h.reverse().map(f=>L3(f,l));this.setFeatureVisable(p)})),this.d(e.resetFeatureStyleEvent.don(()=>{this.resetFeatureStyle()})),this.d(e.highlightFeatureEvent.don((l,h)=>{this.highlightFeature(l,h)})),this.d(e.highlightFeatureAndFlyToEvent.don((l,h,u,p)=>{u&&this.highlightFeature(l,u);const f=new d.Cartesian3(h[0],h[1],h[2]),m=new d.BoundingSphere(f,h[3]);r.camera.flyToBoundingSphere(m,{duration:p??1})})),this.d(o.czmTilesetReadyEvent.don(l=>{const h=u=>{if(l.style=void 0,u.length===0)return;const p=[...u],f=[],m=[];let g;p.forEach(y=>{Array.isArray(y.condition)?(f.push({condition:y.condition,color:y.color??[1,1,1,1]}),m.push({condition:y.condition,show:y.show??!0})):(f.push({condition:[y.condition],color:y.color??[1,1,1,1]}),m.push({condition:[y.condition],show:y.show??!0}))});{const y=(S,C)=>{try{let E;return f.forEach(T=>{if(E===void 0){const I=M3(T,S);I.length>0&&!I.includes(!1)&&(E=E3(T.color,C))}}),E||d.Color.clone(d.Color.WHITE,C)}catch{return d.Color.clone(d.Color.WHITE,C)}},P=S=>{try{let C;return m.forEach(E=>{if(C===void 0){const T=I3(E,S);T.length>0&&!T.includes(!1)&&(C=E.show)}}),C!==void 0?C:!0}catch{return!0}};g=new d.Cesium3DTileStyle({color:{evaluateColor:function(S,C){return y(S,C)}},show:{evaluate:function(S){return P(S)}}})}l.style=g};this.d(e.setFeatureStyleEvent.don(u=>{h(u)})),this.d(e.resetFeatureStyleEvent.don(()=>{l.style=void 0}));{const u=this,p=[],f=l.tileLoad.addEventListener(function(g){try{const P=g.content.getFeature(0),C=P.getPropertyIds().map(I=>{const D=P.getProperty(I);return{key:I,type:typeof D}}),E=p.map(I=>I.key),T=C.filter(I=>!E.includes(I.key));p.push(...T)}catch{}});this.d(()=>{f()});const m=async()=>{try{p.length>0?e._featureTableResultEvent.emit(p):e._featureTableResultEvent.emit(void 0)}catch(g){console.warn(`CzmES3DTileset GetFeatureTable: ${g}`),e._featureTableResultEvent.emit(void 0)}};u.d(e.getFeatureTableEvent.don(()=>{m()}))}{const u=p=>{o.tileset.featureIdLabel=`featureId_${p}`};this.ad(e.featureIdLabelChanged.don(p=>{u(p)}))}})),this.d(o.czmTilesetReadyEvent.don((l,h)=>{e.supportEdit=o.supportEdit,e.tilesetReady.emit(l)})),o.absoluteClippingPlanes=!0,o.czmFlattenedPlaneId=this.flattenedPlane.id,e.flattenedPlaneId=this.flattenedPlane.id,o.clippingPlanesId=this.clippingPlanes.id,this.d(c.track([a,"enabled"],[e,"flattenedPlaneEnabled"])),this.d(c.track([s,"enabled"],[e,"clippingPlaneEnabled"])),this.d(c.track([s,"planeIds"],[e,"clippingPlaneIds"])),this.d(c.track([s,"unionClippingRegions"],[e,"unionClippingRegions"])),this.d(c.track([s,"edgeColor"],[e,"clippingPlaneEdgeColor"])),this.d(c.track([s,"edgeWidth"],[e,"clippingPlaneEdgeWidth"])),this.d(e.clippingPlaneIdChanged.don(()=>{o.clippingPlanesId=e.clippingPlaneId})),this.d(e.excavateIdChanged.don(()=>{o.clippingPolygonsId=e.excavateId}));{const l=()=>{typeof e.url=="string"?e.url=w.ESSceneObject.context.getStrFromEnv(e.url):e.url&&(e.url.url=w.ESSceneObject.context.getStrFromEnv(e.url.url)),o.url=e.url};l(),this.d(e.urlChanged.don(l))}this.d(c.track([o,"show"],[e,"show"])),this.d(c.track([o,"colorBlendMode"],[e,"colorBlendMode"])),this.d(c.track([o,"cacheBytes"],[e,"cacheBytes"])),this.d(c.track([o,"maximumCacheOverflowBytes"],[e,"cacheBytes"])),this.d(c.track([o,"allowPicking"],[e,"allowPicking"])),this.d(c.bind([o,"imageBasedLightingFactor"],[e,"czmImageBasedLightingFactor"])),this.d(c.track([o,"environmentMapManager"],[e,"czmEnvironmentMapManager"])),this.d(c.track([o,"maximumScreenSpaceError"],[e,"maximumScreenSpaceError"])),this.d(c.track([o,"maximumMemoryUsage"],[e,"czmMaximumMemoryUsage"])),this.d(c.track([o,"classificationType"],[e,"czmClassificationType"])),this.d(c.track([o,"styleJson"],[e,"czmStyleJson"])),this.d(c.bind([o,"rotation"],[e,"rotation"])),this.d(c.track([o,"backFaceCulling"],[e,"czmBackFaceCulling"])),this.d(c.track([o,"debugShowBoundingVolume"],[e,"czmDebugShowBoundingVolume"])),this.d(c.track([o,"debugShowContentBoundingVolume"],[e,"czmDebugShowContentBoundingVolume"])),this.d(c.track([o,"skipLevelOfDetail"],[e,"czmSkipLevelOfDetail"])),this.ad(c.bind([o,"splitDirection"],[e,"splitDirection"]));{const l=h=>{e.czmEnvironmentMapManager=e.czmEnvironmentMapManager?{...e.czmEnvironmentMapManager,atmosphereScatteringIntensity:h}:{atmosphereScatteringIntensity:h}};l(e.czmAtmosphereScatteringIntensity),l(e.czmLuminanceAtZenith),this.ad(e.czmAtmosphereScatteringIntensityChanged.don(h=>l(h))),this.ad(e.czmLuminanceAtZenithChanged.don(h=>l(h)))}{const l=()=>{var h,u;(h=e.czmEnvironmentMapManager)!=null&&h.atmosphereScatteringIntensity&&(e.czmAtmosphereScatteringIntensity=e.czmLuminanceAtZenith=(u=e.czmEnvironmentMapManager)==null?void 0:u.atmosphereScatteringIntensity)};l(),this.ad(e.czmEnvironmentMapManagerChanged.don(l))}{const l=()=>{const h=e.materialMode??w.ES3DTileset.defaults.materialMode;LC=e.materialParams.baseColor??[1,1,1],h==="normal"?o.customShaderInstanceClass=void 0:h==="technology"&&(o.customShaderInstanceClass=void 0,o.customShaderInstanceClass=R3)};this.d(e.materialModeChanged.don(h=>{l()})),this.d(e.materialParamsChanged.don(()=>{l()})),l()}}get czm3DTiles(){return this._czm3DTiles}get clippingPlanes(){return this._clippingPlanes}get flattenedPlane(){return this._flattenedPlane}get styleColor(){return this._styleColor.value}set styleColor(e){this._styleColor.value=e}get highlightStyleColor(){return this._highlightStyleColor.value}set highlightStyleColor(e){this._highlightStyleColor.value=e}get styleVisable(){return this._styleVisable.value}set styleVisable(e){this._styleVisable.value=e}highlightFeature(e,n){const r=n??"rgba(255,0,0,1)",a=["${id} === "+(typeof e=="string"?`'${e}'`:e),r];let l={};const h=this.styleColor?[a,...this.styleColor]:[a];this.styleVisable?l={show:{conditions:[...this.styleVisable]},color:{conditions:[...h]}}:l={color:{conditions:[...h]}},console.log("style",l),this._czm3DTiles.styleJson=l,this.highlightStyleColor=[...a]}setFeatureColor(e){const n=this.highlightStyleColor,r=this.styleColor?[...e,...this.styleColor]:[...e];let o={};this.styleVisable?n?o={show:{conditions:[...this.styleVisable]},color:{conditions:[...r,n]}}:o={show:{conditions:[...this.styleVisable]},color:{conditions:[...r]}}:n?o={color:{conditions:[...r,n]}}:o={color:{conditions:[...r]}},console.log("style",o),this._czm3DTiles.styleJson=o,this.styleColor=[...r]}setFeatureVisable(e){let n={};const r=this.highlightStyleColor,o=this.styleVisable?[...e,...this.styleVisable]:[...e];this.styleColor?r?n={show:{conditions:[...o]},color:{conditions:[r,...this.styleColor]}}:n={show:{conditions:[...o]},color:{conditions:[...this.styleColor]}}:r?n={show:{conditions:[...o]},color:{conditions:[r]}}:n={show:{conditions:[...o]}},console.log("style",n),this._czm3DTiles.styleJson=n,this.styleVisable=[...o]}resetFeatureStyle(){this.czm3DTiles.styleJson=void 0,this.styleColor=void 0,this.highlightStyleColor=void 0,this.styleVisable=void 0}flyTo(e,n){const{sceneObject:r,czmViewer:o,czm3DTiles:s}=this;return o.actived?r.flyToParam||r.flyInParam?super.flyTo(e,n):(s.flyTo(e&&e*1e3),r.flyOverEvent.emit(n,"over",o),!0):!1}flyIn(e,n){const{sceneObject:r,czmViewer:o,czm3DTiles:s}=this;return o.actived?r.flyInParam?super.flyIn(e,n):(s.flyTo(e&&e*1e3),r.flyOverEvent.emit(n,"over",o),!0):!1}};v(tl,"type",tl.register("ESCesiumViewer",w.ES3DTileset.type,tl));let ms=tl;const il=class il extends Ee{constructor(e,n){super(e,n);v(this,"_czmModelPrimitive");if(!n.viewer){console.warn("viewer is undefined!");return}const o=w.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/glb/warning/warning_b.glb"),s=w.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/glb/warning/warning_a.glb");this._czmModelPrimitive=this.disposeVar(new Ct(this.czmViewer,this.sceneObject.id));const a=this._czmModelPrimitive;this.ad(c.bind([a,"position"],[e,"position"])),this.ad(ht([a,"rotation"],[e,"rotation"])),this.ad(c.track([a,"show"],[e,"show"])),a.activeAnimationsAnimateWhilePaused=!0,a.activeAnimationsJson=w.ESAlarm.defaults.czmAnimations;{const l=this.dv(c.createNextAnimateFrameEvent(e.allowPickingChanged,e.editingChanged)),h=()=>{e.allowPicking&&!e.editing?a.allowPicking=!0:a.allowPicking=!1};h(),this.d(l.don(h))}{const l=()=>{const h=e.mode;h==="circle"?a.url=o:(h==="cylinder"||h===void 0)&&(a.url=s)};l(),this.dispose(e.modeChanged.disposableOn(()=>{l()}))}{const l=()=>{const u=e.radius??w.ESAlarm.defaults.radius;a.scale=[u*e.scale[0],u*e.scale[1],u*e.scale[2]]};l();const h=this.dv(c.createNextAnimateFrameEvent(e.radiusChanged,e.scaleChanged));this.dispose(h.disposableOn(()=>{l()}))}}get czmModelPrimitive(){return this._czmModelPrimitive}flyTo(e,n){const{sceneObject:r,czmViewer:o,czmModelPrimitive:s}=this;return!o.actived||!o.viewer?!1:r.flyToParam||r.flyInParam?super.flyTo(e,n):(s&&Gt(o,r,n,e,s,!0),!0)}};v(il,"type",il.register("ESCesiumViewer",w.ESAlarm.type,il));let Kp=il;const nl=class nl extends Ee{constructor(e,n){super(e,n);v(this,"_czmCustomPrimitive");if(this._czmCustomPrimitive=this.disposeVar(new Ue(n,this.sceneObject.id)),!n.viewer){console.warn("viewer is undefined!");return}const{czmCustomPrimitive:o}=this;this.dispose(c.track([o,"show"],[e,"show"])),this.dispose(c.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(ht([o,"rotation"],[e,"rotation"])),this.dispose(c.bind([o,"position"],[e,"position"])),this.dispose(c.track([o,"scale"],[e,"scale"])),o.indexTypedArray=new Uint16Array([0,1,2,0,2,3]),o.uniformMap={u_color:[0,.7,1,1]},o.fragmentShaderSource=`
|
|
1477
1477
|
in vec2 v_st;
|
|
1478
1478
|
uniform vec4 u_color;
|
|
1479
1479
|
void main()
|
|
@@ -2837,10 +2837,10 @@ void main()
|
|
|
2837
2837
|
{
|
|
2838
2838
|
out_FragColor = u_color;
|
|
2839
2839
|
}
|
|
2840
|
-
`,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},Ue,t)}class s4 extends c.HasOwner{constructor(i){super(i);const{czmViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const r=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const s=n=this._getStartInfo(o.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(o=>{n&&n.currentPlaneType!=="none"&&(r.restart(void 0,e,n),n=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{do{const s=this._getStartInfo(o.pointerEvent);if(!s||s.currentPlaneType==="none")break;const{currentPlaneType:a}=s,l=[...this.owner.selfRotation];l[Di.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(c.createProcessingFromAsyncFunc(async(i,e,n)=>{const r=this.owner.circles[n.currentPlaneType];e.incrementDisabledInputStack(),i.disposer.dispose(()=>e.decrementDisabledInputStack()),i.disposer.dispose(e.pointerMoveEvent.don(o=>{if(n&&o.pointerEvent){const{offsetX:s,offsetY:a}=o.pointerEvent,l=[s,a],{currentPlaneType:h}=n;if(h==="none")return;const u=this.owner.getPlane(h);if(!n.currentV)return;const p=u.pick(l);if(!p||!this.owner.cartesian)return;const f=d.Cartesian3.subtract(n.currentV,this.owner.cartesian,new d.Cartesian3);d.Cartesian3.normalize(f,f);const m=d.Cartesian3.subtract(p,this.owner.cartesian,new d.Cartesian3);if(d.Cartesian3.normalize(m,m),!u.normal||!u.origin)return;const g=ev(f,m,u.normal),y=ev(u.origin,f,u.normal),P=ev(u.origin,m,u.normal);{const S=[...this.owner.selfRotation];S[Di.rotationNum[h]]=n.startRotation+g,this.owner.selfRotation=S,r.circleStartRotation=y,r.circleEndRotation=P}}})),this.owner.movingPlaneType=n.currentPlaneType,i.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),i.disposer.dispose(()=>{r.circleStartRotation=0,r.circleEndRotation=0}),await c.step(i,o=>new Promise((s,a)=>{o.disposer.dispose(a),o.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),o.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(i,e,n,r,o){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,l=this.owner.getPlane(n).pick(r);if(!l)return;const h=d.Cartesian3.distance(s,l),u=o/4,p=u*3/128;if(!(h>=u-p&&h<=u+p))return;const m=d.Cartesian3.distance(e.camera.positionWC,l);i.currentD2c<=m||(i.currentPlaneType=n,i.currentD2c=m,i.currentV=l,i.startRotation=a[Di.rotationNum[n]])}_getStartInfo(i){var u;const{czmViewer:e}=this.owner,n=(u=e.viewer)==null?void 0:u.scene;if(!this.owner.position||!this.owner.cartesian)return;const r=an(n,this.owner.cartesian,this.owner.pixelSize);if(!r)return;const{offsetX:o,offsetY:s}=i,a=[o,s],l=i.pointerId,h={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(h,n,"heading",a,r),this._pickPlane(h,n,"pitch",a,r),this._pickPlane(h,n,"roll",a,r),h}}function ev(t,i,e){const n=d.Cartesian3.cross(i,t,new d.Cartesian3);if(n.equals(d.Cartesian3.ZERO))return 0;d.Cartesian3.normalize(n,n);const r=d.Cartesian3.dot(n,e);let o=Math.acos(d.Cartesian3.dot(t,i))*180/Math.PI;return o=r>0?o:-o,o}const Sr=class Sr extends ai{constructor(e){super();v(this,"_hoveredPlaneType",this.disposeVar(c.react("none")));v(this,"_movingPlaneType",this.disposeVar(c.react("none")));v(this,"_circles");v(this,"_czmCameraModel");v(this,"_cartesian");v(this,"_planes",{heading:this.disposeVar(new t4(this)),pitch:this.disposeVar(new i4(this)),roll:this.disposeVar(new n4(this))});v(this,"_rotatorRunningResetting");this._czmViewer=e;const n=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new c.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new s4(this)})),this._circles={heading:this._createRotatorCircle(n,"heading"),pitch:this._createRotatorCircle(n,"pitch"),roll:this._createRotatorCircle(n,"roll")},!!n.viewer){{const o=()=>{this._cartesian=this.position&&Be(this.position)||void 0};o(),this.dispose(this.positionChanged.disposableOn(o))}this._createCameraModel(n)}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get circles(){return this._circles}get czmCameraModel(){return this._czmCameraModel}get cartesian(){return this._cartesian}get czmViewer(){return this._czmViewer}getPlane(e){return this._planes[e]}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createCameraModel(e){this._czmCameraModel=new Ct(e),this._czmCameraModel.url="${earthsdk3-assets-script-dir}/assets/glb/camera1/camera1.gltf",this._czmCameraModel.localRotation=[90,0,0],this._czmCameraModel.allowPicking=!1,this._czmCameraModel.opaquePass="OVERLAY",this.dispose(c.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],n=>n*.1)),this.dispose(c.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(c.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const n=()=>{const r=Ve({rotation:this.selfRotation});if(!r)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=d.Matrix4.toArray(r))};n(),this.dispose(this.selfRotationChanged.disposableOn(n))}{const n=()=>{this.circles.heading.show=this.enabled,this.circles.pitch.show=this.enabled,this.circles.roll.show=this.enabled,this._czmCameraModel&&(this._czmCameraModel.show=this.enabled&&this.showHelper)};n(),this.dispose(this.enabledChanged.disposableOn(n)),this.dispose(this.showHelperChanged.disposableOn(n))}}_createRotatorCircle(e,n){const r=this.ad(new Fs(e));this.dispose(c.track([r,"position"],[this,"position"])),this.dispose(c.track([r,"pixelSize"],[this,"pixelSize"])),this.dispose(c.track([r,"debug"],[this,"debug"])),this.dispose(c.track([r,"rotation"],[this,"rotation"]));{const o=()=>{r.selfRotation=Sr.rotationFuncs[n](this.selfRotation),r.circleRotation=this.selfRotation[Sr.rotationNum[n]]};o(),this.dispose(this.selfRotationChanged.disposableOn(o))}{const o=()=>{const s=this.movingPlaneType===n,a=this.hoveredPlaneType===n,h=[0,0,0,s||a?1:.8];h[Sr.rotationNum[n]]=1,r.color=h};o(),this.dispose(this.movingPlaneTypeChanged.disposableOn(o)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(o))}return r}};v(Sr,"rotationNum",{heading:0,pitch:1,roll:2}),v(Sr,"rotationFuncs",{heading:([e,n,r])=>[0,0,0],pitch:([e,n,r])=>[e,0,-90],roll:([e,n,r])=>[e,n+90,0]});let Di=Sr;(t=>{t.createDefaultProps=()=>({...ai.createDefaultProps(),rotation:c.reactArray([0,0,0]),selfRotation:c.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(Di||(Di={})),c.extendClassProps(Di.prototype,Di.createDefaultProps);const Er=class Er extends c.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(i){this.positions=[i??Er.defaults.positions[0],this.stopPosition??Er.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(i){this.positions=[this.startPosition??Er.defaults.positions[0],i??Er.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(i,e){if(super(),!i.viewer)return;const r=this.ad(new ke(i,e));r.arcType="RHUMB";const o=this.ad(new pi(i,e));this.ad(c.track([r,"allowPicking"],[this,"allowPicking"])),this.ad(c.track([o,"allowPicking"],[this,"allowPicking"]));{const s=()=>{r.show=o.show=this.show};s(),this.ad(this.showChanged.don(s))}{const s=()=>{r.width=this.width/2,o.pixelSize=this.width};s(),this.ad(this.widthChanged.don(s))}{const s=()=>{r.color=o.color=this.color};s(),this.ad(this.colorChanged.don(s))}{const s=()=>{r.positions=this.positions,o.position=this.stopPosition};s(),this.dispose(this.startPositionChanged.disposableOn(s)),this.dispose(this.stopPositionChanged.disposableOn(s))}}};v(Er,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let mr=Er;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:c.reactPositions(t.defaults.positions),width:10,color:c.reactArray([1,0,0,1])})})(mr||(mr={})),c.extendClassProps(mr.prototype,mr.createDefaultProps);class bn extends ai{constructor(e){super();v(this,"_lastPosition");v(this,"_opInfo",{step:this.ad(c.react(!1)),moved:this.ad(c.react(!1)),constraintMode:this.disposeVar(c.react("none")),originPosition:this.disposeVar(c.reactArray([0,0,0])),originHeading:this.disposeVar(c.react(0)),originDimensions:this.disposeVar(c.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(c.reactArray([0,0,0])),movingPosition:this.disposeVar(c.reactArray([0,0,0])),targetPosition:this.disposeVar(c.reactArray([0,0,0])),targetHeading:this.disposeVar(c.react(0))});v(this,"_scaleAxis");v(this,"_pickingXYProcessing",e=>this.disposeVar(new c.Processing((n,r,o)=>{const s=[0,0,0],a=new d.Cartographic;return e.pointerMoveEvent.disposableOn(l=>{if(!l.pointerEvent||!e.viewer)return;const h=Ci(c.getDomEventCurrentTargetPos(l.pointerEvent));if(!Ir(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Tr(a,s),this._opInfo.constraintMode.value==="x"?Fo(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?Fo(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 u=[0,0,0];w.geoRhumbDestination(s,o,r,u),this._opInfo.targetPosition.value=u;let p=this.scale[0],f=this.scale[1];const m=w.geoDistance(u,this._opInfo.originPosition.value)-w.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...u];const g=this._opInfo.originDimensions.value[0]/100;m!=0&&this._opInfo.constraintMode.value==="y"&&(m>0?p+=g:p-=g),m!=0&&this._opInfo.constraintMode.value==="x"&&(m>0?f+=g:f-=g),p<=0&&(p+=g),f<=0&&(f+=g),this.scale=[p??1,f??1,this.scale[2]??1]})})));v(this,"_pickingZProcessing",e=>this.disposeVar(new c.Processing(()=>{const n=new d.Cartesian3,r=[0,0,0];return e.pointerMoveEvent.disposableOn(o=>{if(!o.pointerEvent||!e.viewer)return;const s=Ci(c.getDomEventCurrentTargetPos(o.pointerEvent));if(!Xc(e.viewer.scene,Be(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(pe(n,r)){this._opInfo.movingPosition.value=r;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],r[2]+a];let h=this.scale[2];const u=r[2]-this._lastPosition[2];this._lastPosition=[...r];const p=this._opInfo.originDimensions.value[0]/100;u!=0&&(u>0?h+=p:h-=p),h<=0&&(h+=p),this.scale=[this.scale[0]??1,this.scale[1]??1,h??1]}})})));const n=e.viewer;if(!n)return;const{scene:r}=n;this.ad(new jd(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={zAxis:this._createScaleAxis(e,"zAxis"),yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const h=()=>{if(!this._scaleAxis)return;const{zAxis:u,yAxis:p,xAxis:f}=this._scaleAxis,m=this._opInfo.constraintMode.value,g=this._opInfo.step;u.color=[0,0,1,.99],p.color=[0,1,0,.99],f.color=[1,0,0,.99],m==="x"?f.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="y"?p.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="z"&&(u.color=g?[1,1,0,.8]:[1,1,0,.99])};h(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(h)),this.dispose(this._opInfo.step.changed.disposableOn(h))}{const h=()=>{if(!this._scaleAxis)return;const{position:p=bn.defaults.position}=this,{zAxis:f,yAxis:m,xAxis:g}=this._scaleAxis;f.startPosition=m.startPosition=g.startPosition=p;const[y,P,S]=p;f.stopPosition=[y,P,S+this._opInfo.originDimensions.value[2]];const C=w.geoRhumbDestination(p,this._opInfo.originDimensions.value[0],90);C&&(g.stopPosition=C);const E=w.geoRhumbDestination(p,this._opInfo.originDimensions.value[1],0);E&&(m.stopPosition=E)};h();const u=this.ad(c.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(u.don(h))}{const h=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((u,p)=>u===this._opInfo.targetPosition.value[p])){this._opInfo.moved.value=!0;return}};h(),this.dispose(this._opInfo.originHeading.changed.disposableOn(h)),this.dispose(this._opInfo.originPosition.changed.disposableOn(h)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(h)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(h))}const o=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(c.createProcessingFromAsyncFunc(async h=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await c.step(h,async u=>{const p=()=>{const g=[...this.position??bn.defaults.position];e.editingHeightOffset&&(g[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=g};u.disposer.dispose((p(),this.positionChanged.disposableOn(p)));const f={constraintMode:"none",startDragPos:[0,0,0]},m=g=>{if(!this.position)return;const y={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Gd(g,r,y,this.axisSnapPixelSize,f),this._opInfo.constraintMode.value=f.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=f.startDragPos};u.disposer.dispose(e.pointerMoveEvent.disposableOn(g=>{g.pointerEvent&&m(g.pointerEvent)})),await c.step(u,g=>new Promise((y,P)=>{g.disposer.dispose(P),g.disposer.dispose(e.pointerDownEvent.don(S=>{S.pointerEvent&&m(S.pointerEvent),S.pointerEvent&&S.pointerEvent.button===0&&f.constraintMode!=="none"&&y()}))}))}),this._opInfo.step.value=!1,await c.step(h,async u=>{if(e.incrementDisabledInputStack(),u.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const p=w.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),f=w.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);o.restart(void 0,p,f),u.disposer.dispose(()=>o.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),u.disposer.dispose(()=>s.cancel()));await c.step(u,p=>new Promise((f,m)=>{p.disposer.dispose(m),p.disposer.dispose(e.pointerUpEvent.don(()=>{f()})),p.disposer.dispose(e.pointerOutEvent.don(()=>{f()}))})),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,n){const r=this.ad(new mr(e));return r.width=10,this.ad(c.track([r,"show"],[this,"enabled"])),r}}(t=>{t.createDefaultProps=()=>({...ai.createDefaultProps(),scale:c.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(bn||(bn={})),c.extendClassProps(bn.prototype,bn.createDefaultProps);const Ro=class Ro extends Nt{constructor(e){super();v(this,"_editingPoints",this.disposeVar(new c.ObservableArray));v(this,"_cancelEvent",this.disposeVar(new c.Event));v(this,"_currentProcess");v(this,"_menuPoiEnabled",this.disposeVar(c.react(!1)));v(this,"_status",this.disposeVar(c.react("None")));v(this,"_positionsChanged",this.ad(new c.Event));v(this,"_cursorInfo");this._czmViewer=e,this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(n=>{for(let{start:r,deleteCount:o,items:s}of n){for(const a of s)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=r;a<r+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(c.nextAnimateFrame(()=>{var r;((r=n.pointerEvent)==null?void 0:r.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(n=>{this._currentProcess&&(n?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const n=()=>{this.polylineShow=this.czmViewer.editingLineShow};n(),this.ad(this.czmViewer.editingLineShowChanged.don(n))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let n of this._editingPoints)n.position&&e.push([...n.position]);return e}resetPositions(e){if(this.enabled??Ro.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((r,o)=>r.every((s,a)=>{const l=this.editingPoints.get(o);return l.position&&l.position[a]===s})))}forceResetPositions(e){(this.enabled??Ro.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 ke(e));this.ad(c.track([n,"color"],[this,"polylineColor"])),this.ad(c.track([n,"width"],[this,"polylineWidth"])),this.ad(c.track([n,"show"],[this,"polylineShow"])),this.ad(c.track([n,"arcType"],[this,"polylineArcType"])),this.ad(c.track([n,"loop"],[this,"loop"]));{const r=()=>{const o=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,o.push(s);n.positions=o};r(),this.ad(this.positionsChanged.don(r))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new c.CursorInfo(e.container,c.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const r=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}r==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):r==="Modifying"||r==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):r==="None"&&(n.text="",n.show=!1)}}))}};v(Ro,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),v(Ro,"defaults",{...Nt.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:Ro.baseImageUrl+"point-green.png",otherControlPointImageUrl:Ro.baseImageUrl+"point-yellow.png"});let vi=Ro;(t=>{t.createDefaultProps=()=>({...Nt.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:c.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})})(vi||(vi={})),c.extendClassProps(vi.prototype,vi.createDefaultProps);let a4=0;class I1 extends c.Destroyable{constructor(e,n){super();v(this,"_position",this.disposeVar(c.reactArrayWithUndefined(void 0)));v(this,"_id",a4++);v(this,"_menuPoi");n&&(this.position=n),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const r=this._menuPoi=this.ad(new Hr(e.czmViewer));r.enabled=!1,this.ad(c.track([r,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){r.position=void 0;return}const s=[...this.position];s[2]-=e.czmViewer.editingHeightOffset??0,r.position=s,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const s=e.editingPoints.indexOf(this)+1;s!==0&&(r.title=`控制点${s}`,s===1?r.imageUri=e.firstControlPointImageUrl??vi.defaults.firstControlPointImageUrl:r.imageUri=e.otherControlPointImageUrl??vi.defaults.otherControlPointImageUrl)};o(),this.dispose(e.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class b1 extends I1{constructor(i,e){super(i,e)}}class rt extends vi{constructor(e){super(e);v(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new c.Event));v(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new bi(e));n.enabled=!1,this.currentProcess=this.disposeVar(c.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??rt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??rt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await r.promise(c.step(r,async o=>{const s=o.disposer,a=s.ad(this._addingEditingProcessing());s.dispose(()=>"adding canceled!"),s.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(l=>{s.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new b1(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??rt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},n=c.createProcessingFromAsyncFunc(async r=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await r.promise(c.step(r,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new l4(this,o)));const u=a.disposer.disposeVar(new h4(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>u.do())),await a.promise(new Promise(p=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(f=>{f?(o++,p(!0)):p(!1)})),a.disposer.dispose(u.overEvent.disposableOnce(f=>{f?(o--,p(!0)):p(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>p(!1)))}))})))break;while(!0)});return n.start(),n}}(t=>{t.createDefaultProps=()=>({...vi.createDefaultProps()})})(rt||(rt={})),c.extendClassProps(rt.prototype,rt.createDefaultProps);class l4 extends c.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new c.Event));const{placeEditing:r}=e;let o=new b1(e,void 0);e.editingPoints.splice(n,0,o);const s=()=>{(e.debug??rt.defaults.debug)&&console.log("delete currentPosEditor");const h=e.editingPoints.indexOf(o);if(h===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(h,1)};if(r.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(c.track([o,"position"],[r,"position"])),r.enabled=!0;let a=!1;const l=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{r.enabled=!1,!a&&l()}),this.dispose(r.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??rt.defaults.debug)&&console.log(`PointAdding creating! index(${n})`),this.dispose(()=>{(e.debug??rt.defaults.debug)&&console.log(`PointAdding destroying! index(${n})`)})}get overEvent(){return this._overEvent}}function c4(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 h4 extends c.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new c.Event));v(this,"_doEvent",this.disposeVar(new c.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(c4(e,n)))),(e.debug??rt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${n})`),this.dispose(()=>{(e.debug??rt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${n})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class D1 extends rt{constructor(i){super(i),this.loop=!1}}class R1 extends rt{constructor(i){super(i),this.loop=!0}}class Sd extends I1{constructor(i,e){super(i,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",ze.baseImageUrl+"add.png"],["delete","删除当前控制点","",ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ze.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(r=>{i.menuPoiCommand(this,r)})),this.dispose(n.dbclickEvent.disposableOn(()=>{i.menuPoiCommand(this,"dbClick")}))}if(i.middlePointShow){const n=this.ad(new Vi(i.czmViewer));{n.imageUri=i.firstControlPointImageUrl??ze.defaults.firstControlPointImageUrl,n.tooltip="点击增加一个控制点",n.bgColor=[0,0,0,.6],n.fgColor=[1,1,1,1],n.size=[8,8],n.originRatioAndOffset=[.5,.5,0,0];{const r=()=>{if(!(i.enabled??ze.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??ze.defaults.loop)&&s+1>=a)break;const h=this.position;if(!h)break;let u=(s+1)%a;const f=i.editingPoints.get(u).position;if(!f)break;const m=$d(h,f);if(!m)break;m[2]-=i.czmViewer.editingHeightOffset??0,n.position=m;const g=i.editingPoints.length<(i.maxPointsNum??ze.defaults.maxPointsNum);n.enabled=g,n.show=g;return}while(!1);n.enabled=!1,n.show=!1};r(),this.dispose(i.positionsChanged.disposableOn(r)),this.dispose(i.loopChanged.disposableOn(r)),this.dispose(i.enabledChanged.disposableOn(r))}this.dispose(n.clickEvent.disposableOn(r=>{if(r.button!==0||i.editingPoints.length>=(i.maxPointsNum??ze.defaults.maxPointsNum))return;const o=i.editingPoints.indexOf(this);if(o===-1)return;const s=n.position?[...n.position]:void 0;s&&(s[2]+=i.czmViewer.editingHeightOffset??0);let a=new Sd(i,s);i.editingPoints.splice(o+1,0,a),i.modify(a)}))}}}}class ze extends vi{constructor(e){super(e);v(this,"_menuPoiCommand",this.disposeVar(new c.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new c.Event));v(this,"_overEvent",this.disposeVar(new c.Event));v(this,"translationEditing");{const r=this.ad(c.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new c.ObjResettingWithEvent(r,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new d4(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new In(e));n.enabled=!1,this.currentProcess=this.disposeVar(c.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??ze.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??ze.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await r.promise(c.step(r,async s=>{const a=s.disposer,l=a.ad(new u4(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(u=>l.modify(u))),await s.promise(new Promise(u=>{a.dispose(l.overEvent.disposableOnce(p=>{u(p)}))}))})),o===-1){(this.debug??ze.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??ze.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??ze.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let l=o%this.editingPoints.length;const u=this.editingPoints.get(l).position;if(!u)return;const p=$d(a,u);if(!p)return;p&&(p[2]+=this.czmViewer.editingHeightOffset??0);let f=new Sd(this,p);this.editingPoints.splice(o,0,f)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,n){this._menuPoiCommand.emit(e,n)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new Sd(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...vi.createDefaultProps(),moveWithFirstPosition:!1})})(ze||(ze={})),c.extendClassProps(ze.prototype,ze.createDefaultProps);class d4 extends c.Destroyable{constructor(i,e){super(),this._firstPositionEditor=i,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,r)=>{if(n===void 0||r===void 0)return;var o=[n[0]-r[0],n[1]-r[1],n[2]-r[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const l=this.multiPointsModifyEditing.editingPoints.get(a),h=l.position;h!==void 0&&(l.position=[h[0]+o[0],h[1]+o[1],h[2]+o[2]])}})}}class u4 extends c.Destroyable{constructor(e){super();v(this,"_overEvent",this.disposeVar(new c.Event));v(this,"_cancelEvent",this.disposeVar(new c.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new c.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let n;const r=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(r);const o=s=>{r(),e.status="Modifying_Point",n=new p4(e,s),n.dispose(n.overEvent.disposableOn(()=>{r()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((s,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const 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")o(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 p4 extends c.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new c.Event));this._modifying=e,this._posEditor=n,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:r}=this._modifying;if(r.enabled=!0,r.heading=0,this.dispose(()=>{r.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");r.position=this._posEditor.position,this.dispose(c.track([this._posEditor,"position"],[r,"position"])),this.dispose(r.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class x1 extends ze{constructor(i){super(i),this.loop=!1}}class F1 extends ze{constructor(i){super(i),this.loop=!0}}class ks extends rt{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(r<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...rt.createDefaultProps(),startPosition:c.reactArrayWithUndefined(void 0),endPosition:c.reactArrayWithUndefined(void 0),rotation:c.reactArray([90,0,0]),distance:c.react(1)})})(ks||(ks={})),c.extendClassProps(ks.prototype,ks.createDefaultProps);class gr extends ze{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",ze.baseImageUrl+"add.png"],["delete","删除当前控制点","",ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ze.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","删除当前控制点","",ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ze.baseImageUrl+"modify.png"]];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(Math.abs(r)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...ze.createDefaultProps(),startPosition:c.reactArrayWithUndefined(void 0),endPosition:c.reactArrayWithUndefined(void 0),rotation:c.reactArray([0,0,0]),distance:c.react(0)})})(gr||(gr={})),c.extendClassProps(gr.prototype,gr.createDefaultProps);class k1 extends rt{constructor(i){super(i),this.loop=!1,this.polylineShow=!1}}class L1 extends ze{constructor(i){super(i),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Ls extends rt{constructor(i){super(i),i.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(i){const e=this.ad(new Ei(i));e.topOrBottom="bottom",this.ad(c.track([e,"color"],[this,"polylineColor"])),this.ad(c.track([e,"width"],[this,"polylineWidth"])),this.ad(c.track([e,"show"],[this,"polylineShow"])),this.ad(c.track([e,"arcType"],[this,"polylineArcType"])),this.ad(c.track([e,"loop"],[this,"loop"])),this.ad(c.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...rt.createDefaultProps(),visibilityPositions:c.reactPositionsSet(void 0)})})(Ls||(Ls={})),c.extendClassProps(Ls.prototype,Ls.createDefaultProps);class zs extends ze{constructor(i){if(super(i),!!i.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(i){const e=this.ad(new Ei(i));e.topOrBottom="bottom",this.ad(c.track([e,"color"],[this,"polylineColor"])),this.ad(c.track([e,"width"],[this,"polylineWidth"])),this.ad(c.track([e,"show"],[this,"polylineShow"])),this.ad(c.track([e,"arcType"],[this,"polylineArcType"])),this.ad(c.track([e,"loop"],[this,"loop"])),this.ad(c.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...ze.createDefaultProps(),visibilityPositions:c.reactPositionsSet(void 0)})})(zs||(zs={})),c.extendClassProps(zs.prototype,zs.createDefaultProps);class z1 extends gr{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 Ft extends w.EngineObject{constructor(e,n,r){super(e,n,r??!0);v(this,"_supportEditing",this.disposeVar(c.react(!0)));v(this,"_currentEditing",this.disposeVar(c.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var o;if(this.currentEditing){if(this.currentEditing instanceof rt&&((o=this.currentEditing.currentProcess)!=null&&o.isRunning))if(this.currentEditing.currentProcess.cancel(),e!=null&&e.position){if(this.currentEditing.positions.length>1)return;e.position=this.currentEditing.positions[0]??[0,0,0],e!=null&&e.rotation&&(e.rotation=[0,0,0]),e!=null&&e.far&&(e.far=1),e!=null&&e.radius&&(e.radius=1),e!=null&&e.distance&&(e.distance=1)}else e.points=this.currentEditing.positions;this.currentEditing instanceof bi&&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 Mc=class Mc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new bi(e));this.ad(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)==2&&(n.enabled=!0)}));do{if(Reflect.has(i,"position")){this.ad(c.bind([n,"position"],[i,"position"])),n.enabled=!n.position||w.equalsN3(n.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};v(Mc,"type",Mc.registerEditing("ESCesiumViewer",w.ESJEditingMode.Place,Mc));let tv=Mc;const Ic=class Ic extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new Di(e));n.rotation=[90,0,0],this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);r&&(this.ad(c.bind([n,"position"],[r.czm3DTiles,"position"])),this.ad(c.bind([n,"selfRotation"],[i,"rotation"])))});break}if(Reflect.has(i,"position")&&Reflect.has(i,"rotation")){this.ad(c.bind([n,"position"],[i,"position"])),this.ad(c.bind([n,"selfRotation"],[i,"rotation"]));break}this.supportEditing=!1}while(!1)}};v(Ic,"type",Ic.registerEditing("ESCesiumViewer",w.ESJEditingMode.Rotation,Ic));let iv=Ic;const bc=class bc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new bn(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")&&Reflect.has(i,"scale")){this.ad(c.bind([n,"position"],[i,"position"])),this.ad(c.bind([n,"scale"],[i,"scale"]));break}this.supportEditing=!1}while(!1)}};v(bc,"type",bc.registerEditing("ESCesiumViewer",w.ESJEditingMode.Scale,bc));let nv=bc;const Dc=class Dc extends Ft{constructor(i,e){super(Array.isArray(i)?i[0]:i,e,!0);const n=this.currentEditing=this.ad(new In(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(i)){const r=[];for(let o=0;o<i.length;o++){const s=i[o];Reflect.has(s,"position")?r.push(s.position):s.points&&r.push(...s.points)}n.position=w.getMinMaxCorner(r).center,this.ad(n.positionChanged.disposableOn((o,s)=>{if(!(!o||!s)){var a=Ut({originPosition:s},[o])[0][0];i.forEach(l=>{if(Reflect.has(l,"position")){const h=Ut({originPosition:s},[l.position])[0][0];l.position=Un({originPosition:s},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const h=Ut({originPosition:s},l.points)[0];l.points=Un({originPosition:s},h.map(u=>[u[0]+a[0],u[1]+a[1],u[2]+a[2]]))[0]}})}}));break}if(Reflect.has(i,"position")){this.ad(c.bind([n,"position"],[i,"position"]));break}if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);this.ad(c.bind([n,"position"],[r.czm3DTiles,"position"]))});break}if(Reflect.has(i,"points")){if(i.points===void 0||i.points.length===0){this.destroy();break}n.position=w.getMinMaxCorner(i.points).center,this.ad(n.positionChanged.disposableOn((r,o)=>{if(r===void 0||o===void 0||i.points===void 0||i.points.length===0){this.destroy();return}var s=Ut({originPosition:o},[r])[0][0];const a=Ut({originPosition:o},i.points)[0];i.points=Un({originPosition:o},a.map(l=>[l[0]+s[0],l[1]+s[1],l[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};v(Dc,"type",Dc.registerEditing("ESCesiumViewer",w.ESJEditingMode.Translation,Dc));let Ed=Dc;const Rc=class Rc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ks(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")){this.ad(c.bind([n,"startPosition"],[i,"position"])),this.ad(ht([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(c.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(c.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(c.bind([n,"distance"],[i,"distance"]));break}const r=Be(i.position);if(d.Cartesian3.ZERO.equals(r)||!e.viewer)return;n.distance=an(e.viewer.scene,r,100)??1}while(!1);break}if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),this.ad(c.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(Rc,"type",Rc.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsAppend,Rc));let ov=Rc;const xc=class xc extends Ft{constructor(i,e){var o;if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new gr(e));do{if(Reflect.has(i,"position")){this.ad(c.bind([n,"startPosition"],[i,"position"])),this.ad(ht([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(c.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(c.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(c.bind([n,"distance"],[i,"distance"]));break}const s=Be(i.position);if(d.Cartesian3.ZERO.equals(s)||!e.viewer)return;n.distance=an(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(i,"points")&&((o=i.points)==null?void 0:o.length)==2){n.moveWithFirstPosition=!1;const s=()=>n.positions=i.points??[];s(),this.ad(i.pointsChanged.don(()=>!n.enabled&&s())),this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(c.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(xc,"type",xc.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsModify,xc));let rv=xc;const Fc=class Fc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new R1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Fc,"type",Fc.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularAppend,Fc));let sv=Fc;const kc=class kc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new F1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(kc,"type",kc.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularInsert,kc));let av=kc;const Lc=class Lc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new D1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Lc,"type",Lc.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringAppend,Lc));let lv=Lc;const zc=class zc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new x1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(zc,"type",zc.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringInsert,zc));let cv=zc;const Oc=class Oc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new k1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Oc,"type",Oc.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterAppend,Oc));let hv=Oc;const Nc=class Nc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new L1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Nc,"type",Nc.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterModify,Nc));let dv=Nc;const Vc=class Vc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new Ls(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Vc,"type",Vc.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityAppend,Vc));let uv=Vc;const Uc=class Uc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new zs(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Uc,"type",Uc.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityModify,Uc));let pv=Uc;const Gc=class Gc extends Ft{constructor(i,e){if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new z1(e));do{if(Reflect.has(i,"points")){const o=Reflect.has(i,"extrudedHeight"),s=Reflect.has(i,"height"),a=Reflect.has(i,"perPositionHeight")?i.perPositionHeight:!o,l=i instanceof w.ESClassification||i instanceof w.ESPolygonFence;let h=w.getMinMaxCorner(i.points).center,u=[...h],p=l?i.points[0][2]:0;a?o?u[2]=i.extrudedHeight:u[2]=i.height+p:(s&&(h[2]=i.height),o&&(u[2]=i.extrudedHeight)),n.startPosition=h,n.distance=u[2]-h[2],n.moveWithFirstPosition=!1;let f=[...h];this.ad(n.positionsChanged.don(()=>{n.positions.length===2&&(a?(i.points=i.points.map(m=>[m[0],m[1],m[2]+n.positions[0][2]-f[2]]),o?i.extrudedHeight=n.positions[1][2]:s&&(i.height=n.positions[1][2]-(l?n.positions[0][2]:0))):(s&&(i.height=n.positions[0][2]),o&&(i.extrudedHeight=n.positions[1][2])),f=[...n.positions[0]])}));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(c.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Gc,"type",Gc.registerEditing("ESCesiumViewer",w.ESJEditingMode.HeightModify,Gc));let fv=Gc;function O1(){const t=c.createProcessingFromAsyncFunc(async(i,e,n,r,o=!0)=>{const s=Array.isArray(r)?[...r]:[r],a=n.editingID;e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"start",add:{modes:s}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"end",add:{modes:s}}),t.isRunning&&t.cancel()};i.disposer.ad(l),i.disposer.ad(n.toDestroyEvent.don(l)),i.disposer.ad(e.keyDownEvent.don(u=>{u.code=="Escape"&&l()}));let h=0;do{const u=s[h%s.length],p=await c.step(i,async f=>{const m=f.disposer,g=w.EngineObject.contextEditing.getEngineObjConstructor(u,e.typeName);if(!g||!n.supportEditingModes().includes(u))return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;const y=new g(n,e);if(m.ad(()=>{!y.isDestroyed()&&y.destroy()}),y.supportEditing)e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"changed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;return await f.promise(new Promise(S=>{y.isDestroyed()&&S(!1),m.ad(y.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),S(!1)})),o&&(m.ad(e.keyDownEvent.don(C=>{C.code=="Space"&&(console.log(`编辑模式${u}结束`),S(!1))})),m.ad(e.dblclickEvent.don(()=>S(!0))))}))});if(o&&p||!o&&h==s.length-1||e.notSupportEditingCount==s.length)break;h++}while(!0)});return t}function N1(){const t=c.createProcessingFromAsyncFunc(async(i,e,n,r)=>{e.editingEvent.emit({objectIDs:n.map(a=>a.id.split("_")[0]),editingID:r,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:n.map(a=>a.id.split("_")[0]),editingID:r,type:"end"}),t.isRunning&&t.cancel()};i.disposer.ad(o),i.disposer.ad(e.keyDownEvent.don(a=>{a.code=="Escape"&&o()}));const s=new Ed(n,e);i.disposer.ad(()=>{!s.isDestroyed()&&s.destroy()}),await i.promise(new Promise(a=>{s.isDestroyed()&&a(),i.disposer.ad(s.toDestroyEvent.don(()=>{console.log("移动结束"),a()})),i.disposer.ad(e.dblclickEvent.don(()=>a()))}))});return t}x.copyright=void 0;try{const t="earthsdk3-cesium",i="3.0.8-beta.8",e="2025-06-19T03:35:37.000Z",n="北京西部世界科技有限公司",r="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="64fcc5c9e0b8dbfb173ac9ca2a0ed94573ba85f7",a=((Date.now()-1750304137e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${i}.${o.slice(0,8)}.${e} (距今${a}个小时)
|
|
2840
|
+
`,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},Ue,t)}class s4 extends c.HasOwner{constructor(i){super(i);const{czmViewer:e}=this.owner;let n;this.dispose(()=>this.owner.hoveredPlaneType="none");const r=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const s=n=this._getStartInfo(o.pointerEvent);s&&(this.owner.hoveredPlaneType=s.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(o=>{n&&n.currentPlaneType!=="none"&&(r.restart(void 0,e,n),n=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{do{const s=this._getStartInfo(o.pointerEvent);if(!s||s.currentPlaneType==="none")break;const{currentPlaneType:a}=s,l=[...this.owner.selfRotation];l[Di.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(c.createProcessingFromAsyncFunc(async(i,e,n)=>{const r=this.owner.circles[n.currentPlaneType];e.incrementDisabledInputStack(),i.disposer.dispose(()=>e.decrementDisabledInputStack()),i.disposer.dispose(e.pointerMoveEvent.don(o=>{if(n&&o.pointerEvent){const{offsetX:s,offsetY:a}=o.pointerEvent,l=[s,a],{currentPlaneType:h}=n;if(h==="none")return;const u=this.owner.getPlane(h);if(!n.currentV)return;const p=u.pick(l);if(!p||!this.owner.cartesian)return;const f=d.Cartesian3.subtract(n.currentV,this.owner.cartesian,new d.Cartesian3);d.Cartesian3.normalize(f,f);const m=d.Cartesian3.subtract(p,this.owner.cartesian,new d.Cartesian3);if(d.Cartesian3.normalize(m,m),!u.normal||!u.origin)return;const g=ev(f,m,u.normal),y=ev(u.origin,f,u.normal),P=ev(u.origin,m,u.normal);{const S=[...this.owner.selfRotation];S[Di.rotationNum[h]]=n.startRotation+g,this.owner.selfRotation=S,r.circleStartRotation=y,r.circleEndRotation=P}}})),this.owner.movingPlaneType=n.currentPlaneType,i.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),i.disposer.dispose(()=>{r.circleStartRotation=0,r.circleEndRotation=0}),await c.step(i,o=>new Promise((s,a)=>{o.disposer.dispose(a),o.disposer.dispose(e.pointerUpEvent.don(()=>{s()})),o.disposer.dispose(e.pointerOutEvent.don(()=>{s()}))}))}))}_pickPlane(i,e,n,r,o){const s=this.owner.cartesian;if(!s)return;const{selfRotation:a}=this.owner,l=this.owner.getPlane(n).pick(r);if(!l)return;const h=d.Cartesian3.distance(s,l),u=o/4,p=u*3/128;if(!(h>=u-p&&h<=u+p))return;const m=d.Cartesian3.distance(e.camera.positionWC,l);i.currentD2c<=m||(i.currentPlaneType=n,i.currentD2c=m,i.currentV=l,i.startRotation=a[Di.rotationNum[n]])}_getStartInfo(i){var u;const{czmViewer:e}=this.owner,n=(u=e.viewer)==null?void 0:u.scene;if(!this.owner.position||!this.owner.cartesian)return;const r=an(n,this.owner.cartesian,this.owner.pixelSize);if(!r)return;const{offsetX:o,offsetY:s}=i,a=[o,s],l=i.pointerId,h={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(h,n,"heading",a,r),this._pickPlane(h,n,"pitch",a,r),this._pickPlane(h,n,"roll",a,r),h}}function ev(t,i,e){const n=d.Cartesian3.cross(i,t,new d.Cartesian3);if(n.equals(d.Cartesian3.ZERO))return 0;d.Cartesian3.normalize(n,n);const r=d.Cartesian3.dot(n,e);let o=Math.acos(d.Cartesian3.dot(t,i))*180/Math.PI;return o=r>0?o:-o,o}const Sr=class Sr extends ai{constructor(e){super();v(this,"_hoveredPlaneType",this.disposeVar(c.react("none")));v(this,"_movingPlaneType",this.disposeVar(c.react("none")));v(this,"_circles");v(this,"_czmCameraModel");v(this,"_cartesian");v(this,"_planes",{heading:this.disposeVar(new t4(this)),pitch:this.disposeVar(new i4(this)),roll:this.disposeVar(new n4(this))});v(this,"_rotatorRunningResetting");this._czmViewer=e;const n=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new c.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new s4(this)})),this._circles={heading:this._createRotatorCircle(n,"heading"),pitch:this._createRotatorCircle(n,"pitch"),roll:this._createRotatorCircle(n,"roll")},!!n.viewer){{const o=()=>{this._cartesian=this.position&&Be(this.position)||void 0};o(),this.dispose(this.positionChanged.disposableOn(o))}this._createCameraModel(n)}}get hoveredPlaneType(){return this._hoveredPlaneType.value}set hoveredPlaneType(e){this._hoveredPlaneType.value=e}get hoveredPlaneTypeChanged(){return this._hoveredPlaneType.changed}get movingPlaneType(){return this._movingPlaneType.value}set movingPlaneType(e){this._movingPlaneType.value=e}get movingPlaneTypeChanged(){return this._movingPlaneType.changed}get circles(){return this._circles}get czmCameraModel(){return this._czmCameraModel}get cartesian(){return this._cartesian}get czmViewer(){return this._czmViewer}getPlane(e){return this._planes[e]}get rotatorRunningResetting(){return this._rotatorRunningResetting}_createCameraModel(e){this._czmCameraModel=new Ct(e),this._czmCameraModel.url="${earthsdk3-assets-script-dir}/assets/glb/camera1/camera1.gltf",this._czmCameraModel.localRotation=[90,0,0],this._czmCameraModel.allowPicking=!1,this._czmCameraModel.opaquePass="OVERLAY",this.dispose(c.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],n=>n*.1)),this.dispose(c.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(c.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const n=()=>{const r=Ve({rotation:this.selfRotation});if(!r)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=d.Matrix4.toArray(r))};n(),this.dispose(this.selfRotationChanged.disposableOn(n))}{const n=()=>{this.circles.heading.show=this.enabled,this.circles.pitch.show=this.enabled,this.circles.roll.show=this.enabled,this._czmCameraModel&&(this._czmCameraModel.show=this.enabled&&this.showHelper)};n(),this.dispose(this.enabledChanged.disposableOn(n)),this.dispose(this.showHelperChanged.disposableOn(n))}}_createRotatorCircle(e,n){const r=this.ad(new Fs(e));this.dispose(c.track([r,"position"],[this,"position"])),this.dispose(c.track([r,"pixelSize"],[this,"pixelSize"])),this.dispose(c.track([r,"debug"],[this,"debug"])),this.dispose(c.track([r,"rotation"],[this,"rotation"]));{const o=()=>{r.selfRotation=Sr.rotationFuncs[n](this.selfRotation),r.circleRotation=this.selfRotation[Sr.rotationNum[n]]};o(),this.dispose(this.selfRotationChanged.disposableOn(o))}{const o=()=>{const s=this.movingPlaneType===n,a=this.hoveredPlaneType===n,h=[0,0,0,s||a?1:.8];h[Sr.rotationNum[n]]=1,r.color=h};o(),this.dispose(this.movingPlaneTypeChanged.disposableOn(o)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(o))}return r}};v(Sr,"rotationNum",{heading:0,pitch:1,roll:2}),v(Sr,"rotationFuncs",{heading:([e,n,r])=>[0,0,0],pitch:([e,n,r])=>[e,0,-90],roll:([e,n,r])=>[e,n+90,0]});let Di=Sr;(t=>{t.createDefaultProps=()=>({...ai.createDefaultProps(),rotation:c.reactArray([0,0,0]),selfRotation:c.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(Di||(Di={})),c.extendClassProps(Di.prototype,Di.createDefaultProps);const Er=class Er extends c.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(i){this.positions=[i??Er.defaults.positions[0],this.stopPosition??Er.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(i){this.positions=[this.startPosition??Er.defaults.positions[0],i??Er.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(i,e){if(super(),!i.viewer)return;const r=this.ad(new ke(i,e));r.arcType="RHUMB";const o=this.ad(new pi(i,e));this.ad(c.track([r,"allowPicking"],[this,"allowPicking"])),this.ad(c.track([o,"allowPicking"],[this,"allowPicking"]));{const s=()=>{r.show=o.show=this.show};s(),this.ad(this.showChanged.don(s))}{const s=()=>{r.width=this.width/2,o.pixelSize=this.width};s(),this.ad(this.widthChanged.don(s))}{const s=()=>{r.color=o.color=this.color};s(),this.ad(this.colorChanged.don(s))}{const s=()=>{r.positions=this.positions,o.position=this.stopPosition};s(),this.dispose(this.startPositionChanged.disposableOn(s)),this.dispose(this.stopPositionChanged.disposableOn(s))}}};v(Er,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let mr=Er;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:c.reactPositions(t.defaults.positions),width:10,color:c.reactArray([1,0,0,1])})})(mr||(mr={})),c.extendClassProps(mr.prototype,mr.createDefaultProps);class bn extends ai{constructor(e){super();v(this,"_lastPosition");v(this,"_opInfo",{step:this.ad(c.react(!1)),moved:this.ad(c.react(!1)),constraintMode:this.disposeVar(c.react("none")),originPosition:this.disposeVar(c.reactArray([0,0,0])),originHeading:this.disposeVar(c.react(0)),originDimensions:this.disposeVar(c.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(c.reactArray([0,0,0])),movingPosition:this.disposeVar(c.reactArray([0,0,0])),targetPosition:this.disposeVar(c.reactArray([0,0,0])),targetHeading:this.disposeVar(c.react(0))});v(this,"_scaleAxis");v(this,"_pickingXYProcessing",e=>this.disposeVar(new c.Processing((n,r,o)=>{const s=[0,0,0],a=new d.Cartographic;return e.pointerMoveEvent.disposableOn(l=>{if(!l.pointerEvent||!e.viewer)return;const h=Ci(c.getDomEventCurrentTargetPos(l.pointerEvent));if(!Ir(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Tr(a,s),this._opInfo.constraintMode.value==="x"?Fo(this._opInfo.originPosition.value,this._opInfo.originHeading.value,s,s):this._opInfo.constraintMode.value==="y"?Fo(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 u=[0,0,0];w.geoRhumbDestination(s,o,r,u),this._opInfo.targetPosition.value=u;let p=this.scale[0],f=this.scale[1];const m=w.geoDistance(u,this._opInfo.originPosition.value)-w.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...u];const g=this._opInfo.originDimensions.value[0]/100;m!=0&&this._opInfo.constraintMode.value==="y"&&(m>0?p+=g:p-=g),m!=0&&this._opInfo.constraintMode.value==="x"&&(m>0?f+=g:f-=g),p<=0&&(p+=g),f<=0&&(f+=g),this.scale=[p??1,f??1,this.scale[2]??1]})})));v(this,"_pickingZProcessing",e=>this.disposeVar(new c.Processing(()=>{const n=new d.Cartesian3,r=[0,0,0];return e.pointerMoveEvent.disposableOn(o=>{if(!o.pointerEvent||!e.viewer)return;const s=Ci(c.getDomEventCurrentTargetPos(o.pointerEvent));if(!Xc(e.viewer.scene,Be(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(pe(n,r)){this._opInfo.movingPosition.value=r;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],r[2]+a];let h=this.scale[2];const u=r[2]-this._lastPosition[2];this._lastPosition=[...r];const p=this._opInfo.originDimensions.value[0]/100;u!=0&&(u>0?h+=p:h-=p),h<=0&&(h+=p),this.scale=[this.scale[0]??1,this.scale[1]??1,h??1]}})})));const n=e.viewer;if(!n)return;const{scene:r}=n;this.ad(new jd(e,this.positionReact,this._opInfo.originDimensions,this.axisPixelSize)),this.ad(e.dblclickEvent.don(()=>{this.enabled=!1})),this._scaleAxis={zAxis:this._createScaleAxis(e,"zAxis"),yAxis:this._createScaleAxis(e,"yAxis"),xAxis:this._createScaleAxis(e,"xAxis")};{const h=()=>{if(!this._scaleAxis)return;const{zAxis:u,yAxis:p,xAxis:f}=this._scaleAxis,m=this._opInfo.constraintMode.value,g=this._opInfo.step;u.color=[0,0,1,.99],p.color=[0,1,0,.99],f.color=[1,0,0,.99],m==="x"?f.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="y"?p.color=g?[1,1,0,.8]:[1,1,0,.99]:m==="z"&&(u.color=g?[1,1,0,.8]:[1,1,0,.99])};h(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(h)),this.dispose(this._opInfo.step.changed.disposableOn(h))}{const h=()=>{if(!this._scaleAxis)return;const{position:p=bn.defaults.position}=this,{zAxis:f,yAxis:m,xAxis:g}=this._scaleAxis;f.startPosition=m.startPosition=g.startPosition=p;const[y,P,S]=p;f.stopPosition=[y,P,S+this._opInfo.originDimensions.value[2]];const C=w.geoRhumbDestination(p,this._opInfo.originDimensions.value[0],90);C&&(g.stopPosition=C);const E=w.geoRhumbDestination(p,this._opInfo.originDimensions.value[1],0);E&&(m.stopPosition=E)};h();const u=this.ad(c.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(u.don(h))}{const h=()=>{if(this._opInfo.constraintMode.value==="none"){this._opInfo.moved.value=!1;return}if(this._opInfo.originHeading.value!==this._opInfo.targetHeading.value){this._opInfo.moved.value=!0;return}if(!this._opInfo.originPosition.value.every((u,p)=>u===this._opInfo.targetPosition.value[p])){this._opInfo.moved.value=!0;return}};h(),this.dispose(this._opInfo.originHeading.changed.disposableOn(h)),this.dispose(this._opInfo.originPosition.changed.disposableOn(h)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(h)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(h))}const o=this._pickingXYProcessing(e),s=this._pickingZProcessing(e),a=this.disposeVar(c.createProcessingFromAsyncFunc(async h=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await c.step(h,async u=>{const p=()=>{const g=[...this.position??bn.defaults.position];e.editingHeightOffset&&(g[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=g};u.disposer.dispose((p(),this.positionChanged.disposableOn(p)));const f={constraintMode:"none",startDragPos:[0,0,0]},m=g=>{if(!this.position)return;const y={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Gd(g,r,y,this.axisSnapPixelSize,f),this._opInfo.constraintMode.value=f.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=f.startDragPos};u.disposer.dispose(e.pointerMoveEvent.disposableOn(g=>{g.pointerEvent&&m(g.pointerEvent)})),await c.step(u,g=>new Promise((y,P)=>{g.disposer.dispose(P),g.disposer.dispose(e.pointerDownEvent.don(S=>{S.pointerEvent&&m(S.pointerEvent),S.pointerEvent&&S.pointerEvent.button===0&&f.constraintMode!=="none"&&y()}))}))}),this._opInfo.step.value=!1,await c.step(h,async u=>{if(e.incrementDisabledInputStack(),u.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const p=w.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),f=w.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);o.restart(void 0,p,f),u.disposer.dispose(()=>o.cancel())}else this._opInfo.constraintMode.value==="z"&&(s.restart(),u.disposer.dispose(()=>s.cancel()));await c.step(u,p=>new Promise((f,m)=>{p.disposer.dispose(m),p.disposer.dispose(e.pointerUpEvent.don(()=>{f()})),p.disposer.dispose(e.pointerOutEvent.don(()=>{f()}))})),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,n){const r=this.ad(new mr(e));return r.width=10,this.ad(c.track([r,"show"],[this,"enabled"])),r}}(t=>{t.createDefaultProps=()=>({...ai.createDefaultProps(),scale:c.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(bn||(bn={})),c.extendClassProps(bn.prototype,bn.createDefaultProps);const Ro=class Ro extends Nt{constructor(e){super();v(this,"_editingPoints",this.disposeVar(new c.ObservableArray));v(this,"_cancelEvent",this.disposeVar(new c.Event));v(this,"_currentProcess");v(this,"_menuPoiEnabled",this.disposeVar(c.react(!1)));v(this,"_status",this.disposeVar(c.react("None")));v(this,"_positionsChanged",this.ad(new c.Event));v(this,"_cursorInfo");this._czmViewer=e,this.enabled=!1,this.createPolyline(e),this._createCursorInfo(e),this.dispose(()=>this.resetPositions()),this.dispose(()=>this.editingPoints.length=0),this.dispose(this.editingPoints.changedEvent.disposableOn(()=>this.positionsChanged.emit())),this.dispose(this.editingPoints.toChangeEvent.disposableOn(n=>{for(let{start:r,deleteCount:o,items:s}of n){for(const a of s)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=r;a<r+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let n of this.editingPoints)n.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(n=>{this.ad(c.nextAnimateFrame(()=>{var r;((r=n.pointerEvent)==null?void 0:r.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(n=>{this._currentProcess&&(n?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const n=()=>{this.polylineShow=this.czmViewer.editingLineShow};n(),this.ad(this.czmViewer.editingLineShowChanged.don(n))}}get editingPoints(){return this._editingPoints}get cancelEvent(){return this._cancelEvent}cancel(){this._cancelEvent.emit()}get currentProcess(){return this._currentProcess}set currentProcess(e){this._currentProcess=e}get menuPoiEnabled(){return this._menuPoiEnabled.value}set menuPoiEnabled(e){this._menuPoiEnabled.value=e}get menuPoiEnabledChanged(){return this._menuPoiEnabled.changed}get status(){return this._status.value}get statusChanged(){return this._status.changed}set status(e){this._status.value=e}getPositions(){const e=[];for(let n of this._editingPoints)n.position&&e.push([...n.position]);return e}resetPositions(e){if(this.enabled??Ro.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const n=e||[];return!(n.length===this.editingPoints.length&&n.every((r,o)=>r.every((s,a)=>{const l=this.editingPoints.get(o);return l.position&&l.position[a]===s})))}forceResetPositions(e){(this.enabled??Ro.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 ke(e));this.ad(c.track([n,"color"],[this,"polylineColor"])),this.ad(c.track([n,"width"],[this,"polylineWidth"])),this.ad(c.track([n,"show"],[this,"polylineShow"])),this.ad(c.track([n,"arcType"],[this,"polylineArcType"])),this.ad(c.track([n,"loop"],[this,"loop"]));{const r=()=>{const o=[];for(const s of this.getPositions())s[2]-=e.editingHeightOffset??0,o.push(s);n.positions=o};r(),this.ad(this.positionsChanged.don(r))}}_createCursorInfo(e){const n=this._cursorInfo=this.ad(new c.CursorInfo(e.container,c.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const r=this.status;if(n){if(!this.hideCursorInfo){n.show=!1;return}r==="Adding"?(n.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",n.show=!0):r==="Modifying"||r==="Modifying_Point"?(n.text="Esc键或左键双击:退出编辑状态",n.show=!0):r==="None"&&(n.text="",n.show=!1)}}))}};v(Ro,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),v(Ro,"defaults",{...Nt.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:Ro.baseImageUrl+"point-green.png",otherControlPointImageUrl:Ro.baseImageUrl+"point-yellow.png"});let vi=Ro;(t=>{t.createDefaultProps=()=>({...Nt.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:c.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})})(vi||(vi={})),c.extendClassProps(vi.prototype,vi.createDefaultProps);let a4=0;class I1 extends c.Destroyable{constructor(e,n){super();v(this,"_position",this.disposeVar(c.reactArrayWithUndefined(void 0)));v(this,"_id",a4++);v(this,"_menuPoi");n&&(this.position=n),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const r=this._menuPoi=this.ad(new Hr(e.czmViewer));r.enabled=!1,this.ad(c.track([r,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){r.position=void 0;return}const s=[...this.position];s[2]-=e.czmViewer.editingHeightOffset??0,r.position=s,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const s=e.editingPoints.indexOf(this)+1;s!==0&&(r.title=`控制点${s}`,s===1?r.imageUri=e.firstControlPointImageUrl??vi.defaults.firstControlPointImageUrl:r.imageUri=e.otherControlPointImageUrl??vi.defaults.otherControlPointImageUrl)};o(),this.dispose(e.editingPoints.changedEvent.disposableOn(o))}}get position(){return this._position.value}set position(e){this._position.value=e}get positionChanged(){return this._position.changed}get id(){return this._id}get menuPoi(){return this._menuPoi}}class b1 extends I1{constructor(i,e){super(i,e)}}class rt extends vi{constructor(e){super(e);v(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new c.Event));v(this,"placeEditing");if(!e.viewer)return;const n=this.placeEditing=this.ad(new bi(e));n.enabled=!1,this.currentProcess=this.disposeVar(c.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??rt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??rt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await r.promise(c.step(r,async o=>{const s=o.disposer,a=s.ad(this._addingEditingProcessing());s.dispose(()=>"adding canceled!"),s.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(l=>{s.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new b1(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??rt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},n=c.createProcessingFromAsyncFunc(async r=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await r.promise(c.step(r,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new l4(this,o)));const u=a.disposer.disposeVar(new h4(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>u.do())),await a.promise(new Promise(p=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(f=>{f?(o++,p(!0)):p(!1)})),a.disposer.dispose(u.overEvent.disposableOnce(f=>{f?(o--,p(!0)):p(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>p(!1)))}))})))break;while(!0)});return n.start(),n}}(t=>{t.createDefaultProps=()=>({...vi.createDefaultProps()})})(rt||(rt={})),c.extendClassProps(rt.prototype,rt.createDefaultProps);class l4 extends c.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new c.Event));const{placeEditing:r}=e;let o=new b1(e,void 0);e.editingPoints.splice(n,0,o);const s=()=>{(e.debug??rt.defaults.debug)&&console.log("delete currentPosEditor");const h=e.editingPoints.indexOf(o);if(h===-1)throw new Error("currentPosEditor not found");e.editingPoints.splice(h,1)};if(r.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(c.track([o,"position"],[r,"position"])),r.enabled=!0;let a=!1;const l=()=>{s(),this._overEvent.emit(!1)};this.dispose(()=>{r.enabled=!1,!a&&l()}),this.dispose(r.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??rt.defaults.debug)&&console.log(`PointAdding creating! index(${n})`),this.dispose(()=>{(e.debug??rt.defaults.debug)&&console.log(`PointAdding destroying! index(${n})`)})}get overEvent(){return this._overEvent}}function c4(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 h4 extends c.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new c.Event));v(this,"_doEvent",this.disposeVar(new c.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(c4(e,n)))),(e.debug??rt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${n})`),this.dispose(()=>{(e.debug??rt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${n})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class D1 extends rt{constructor(i){super(i),this.loop=!1}}class R1 extends rt{constructor(i){super(i),this.loop=!0}}class Sd extends I1{constructor(i,e){super(i,e);{const{menuPoi:n}=this;n.commands=[["add","增加控制点","",ze.baseImageUrl+"add.png"],["delete","删除当前控制点","",ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ze.baseImageUrl+"modify.png"]],n.clickCommandName="modify",n.rightClickCommandName="delete",this.dispose(n.commandEvent.disposableOn(r=>{i.menuPoiCommand(this,r)})),this.dispose(n.dbclickEvent.disposableOn(()=>{i.menuPoiCommand(this,"dbClick")}))}if(i.middlePointShow){const n=this.ad(new Vi(i.czmViewer));{n.imageUri=i.firstControlPointImageUrl??ze.defaults.firstControlPointImageUrl,n.tooltip="点击增加一个控制点",n.bgColor=[0,0,0,.6],n.fgColor=[1,1,1,1],n.size=[8,8],n.originRatioAndOffset=[.5,.5,0,0];{const r=()=>{if(!(i.enabled??ze.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??ze.defaults.loop)&&s+1>=a)break;const h=this.position;if(!h)break;let u=(s+1)%a;const f=i.editingPoints.get(u).position;if(!f)break;const m=$d(h,f);if(!m)break;m[2]-=i.czmViewer.editingHeightOffset??0,n.position=m;const g=i.editingPoints.length<(i.maxPointsNum??ze.defaults.maxPointsNum);n.enabled=g,n.show=g;return}while(!1);n.enabled=!1,n.show=!1};r(),this.dispose(i.positionsChanged.disposableOn(r)),this.dispose(i.loopChanged.disposableOn(r)),this.dispose(i.enabledChanged.disposableOn(r))}this.dispose(n.clickEvent.disposableOn(r=>{if(r.button!==0||i.editingPoints.length>=(i.maxPointsNum??ze.defaults.maxPointsNum))return;const o=i.editingPoints.indexOf(this);if(o===-1)return;const s=n.position?[...n.position]:void 0;s&&(s[2]+=i.czmViewer.editingHeightOffset??0);let a=new Sd(i,s);i.editingPoints.splice(o+1,0,a),i.modify(a)}))}}}}class ze extends vi{constructor(e){super(e);v(this,"_menuPoiCommand",this.disposeVar(new c.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new c.Event));v(this,"_overEvent",this.disposeVar(new c.Event));v(this,"translationEditing");{const r=this.ad(c.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new c.ObjResettingWithEvent(r,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new d4(this.editingPoints.get(0),this)}))}const n=this.translationEditing=this.disposeVar(new In(e));n.enabled=!1,this.currentProcess=this.disposeVar(c.createProcessingFromAsyncFunc(async r=>{r.disposer.dispose(()=>{(this.debug??ze.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??ze.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await r.promise(c.step(r,async s=>{const a=s.disposer,l=a.ad(new u4(this));return a.dispose(()=>"modifying canceled!"),this.editingPoints.length>0&&l.modify(this.editingPoints.get(o===-1||o>=this.editingPoints.length?0:o)),a.dispose(this.cancelEvent.disposableOn(()=>l.cancel())),a.dispose(this._forceModifyPosEditorEvent.disposableOn(u=>l.modify(u))),await s.promise(new Promise(u=>{a.dispose(l.overEvent.disposableOnce(p=>{u(p)}))}))})),o===-1){(this.debug??ze.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??ze.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??ze.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let l=o%this.editingPoints.length;const u=this.editingPoints.get(l).position;if(!u)return;const p=$d(a,u);if(!p)return;p&&(p[2]+=this.czmViewer.editingHeightOffset??0);let f=new Sd(this,p);this.editingPoints.splice(o,0,f)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,n){this._menuPoiCommand.emit(e,n)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const n=e?e.map(r=>new Sd(this,r)):[];return this.editingPoints.splice(0,this.editingPoints.length,...n),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...vi.createDefaultProps(),moveWithFirstPosition:!1})})(ze||(ze={})),c.extendClassProps(ze.prototype,ze.createDefaultProps);class d4 extends c.Destroyable{constructor(i,e){super(),this._firstPositionEditor=i,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((n,r)=>{if(n===void 0||r===void 0)return;var o=[n[0]-r[0],n[1]-r[1],n[2]-r[2]];const s=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<s;a++){const l=this.multiPointsModifyEditing.editingPoints.get(a),h=l.position;h!==void 0&&(l.position=[h[0]+o[0],h[1]+o[1],h[2]+o[2]])}})}}class u4 extends c.Destroyable{constructor(e){super();v(this,"_overEvent",this.disposeVar(new c.Event));v(this,"_cancelEvent",this.disposeVar(new c.Event));v(this,"_forceModifyPosEditorEvent",this.disposeVar(new c.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let n;const r=()=>{n==null||n.destroy(),n=void 0,e.status="Modifying"};this.dispose(r);const o=s=>{r(),e.status="Modifying_Point",n=new p4(e,s),n.dispose(n.overEvent.disposableOn(()=>{r()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((s,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const 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")o(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 p4 extends c.Destroyable{constructor(e,n){super();v(this,"_overEvent",this.disposeVar(new c.Event));this._modifying=e,this._posEditor=n,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:r}=this._modifying;if(r.enabled=!0,r.heading=0,this.dispose(()=>{r.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");r.position=this._posEditor.position,this.dispose(c.track([this._posEditor,"position"],[r,"position"])),this.dispose(r.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class x1 extends ze{constructor(i){super(i),this.loop=!1}}class F1 extends ze{constructor(i){super(i),this.loop=!0}}class ks extends rt{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(r<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...rt.createDefaultProps(),startPosition:c.reactArrayWithUndefined(void 0),endPosition:c.reactArrayWithUndefined(void 0),rotation:c.reactArray([90,0,0]),distance:c.react(1)})})(ks||(ks={})),c.extendClassProps(ks.prototype,ks.createDefaultProps);class gr extends ze{init(){const i=this.startPosition;if(!i)return;const e=this.distance,n=this.rotation,r=e*Math.cos(n[1]*Math.PI/180),o=w.geoDestination(i,r,n[0]);if(!o){this.positions=[i];return}const s=e*Math.sin(n[1]*Math.PI/180);o[2]+=s,this.positions=[i,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=i,this.editingPoints.get(1).position=o)}constructor(i){super(i),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",ze.baseImageUrl+"add.png"],["delete","删除当前控制点","",ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ze.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","删除当前控制点","",ze.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ze.baseImageUrl+"modify.png"]];const n=w.geoHeading(this.startPosition,this.endPosition),r=w.geoDistance(this.startPosition,this.endPosition);if(Math.abs(r)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],s=Math.atan(o/r)*180/Math.PI,a=Math.sqrt(r*r+o*o);this.rotation=[n,s,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...ze.createDefaultProps(),startPosition:c.reactArrayWithUndefined(void 0),endPosition:c.reactArrayWithUndefined(void 0),rotation:c.reactArray([0,0,0]),distance:c.react(0)})})(gr||(gr={})),c.extendClassProps(gr.prototype,gr.createDefaultProps);class k1 extends rt{constructor(i){super(i),this.loop=!1,this.polylineShow=!1}}class L1 extends ze{constructor(i){super(i),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class Ls extends rt{constructor(i){super(i),i.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(i){const e=this.ad(new Ei(i));e.topOrBottom="bottom",this.ad(c.track([e,"color"],[this,"polylineColor"])),this.ad(c.track([e,"width"],[this,"polylineWidth"])),this.ad(c.track([e,"show"],[this,"polylineShow"])),this.ad(c.track([e,"arcType"],[this,"polylineArcType"])),this.ad(c.track([e,"loop"],[this,"loop"])),this.ad(c.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...rt.createDefaultProps(),visibilityPositions:c.reactPositionsSet(void 0)})})(Ls||(Ls={})),c.extendClassProps(Ls.prototype,Ls.createDefaultProps);class zs extends ze{constructor(i){if(super(i),!!i.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const n=[...this.positions[0]];n[2]-=i.editingHeightOffset??0,this.visibilityPositions=this.positions.map(r=>(r[2]-=i.editingHeightOffset??0,[n,r]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(i){const e=this.ad(new Ei(i));e.topOrBottom="bottom",this.ad(c.track([e,"color"],[this,"polylineColor"])),this.ad(c.track([e,"width"],[this,"polylineWidth"])),this.ad(c.track([e,"show"],[this,"polylineShow"])),this.ad(c.track([e,"arcType"],[this,"polylineArcType"])),this.ad(c.track([e,"loop"],[this,"loop"])),this.ad(c.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...ze.createDefaultProps(),visibilityPositions:c.reactPositionsSet(void 0)})})(zs||(zs={})),c.extendClassProps(zs.prototype,zs.createDefaultProps);class z1 extends gr{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 Ft extends w.EngineObject{constructor(e,n,r){super(e,n,r??!0);v(this,"_supportEditing",this.disposeVar(c.react(!0)));v(this,"_currentEditing",this.disposeVar(c.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var o;if(this.currentEditing){if(this.currentEditing instanceof rt&&((o=this.currentEditing.currentProcess)!=null&&o.isRunning))if(this.currentEditing.currentProcess.cancel(),e!=null&&e.position){if(this.currentEditing.positions.length>1)return;e.position=this.currentEditing.positions[0]??[0,0,0],e!=null&&e.rotation&&(e.rotation=[0,0,0]),e!=null&&e.far&&(e.far=1),e!=null&&e.radius&&(e.radius=1),e!=null&&e.distance&&(e.distance=1)}else e.points=this.currentEditing.positions;this.currentEditing instanceof bi&&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 Mc=class Mc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new bi(e));this.ad(e.clickEvent.don(r=>{var o;((o=r.pointerEvent)==null?void 0:o.button)==2&&(n.enabled=!0)}));do{if(Reflect.has(i,"position")){this.ad(c.bind([n,"position"],[i,"position"])),n.enabled=!n.position||w.equalsN3(n.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};v(Mc,"type",Mc.registerEditing("ESCesiumViewer",w.ESJEditingMode.Place,Mc));let tv=Mc;const Ic=class Ic extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new Di(e));n.rotation=[90,0,0],this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);r&&(this.ad(c.bind([n,"position"],[r.czm3DTiles,"position"])),this.ad(c.bind([n,"selfRotation"],[i,"rotation"])))});break}if(Reflect.has(i,"position")&&Reflect.has(i,"rotation")){this.ad(c.bind([n,"position"],[i,"position"])),this.ad(c.bind([n,"selfRotation"],[i,"rotation"]));break}this.supportEditing=!1}while(!1)}};v(Ic,"type",Ic.registerEditing("ESCesiumViewer",w.ESJEditingMode.Rotation,Ic));let iv=Ic;const bc=class bc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new bn(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")&&Reflect.has(i,"scale")){this.ad(c.bind([n,"position"],[i,"position"])),this.ad(c.bind([n,"scale"],[i,"scale"]));break}this.supportEditing=!1}while(!1)}};v(bc,"type",bc.registerEditing("ESCesiumViewer",w.ESJEditingMode.Scale,bc));let nv=bc;const Dc=class Dc extends Ft{constructor(i,e){super(Array.isArray(i)?i[0]:i,e,!0);const n=this.currentEditing=this.ad(new In(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(i)){const r=[];for(let o=0;o<i.length;o++){const s=i[o];Reflect.has(s,"position")?r.push(s.position):s.points&&r.push(...s.points)}n.position=w.getMinMaxCorner(r).center,this.ad(n.positionChanged.disposableOn((o,s)=>{if(!(!o||!s)){var a=Ut({originPosition:s},[o])[0][0];i.forEach(l=>{if(Reflect.has(l,"position")){const h=Ut({originPosition:s},[l.position])[0][0];l.position=Un({originPosition:s},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const h=Ut({originPosition:s},l.points)[0];l.points=Un({originPosition:s},h.map(u=>[u[0]+a[0],u[1]+a[1],u[2]+a[2]]))[0]}})}}));break}if(Reflect.has(i,"position")){this.ad(c.bind([n,"position"],[i,"position"]));break}if(i instanceof w.ES3DTileset){w.registerCreatedEventUpdate(this,i,()=>{const r=e.getEngineObject(i);this.ad(c.bind([n,"position"],[r.czm3DTiles,"position"]))});break}if(Reflect.has(i,"points")){if(i.points===void 0||i.points.length===0){this.destroy();break}n.position=w.getMinMaxCorner(i.points).center,this.ad(n.positionChanged.disposableOn((r,o)=>{if(r===void 0||o===void 0||i.points===void 0||i.points.length===0){this.destroy();return}var s=Ut({originPosition:o},[r])[0][0];const a=Ut({originPosition:o},i.points)[0];i.points=Un({originPosition:o},a.map(l=>[l[0]+s[0],l[1]+s[1],l[2]+s[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};v(Dc,"type",Dc.registerEditing("ESCesiumViewer",w.ESJEditingMode.Translation,Dc));let Ed=Dc;const Rc=class Rc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new ks(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"position")){this.ad(c.bind([n,"startPosition"],[i,"position"])),this.ad(ht([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(c.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(c.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(c.bind([n,"distance"],[i,"distance"]));break}const r=Be(i.position);if(d.Cartesian3.ZERO.equals(r)||!e.viewer)return;n.distance=an(e.viewer.scene,r,100)??1}while(!1);break}if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),this.ad(c.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(Rc,"type",Rc.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsAppend,Rc));let ov=Rc;const xc=class xc extends Ft{constructor(i,e){var o;if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new gr(e));do{if(Reflect.has(i,"position")){this.ad(c.bind([n,"startPosition"],[i,"position"])),this.ad(ht([n,"rotation"],[i,"rotation"]));do{if(Reflect.has(i,"far")){this.ad(c.bind([n,"distance"],[i,"far"]));break}if(Reflect.has(i,"radius")){this.ad(c.bind([n,"distance"],[i,"radius"]));break}if(Reflect.has(i,"distance")){this.ad(c.bind([n,"distance"],[i,"distance"]));break}const s=Be(i.position);if(d.Cartesian3.ZERO.equals(s)||!e.viewer)return;n.distance=an(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(i,"points")&&((o=i.points)==null?void 0:o.length)==2){n.moveWithFirstPosition=!1;const s=()=>n.positions=i.points??[];s(),this.ad(i.pointsChanged.don(()=>!n.enabled&&s())),this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(c.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(xc,"type",xc.registerEditing("ESCesiumViewer",w.ESJEditingMode.DoublePointsModify,xc));let rv=xc;const Fc=class Fc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new R1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Fc,"type",Fc.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularAppend,Fc));let sv=Fc;const kc=class kc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new F1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(kc,"type",kc.registerEditing("ESCesiumViewer",w.ESJEditingMode.CircularInsert,kc));let av=kc;const Lc=class Lc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new D1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Lc,"type",Lc.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringAppend,Lc));let lv=Lc;const zc=class zc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new x1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(zc,"type",zc.registerEditing("ESCesiumViewer",w.ESJEditingMode.LineStringInsert,zc));let cv=zc;const Oc=class Oc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new k1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Oc,"type",Oc.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterAppend,Oc));let hv=Oc;const Nc=class Nc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new L1(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Nc,"type",Nc.registerEditing("ESCesiumViewer",w.ESJEditingMode.ScatterModify,Nc));let dv=Nc;const Vc=class Vc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new Ls(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Vc,"type",Vc.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityAppend,Vc));let uv=Vc;const Uc=class Uc extends Ft{constructor(i,e){super(i,e,!0);const n=this.currentEditing=this.ad(new zs(e));this.ad(n.enabledChanged.don(r=>{!r&&this.ad(c.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(i,"points")){const r=()=>n.positions=i.points??[];r(),this.ad(i.pointsChanged.don(()=>!n.enabled&&r())),n.enabled=!0,this.ad(c.track([i,"points"],[n,"positions"]));break}this.supportEditing=!1}while(!1)}};v(Uc,"type",Uc.registerEditing("ESCesiumViewer",w.ESJEditingMode.VisibilityModify,Uc));let pv=Uc;const Gc=class Gc extends Ft{constructor(i,e){if(super(i,e,!0),!e.viewer)return;const n=this.currentEditing=this.ad(new z1(e));do{if(Reflect.has(i,"points")){const o=Reflect.has(i,"extrudedHeight"),s=Reflect.has(i,"height"),a=Reflect.has(i,"perPositionHeight")?i.perPositionHeight:!o,l=i instanceof w.ESClassification||i instanceof w.ESPolygonFence;let h=w.getMinMaxCorner(i.points).center,u=[...h],p=l?i.points[0][2]:0;a?o?u[2]=i.extrudedHeight:u[2]=i.height+p:(s&&(h[2]=i.height),o&&(u[2]=i.extrudedHeight)),n.startPosition=h,n.distance=u[2]-h[2],n.moveWithFirstPosition=!1;let f=[...h];this.ad(n.positionsChanged.don(()=>{n.positions.length===2&&(a?(i.points=i.points.map(m=>[m[0],m[1],m[2]+n.positions[0][2]-f[2]]),o?i.extrudedHeight=n.positions[1][2]:s&&(i.height=n.positions[1][2]-(l?n.positions[0][2]:0))):(s&&(i.height=n.positions[0][2]),o&&(i.extrudedHeight=n.positions[1][2])),f=[...n.positions[0]])}));break}this.supportEditing=!1;return}while(!1);n.init(),n.enabled=!0;const r=this.ad(c.createNextAnimateFrameEvent(n.enabledChanged,n.startPositionChanged));this.ad(r.don(()=>{(!n.enabled||!n.startPosition||w.equalsN3(n.startPosition,[0,0,0]))&&this.destroy()}))}};v(Gc,"type",Gc.registerEditing("ESCesiumViewer",w.ESJEditingMode.HeightModify,Gc));let fv=Gc;function O1(){const t=c.createProcessingFromAsyncFunc(async(i,e,n,r,o=!0)=>{const s=Array.isArray(r)?[...r]:[r],a=n.editingID;e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"start",add:{modes:s}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"end",add:{modes:s}}),t.isRunning&&t.cancel()};i.disposer.ad(l),i.disposer.ad(n.toDestroyEvent.don(l)),i.disposer.ad(e.keyDownEvent.don(u=>{u.code=="Escape"&&l()}));let h=0;do{const u=s[h%s.length],p=await c.step(i,async f=>{const m=f.disposer,g=w.EngineObject.contextEditing.getEngineObjConstructor(u,e.typeName);if(!g||!n.supportEditingModes().includes(u))return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;const y=new g(n,e);if(m.ad(()=>{!y.isDestroyed()&&y.destroy()}),y.supportEditing)e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"changed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${u},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[n.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:u,cIndex:h}}),e.notSupportEditingCount++,!1;return await f.promise(new Promise(S=>{y.isDestroyed()&&S(!1),m.ad(y.toDestroyEvent.don(()=>{console.log(`编辑模式${u}结束`),S(!1)})),o&&(m.ad(e.keyDownEvent.don(C=>{C.code=="Space"&&(console.log(`编辑模式${u}结束`),S(!1))})),m.ad(e.dblclickEvent.don(()=>S(!0))))}))});if(o&&p||!o&&h==s.length-1||e.notSupportEditingCount==s.length)break;h++}while(!0)});return t}function N1(){const t=c.createProcessingFromAsyncFunc(async(i,e,n,r)=>{e.editingEvent.emit({objectIDs:n.map(a=>a.id.split("_")[0]),editingID:r,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:n.map(a=>a.id.split("_")[0]),editingID:r,type:"end"}),t.isRunning&&t.cancel()};i.disposer.ad(o),i.disposer.ad(e.keyDownEvent.don(a=>{a.code=="Escape"&&o()}));const s=new Ed(n,e);i.disposer.ad(()=>{!s.isDestroyed()&&s.destroy()}),await i.promise(new Promise(a=>{s.isDestroyed()&&a(),i.disposer.ad(s.toDestroyEvent.don(()=>{console.log("移动结束"),a()})),i.disposer.ad(e.dblclickEvent.don(()=>a()))}))});return t}x.copyright=void 0;try{const t="earthsdk3-cesium",i="3.2.0-beta.2",e="2025-06-20T09:39:24.000Z",n="北京西部世界科技有限公司",r="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="541f35d8eb94e9d6ae9e8f6de5f1aa5fb9895acd",a=((Date.now()-1750412364e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${i}.${o.slice(0,8)}.${e} (距今${a}个小时)
|
|
2841
2841
|
%c${r?r+`
|
|
2842
2842
|
`:""}当前网站正在使用${t},此软件版权归${n}所有
|
|
2843
|
-
`;x.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
2843
|
+
`;x.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","541f35d8eb94e9d6ae9e8f6de5f1aa5fb9895acd")},get info(){return l},get date(){return"2025-06-20T09:39:24.000Z"},get author(){return"suplyang"},get version(){return"3.2.0-beta.2"},get name(){return"earthsdk3-cesium"},get commitId(){return"541f35d8eb94e9d6ae9e8f6de5f1aa5fb9895acd"},print(){console.info(this.info,`
|
|
2844
2844
|
font-size: 18px;
|
|
2845
2845
|
font-weight: 1000;
|
|
2846
2846
|
line-height: 1;
|