earthsdk3-cesium 3.0.7-beta.15 → 3.0.7-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/earthsdk3-cesium.iife.js +6 -6
- package/dist/earthsdk3-cesium.js +1626 -1617
- package/dist/earthsdk3-cesium.umd.cjs +55 -55
- package/dist/types/CzmObjects/general/CzmESGeoDiv/index.d.ts.map +1 -1
- package/dist/types/CzmObjects/general/CzmESHumanPoi/index.d.ts.map +1 -1
- package/dist/types/CzmObjects/general/CzmESPoi2D/index.d.ts.map +1 -1
- package/dist/types/CzmObjects/general/CzmESSkylineAnalysis/index.d.ts.map +1 -1
- package/dist/types/ESCesiumViewer/ViewerExtensions/TerrainManager.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -962,7 +962,7 @@ void gaussianSplatStage(ProcessedAttributes attributes, inout vec4 positionClip)
|
|
|
962
962
|
`,Dl={GAUSSIAN_SPLATS:11},Db={name:"GaussianSplatPipelineStage"};Db.process=function(t,n,e){const{shaderBuilder:r}=t,s=t.renderStateOptions;s.cull.enabled=!1,s.depthMask=!1,s.depthTest.enabled=!1,s.blending=Me.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,t.alphaOptions.pass=Dl.GAUSSIAN_SPLATS,r.addDefine("HAS_GAUSSIAN_SPLATS",void 0,Me.ShaderDestination.BOTH),n.hasAttributeTexture&&r.addDefine("HAS_SPLAT_TEXTURE",void 0,Me.ShaderDestination.BOTH),r.addAttribute("vec2","a_screenQuadPosition"),r.addAttribute("vec3","a_splatPosition"),r.addAttribute("vec4","a_splatColor"),r.addVarying("vec4","v_splatColor"),r.addVarying("vec2","v_vertPos"),r.addVarying("float","v_splatOpacity"),r.addVarying("vec4","v_splatScale"),r.addVarying("vec4","v_splatRot"),r.addUniform("float","u_tan_fovX",Me.ShaderDestination.VERTEX),r.addUniform("float","u_tan_fovY",Me.ShaderDestination.VERTEX),r.addUniform("float","u_focalX",Me.ShaderDestination.VERTEX),r.addUniform("float","u_focalY",Me.ShaderDestination.VERTEX),r.addUniform("float","u_splatScale",Me.ShaderDestination.VERTEX),r.addUniform("mat4","u_scalingMatrix",Me.ShaderDestination.VERTEX);const o=t.uniformMap,i=e.camera,a=e.context.drawingBufferWidth,l=e.context.drawingBufferHeight,h=Math.tan(i.frustum.fov*.5),f=Math.tan(i.frustum.fovy*.5),u=a/(h*2),A=l/(f*2);o.u_tan_fovX=function(){return h},o.u_tan_fovY=function(){return f},o.u_focalX=function(){return u},o.u_focalY=function(){return A},o.u_splatScale=function(){var g,m;return((m=(g=t.model)==null?void 0:g.style)==null?void 0:m.splatScale)??1},o.u_scalingMatrix=function(){return t.model.sceneGraph.components.nodes[0].matrix},(()=>{const g=new Me.Matrix4,m=t.model.modelMatrix;Me.Matrix4.multiply(i.viewMatrix,m,g);const p=Me.ModelUtility.getAttributeBySemantic(n,Ie.POSITION),d=Me.ModelUtility.getAttributeBySemantic(n,Ie.SCALE),c=Me.ModelUtility.getAttributeBySemantic(n,Ie.ROTATION),y=Me.ModelUtility.getAttributeBySemantic(n,Ie.COLOR),w=p.typedArray,b=d.typedArray,_=c.typedArray,x=y.typedArray,C=new w.constructor(w.length),T=new b.constructor(b.length),I=new _.constructor(_.length),P=new x.constructor(x.length),k=U=>w[U*3]*g[2]+w[U*3+1]*g[6]+w[U*3+2]*g[10],S=new Int32Array(t.count);let B=1/0;for(let U=0;U<t.count;U++){const L=k(U)*4096|0;S[U]=L,B=Math.min(B,L)}const O=-B;for(let U=0;U<t.count;U++)S[U]+=O;const M=new Uint32Array(t.count);for(let U=0;U<t.count;U++)M[U]=U;const D=new Int32Array(t.count),R=new Uint32Array(t.count);for(let U=0;U<32;U+=8){const L=new Uint32Array(256);for(let V=0;V<t.count;V++){const H=S[V]>>U&255;L[H]++}let z=0;for(let V=0;V<256;V++){const H=L[V];L[V]=z,z+=H}for(let V=0;V<t.count;V++){const H=S[V]>>U&255,G=L[H]++;D[G]=S[V],R[G]=M[V]}S.set(D),M.set(R)}for(let U=0;U<t.count;U++){const L=M[U];C[U*3]=w[L*3],C[U*3+1]=w[L*3+1],C[U*3+2]=w[L*3+2],T[U*3]=b[L*3],T[U*3+1]=b[L*3+1],T[U*3+2]=b[L*3+2],I[U*4]=_[L*4],I[U*4+1]=_[L*4+1],I[U*4+2]=_[L*4+2],I[U*4+3]=_[L*4+3],P[U*4]=x[L*4],P[U*4+1]=x[L*4+1],P[U*4+2]=x[L*4+2],P[U*4+3]=x[L*4+3]}p.typedArray=C,d.typedArray=T,c.typedArray=I,y.typedArray=P})(),t.instanceCount=t.count,t.count=4,t.primitiveType=Me.PrimitiveType.TRIANGLE_STRIP,r.addVertexLines(Mb),r.addFragmentLines(Ob)};const Rb={name:"GaussianSplatTexturePipelineStage"};Rb.process=function(t,n,e){const{shaderBuilder:r}=t,s=t.renderStateOptions;s.cull.enabled=!1,s.depthMask=!1,s.depthTest.enabled=!1,s.blending=Me.BlendingState.PRE_MULTIPLIED_ALPHA_BLEND,t.alphaOptions.pass=Dl.GAUSSIAN_SPLATS,r.addDefine("HAS_GAUSSIAN_SPLATS",void 0,Me.ShaderDestination.BOTH),r.addDefine("HAS_SPLAT_TEXTURE",void 0,Me.ShaderDestination.BOTH),t.model.content.tileset.debugShowBoundingVolume&&r.addDefine("DEBUG_BOUNDING_VOLUMES",void 0,Me.ShaderDestination.BOTH),r.addAttribute("float","a_splatIndex"),r.addVarying("vec4","v_splatColor"),r.addVarying("vec2","v_vertPos"),r.addUniform("highp usampler2D","u_splatAttributeTexture",Me.ShaderDestination.VERTEX),r.addUniform("float","u_splatScale",Me.ShaderDestination.VERTEX);const o=t.uniformMap;o.u_splatScale=function(){var i,a;return((a=(i=t.model)==null?void 0:i.style)==null?void 0:a.splatScale)??1},o.u_splatAttributeTexture=function(){return n.gaussianSplatTexture},t.instanceCount=t.count,t.count=4,t.primitiveType=Me.PrimitiveType.TRIANGLE_STRIP,r.addVertexLines(Mb),r.addFragmentLines(Ob)};function lM(){F.ModelRuntimePrimitive.prototype.configurePipeline=function(t){var I;const n=this.pipelineStages;n.length=0;const e=this.primitive,r=this.node,s=this.model,o=s.customShader,i=s.style,a=t.context.webgl2,h=t.mode!==F.SceneMode.SCENE3D&&!t.scene3DOnly&&s._projectTo2D,f=t.verticalExaggeration!==1&&s.hasVerticalExaggeration,u=F.defined(e.morphTargets)&&e.morphTargets.length>0,A=F.defined(r.skin),v=F.defined(o),m=!(v&&F.defined(o.fragmentShaderText))||o.mode!==F.CustomShaderMode.REPLACE_MATERIAL,p=F.ModelUtility.hasQuantizedAttributes(e.attributes),d=s.debugWireframe&&F.PrimitiveType.isTriangles(e.primitiveType)&&(s._enableDebugWireframe||a),c=s.pointCloudShading,y=F.defined(c)&&c.attenuation,w=F.defined(c)&&c.backFaceCulling,b=e.primitiveType===F.PrimitiveType.POINTS&&(F.defined(i)||y||w),_=s._enableShowOutline&&F.defined(e.outlineCoordinates),x=uM(s,r,e),C=F.defined(s.classificationType),T=(((I=s==null?void 0:s.style)==null?void 0:I.showGaussianSplatting)??s.showGaussianSplatting)&&((e==null?void 0:e.isGaussianSplatPrimitive)??!1);h&&n.push(F.SceneMode2DPipelineStage),n.push(F.GeometryPipelineStage),d&&n.push(F.WireframePipelineStage),C&&n.push(F.ClassificationPipelineStage),u&&n.push(F.MorphTargetsPipelineStage),A&&n.push(F.SkinningPipelineStage),b&&n.push(F.PointCloudStylingPipelineStage),p&&n.push(F.DequantizationPipelineStage),m&&n.push(F.MaterialPipelineStage),n.push(F.FeatureIdPipelineStage),n.push(F.MetadataPipelineStage),n.push(F.MetadataPickingPipelineStage),x.hasPropertyTable&&(n.push(F.SelectedFeatureIdPipelineStage),n.push(F.BatchTexturePipelineStage),n.push(F.CPUStylingPipelineStage)),f&&n.push(F.VerticalExaggerationPipelineStage),v&&n.push(F.CustomShaderPipelineStage),n.push(F.LightingPipelineStage),s.allowPicking&&n.push(F.PickingPipelineStage),_&&n.push(F.PrimitiveOutlinePipelineStage),n.push(F.AlphaPipelineStage),n.push(F.PrimitiveStatisticsPipelineStage),T&&(F.defined(e.needsGaussianSplatTexture)?e.needsGaussianSplatTexture===!1&&((e==null?void 0:e.hasGaussianSplatTexture)??!1)&&n.push(Rb):n.push(Db))}}function uM(t,n,e){let r;return F.defined(n.instances)&&(r=F.ModelUtility.getFeatureIdsByLabel(n.instances.featureIds,t.instanceFeatureIdLabel),F.defined(r))?{hasFeatureIds:!0,hasPropertyTable:F.defined(r.propertyTableId)}:(r=F.ModelUtility.getFeatureIdsByLabel(e.featureIds,t.featureIdLabel),F.defined(r)?{hasFeatureIds:!0,hasPropertyTable:F.defined(r.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}const{defined:Ub,AttributeType:Lb}=F;function cM(){const t=F.ModelUtility.supportedExtensions;F.ModelUtility.supportedExtensions={...t,KHR_gaussian_splatting:!0},F.ModelUtility.getAttributeInfo=function(n){const e=n.semantic,r=n.setIndex;let s,o=!1;Ub(e)?(s=Ie.getVariableName(e,r),o=!0):(s=n.name,s=s.replace(/^_/,""),s=s.toLowerCase());const i=/^color_\d+$/.test(s),a=n.type;let l=Lb.getGlslType(a);i&&(l="vec4");const h=Ub(n.quantization);let f;return h&&(f=i?"vec4":Lb.getGlslType(n.quantization.type)),{attribute:n,isQuantized:h,variableName:s,hasSemantic:o,glslType:l,quantizedGlslType:f}}}const{PrimitiveLoadPlan:zb,PrimitiveOutlineGenerator:hM,IndexDatatype:fM,ModelComponents:dM,ComponentDatatype:Ja,AttributeType:Nb,AttributeLoadPlan:pM,defined:AM,BufferUsage:Vb,Cartesian3:xA,AttributeCompression:mM}=F;function yM(){Object.defineProperties(zb,{needGaussianSplats:{value:!1},generateGaussianSplatTexture:{value:!1}}),zb.prototype.postProcess=function(e){this.needsOutlines&&(gM(this),wM(this,e)),this.needsGaussianSplats&&(this.primitive.isGaussianSplatPrimitive=!0,n(this),this.generateGaussianSplatTexture&&this.attributePlans.forEach(r=>{t(r),this.primitive.needsGaussianSplatTexture=!0}))};function t(e){if(e.name==="_ROTATION"&&e.componentDatatype===Ja.SHORT&&(e.typedArray=mM.dequantize(e.typedArray,Ja.SHORT,Nb.VEC4,e.count),e.componentDatatype=Ja.FLOAT),e.name==="POSITION"&&e.componentDatatype===Ja.UNSIGNED_SHORT){const r=Float32Array.from(e.typedArray,o=>o/e.max.x);e.typedArray=r,e.componentDatatype=Ja.FLOAT,e.normalized=!1,e.constant=new xA(0,0,0);const s=o=>{let i=1/0,a=-1/0,l=1/0,h=-1/0,f=1/0,u=-1/0;for(let A=0;A<o.length;A+=3){const v=o[A],g=o[A+1],m=o[A+2];i=Math.min(i,v),a=Math.max(a,v),l=Math.min(l,g),h=Math.max(h,g),f=Math.min(f,m),u=Math.max(u,m)}return[new xA(i,l,f),new xA(a,h,u)]};[e.min,e.max]=s(e.typedArray)}}function n(e,r){const s=e.attributePlans,o=s.length;for(let i=0;i<o;i++){const a=s[i];a.loadBuffer=!1,a.loadTypedArray=!0;const l=a.attribute;t(l)}}}function gM(t){const n=t.primitive,e=n.indices,r=n.attributes[0].count,s=new hM({triangleIndices:e.typedArray,outlineIndices:t.outlineIndices,originalVertexCount:r});e.typedArray=s.updatedTriangleIndices,e.indexDatatype=fM.fromTypedArray(e.typedArray);const o=vM(s.outlineCoordinates),i=new pM(o);i.loadBuffer=!0,i.loadTypedArray=!1,t.attributePlans.push(i),n.outlineCoordinates=i.attribute;const a=t.attributePlans,l=t.attributePlans.length;for(let h=0;h<l;h++){const f=a[h].attribute;f.typedArray=s.updateAttribute(f.typedArray)}}function vM(t){const n=new dM.Attribute;return n.name="_OUTLINE_COORDINATES",n.typedArray=t,n.componentDatatype=Ja.FLOAT,n.type=Nb.VEC3,n.normalized=!1,n.count=t.length/3,n}function wM(t,n){bM(t.attributePlans,n),AM(t.indicesPlan)&&_M(t.indicesPlan,n)}function bM(t,n){const e=t.length;for(let r=0;r<e;r++){const s=t[r],o=s.attribute,i=o.typedArray;if(s.loadBuffer){const a=Buffer.createVertexBuffer({typedArray:i,context:n,usage:Vb.STATIC_DRAW});a.vertexArrayDestroyable=!1,o.buffer=a}s.loadTypedArray||(o.typedArray=void 0)}}function _M(t,n){const e=t.indices;if(t.loadBuffer){const r=Buffer.createIndexBuffer({typedArray:e.typedArray,context:n,usage:Vb.STATIC_DRAW,indexDatatype:e.indexDatatype});e.buffer=r,r.vertexArrayDestroyable=!1}t.loadTypedArray||(e.typedArray=void 0)}const{Scene:xM,defined:$e,SceneMode:Rl,MapMode2D:CM,Cartesian3:nn,BoundingRectangle:Qb,Cartographic:SM,Math:of,Matrix4:kr,Transforms:EM,DebugCameraPrimitive:PM,Pass:ft,ClearCommand:TM,EllipsoidGeometry:Hb,Camera:jb,defaultValue:Gb,PerspectiveFrustum:BM,PerspectiveOffCenterFrustum:IM,OrthographicFrustum:FM,OrthographicOffCenterFrustum:kM,mergeSort:af,PerInstanceColorAppearance:CA,BoxGeometry:Wb,Primitive:MM,GeometryInstance:OM,GeometryPipeline:DM,ColorGeometryInstanceAttribute:RM,SunPostProcess:UM,DerivedCommand:LM,Color:zM}=F,NM=new Qb,VM=new nn,QM=new SM(Math.PI,of.PI_OVER_TWO),HM=new nn,jM=new kr,GM=new kr,WM=new nn,qM=new nn;function KM(){xM.prototype.updateAndExecuteCommands=function(o,i){hO(this,o,i),this._environmentState.useWebVR?r(this,o):this._frameState.mode!==Rl.SCENE2D||this._mapMode2D===CM.ROTATE?n(!0,this,o):t(this,o)};function t(o,i){const{frameState:a,camera:l}=o,{uniformState:h}=o.context,f=i.viewport,u=Qb.clone(f,NM);i.viewport=u;const A=QM,v=HM;o.mapProjection.project(A,v);const m=nn.clone(l.position,VM),p=kr.clone(l.transform,jM),d=l.frustum.clone();l._setTransform(kr.IDENTITY);const c=kr.computeViewportTransformation(u,0,1,GM),y=l.frustum.projectionMatrix,w=l.positionWC.y,b=nn.fromElements(of.sign(w)*v.x-w,0,-l.positionWC.x,WM),_=EM.pointToGLWindowCoordinates(y,c,b,qM);_.x=Math.floor(_.x);const x=u.x,C=u.width;if(w===0||_.x<=x||_.x>=x+C)n(!0,o,i);else if(Math.abs(x+C*.5-_.x)<1)u.width=_.x-u.x,l.position.x*=of.sign(l.position.x),l.frustum.right=0,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),n(!0,o,i),u.x=_.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),n(!1,o,i);else if(_.x>x+C*.5){u.width=_.x-x;const T=l.frustum.right;l.frustum.right=v.x-w,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),n(!0,o,i),u.x=_.x,u.width=x+C-_.x,l.position.x=-l.position.x,l.frustum.left=-l.frustum.right,l.frustum.right=T-l.frustum.right*2,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),n(!1,o,i)}else{u.x=_.x,u.width=x+C-_.x;const T=l.frustum.left;l.frustum.left=-v.x-w,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),n(!0,o,i),u.x=x,u.width=_.x-x,l.position.x=-l.position.x,l.frustum.right=-l.frustum.left,l.frustum.left=T-l.frustum.left*2,a.cullingVolume=l.frustum.computeCullingVolume(l.positionWC,l.directionWC,l.upWC),h.update(a),n(!1,o,i)}l._setTransform(p),nn.clone(m,l.position),l.frustum=d.clone(),i.viewport=f}function n(o,i,a){const l=i._view,{renderTranslucentDepthForPick:h}=i._environmentState;o||(i.frameState.commandList.length=0),Yb(i),l.createPotentiallyVisibleSet(i),o&&(Zb(i),h||$b(i)),s(i,a)}const e=new nn;function r(o,i){const a=o._view,l=a.camera,f=o._environmentState.renderTranslucentDepthForPick;Yb(o),a.createPotentiallyVisibleSet(o),Zb(o),f||$b(o);const u=i.viewport;u.x=0,u.y=0,u.width=u.width*.5;const A=jb.clone(l,o._cameraVR);A.frustum=l.frustum;const v=l.frustum.near,g=v*Gb(o.focalLength,5),m=Gb(o.eyeSeparation,g/30),p=nn.multiplyByScalar(A.right,m*.5,e);l.frustum.aspectRatio=u.width/u.height;const d=.5*m*v/g;nn.add(A.position,p,l.position),l.frustum.xOffset=d,s(o,i),u.x=u.width,nn.subtract(A.position,p,l.position),l.frustum.xOffset=-d,s(o,i),jb.clone(A,l)}function s(o,i){const{camera:a,context:l,frameState:h}=o,{uniformState:f}=l;f.updateCamera(a);const u=mO(a);u.near=a.frustum.near,u.far=a.frustum.far;const A=h.passes,v=A.pick||A.pickVoxel;v||oO(o,i);const{clearGlobeDepth:g,renderTranslucentDepthForPick:m,useDepthPlane:p,useGlobeDepthFramebuffer:d,useInvertClassification:c,usePostProcessSelected:y}=o._environmentState,{globeDepth:w,globeTranslucencyFramebuffer:b,sceneFramebuffer:_,frustumCommandsList:x}=o._view,C=x.length,T=o._globeTranslucencyState,I=o._depthClearCommand,P=o._stencilClearCommand,k=o._classificationStencilClearCommand,S=o._depthPlane,B=a.position.z;function O(D,R){f.updatePass(R);const U=D.commands[R],L=D.indices[R];for(let z=0;z<L;++z)yr(U[z],o,i);return L}function M(D,R){f.updatePass(R);const U=D.commands[R],L=D.indices[R];for(let z=0;z<L;++z)Xb(U[z],o,i)}for(let D=0;D<C;++D){const R=C-D-1,U=x[R];o.mode===Rl.SCENE2D?(a.position.z=B-U.near+1,u.far=Math.max(1,U.far-U.near),u.near=1,f.update(h),f.updateFrustum(u)):(u.near=R!==0?U.near*o.opaqueFrustumNearOffset:U.near,u.far=U.far,f.updateFrustum(u)),I.execute(l,i),l.stencilBuffer&&P.execute(l,i),T.translucent?(f.updatePass(ft.GLOBE),T.executeGlobeCommands(U,yr,b,o,i)):O(U,ft.GLOBE),d&&w.executeCopyDepth(l,i),m||(T.translucent?(f.updatePass(ft.TERRAIN_CLASSIFICATION),T.executeGlobeClassificationCommands(U,yr,b,o,i)):O(U,ft.TERRAIN_CLASSIFICATION)),g&&(I.execute(l,i),p&&S.execute(l,i));let L;if(!c||v||m)L=O(U,ft.CESIUM_3D_TILE),L>0&&(d&&(w.prepareColorTextures(l,g),w.executeUpdateDepth(l,i,w.depthStencilTexture)),m||(L=O(U,ft.CESIUM_3D_TILE_CLASSIFICATION)));else{o._invertClassification.clear(l,i);const V=i.framebuffer;i.framebuffer=o._invertClassification._fbo.framebuffer,L=O(U,ft.CESIUM_3D_TILE),d&&(o._invertClassification.prepareTextures(l),w.executeUpdateDepth(l,i,o._invertClassification._fbo.getDepthStencilTexture())),L=O(U,ft.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),i.framebuffer=V,o._invertClassification.executeClassified(l,i),h.invertClassificationColor.alpha===1&&o._invertClassification.executeUnclassified(l,i),L>0&&l.stencilBuffer&&k.execute(l,i),L=O(U,ft.CESIUM_3D_TILE_CLASSIFICATION)}if(L>0&&l.stencilBuffer&&P.execute(l,i),tO(o,i,U),O(U,ft.OPAQUE),iO(o,i,U),R!==0&&o.mode!==Rl.SCENE2D&&(u.near=U.near,f.updateFrustum(u)),$M(o,i,U),XM(o,i,U),l.depthTexture&&o.useDepthPicking&&(d||m)){const V=o._picking.getPickDepth(o,R);V.update(l,w.depthStencilTexture),V.executeCopyDepth(l,i)}if(v||!y)continue;const z=i.framebuffer;i.framebuffer=_.getIdFramebuffer(),u.near=R!==0?U.near*o.opaqueFrustumNearOffset:U.near,u.far=U.far,f.updateFrustum(u),T.translucent?(f.updatePass(ft.GLOBE),T.executeGlobeCommands(U,Xb,b,o,i)):M(U,ft.GLOBE),g&&(I.framebuffer=i.framebuffer,I.execute(l,i),I.framebuffer=void 0),g&&p&&S.execute(l,i),M(U,ft.CESIUM_3D_TILE),M(U,ft.OPAQUE),M(U,ft.TRANSLUCENT),i.framebuffer=z}}}function XM(t,n,e){const{translucentTileClassification:r,globeDepth:s}=t._view;if(!(e.indices[ft.CESIUM_3D_TILE_CLASSIFICATION]>0)||!r.isSupported())return;const i=e.commands[ft.TRANSLUCENT];r.executeTranslucentCommands(t,yr,n,i,s.depthStencilTexture),r.executeClassificationCommands(t,yr,n,e)}function $M(t,n,e){const{frameState:r,context:s}=t,{pick:o,pickVoxel:i}=r.passes,a=o||i;let l;!a&&t._environmentState.useInvertClassification&&r.invertClassificationColor.alpha<1&&(l=t._invertClassification);const h=ZM(t);s.uniformState.updatePass(ft.TRANSLUCENT);const f=e.commands[ft.TRANSLUCENT];f.length=e.indices[ft.TRANSLUCENT],h(t,yr,n,f,l)}function ZM(t){if(t._environmentState.useOIT){if(!$e(t._executeOITFunction)){const{view:n,context:e}=t;t._executeOITFunction=function(r,s,o,i,a){n.globeDepth.prepareColorTextures(e),n.oit.executeCommands(r,s,o,i,a)}}return t._executeOITFunction}return t.frameState.passes.render?YM:eO}function qb(t,n,e){return n.boundingVolume.distanceSquaredTo(e)-t.boundingVolume.distanceSquaredTo(e)}function YM(t,n,e,r,s){af(r,qb,t.camera.positionWC),$e(s)&&n(s.unclassifiedCommand,t,e);for(let o=0;o<r.length;++o)n(r[o],t,e)}function JM(t,n,e){return t.boundingVolume.distanceSquaredTo(e)-n.boundingVolume.distanceSquaredTo(e)+of.EPSILON12}function eO(t,n,e,r,s){af(r,JM,t.camera.positionWC),$e(s)&&n(s.unclassifiedCommand,t,e);for(let o=0;o<r.length;++o)n(r[o],t,e)}function tO(t,n,e){t.context.uniformState.updatePass(ft.VOXELS);const r=e.commands[ft.VOXELS];r.length=e.indices[ft.VOXELS],af(r,qb,t.camera.positionWC);for(let s=0;s<r.length;++s)yr(r[s],t,n)}const nO=new nn;function Kb(t,n){const e=nn.subtract(t,n,nO),r=Math.max(0,nn.magnitude(e));return r*r}function rO(t,n,e){const r=t.boundingVolume,s=n.boundingVolume;return Kb(s.center,e)-Kb(r.center,e)}function iO(t,n,e){t.context.uniformState.updatePass(Dl.GAUSSIAN_SPLATS);const r=e.commands[Dl.GAUSSIAN_SPLATS];r.length=e.indices[Dl.GAUSSIAN_SPLATS],af(r,rO,t.camera.positionWC);for(let s=0;s<r.length;++s)yr(r[s],t,n)}function Xb(t,n,e){const{derivedCommands:r}=t;if(!$e(r))return;const s=n._frameState,o=n._context;s.useLogDepth&&$e(r.logDepth)&&(t=r.logDepth.command);const{picking:i,pickingMetadata:a,depth:l}=t.derivedCommands;$e(a)&&(t=r.pickingMetadata.pickMetadataCommand,t.execute(o,e)),$e(i)?(t=i.pickCommand,t.execute(o,e)):$e(l)&&(t=l.depthOnlyCommand,t.execute(o,e))}function oO(t,n){const{context:e,environmentState:r,view:s}=t;if(e.uniformState.updatePass(ft.ENVIRONMENT),$e(r.skyBoxCommand)&&yr(r.skyBoxCommand,t,n),r.isSkyAtmosphereVisible&&yr(r.skyAtmosphereCommand,t,n),r.isSunVisible&&(r.sunDrawCommand.execute(e,n),t.sunBloom&&!r.useWebVR)){let o;r.useGlobeDepthFramebuffer?o=s.globeDepth.framebuffer:r.usePostProcess?o=s.sceneFramebuffer.framebuffer:o=r.originalFramebuffer,t._sunPostProcess.execute(e),t._sunPostProcess.copy(e,o),n.framebuffer=o}r.isMoonVisible&&r.moonCommand.execute(e,n)}function aO(t,n,e){const{shadowMapCullingVolume:r,isPointLight:s,passes:o}=e,i=o.length,a=[ft.GLOBE,ft.CESIUM_3D_TILE,ft.OPAQUE,ft.TRANSLUCENT];for(let l=0;l<n.length;++l){const h=n[l];if(t.updateDerivedCommands(h),!(!h.castShadows||a.indexOf(h.pass)<0||!t.isVisible(r,h)))if(s)for(let f=0;f<i;++f)o[f].commandList.push(h);else if(i===1)o[0].commandList.push(h);else{let f=!1;for(let u=i-1;u>=0;--u){const A=o[u].cullingVolume;if(t.isVisible(A,h))o[u].commandList.push(h),f=!0;else if(f)break}}}}function $b(t){const{shadowState:n,commandList:e}=t.frameState,{shadowsEnabled:r,shadowMaps:s}=n;if(!r)return;const{context:o}=t,{uniformState:i}=o;for(let a=0;a<s.length;++a){const l=s[a];if(l.outOfView)continue;const{passes:h}=l;for(let f=0;f<h.length;++f)h[f].commandList.length=0;aO(t,e,l);for(let f=0;f<h.length;++f){const u=l.passes[f],{camera:A,commandList:v}=u;i.updateCamera(A),l.updatePass(o,f);for(let g=0;g<v.length;++g){const m=v[g];i.updatePass(m.pass);const p=m.derivedCommands.shadows.castCommands[a];yr(p,t,u.passState)}}}}function yr(t,n,e,r){const s=n._frameState,o=n._context;if($e(n.debugCommandFilter)&&!n.debugCommandFilter(t))return;if(t instanceof TM){t.execute(o,e);return}t.debugShowBoundingVolume&&$e(t.boundingVolume)&&lO(t,n,e,r),s.useLogDepth&&$e(t.derivedCommands.logDepth)&&(t=t.derivedCommands.logDepth.command);const i=s.passes;if(!i.pick&&!i.pickVoxel&&!i.depth&&n._hdr&&$e(t.derivedCommands)&&$e(t.derivedCommands.hdr)&&(t=t.derivedCommands.hdr.command),i.pick||i.depth){if(i.pick&&!i.depth){if(s.pickingMetadata&&$e(t.derivedCommands.pickingMetadata)){t=t.derivedCommands.pickingMetadata.pickMetadataCommand,t.execute(o,e);return}if(!s.pickingMetadata&&$e(t.derivedCommands.picking)){t=t.derivedCommands.picking.pickCommand,t.execute(o,e);return}}else if($e(t.derivedCommands.depth)){t=t.derivedCommands.depth.depthOnlyCommand,t.execute(o,e);return}}if(n.debugShowCommands||n.debugShowFrustums){n._debugInspector.executeDebugShowFrustumsCommand(n,t,e);return}s.shadowState.lightShadowsEnabled&&t.receiveShadows&&$e(t.derivedCommands.shadows)?t.derivedCommands.shadows.receiveCommand.execute(o,e):t.execute(o,e)}let sO=new kr(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);function lO(t,n,e,r){const s=n._frameState,o=s.context,i=t.boundingVolume;$e(n._debugVolume)&&n._debugVolume.destroy();let a=nn.clone(i.center);if(s.mode!==Rl.SCENE3D){a=kr.multiplyByPoint(sO,a,a);const g=s.mapProjection,m=g.unproject(a);a=g.ellipsoid.cartographicToCartesian(m)}let l,h;const{radius:f}=i;$e(f)?(l=Hb.createGeometry(new Hb({radii:new nn(f,f,f),vertexFormat:CA.FLAT_VERTEX_FORMAT})),h=kr.fromTranslation(a)):(l=Wb.createGeometry(Wb.fromDimensions({dimensions:new nn(2,2,2),vertexFormat:CA.FLAT_VERTEX_FORMAT})),h=kr.fromRotationTranslation(i.halfAxes,a,new kr)),n._debugVolume=new MM({geometryInstances:new OM({geometry:DM.toWireframe(l),modelMatrix:h,attributes:{color:new RM(1,0,0,1)}}),appearance:new CA({flat:!0,translucent:!1}),asynchronous:!1});const u=s.commandList,A=s.commandList=[];n._debugVolume.update(s),t=A[0],s.useLogDepth&&(t=LM.createLogDepthCommand(t,o).command);let v;$e(r)&&(v=e.framebuffer,e.framebuffer=r),t.execute(o,e),$e(v)&&(e.framebuffer=v),s.commandList=u}function Zb(t){t.context.uniformState.updatePass(ft.COMPUTE);const n=t._environmentState.sunComputeCommand;$e(n)&&n.execute(t._computeEngine);const e=t._computeCommandList;for(let r=0;r<e.length;++r)e[r].execute(t._computeEngine)}function Yb(t){const n=t._frameState;t._groundPrimitives.update(n),t._primitives.update(n),uO(t),cO(t),t._globe&&t._globe.render(n)}function uO(t){const n=t._frameState;t.debugShowFrustumPlanes!==t._debugShowFrustumPlanes&&(t.debugShowFrustumPlanes?t._debugFrustumPlanes=new PM({camera:t.camera,updateOnChange:!1,frustumSplits:n.frustumSplits}):t._debugFrustumPlanes=t._debugFrustumPlanes&&t._debugFrustumPlanes.destroy(),t._debugShowFrustumPlanes=t.debugShowFrustumPlanes),$e(t._debugFrustumPlanes)&&t._debugFrustumPlanes.update(n)}function cO(t){const n=t._frameState,{passes:e,shadowState:r,shadowMaps:s}=n,o=s.length,i=o>0&&!e.pick&&!e.pickVoxel&&t.mode===Rl.SCENE3D;if(i!==r.shadowsEnabled&&(++r.lastDirtyTime,r.shadowsEnabled=i),r.lightShadowsEnabled=!1,!!i){for(let a=0;a<o;++a)if(s[a]!==r.shadowMaps[a]){++r.lastDirtyTime;break}r.shadowMaps.length=0,r.lightShadowMaps.length=0;for(let a=0;a<o;++a){const l=s[a];l.update(n),r.shadowMaps.push(l),l.fromLightSource&&(r.lightShadowMaps.push(l),r.lightShadowsEnabled=!0),l.dirty&&(++r.lastDirtyTime,l.dirty=!1)}}}function hO(t,n,e){const r=t._context,s=t._frameState,o=t._environmentState,i=t._view,a=s.passes,l=a.pick||a.pickVoxel;$e(i.globeDepth)&&(i.globeDepth.picking=l);const h=o.useWebVR;o.originalFramebuffer=n.framebuffer,$e(t.sun)&&t.sunBloom!==t._sunBloom?(t.sunBloom&&!h?t._sunPostProcess=new UM:$e(t._sunPostProcess)&&(t._sunPostProcess=t._sunPostProcess.destroy()),t._sunBloom=t.sunBloom):!$e(t.sun)&&$e(t._sunPostProcess)&&(t._sunPostProcess=t._sunPostProcess.destroy(),t._sunBloom=!1);const f=t._clearColorCommand;zM.clone(e,f.color),f.execute(r,n);const u=o.useGlobeDepthFramebuffer=$e(i.globeDepth);u&&(i.globeDepth.update(r,n,i.viewport,t.msaaSamples,t._hdr,o.clearGlobeDepth),i.globeDepth.clear(r,n,e));const A=i.oit,v=o.useOIT=!l&&$e(A)&&A.isSupported();v&&(A.update(r,n,i.globeDepth.colorFramebufferManager,t._hdr,t.msaaSamples),A.clear(r,n,e),o.useOIT=A.isSupported());const g=t.postProcessStages;let m=o.usePostProcess=!l&&(t._hdr||g.length>0||g.ambientOcclusion.enabled||g.fxaa.enabled||g.bloom.enabled);if(o.usePostProcessSelected=!1,m&&(i.sceneFramebuffer.update(r,i.viewport,t._hdr,t.msaaSamples),i.sceneFramebuffer.clear(r,n,e),g.update(r,s.useLogDepth,t._hdr),g.clear(r),m=o.usePostProcess=g.ready,o.usePostProcessSelected=m&&g.hasSelected),o.isSunVisible&&t.sunBloom&&!h?(n.framebuffer=t._sunPostProcess.update(n),t._sunPostProcess.clear(r,n,e)):u?n.framebuffer=i.globeDepth.framebuffer:m&&(n.framebuffer=i.sceneFramebuffer.framebuffer),$e(n.framebuffer)&&f.execute(r,n),o.useInvertClassification=!l&&$e(n.framebuffer)&&t.invertClassification){let d;if(s.invertClassificationColor.alpha===1&&u&&(d=i.globeDepth.framebuffer),$e(d)||r.depthTexture){if(t._invertClassification.previousFramebuffer=d,t._invertClassification.update(r,t.msaaSamples,i.globeDepth.colorFramebufferManager),t._invertClassification.clear(r,n),s.invertClassificationColor.alpha<1&&v){const c=t._invertClassification.unclassifiedCommand,y=c.derivedCommands;y.oit=A.createDerivedCommands(c,r,y.oit)}}else o.useInvertClassification=!1}t._globeTranslucencyState.translucent&&i.globeTranslucencyFramebuffer.updateAndClear(t._hdr,i.viewport,r,n)}const fO=new BM,dO=new IM,pO=new FM,AO=new kM;function mO(t){const{frustum:n}=t;return $e(n.fov)?n.clone(fO):$e(n.infiniteProjectionMatrix)?n.clone(dO):$e(n.width)?n.clone(pO):n.clone(AO)}class yO{constructor(n,e,r,s){N(this,"name");N(this,"value");N(this,"_gl");N(this,"_location");N(this,"textureUnitIndex");N(this,"_setSampler",n=>(this.textureUnitIndex=n,this._gl.uniform1i(this._location,n),n+1));N(this,"set",()=>{const n=this._gl;n.activeTexture(n.TEXTURE0+this.textureUnitIndex);const e=this.value;n.bindTexture(e._target,e._texture)});this.uniformName=r,this._gl=n,this.name=r,this._location=s}}class gO{constructor(n,e,r,s){N(this,"name");N(this,"value");N(this,"_value");N(this,"_gl");N(this,"_locations");N(this,"textureUnitIndex");N(this,"_setSampler",n=>{this.textureUnitIndex=n;const e=this._locations,r=e.length;for(let s=0;s<r;++s){const o=n+s;this._gl.uniform1i(e[s],o)}return n+r});N(this,"set",()=>{const n=this._gl,e=n.TEXTURE0+this.textureUnitIndex,r=this.value,s=r.length;for(let o=0;o<s;++o){const i=r[o];n.activeTexture(e+o),n.bindTexture(i._target,i._texture)}});this.uniformName=r;const o=s.length;this._gl=n,this.value=new Array(o),this._value=new Float32Array(o),this.name=r,this._locations=s,this.textureUnitIndex=void 0}}const{defined:ui,RuntimeError:vO,AutomaticUniforms:wO,createUniform:bO,createUniformArray:_O}=F;function xO(){Object.defineProperties(F.ShaderProgram,{fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return sf(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return sf(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return sf(this),this._uniformsByName}}}),F.ShaderProgram.prototype._bind=function(){sf(this),this._gl.useProgram(this._program)}}function sf(t){ui(t._program)||Jb(t)}function Jb(t){const n=t._program,e=t._gl,r=CO(e,t,t._debugShaders),s=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),o=SO(e,r),i=EO(t,o.uniformsByName);t._program=r,t._numberOfVertexAttributes=s,t._vertexAttributes=PO(e,r,s),t._uniformsByName=o.uniformsByName,t._uniforms=o.uniforms,t._automaticUniforms=i.automaticUniforms,t._manualUniforms=i.manualUniforms,t.maximumTextureUnitIndex=TO(e,r,o.samplerUniforms),n&&t._gl.deleteProgram(n),typeof spector<"u"&&(t._program.__SPECTOR_rebuildProgram=function(a,l,h,f){const u=t._vertexShaderText,A=t._fragmentShaderText,v=/ ! = /g;t._vertexShaderText=a.replace(v," != "),t._fragmentShaderText=l.replace(v," != ");try{Jb(t),h(t._program)}catch(g){t._vertexShaderText=u,t._fragmentShaderText=A;const p=/(?:Compile|Link) error: ([^]*)/.exec(g.message);f(p?p[1]:g.message)}})}const Mr="[Cesium WebGL] ";function CO(t,n){const e=n._vertexShaderText,r=n._fragmentShaderText,s=t.createShader(t.VERTEX_SHADER);t.shaderSource(s,e),t.compileShader(s);const o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,r),t.compileShader(o);const i=t.createProgram();t.attachShader(i,s),t.attachShader(i,o);const a=n._attributeLocations;if(ui(a))for(const A in a)a.hasOwnProperty(A)&&t.bindAttribLocation(i,a[A],A);t.linkProgram(i);let l;if(t.getProgramParameter(i,t.LINK_STATUS))return n._logShaderCompilation&&(l=t.getShaderInfoLog(s),ui(l)&&l.length>0&&console.log(`${Mr}Vertex shader compile log: ${l}`),l=t.getShaderInfoLog(o),ui(l)&&l.length>0&&console.log(`${Mr}Fragment shader compile log: ${l}`),l=t.getProgramInfoLog(i),ui(l)&&l.length>0&&console.log(`${Mr}Shader program link log: ${l}`)),t.deleteShader(s),t.deleteShader(o),i;let h;const f=n._debugShaders;throw t.getShaderParameter(o,t.COMPILE_STATUS)?t.getShaderParameter(s,t.COMPILE_STATUS)?(l=t.getProgramInfoLog(i),console.error(`${Mr}Shader program link log: ${l}`),u(s,"vertex"),u(o,"fragment"),h=`Program failed to link. Link log: ${l}`):(l=t.getShaderInfoLog(s),console.error(`${Mr}Vertex shader compile log: ${l}`),console.error(`${Mr} Vertex shader source:
|
|
963
963
|
${e}`),h=`Vertex shader failed to compile. Compile log: ${l}`):(l=t.getShaderInfoLog(o),console.error(`${Mr}Fragment shader compile log: ${l}`),console.error(`${Mr} Fragment shader source:
|
|
964
964
|
${r}`),h=`Fragment shader failed to compile. Compile log: ${l}`),t.deleteShader(s),t.deleteShader(o),t.deleteProgram(i),new vO(h);function u(A,v){if(!ui(f))return;const g=f.getTranslatedShaderSource(A);if(g===""){console.error(`${Mr}${v} shader translation failed.`);return}console.error(`${Mr}Translated ${v} shaderSource:
|
|
965
|
-
${g}`)}}function SO(t,n){const e={},r=[],s=[],o=t.getProgramParameter(n,t.ACTIVE_UNIFORMS);for(let i=0;i<o;++i){const a=t.getActiveUniform(n,i),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 f=t.getUniformLocation(n,h);if(f!==null){const u=a.type!=t.UNSIGNED_INT_SAMPLER_2D?bO(t,a,h,f):new yO(t,a,h,f);e[h]=u,r.push(u),u._setSampler&&s.push(u)}}else{let f,u,A,v;const g=h.indexOf("[");if(g>=0){if(f=e[h.slice(0,g)],!ui(f))continue;u=f._locations,u.length<=1&&(A=f.value,v=t.getUniformLocation(n,h),v!==null&&(u.push(v),A.push(t.getUniform(n,v))))}else{u=[];for(let m=0;m<a.size;++m)v=t.getUniformLocation(n,`${h}[${m}]`),v!==null&&u.push(v);f=a.type!=t.UNSIGNED_INT_SAMPLER_2D?_O(t,a,h,u):new gO(t,a,h,u),e[h]=f,r.push(f),f._setSampler&&s.push(f)}}}return{uniformsByName:e,uniforms:r,samplerUniforms:s}}function EO(t,n){const e=[],r=[];for(const s in n)if(n.hasOwnProperty(s)){const o=n[s];let i=s;const a=t._duplicateUniformNames[i];ui(a)&&(o.name=a,i=a);const l=wO[i];ui(l)?e.push({uniform:o,automaticUniform:l}):r.push(o)}return{automaticUniforms:e,manualUniforms:r}}function PO(t,n,e){const r={};for(let s=0;s<e;++s){const o=t.getActiveAttrib(n,s),i=t.getAttribLocation(n,o.name);r[o.name]={name:o.name,type:o.type,index:i}}return r}function TO(t,n,e){t.useProgram(n);let r=0;const s=e.length;for(let o=0;o<s;++o)r=e[o]._setSampler(r);return t.useProgram(null),r}const{defaultValue:Gi,BufferUsage:BO,defined:Or,ComponentDatatype:jn,Geometry:IO,Math:FO,IndexDatatype:e1,VertexArray:kO,RuntimeError:MO,Buffer:Ul,AttributeType:OO}=F;function DO(){F.VertexArray.fromGeometry=function(t){t=Gi(t,Gi.EMPTY_OBJECT),F.Check.defined("options.context",t.context);const n=t.context,e=Gi(t.geometry,Gi.EMPTY_OBJECT),r=Gi(t.bufferUsage,BO.DYNAMIC_DRAW),s=Gi(t.attributeLocations,Gi.EMPTY_OBJECT),o=Gi(t.interleave,!1),i=t.vertexArrayAttributes;let a,l,h;const f=Or(i)?i:[],u=e.attributes;if(o){const g=RO(u);if(Or(g)){h=Ul.createVertexBuffer({context:n,typedArray:g.buffer,usage:r});const m=g.offsetsInBytes,p=g.vertexSizeInBytes;for(a in u)u.hasOwnProperty(a)&&Or(u[a])&&(l=u[a],Or(l.values)?f.push({index:s[a],vertexBuffer:h,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize,offsetInBytes:m[a],strideInBytes:p}):f.push({index:s[a],value:l.value,componentDatatype:l.componentDatatype,normalize:l.normalize}))}}else for(a in u)if(u.hasOwnProperty(a)&&Or(u[a])){l=u[a];let g=l.componentDatatype;g===jn.DOUBLE&&(g=jn.FLOAT);let m={};h=void 0,Or(l.values)&&(h=Ul.createVertexBuffer({context:n,typedArray:jn.createTypedArray(g,l.values),usage:r}),m={index:s[a],vertexBuffer:h,value:l.value,componentDatatype:g,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize}),Or(l.typedArray)&&(h=Ul.createVertexBuffer({context:n,typedArray:l.typedArray,usage:r}),m={index:s[a],vertexBuffer:h,value:void 0,componentDatatype:g,componentsPerAttribute:OO.getNumberOfComponents(l.type),normalize:l.normalized,instanceDivisor:l.instanceDivisor}),f.push(m)}let A;const v=e.indices;return Or(v)&&(IO.computeNumberOfVertices(e)>=FO.SIXTY_FOUR_KILOBYTES&&n.elementIndexUint?A=Ul.createIndexBuffer({context:n,typedArray:new Uint32Array(v),usage:r,indexDatatype:e1.UNSIGNED_INT}):A=Ul.createIndexBuffer({context:n,typedArray:new Uint16Array(v),usage:r,indexDatatype:e1.UNSIGNED_SHORT})),new kO({context:n,attributes:f,indexBuffer:A})}}function RO(t){let n,e,r;const s=[];for(e in t)t.hasOwnProperty(e)&&Or(t[e])&&Or(t[e].values)&&(s.push(e),t[e].componentDatatype===jn.DOUBLE&&(t[e].componentDatatype=jn.FLOAT,t[e].values=jn.createTypedArray(jn.FLOAT,t[e].values)));let o;const i=s.length;if(i>0)for(o=t1(t[s[0]]),n=1;n<i;++n){const h=t1(t[s[n]]);if(h!==o)throw new MO(`Each attribute list must have the same number of vertices. Attribute ${s[n]} has a different number of vertices (${h.toString()}) than attribute ${s[0]} (${o.toString()}).`)}s.sort(function(h,f){return jn.getSizeInBytes(t[f].componentDatatype)-jn.getSizeInBytes(t[h].componentDatatype)});let a=0;const l={};for(n=0;n<i;++n)e=s[n],r=t[e],l[e]=a,a+=UO(r);if(a>0){const h=jn.getSizeInBytes(t[s[0]].componentDatatype),f=a%h;f!==0&&(a+=h-f);const u=o*a,A=new ArrayBuffer(u),v={};for(n=0;n<i;++n){e=s[n];const g=jn.getSizeInBytes(t[e].componentDatatype);v[e]={pointer:jn.createTypedArray(t[e].componentDatatype,A),index:l[e]/g,strideInComponentType:a/g}}for(n=0;n<o;++n)for(let g=0;g<i;++g){e=s[g],r=t[e];const m=r.values,p=v[e],d=p.pointer,c=r.componentsPerAttribute;for(let y=0;y<c;++y)d[p.index+y]=m[n*c+y];p.index+=p.strideInComponentType}return{buffer:A,offsetsInBytes:l,vertexSizeInBytes:a}}}function t1(t){return t.values.length/t.componentsPerAttribute}function UO(t){return jn.getSizeInBytes(t.componentDatatype)*t.componentsPerAttribute}const{defaultValue:n1}=F;class LO extends F.FrustumCommands{constructor(n,e){super(n,e),this.near=n1(n,0),this.far=n1(e,0);const r=12,s=new Array(r),o=new Array(r);for(let i=0;i<r;++i)s[i]=[],o[i]=0;this.commands=s,this.indices=o}}const{SceneMode:r1,CullingVolume:zO,Interval:NO,Pass:lf,defined:Ll,ShadowMap:VO,Math:QO,ClearCommand:HO}=F,i1=new zO,jO=new NO;function GO(){F.View.prototype.createPotentiallyVisibleSet=function(t){const{frameState:n}=t,{camera:e,commandList:r,shadowState:s}=n,{positionWC:o,directionWC:i,frustum:a}=e,l=t._computeCommandList,h=t._overlayCommandList;t.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const f=this.frustumCommandsList;for(let T=0;T<f.length;++T)for(let I=0;I<12;++I)f[T].indices[I]=0;l.length=0,h.length=0;const u=this._commandExtents,A=u.length;let v=0,g=+Number.MAX_VALUE,m=-Number.MAX_VALUE;const{shadowsEnabled:p}=s;let d=+Number.MAX_VALUE,c=-Number.MAX_VALUE,y=Number.MAX_VALUE;const w=n.mode===r1.SCENE3D?n.occluder:void 0;let{cullingVolume:b}=n;const _=i1.planes;for(let T=0;T<5;++T)_[T]=b.planes[T];b=i1;for(let T=0;T<r.length;++T){const I=r[T],{pass:P,boundingVolume:k}=I;if(P===lf.COMPUTE)l.push(I);else if(P===lf.OVERLAY)h.push(I);else{let S,B;if(Ll(k)){if(!t.isVisible(b,I,w))continue;const M=k.computePlaneDistances(o,i,jO);if(S=M.start,B=M.stop,g=Math.min(g,S),m=Math.max(m,B),p&&I.receiveShadows&&S<VO.MAXIMUM_DISTANCE&&!(P===lf.GLOBE&&S<-100&&B>100)){const D=B-S;P!==lf.GLOBE&&S<100&&(y=Math.min(y,D)),d=Math.min(d,S),c=Math.max(c,B)}}else I instanceof HO?(S=a.near,B=a.far):(S=a.near,B=a.far,g=Math.min(g,S),m=Math.max(m,B));let O=u[v];Ll(O)||(O=u[v]=new KO),O.command=I,O.near=S,O.far=B,v++}}p&&(d=Math.min(Math.max(d,a.near),a.far),c=Math.max(Math.min(c,a.far),d),s.nearPlane=d,s.farPlane=c,s.closestObjectSize=y),WO(this,t,g,m);for(let T=0;T<v;T++)qO(this,t,u[T]);if(v<A)for(let T=v;T<A;T++){const I=u[T];if(!Ll(I.command))break;I.command=void 0}const x=f.length,{frustumSplits:C}=n;C.length=x+1;for(let T=0;T<x;++T)C[T]=f[T].near,T===x-1&&(C[T+1]=f[T].far)}}function WO(t,n,e,r){const{frameState:s}=n,{camera:o,useLogDepth:i}=s,a=i?n.logarithmicDepthFarToNearRatio:n.farToNearRatio,l=n.mode===r1.SCENE2D,h=n.nearToFarDistance2D;r*=1+QO.EPSILON2,e=Math.min(Math.max(e,o.frustum.near),o.frustum.far),r=Math.max(Math.min(r,o.frustum.far),e);let f;l?(r=Math.min(r,o.position.z+n.nearToFarDistance2D),e=Math.min(e,r),f=Math.ceil(Math.max(1,r-e)/n.nearToFarDistance2D)):f=Math.ceil(Math.log(r/e)/Math.log(a));const{frustumCommandsList:u}=t;u.length=f;for(let A=0;A<f;++A){let v,g;l?(v=Math.min(r-h,e+A*h),g=Math.min(r,v+h)):(v=Math.max(e,Math.pow(a,A)*e),g=Math.min(r,a*v));let m=u[A];Ll(m)?(m.near=v,m.far=g):m=u[A]=new LO(v,g)}}function qO(t,n,e){const{command:r,near:s,far:o}=e;n.debugShowFrustums&&(r.debugOverlappingFrustums=0);const{frustumCommandsList:i}=t;for(let a=0;a<i.length;++a){const l=i[a];if(s>l.far)continue;if(o<l.near)break;const h=r.pass,f=l.indices[h]++;if(l.commands[h][f]=r,n.debugShowFrustums&&(r.debugOverlappingFrustums|=1<<a),r.executeInClosestFrustum)break}if(n.debugShowFrustums){const{debugFrustumStatistics:a}=t,{debugOverlappingFrustums:l}=r,h=a.commandsInFrustums;h[l]=Ll(h[l])?h[l]+1:1,++a.totalCommands}n.updateDerivedCommands(r)}class KO{constructor(){N(this,"command");N(this,"near");N(this,"far")}}eI(),tI(),fI(),nF(),ck(),Jk(),oM(),lM(),cM(),yM(),KM(),GO(),DO(),xO(),kB(),MB(),OB(),LB(),zB(),NB(),VB(),FB(),YB(),JB(),F.Camera.DEFAULT_VIEW_RECTANGLE=F.Rectangle.fromDegrees(70,5,140,55);function XO(){return new Promise((t,n)=>F.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class $O extends E.Destroyable{constructor(n,e,r,s){super();const o=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=Gn(a);if(l&&(l.destroy(),SA(a,void 0)),F.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(),r(void 0)}};this.d(o);const i=this.dv(E.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const h=IB;await a.promise(XO());const f=await a.promise(E.createCancelablePromise(h(l,s)));f.scene._xbsjOriginSkyAtmosphere=f.scene.skyAtmosphere,f.scene._xbsjOriginSkyBox=f.scene.skyBox,f.clockViewModel.currentTime=F.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const u=F.JulianDate.fromDate(new Date(e.currentTime));F.JulianDate.equals(u,f.clockViewModel.currentTime)||(f.clockViewModel.currentTime=u)})),this.dispose(Ir(f.clockViewModel,"currentTime",u=>{const A=F.JulianDate.toDate(f.clockViewModel.currentTime).getTime();A!==e.currentTime&&(e.currentTime=A)}));{const u=new u1(f,e);SA(f,u)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),r(f)}));i.start(n),i.errorEvent.don(()=>{e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const ZO=new F.EllipsoidTerrainProvider;class o1 extends E.Destroyable{constructor(e){super();N(this,"_terrainMap",new Map);N(this,"_nextAnimateFrame",this.dv(E.createNextAnimateFrame()));N(this,"selectedTerrain");this._viewer=e;const r=this._viewer,s=r.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{s&&s()}),this.dispose(this._changed.disposableOn(()=>{let o=Number.MIN_SAFE_INTEGER;for(let i of this._terrainMap.keys())i.sceneObject.activate=!1,(i.sceneObject.show??!0)&&i.sceneObject.zIndex>=o&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${i.sceneObject.name}(${i.sceneObject.id})`),o=i.sceneObject.zIndex,this.selectedTerrain=i);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),r.scene.terrainProvider=this.selectedTerrain&&this.selectedTerrain.provider||ZO}))}_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 r=new E.Destroyable;r.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),r.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>r.destroy()),this._makeDirty(),this.d(e.sceneObject.zIndexChanged.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const r=this._terrainMap.get(e);if(!r){console.error("!disposeFunc");return}r(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class a1 extends E.Destroyable{constructor(e){super();N(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const r=e instanceof It?"div":"canvas";if(this._labelMap[r].has(e)){console.warn(`this._labelMap[${r}].has(poi)`,e);return}const s=new E.Destroyable;{const o=s.dv(E.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));s.dispose(o.don(()=>{this._updateZOrder()}))}this._labelMap[r].set(e,()=>s.destroy()),this._updateZOrder()}delete(e){const r=e instanceof It?"div":"canvas";if(!this._labelMap[r].has(e)){console.warn(`!this._labelMap[${r}].has(poi)`,e);return}const s=this._labelMap[r].get(e);if(!s){console.error("!disposeFunc");return}s(),this._labelMap[r].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,r){const s={};for(const a of e.keys())s[a.zOrder]||(s[a.zOrder]=new Map),s[a.zOrder].set(a,a instanceof It?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const o=Object.keys(s).sort((a,l)=>r=="div"?Number(l)-Number(a):Number(a)-Number(l));let i=e.size;for(let a=0;a<o.length;a++)new Map([...s[o[a]]].sort((h,f)=>Number(f[1])-Number(h[1]))).forEach((h,f)=>{f instanceof It&&f.czmDivPoi&&(f.czmDivPoi.zOrder=i),f instanceof fi&&f.canvasObj&&(f.canvasObj.czmCanvasPoi.zOrder=i),i--})}}class YO extends E.Destroyable{constructor(e){super();N(this,"_czmImageryLayerWrappers",new Set);N(this,"_zIndexChangedEvent",this.dv(new E.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const r=[...this.czmImageryLayerWrappers.values()];r.sort((s,o)=>{const i=s.czmImageryWrapper.imagery.zIndex??Q.ESImageryLayer.defaults.zIndex,a=o.czmImageryWrapper.imagery.zIndex??Q.ESImageryLayer.defaults.zIndex;return i-a});for(const s of r)this.viewer.imageryLayers.raiseToTop(s.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 JO extends E.Destroyable{constructor(e){super();N(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:r}=this,s=r.manager.czmImageriesManager;s.add(this),this.d(()=>s.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>s.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class e3 extends E.Destroyable{constructor(e){super();N(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new E.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new JO(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class t3 extends E.Destroyable{constructor(e,r){super();N(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=r,this._czmImageryLayerWrapperObjResetting=this.dv(new E.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new e3(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class s1 extends E.Destroyable{constructor(e){super();N(this,"_czmImageryWrappers",new Set);N(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new YO(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let r of this.czmImageryWrappers)if(r.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new t3(e,this))}delete(e){for(const r of this.czmImageryWrappers)if(r.imagery===e){this.czmImageryWrappers.delete(r);return}console.warn("imageriesManager delete error!",e)}}class l1 extends E.Destroyable{constructor(e){super();N(this,"_pause",this.disposeVar(E.react(!1)));N(this,"_pickPositionTasks",[]);N(this,"_pickTasks",[]);N(this,"pickHeightMustGreaterThanZero",!0);N(this,"objectsToExclude",[]);const r=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 s=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let h of a){const[f,u,A,v]=h;try{(async()=>{const{scene:g,camera:m}=r,p=rt(f),d=m.getPickRay(p);do{if(!d)break;let c;if(u?c=await g.pickFromRayMostDetailed(d,this.objectsToExclude):c=g.pickFromRay(d,this.objectsToExclude),!c||!c.position)break;const y=He(c.position);if(!y){v(new Error("positionFromCartesian failed"));return}A(y);return}while(!1);if(d&&!(g.terrainProvider instanceof F.EllipsoidTerrainProvider)){const c=g.globe.pick(d,g);if(!c){v(new Error("scene.globe.pick failed"));return}const y=He(c);if(!y){v(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&y[2]<0&&(y[2]=0),A(y);return}{const c=g.terrainProvider instanceof F.EllipsoidTerrainProvider?g.terrainProvider.tilingScheme.ellipsoid:r.scene.globe.ellipsoid,y=r.camera.pickEllipsoid(rt(f),c);if(!y){v(new Error("Pick failed"));return}const w=He(y);if(!w){v(new Error("positionFromCartesian failed"));return}A(w)}})()}catch(g){v(g)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let h of l){const[f,u,A,v,g]=h;e.pickCustomAttachedInfo=A;try{(async()=>{var b,_,x;let m=r.scene.pick(rt(f),u&&u[0],u&&u[1]);!m&&F.defined(r.scene.globe)&&(m=await n3(r,rt(f)));let p;if(m&&m instanceof F.Cesium3DTileFeature){p={};try{m&&m.getPropertyIds().forEach(T=>{p&&(p[T]=m.getProperty(T))})}catch(C){console.warn(C)}}let d;do{if(!m)break;if(m.id&&m.id instanceof F.Entity&&m.id.ESSceneObjectID){d=m.id.ESSceneObjectID;break}if(m.primitive&&m.primitive.ESSceneObjectID){d=m.primitive.ESSceneObjectID;break}}while(!1);const c=d?Q.ESSceneObject.getSceneObject(d):void 0;let y={};if(c&&Reflect.has(c,"allowPicking")&&Reflect.has(c,"pickedEvent")&&(c.allowPicking??!1)){do{if(c instanceof Q.ESEntityCluster){const C=new F.JulianDate;y=m.id instanceof F.Entity?{name:m.id.label.text.getValue(C),properties:(b=m.id.properties)==null?void 0:b.getValue(C),coordinates:bl(m.id.position.getValue(C))}:(_=m.id)==null?void 0:_.map(T=>{var I;return{name:T.id,properties:(I=T.properties)==null?void 0:I.getValue(C),coordinates:bl(T.position.getValue(C))}});break}if(c instanceof Q.ESGeoJson){const C=new F.JulianDate;if(!m.id.entityCollection)return;const T=m.id.polygon?"Polygon":m.id.polyline?"LineString":"Point",I=((x=m.id.properties)==null?void 0:x.getValue(C))??{},P=T=="Point"?He(m.id.position.getValue(C)):T=="LineString"?m.id.polyline.positions.getValue(C).map(k=>He(k)):Lp(m.id.polygon.hierarchy.getValue(C));y=c.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:T,coordinates:P},properties:I}:{type:T,coordinates:P,properties:I};break}if(c instanceof Q.ESGltfModel){let C;Reflect.has(m,"featureId")?C=m.featureId:Reflect.has(m,"instanceId")&&(C=m.instanceId),C&&(m.id=m.primitive.structuralMetadata.getPropertyTable(0).getProperty(m.instanceId,"id"))}}while(!1);c.pickedEvent.emit(new Q.ESJPickedResult(m,c,p,y,A,f))}c&&Reflect.has(c,"allowPicking")&&!c.allowPicking&&v(new Q.ESJPickedResult);const w=new Q.ESJPickedResult(m,c,p,y,A,f);v(w)})()}catch(m){g(m)}}};let o=r.scene.postRender.addEventListener(s);const i=()=>{o&&o(),o=void 0};this.ad(i),this.ad(this.pauseChanged.don(a=>{a?i():o=r.scene.postRender.addEventListener(s)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((r,s)=>{this._pickPositionTasks.push([e,!0,r,s])})}quickPickPosition(e){return new Promise((r,s)=>{this._pickPositionTasks.push([e,!1,r,s])})}pick(e,r,s){return new Promise((o,i)=>{this._pickTasks.push([e,r,s,o,i])})}}function n3(t,n){const e=t.scene,r=e.camera.getPickRay(n);if(!r)return;const s=e.imageryLayers.pickImageryLayerFeatures(r,e);if(F.defined(s))return s}class r3 extends E.Destroyable{constructor(e){super();N(this,"_enabled",this.disposeVar(E.react(!1)));N(this,"_cursorPosition",E.react(void 0));N(this,"quickPickPosition",!0);let r=new E.Destroyable;const s=()=>{r&&(r.destroy(),r=void 0)};this.dispose(s);const o=()=>{if(s(),!this._enabled.value||!e)return;const i=Gn(e);if(!i)return;r=new E.Destroyable;const a=r.disposeVar(E.react(void 0)),l=r.disposeVar(E.createNextAnimateFrameEvent(a.changed));r.dispose(i.czmViewer.pointerMoveEvent.disposableOn(f=>{f.pointerEvent&&(a.value=E.getDomEventCurrentTargetPos(f.pointerEvent))}));const h=r.disposeVar(E.createProcessingFromAsyncFunc(async f=>{if(i.pickingManager&&a.value)if(this.quickPickPosition){const u=await f.promise(E.createCancelablePromise(i.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=u}else{const u=await f.promise(E.createCancelablePromise(i.pickingManager.pickPosition(a.value)));this._cursorPosition.value=u}}));r.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 Gn(t){return E.getExtProp(t,"_viewerExtensions")}function SA(t,n){E.setExtProp(t,"_viewerExtensions",n)}class u1 extends E.Destroyable{constructor(e,r){super();N(this,"_imageriesManager");N(this,"_terrainManager");N(this,"_labelManager");N(this,"_pickingManager");N(this,"_poiContext");N(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=r,this._imageriesManager=this.dv(new s1(this.viewer)),this._terrainManager=this.dv(new o1(this.viewer)),this._labelManager=this.dv(new a1(this.viewer)),this._poiContext=this.disposeVar(new I1(this._viewer)),this._cursorPositionInfo=this.disposeVar(new r3(this._viewer)),this.ad(r.viewerChanged.don(()=>{this._pickingManager=this.dv(new l1(r))}))}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 c1=new F.Cartesian3,h1=new F.Cartesian3;function f1(t,n,e){let r=F.Matrix4.clone(t.transform);t.lookAtTransform(F.Matrix4.IDENTITY);var s=t.positionCartographic.height,o=t.positionWC,i=F.Cartesian3.normalize(o,c1),a=F.Cartesian3.dot(t.direction,i);if(a>-.9&&a<.9)var l=F.Cartesian3.cross(t.direction,i,h1);else var l=F.Cartesian3.cross(t.up,i,h1);var h=l;if(e){var f=F.Cartesian3.cross(i,l,c1);h=f}var u=F.Cartesian3.magnitude(o);t.rotate(h,n/u);var A=t.positionCartographic,v=A.longitude,g=A.latitude;F.Cartesian3.fromRadians(v,g,s,void 0,t.position),t.lookAtTransform(r)}function d1(t,n){f1(t,n,!1)}function p1(t,n){f1(t,-n,!0)}class i3 extends E.Destroyable{constructor(e){super();N(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:r}=this,{viewer:s}=r.firstPersonController,{camera:o}=s;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(i=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[i.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:a[i.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(i=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[i.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:i}=this;let a=Date.now();const l=()=>{const h=Date.now(),f=h-a;a=h;const u=this.controller.speed;i.WithCamera||this.controller.alwaysWithCamera?(i.MoveForward&&o.moveForward(f*u),i.MoveBackword&&o.moveBackward(f*u),i.MoveLeft&&o.moveLeft(f*u),i.MoveRight&&o.moveRight(f*u)):(i.MoveForward&&d1(o,f*u),i.MoveBackword&&d1(o,-f*u),i.MoveLeft&&p1(o,-f*u),i.MoveRight&&p1(o,f*u));{const{rotateSpeed:A}=this.controller,v=F.Math.toRadians(A*f);i.RotateRight?o.lookRight(v):i.RotateLeft?o.lookRight(-v):i.RotateUp?o.lookDown(-v):i.RotateDown&&o.lookDown(v)}};s.scene.preUpdate.addEventListener(l),this.dispose(()=>s.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 r of e)this._actions[r]=!1}_updateActions(){const{running:e}=this,{keyStatus:r}=e,{actions:s}=this;this._resetActions();const{keyStatusMap:o}=this.running.keyboardCameraController;for(let i of r.currentKeyIds)s[o[i]]=!0}}class uf extends E.Destroyable{constructor(e){super();N(this,"_currentKeyIds",new Set);N(this,"_currentKeyIdsChanged",this.dv(new E.Event));N(this,"_debug",this.dv(E.react(!1)));N(this,"_debugResetting",this.dv(new E.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends E.Destroyable{constructor(e){super();const r=()=>{console.log([...e.currentKeyIds].join(`
|
|
965
|
+
${g}`)}}function SO(t,n){const e={},r=[],s=[],o=t.getProgramParameter(n,t.ACTIVE_UNIFORMS);for(let i=0;i<o;++i){const a=t.getActiveUniform(n,i),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 f=t.getUniformLocation(n,h);if(f!==null){const u=a.type!=t.UNSIGNED_INT_SAMPLER_2D?bO(t,a,h,f):new yO(t,a,h,f);e[h]=u,r.push(u),u._setSampler&&s.push(u)}}else{let f,u,A,v;const g=h.indexOf("[");if(g>=0){if(f=e[h.slice(0,g)],!ui(f))continue;u=f._locations,u.length<=1&&(A=f.value,v=t.getUniformLocation(n,h),v!==null&&(u.push(v),A.push(t.getUniform(n,v))))}else{u=[];for(let m=0;m<a.size;++m)v=t.getUniformLocation(n,`${h}[${m}]`),v!==null&&u.push(v);f=a.type!=t.UNSIGNED_INT_SAMPLER_2D?_O(t,a,h,u):new gO(t,a,h,u),e[h]=f,r.push(f),f._setSampler&&s.push(f)}}}return{uniformsByName:e,uniforms:r,samplerUniforms:s}}function EO(t,n){const e=[],r=[];for(const s in n)if(n.hasOwnProperty(s)){const o=n[s];let i=s;const a=t._duplicateUniformNames[i];ui(a)&&(o.name=a,i=a);const l=wO[i];ui(l)?e.push({uniform:o,automaticUniform:l}):r.push(o)}return{automaticUniforms:e,manualUniforms:r}}function PO(t,n,e){const r={};for(let s=0;s<e;++s){const o=t.getActiveAttrib(n,s),i=t.getAttribLocation(n,o.name);r[o.name]={name:o.name,type:o.type,index:i}}return r}function TO(t,n,e){t.useProgram(n);let r=0;const s=e.length;for(let o=0;o<s;++o)r=e[o]._setSampler(r);return t.useProgram(null),r}const{defaultValue:Gi,BufferUsage:BO,defined:Or,ComponentDatatype:jn,Geometry:IO,Math:FO,IndexDatatype:e1,VertexArray:kO,RuntimeError:MO,Buffer:Ul,AttributeType:OO}=F;function DO(){F.VertexArray.fromGeometry=function(t){t=Gi(t,Gi.EMPTY_OBJECT),F.Check.defined("options.context",t.context);const n=t.context,e=Gi(t.geometry,Gi.EMPTY_OBJECT),r=Gi(t.bufferUsage,BO.DYNAMIC_DRAW),s=Gi(t.attributeLocations,Gi.EMPTY_OBJECT),o=Gi(t.interleave,!1),i=t.vertexArrayAttributes;let a,l,h;const f=Or(i)?i:[],u=e.attributes;if(o){const g=RO(u);if(Or(g)){h=Ul.createVertexBuffer({context:n,typedArray:g.buffer,usage:r});const m=g.offsetsInBytes,p=g.vertexSizeInBytes;for(a in u)u.hasOwnProperty(a)&&Or(u[a])&&(l=u[a],Or(l.values)?f.push({index:s[a],vertexBuffer:h,componentDatatype:l.componentDatatype,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize,offsetInBytes:m[a],strideInBytes:p}):f.push({index:s[a],value:l.value,componentDatatype:l.componentDatatype,normalize:l.normalize}))}}else for(a in u)if(u.hasOwnProperty(a)&&Or(u[a])){l=u[a];let g=l.componentDatatype;g===jn.DOUBLE&&(g=jn.FLOAT);let m={};h=void 0,Or(l.values)&&(h=Ul.createVertexBuffer({context:n,typedArray:jn.createTypedArray(g,l.values),usage:r}),m={index:s[a],vertexBuffer:h,value:l.value,componentDatatype:g,componentsPerAttribute:l.componentsPerAttribute,normalize:l.normalize}),Or(l.typedArray)&&(h=Ul.createVertexBuffer({context:n,typedArray:l.typedArray,usage:r}),m={index:s[a],vertexBuffer:h,value:void 0,componentDatatype:g,componentsPerAttribute:OO.getNumberOfComponents(l.type),normalize:l.normalized,instanceDivisor:l.instanceDivisor}),f.push(m)}let A;const v=e.indices;return Or(v)&&(IO.computeNumberOfVertices(e)>=FO.SIXTY_FOUR_KILOBYTES&&n.elementIndexUint?A=Ul.createIndexBuffer({context:n,typedArray:new Uint32Array(v),usage:r,indexDatatype:e1.UNSIGNED_INT}):A=Ul.createIndexBuffer({context:n,typedArray:new Uint16Array(v),usage:r,indexDatatype:e1.UNSIGNED_SHORT})),new kO({context:n,attributes:f,indexBuffer:A})}}function RO(t){let n,e,r;const s=[];for(e in t)t.hasOwnProperty(e)&&Or(t[e])&&Or(t[e].values)&&(s.push(e),t[e].componentDatatype===jn.DOUBLE&&(t[e].componentDatatype=jn.FLOAT,t[e].values=jn.createTypedArray(jn.FLOAT,t[e].values)));let o;const i=s.length;if(i>0)for(o=t1(t[s[0]]),n=1;n<i;++n){const h=t1(t[s[n]]);if(h!==o)throw new MO(`Each attribute list must have the same number of vertices. Attribute ${s[n]} has a different number of vertices (${h.toString()}) than attribute ${s[0]} (${o.toString()}).`)}s.sort(function(h,f){return jn.getSizeInBytes(t[f].componentDatatype)-jn.getSizeInBytes(t[h].componentDatatype)});let a=0;const l={};for(n=0;n<i;++n)e=s[n],r=t[e],l[e]=a,a+=UO(r);if(a>0){const h=jn.getSizeInBytes(t[s[0]].componentDatatype),f=a%h;f!==0&&(a+=h-f);const u=o*a,A=new ArrayBuffer(u),v={};for(n=0;n<i;++n){e=s[n];const g=jn.getSizeInBytes(t[e].componentDatatype);v[e]={pointer:jn.createTypedArray(t[e].componentDatatype,A),index:l[e]/g,strideInComponentType:a/g}}for(n=0;n<o;++n)for(let g=0;g<i;++g){e=s[g],r=t[e];const m=r.values,p=v[e],d=p.pointer,c=r.componentsPerAttribute;for(let y=0;y<c;++y)d[p.index+y]=m[n*c+y];p.index+=p.strideInComponentType}return{buffer:A,offsetsInBytes:l,vertexSizeInBytes:a}}}function t1(t){return t.values.length/t.componentsPerAttribute}function UO(t){return jn.getSizeInBytes(t.componentDatatype)*t.componentsPerAttribute}const{defaultValue:n1}=F;class LO extends F.FrustumCommands{constructor(n,e){super(n,e),this.near=n1(n,0),this.far=n1(e,0);const r=12,s=new Array(r),o=new Array(r);for(let i=0;i<r;++i)s[i]=[],o[i]=0;this.commands=s,this.indices=o}}const{SceneMode:r1,CullingVolume:zO,Interval:NO,Pass:lf,defined:Ll,ShadowMap:VO,Math:QO,ClearCommand:HO}=F,i1=new zO,jO=new NO;function GO(){F.View.prototype.createPotentiallyVisibleSet=function(t){const{frameState:n}=t,{camera:e,commandList:r,shadowState:s}=n,{positionWC:o,directionWC:i,frustum:a}=e,l=t._computeCommandList,h=t._overlayCommandList;t.debugShowFrustums&&(this.debugFrustumStatistics={totalCommands:0,commandsInFrustums:{}});const f=this.frustumCommandsList;for(let T=0;T<f.length;++T)for(let I=0;I<12;++I)f[T].indices[I]=0;l.length=0,h.length=0;const u=this._commandExtents,A=u.length;let v=0,g=+Number.MAX_VALUE,m=-Number.MAX_VALUE;const{shadowsEnabled:p}=s;let d=+Number.MAX_VALUE,c=-Number.MAX_VALUE,y=Number.MAX_VALUE;const w=n.mode===r1.SCENE3D?n.occluder:void 0;let{cullingVolume:b}=n;const _=i1.planes;for(let T=0;T<5;++T)_[T]=b.planes[T];b=i1;for(let T=0;T<r.length;++T){const I=r[T],{pass:P,boundingVolume:k}=I;if(P===lf.COMPUTE)l.push(I);else if(P===lf.OVERLAY)h.push(I);else{let S,B;if(Ll(k)){if(!t.isVisible(b,I,w))continue;const M=k.computePlaneDistances(o,i,jO);if(S=M.start,B=M.stop,g=Math.min(g,S),m=Math.max(m,B),p&&I.receiveShadows&&S<VO.MAXIMUM_DISTANCE&&!(P===lf.GLOBE&&S<-100&&B>100)){const D=B-S;P!==lf.GLOBE&&S<100&&(y=Math.min(y,D)),d=Math.min(d,S),c=Math.max(c,B)}}else I instanceof HO?(S=a.near,B=a.far):(S=a.near,B=a.far,g=Math.min(g,S),m=Math.max(m,B));let O=u[v];Ll(O)||(O=u[v]=new KO),O.command=I,O.near=S,O.far=B,v++}}p&&(d=Math.min(Math.max(d,a.near),a.far),c=Math.max(Math.min(c,a.far),d),s.nearPlane=d,s.farPlane=c,s.closestObjectSize=y),WO(this,t,g,m);for(let T=0;T<v;T++)qO(this,t,u[T]);if(v<A)for(let T=v;T<A;T++){const I=u[T];if(!Ll(I.command))break;I.command=void 0}const x=f.length,{frustumSplits:C}=n;C.length=x+1;for(let T=0;T<x;++T)C[T]=f[T].near,T===x-1&&(C[T+1]=f[T].far)}}function WO(t,n,e,r){const{frameState:s}=n,{camera:o,useLogDepth:i}=s,a=i?n.logarithmicDepthFarToNearRatio:n.farToNearRatio,l=n.mode===r1.SCENE2D,h=n.nearToFarDistance2D;r*=1+QO.EPSILON2,e=Math.min(Math.max(e,o.frustum.near),o.frustum.far),r=Math.max(Math.min(r,o.frustum.far),e);let f;l?(r=Math.min(r,o.position.z+n.nearToFarDistance2D),e=Math.min(e,r),f=Math.ceil(Math.max(1,r-e)/n.nearToFarDistance2D)):f=Math.ceil(Math.log(r/e)/Math.log(a));const{frustumCommandsList:u}=t;u.length=f;for(let A=0;A<f;++A){let v,g;l?(v=Math.min(r-h,e+A*h),g=Math.min(r,v+h)):(v=Math.max(e,Math.pow(a,A)*e),g=Math.min(r,a*v));let m=u[A];Ll(m)?(m.near=v,m.far=g):m=u[A]=new LO(v,g)}}function qO(t,n,e){const{command:r,near:s,far:o}=e;n.debugShowFrustums&&(r.debugOverlappingFrustums=0);const{frustumCommandsList:i}=t;for(let a=0;a<i.length;++a){const l=i[a];if(s>l.far)continue;if(o<l.near)break;const h=r.pass,f=l.indices[h]++;if(l.commands[h][f]=r,n.debugShowFrustums&&(r.debugOverlappingFrustums|=1<<a),r.executeInClosestFrustum)break}if(n.debugShowFrustums){const{debugFrustumStatistics:a}=t,{debugOverlappingFrustums:l}=r,h=a.commandsInFrustums;h[l]=Ll(h[l])?h[l]+1:1,++a.totalCommands}n.updateDerivedCommands(r)}class KO{constructor(){N(this,"command");N(this,"near");N(this,"far")}}eI(),tI(),fI(),nF(),ck(),Jk(),oM(),lM(),cM(),yM(),KM(),GO(),DO(),xO(),kB(),MB(),OB(),LB(),zB(),NB(),VB(),FB(),YB(),JB(),F.Camera.DEFAULT_VIEW_RECTANGLE=F.Rectangle.fromDegrees(70,5,140,55);function XO(){return new Promise((t,n)=>F.GroundPolylinePrimitive.initializeTerrainHeights().then(t))}class $O extends E.Destroyable{constructor(n,e,r,s){super();const o=()=>{e.setStatus("Raw");const{viewer:a}=e;if(a){const l=Gn(a);if(l&&(l.destroy(),SA(a,void 0)),F.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(),r(void 0)}};this.d(o);const i=this.dv(E.createProcessingFromAsyncFunc(async(a,l)=>{e.setStatus("Creating"),e.setStatusLog("正在创建Cesium视口...");const h=IB;await a.promise(XO());const f=await a.promise(E.createCancelablePromise(h(l,s)));f.scene._xbsjOriginSkyAtmosphere=f.scene.skyAtmosphere,f.scene._xbsjOriginSkyBox=f.scene.skyBox,f.clockViewModel.currentTime=F.JulianDate.fromDate(new Date(e.currentTime)),this.dispose(e.currentTimeChanged.disposableOn(()=>{if(e.currentTime===void 0)return;const u=F.JulianDate.fromDate(new Date(e.currentTime));F.JulianDate.equals(u,f.clockViewModel.currentTime)||(f.clockViewModel.currentTime=u)})),this.dispose(Ir(f.clockViewModel,"currentTime",u=>{const A=F.JulianDate.toDate(f.clockViewModel.currentTime).getTime();A!==e.currentTime&&(e.currentTime=A)}));{const u=new u1(f,e);SA(f,u)}e.setStatus("Created"),e.setStatusLog("成功创建Cesium视口!"),r(f)}));i.start(n),i.errorEvent.don(()=>{e.setStatus("Error"),e.setStatusLog("创建Cesium视口失败!")})}}const ZO=new F.EllipsoidTerrainProvider;class o1 extends E.Destroyable{constructor(e){super();N(this,"_terrainMap",new Map);N(this,"_nextAnimateFrame",this.dv(E.createNextAnimateFrame()));N(this,"selectedTerrain");this._viewer=e;const r=this._viewer,s=r.scene.globe.terrainProviderChanged.addEventListener(()=>{this.selectedTerrain&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit())});this.ad(()=>{s&&s()}),this.dispose(this._changed.disposableOn(()=>{let o=Number.MIN_SAFE_INTEGER;for(let i of this._terrainMap.keys())i.sceneObject.activate=!1,(i.sceneObject.show??!0)&&i.sceneObject.zIndex>=o&&(this.selectedTerrain&&console.warn(`存在多个terrain,只能显示一个,当前terrian:${this.selectedTerrain.sceneObject.name}(${this.selectedTerrain.sceneObject.id}), 即将被替换成${i.sceneObject.name}(${i.sceneObject.id})`),o=i.sceneObject.zIndex,this.selectedTerrain=i);this.selectedTerrain&&!this.selectedTerrain.provider&&(this.selectedTerrain.sceneObject.activate=!0,this.selectedTerrain.sceneObject.activateEvent.emit()),r.scene.terrainProvider=(this.selectedTerrain&&this.selectedTerrain.provider)??ZO,r.scene.globe.depthTestAgainstTerrain=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="disableDepthTest":!0,r.scene.globe.translucency.enabled=this.selectedTerrain?this.selectedTerrain.sceneObject.renderMode!="default":!1,r.scene.globe.translucency.frontFaceAlpha=this.selectedTerrain?E.clamp(this.selectedTerrain.sceneObject.opacity,0,1):1,r.scene.globe.translucency.backFaceAlpha=this.selectedTerrain?E.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 r=new E.Destroyable;r.dispose(e.providerChanged.disposableOn(()=>this._makeDirty())),r.dispose(e.sceneObject.showChanged.disposableOn(()=>this._makeDirty())),this._terrainMap.set(e,()=>r.destroy()),this._makeDirty();const s=this.ad(E.createNextAnimateFrameEvent(e.sceneObject.zIndexChanged,e.sceneObject.opacityChanged,e.sceneObject.renderModeChanged));this.d(s.don(()=>{this._changed.emit()}))}delete(e){if(!this._terrainMap.has(e)){console.warn("!this._imageriesMap.has(imagery)");return}const r=this._terrainMap.get(e);if(!r){console.error("!disposeFunc");return}r(),this._terrainMap.delete(e),this.selectedTerrain===e&&(this.selectedTerrain=void 0),this._makeDirty()}}class a1 extends E.Destroyable{constructor(e){super();N(this,"_labelMap",{div:new Map,canvas:new Map});this._viewer=e,this.d(e.scene.camera.changed.addEventListener(()=>{this._updateZOrder()}))}add(e){const r=e instanceof It?"div":"canvas";if(this._labelMap[r].has(e)){console.warn(`this._labelMap[${r}].has(poi)`,e);return}const s=new E.Destroyable;{const o=s.dv(E.createNextAnimateFrameEvent(e.zOrderChanged,e.positionChanged));s.dispose(o.don(()=>{this._updateZOrder()}))}this._labelMap[r].set(e,()=>s.destroy()),this._updateZOrder()}delete(e){const r=e instanceof It?"div":"canvas";if(!this._labelMap[r].has(e)){console.warn(`!this._labelMap[${r}].has(poi)`,e);return}const s=this._labelMap[r].get(e);if(!s){console.error("!disposeFunc");return}s(),this._labelMap[r].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,r){const s={};for(const a of e.keys())s[a.zOrder]||(s[a.zOrder]=new Map),s[a.zOrder].set(a,a instanceof It?a.czmDivPoi?a.czmDivPoi.depth:0:a.canvasObj?a.canvasObj.czmCanvasPoi.depth:0);const o=Object.keys(s).sort((a,l)=>r=="div"?Number(l)-Number(a):Number(a)-Number(l));let i=e.size;for(let a=0;a<o.length;a++)new Map([...s[o[a]]].sort((h,f)=>Number(f[1])-Number(h[1]))).forEach((h,f)=>{f instanceof It&&f.czmDivPoi&&(f.czmDivPoi.zOrder=i),f instanceof fi&&f.canvasObj&&(f.canvasObj.czmCanvasPoi.zOrder=i),i--})}}class YO extends E.Destroyable{constructor(e){super();N(this,"_czmImageryLayerWrappers",new Set);N(this,"_zIndexChangedEvent",this.dv(new E.Event));this._viewer=e,this.d(this._zIndexChangedEvent.don(()=>{const r=[...this.czmImageryLayerWrappers.values()];r.sort((s,o)=>{const i=s.czmImageryWrapper.imagery.zIndex??Q.ESImageryLayer.defaults.zIndex,a=o.czmImageryWrapper.imagery.zIndex??Q.ESImageryLayer.defaults.zIndex;return i-a});for(const s of r)this.viewer.imageryLayers.raiseToTop(s.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 JO extends E.Destroyable{constructor(e){super();N(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:r}=this,s=r.manager.czmImageriesManager;s.add(this),this.d(()=>s.delete(this)),this.d(this._czmImageryWrapper.imagery.zIndexChanged.don(()=>s.zIndexChange()))}get imageryLayer(){return this._imageryLayer}get czmImageryWrapper(){return this._czmImageryWrapper}}class e3 extends E.Destroyable{constructor(e){super();N(this,"_objResetting");this._czmImageryWrapper=e,this._objResetting=this.dv(new E.ObjResettingWithEvent(this.czmImageryWrapper.imagery.showChanged,()=>{if(this.czmImageryWrapper.imagery.show??!0)return new JO(this.czmImageryWrapper)}))}get czmImageryWrapper(){return this._czmImageryWrapper}get objResetting(){return this._objResetting}}class t3 extends E.Destroyable{constructor(e,r){super();N(this,"_czmImageryLayerWrapperObjResetting");this._imagery=e,this._manager=r,this._czmImageryLayerWrapperObjResetting=this.dv(new E.ObjResettingWithEvent(this.imagery.layerChanged,()=>{if(this.imagery.layer)return new e3(this)}))}get imagery(){return this._imagery}get manager(){return this._manager}get czmImageryLayerWrapperObjResetting(){return this._czmImageryLayerWrapperObjResetting}}class s1 extends E.Destroyable{constructor(e){super();N(this,"_czmImageryWrappers",new Set);N(this,"_czmImageryLayersManager");this._viewer=e,this._czmImageryLayersManager=this.dv(new YO(this.viewer))}get czmImageryWrappers(){return this._czmImageryWrappers}get czmImageriesManager(){return this._czmImageryLayersManager}get viewer(){return this._viewer}add(e){for(let r of this.czmImageryWrappers)if(r.imagery===e){console.warn("imageriesManager add error: has already added!",e);return}this.czmImageryWrappers.add(new t3(e,this))}delete(e){for(const r of this.czmImageryWrappers)if(r.imagery===e){this.czmImageryWrappers.delete(r);return}console.warn("imageriesManager delete error!",e)}}class l1 extends E.Destroyable{constructor(e){super();N(this,"_pause",this.disposeVar(E.react(!1)));N(this,"_pickPositionTasks",[]);N(this,"_pickTasks",[]);N(this,"pickHeightMustGreaterThanZero",!0);N(this,"objectsToExclude",[]);const r=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 s=()=>{const a=[...this._pickPositionTasks];this._pickPositionTasks.length=0;for(let h of a){const[f,u,A,v]=h;try{(async()=>{const{scene:g,camera:m}=r,p=rt(f),d=m.getPickRay(p);do{if(!d)break;let c;if(u?c=await g.pickFromRayMostDetailed(d,this.objectsToExclude):c=g.pickFromRay(d,this.objectsToExclude),!c||!c.position)break;const y=He(c.position);if(!y){v(new Error("positionFromCartesian failed"));return}A(y);return}while(!1);if(d&&!(g.terrainProvider instanceof F.EllipsoidTerrainProvider)){const c=g.globe.pick(d,g);if(!c){v(new Error("scene.globe.pick failed"));return}const y=He(c);if(!y){v(new Error("positionFromCartesian failed"));return}this.pickHeightMustGreaterThanZero&&y[2]<0&&(y[2]=0),A(y);return}{const c=g.terrainProvider instanceof F.EllipsoidTerrainProvider?g.terrainProvider.tilingScheme.ellipsoid:r.scene.globe.ellipsoid,y=r.camera.pickEllipsoid(rt(f),c);if(!y){v(new Error("Pick failed"));return}const w=He(y);if(!w){v(new Error("positionFromCartesian failed"));return}A(w)}})()}catch(g){v(g)}}const l=[...this._pickTasks];this._pickTasks.length=0;for(let h of l){const[f,u,A,v,g]=h;e.pickCustomAttachedInfo=A;try{(async()=>{var b,_,x;let m=r.scene.pick(rt(f),u&&u[0],u&&u[1]);!m&&F.defined(r.scene.globe)&&(m=await n3(r,rt(f)));let p;if(m&&m instanceof F.Cesium3DTileFeature){p={};try{m&&m.getPropertyIds().forEach(T=>{p&&(p[T]=m.getProperty(T))})}catch(C){console.warn(C)}}let d;do{if(!m)break;if(m.id&&m.id instanceof F.Entity&&m.id.ESSceneObjectID){d=m.id.ESSceneObjectID;break}if(m.primitive&&m.primitive.ESSceneObjectID){d=m.primitive.ESSceneObjectID;break}}while(!1);const c=d?Q.ESSceneObject.getSceneObject(d):void 0;let y={};if(c&&Reflect.has(c,"allowPicking")&&Reflect.has(c,"pickedEvent")&&(c.allowPicking??!1)){do{if(c instanceof Q.ESEntityCluster){const C=new F.JulianDate;y=m.id instanceof F.Entity?{name:m.id.label.text.getValue(C),properties:(b=m.id.properties)==null?void 0:b.getValue(C),coordinates:bl(m.id.position.getValue(C))}:(_=m.id)==null?void 0:_.map(T=>{var I;return{name:T.id,properties:(I=T.properties)==null?void 0:I.getValue(C),coordinates:bl(T.position.getValue(C))}});break}if(c instanceof Q.ESGeoJson){const C=new F.JulianDate;if(!m.id.entityCollection)return;const T=m.id.polygon?"Polygon":m.id.polyline?"LineString":"Point",I=((x=m.id.properties)==null?void 0:x.getValue(C))??{},P=T=="Point"?He(m.id.position.getValue(C)):T=="LineString"?m.id.polyline.positions.getValue(C).map(k=>He(k)):Lp(m.id.polygon.hierarchy.getValue(C));y=c.pickedInfoType=="FeatureCollection"?{type:"Feature",geometry:{type:T,coordinates:P},properties:I}:{type:T,coordinates:P,properties:I};break}if(c instanceof Q.ESGltfModel){let C;Reflect.has(m,"featureId")?C=m.featureId:Reflect.has(m,"instanceId")&&(C=m.instanceId),C&&(m.id=m.primitive.structuralMetadata.getPropertyTable(0).getProperty(m.instanceId,"id"))}}while(!1);c.pickedEvent.emit(new Q.ESJPickedResult(m,c,p,y,A,f))}c&&Reflect.has(c,"allowPicking")&&!c.allowPicking&&v(new Q.ESJPickedResult);const w=new Q.ESJPickedResult(m,c,p,y,A,f);v(w)})()}catch(m){g(m)}}};let o=r.scene.postRender.addEventListener(s);const i=()=>{o&&o(),o=void 0};this.ad(i),this.ad(this.pauseChanged.don(a=>{a?i():o=r.scene.postRender.addEventListener(s)}))}}get pause(){return this._pause.value}set pause(e){this._pause.value=e}get pauseChanged(){return this._pause.changed}pickPosition(e){return new Promise((r,s)=>{this._pickPositionTasks.push([e,!0,r,s])})}quickPickPosition(e){return new Promise((r,s)=>{this._pickPositionTasks.push([e,!1,r,s])})}pick(e,r,s){return new Promise((o,i)=>{this._pickTasks.push([e,r,s,o,i])})}}function n3(t,n){const e=t.scene,r=e.camera.getPickRay(n);if(!r)return;const s=e.imageryLayers.pickImageryLayerFeatures(r,e);if(F.defined(s))return s}class r3 extends E.Destroyable{constructor(e){super();N(this,"_enabled",this.disposeVar(E.react(!1)));N(this,"_cursorPosition",E.react(void 0));N(this,"quickPickPosition",!0);let r=new E.Destroyable;const s=()=>{r&&(r.destroy(),r=void 0)};this.dispose(s);const o=()=>{if(s(),!this._enabled.value||!e)return;const i=Gn(e);if(!i)return;r=new E.Destroyable;const a=r.disposeVar(E.react(void 0)),l=r.disposeVar(E.createNextAnimateFrameEvent(a.changed));r.dispose(i.czmViewer.pointerMoveEvent.disposableOn(f=>{f.pointerEvent&&(a.value=E.getDomEventCurrentTargetPos(f.pointerEvent))}));const h=r.disposeVar(E.createProcessingFromAsyncFunc(async f=>{if(i.pickingManager&&a.value)if(this.quickPickPosition){const u=await f.promise(E.createCancelablePromise(i.pickingManager.quickPickPosition(a.value)));this._cursorPosition.value=u}else{const u=await f.promise(E.createCancelablePromise(i.pickingManager.pickPosition(a.value)));this._cursorPosition.value=u}}));r.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 Gn(t){return E.getExtProp(t,"_viewerExtensions")}function SA(t,n){E.setExtProp(t,"_viewerExtensions",n)}class u1 extends E.Destroyable{constructor(e,r){super();N(this,"_imageriesManager");N(this,"_terrainManager");N(this,"_labelManager");N(this,"_pickingManager");N(this,"_poiContext");N(this,"_cursorPositionInfo");this._viewer=e,this._czmViewer=r,this._imageriesManager=this.dv(new s1(this.viewer)),this._terrainManager=this.dv(new o1(this.viewer)),this._labelManager=this.dv(new a1(this.viewer)),this._poiContext=this.disposeVar(new I1(this._viewer)),this._cursorPositionInfo=this.disposeVar(new r3(this._viewer)),this.ad(r.viewerChanged.don(()=>{this._pickingManager=this.dv(new l1(r))}))}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 c1=new F.Cartesian3,h1=new F.Cartesian3;function f1(t,n,e){let r=F.Matrix4.clone(t.transform);t.lookAtTransform(F.Matrix4.IDENTITY);var s=t.positionCartographic.height,o=t.positionWC,i=F.Cartesian3.normalize(o,c1),a=F.Cartesian3.dot(t.direction,i);if(a>-.9&&a<.9)var l=F.Cartesian3.cross(t.direction,i,h1);else var l=F.Cartesian3.cross(t.up,i,h1);var h=l;if(e){var f=F.Cartesian3.cross(i,l,c1);h=f}var u=F.Cartesian3.magnitude(o);t.rotate(h,n/u);var A=t.positionCartographic,v=A.longitude,g=A.latitude;F.Cartesian3.fromRadians(v,g,s,void 0,t.position),t.lookAtTransform(r)}function d1(t,n){f1(t,n,!1)}function p1(t,n){f1(t,-n,!0)}class i3 extends E.Destroyable{constructor(e){super();N(this,"_actions",{MoveForward:!1,MoveBackword:!1,MoveLeft:!1,MoveRight:!1});this._running=e;const{controller:r}=this,{viewer:s}=r.firstPersonController,{camera:o}=s;this.dispose(this.running.keyStatus.currentKeyIdsChanged.disposableOn(()=>{this._updateActions()})),this.dispose(this.controller.keyDownEvent.disposableOn(i=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[i.code]==="SpeedUp"?this.controller.speed=this.controller.speed*2:a[i.code]==="SpeedDown"&&(this.controller.speed=this.controller.speed*.5)})),this.dispose(this.controller.keyDownEvent.disposableOn(i=>{const{keyStatusMap:a}=this.running.keyboardCameraController;a[i.code]==="SwitchAlwaysWithCamera"&&(this.controller.alwaysWithCamera=!this.controller.alwaysWithCamera)}));{const{actions:i}=this;let a=Date.now();const l=()=>{const h=Date.now(),f=h-a;a=h;const u=this.controller.speed;i.WithCamera||this.controller.alwaysWithCamera?(i.MoveForward&&o.moveForward(f*u),i.MoveBackword&&o.moveBackward(f*u),i.MoveLeft&&o.moveLeft(f*u),i.MoveRight&&o.moveRight(f*u)):(i.MoveForward&&d1(o,f*u),i.MoveBackword&&d1(o,-f*u),i.MoveLeft&&p1(o,-f*u),i.MoveRight&&p1(o,f*u));{const{rotateSpeed:A}=this.controller,v=F.Math.toRadians(A*f);i.RotateRight?o.lookRight(v):i.RotateLeft?o.lookRight(-v):i.RotateUp?o.lookDown(-v):i.RotateDown&&o.lookDown(v)}};s.scene.preUpdate.addEventListener(l),this.dispose(()=>s.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 r of e)this._actions[r]=!1}_updateActions(){const{running:e}=this,{keyStatus:r}=e,{actions:s}=this;this._resetActions();const{keyStatusMap:o}=this.running.keyboardCameraController;for(let i of r.currentKeyIds)s[o[i]]=!0}}class uf extends E.Destroyable{constructor(e){super();N(this,"_currentKeyIds",new Set);N(this,"_currentKeyIdsChanged",this.dv(new E.Event));N(this,"_debug",this.dv(E.react(!1)));N(this,"_debugResetting",this.dv(new E.ObjResettingWithEvent(this.debugChanged,()=>{if(this.debug)return new class extends E.Destroyable{constructor(e){super();const r=()=>{console.log([...e.currentKeyIds].join(`
|
|
966
966
|
`))};r(),this.d(e.currentKeyIdsChanged.don(r))}}(this)})));this._keyboardCameraControllerRunning=e;const{keyboardCameraController:r}=this._keyboardCameraControllerRunning;{const s=o=>{const i=uf.getKeyId(o);this._currentKeyIds.has(i)||(this._currentKeyIds.add(i),this._currentKeyIdsChanged.emit())};this.d(r.keyDownEvent.don(s))}{const s=o=>{const i=uf.getKeyId(o);this._currentKeyIds.has(i)&&(this._currentKeyIds.delete(i),this._currentKeyIdsChanged.emit())};this.d(r.keyUpEvent.don(s))}{const s=()=>{this._currentKeyIds.clear(),this._currentKeyIdsChanged.emit()};this.d(r.abortEvent.don(s))}}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 o3 extends E.Destroyable{constructor(e){super();N(this,"_keyStatus");N(this,"_cameraOp");this._keyboardCameraController=e,this._keyStatus=this.dv(new uf(this)),this._cameraOp=this.dv(new i3(this))}get keyboardCameraController(){return this._keyboardCameraController}get keyStatus(){return this._keyStatus}get cameraOp(){return this._cameraOp}}const yp=class yp extends E.Destroyable{constructor(e){super();N(this,"_enabled",this.dv(E.react(!1)));N(this,"_keyStatusMap",this.dv(E.react(yp.defaultKeyStatusMap)));N(this,"_speed",this.dv(E.react(1)));N(this,"_rotateSpeed",this.dv(E.react(.01)));N(this,"_alwaysWithCamera",this.dv(E.react(!1)));N(this,"_keyDownEvent",this.dv(new E.Event));N(this,"_keyUpEvent",this.dv(new E.Event));N(this,"_abortEvent",this.dv(new E.Event));this._firstPersonController=e,this.dv(new E.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new o3(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()}};N(yp,"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 cf=yp;function a3(t,n){t.lookRight(F.Math.toRadians(n.movementX)*.1),t.lookDown(F.Math.toRadians(n.movementY)*.1);const e=t.pitch,r=F.Math.clamp(e,-F.Math.PI_OVER_TWO,F.Math.PI_OVER_TWO);r!==e&&t.setView({destination:t.positionWC,orientation:{heading:t.heading,pitch:r,roll:t.roll}})}class s3 extends E.Destroyable{constructor(n,e){super(),this._firstPersonController=n,this._mouseCameraController=e;const{canvas:r}=this._firstPersonController.viewer;{const s=o=>{const{camera:i}=this._firstPersonController.viewer.scene;a3(i,o)};r.addEventListener("pointermove",s),this.dispose(()=>r.removeEventListener("pointermove",s))}}}const gp=class gp extends E.Destroyable{constructor(e){super();N(this,"_mouseMoving",this.dv(new s3(this.firstPersonController,this.mouseCameraController)));this._mouseCameraController=e;const{viewer:r}=this.firstPersonController;this.mouseCameraController.enableViewerOriginInputs(!1),this.dispose(()=>this.mouseCameraController.enableViewerOriginInputs(!0)),Element.prototype.setPointerCapture=()=>{},this.dispose(()=>Element.prototype.setPointerCapture=gp.origin_setPointerCapture);const s=r.canvas;s.requestPointerLock(),this.dispose(()=>document.exitPointerLock());{const o=()=>{document.pointerLockElement!==s&&(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}};N(gp,"origin_setPointerCapture",Element.prototype.setPointerCapture);let EA=gp;class l3 extends E.Destroyable{constructor(e){super();N(this,"_enabled",this.dv(E.react(!1)));N(this,"enableViewerOriginInputs",e=>{e?this.firstPersonController.czmViewer.incrementDisabledInputStack():this.firstPersonController.czmViewer.decrementDisabledInputStack()});N(this,"_mouseResetting",this.dv(new E.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new EA(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 u3 extends E.Destroyable{constructor(e){super();N(this,"viewer");N(this,"_mouseCameraController",this.dv(new l3(this)));N(this,"_keyboardCameraController",this.dv(new cf(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 A1(t){t.removeInputAction(F.ScreenSpaceEventType.LEFT_DOWN),t.removeInputAction(F.ScreenSpaceEventType.RIGHT_DOWN),t.removeInputAction(F.ScreenSpaceEventType.MIDDLE_DOWN),t.removeInputAction(F.ScreenSpaceEventType.MOUSE_MOVE),t.removeInputAction(F.ScreenSpaceEventType.LEFT_UP),t.removeInputAction(F.ScreenSpaceEventType.RIGHT_UP),t.removeInputAction(F.ScreenSpaceEventType.MIDDLE_UP)}function PA(t,n,e,r=void 0){const o=t.camera,i=new F.Cartesian2;i.x=n.startPosition.x,i.y=0;const a=new F.Cartesian2;a.x=n.endPosition.x,a.y=0;let l=o.getPickRay(i,new F.Ray),h=o.getPickRay(a,new F.Ray),f=0,u,A;if(!l||!h)return;o.frustum instanceof F.OrthographicFrustum?(u=l.origin,A=h.origin,F.Cartesian3.add(o.direction,u,u),F.Cartesian3.add(o.direction,A,A),F.Cartesian3.subtract(u,o.position,u),F.Cartesian3.subtract(A,o.position,A),F.Cartesian3.normalize(u,u),F.Cartesian3.normalize(A,A)):(u=l.direction,A=h.direction);let v=F.Cartesian3.dot(u,A);v<1&&(f=Math.acos(v)),f=n.startPosition.x>n.endPosition.x?f:-f;const g=e._horizontalRotationAxis;if(F.defined(r)?o.look(r,-f):F.defined(g)?o.look(g,-f):o.lookLeft(f),i.x=0,i.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,l=o.getPickRay(i,new F.Ray),h=o.getPickRay(a,new F.Ray),f=0,!(!l||!h))if(o.frustum instanceof F.OrthographicFrustum?(u=l.origin,A=h.origin,F.Cartesian3.add(o.direction,u,u),F.Cartesian3.add(o.direction,A,A),F.Cartesian3.subtract(u,o.position,u),F.Cartesian3.subtract(A,o.position,A),F.Cartesian3.normalize(u,u),F.Cartesian3.normalize(A,A)):(u=l.direction,A=h.direction),v=F.Cartesian3.dot(u,A),v<1&&(f=Math.acos(v)),f=n.startPosition.y>n.endPosition.y?f:-f,r=F.defaultValue(r,g),F.defined(r)){const m=o.direction,p=F.Cartesian3.negate(r,new F.Cartesian3),d=F.Cartesian3.equalsEpsilon(m,r,F.Math.EPSILON2),c=F.Cartesian3.equalsEpsilon(m,p,F.Math.EPSILON2);if(!d&&!c){v=F.Cartesian3.dot(m,r);let y=F.Math.acosClamped(v);f>0&&f>y&&(f=y-F.Math.EPSILON4),v=F.Cartesian3.dot(m,p),y=F.Math.acosClamped(v),f<0&&-f>y&&(f=-y+F.Math.EPSILON4);const w=F.Cartesian3.cross(r,m,new F.Cartesian3);o.look(w,f)}else(d&&f<0||c&&f>0)&&o.look(o.right,-f)}else o.lookUp(f)}class c3 extends E.Destroyable{constructor(n,e){super();const r=e.viewer;if(!r)throw new Error("viewer is undefined");let s=!0;this.d(n.positionChanged.don(()=>s=!0)),this.d(n.rotationChanged.don(()=>s=!0)),this.d(n.offsetHeightChanged.don(()=>s=!0)),this.d(n.viewDistanceChanged.don(()=>s=!0)),this.d(n.offsetRotationChanged.don(()=>s=!0)),this.d(n.relativeRotationChanged.don(()=>s=!0));const o=[0,0,0],i=[0,0,0];this.d(r.clock.onTick.addEventListener(()=>{if(!s)return;if(s=!1,!n.position){console.warn("相机控制器未能设置位置,无法启用!");return}if(n.viewDistance===void 0){console.warn("相机控制器未能设置视距,将自动设置视距!");const u=Tt(n.position),A=r.camera.positionWC,v=F.Cartesian3.distance(u,A);n.viewDistance=v}E.Vector.clone(n.position,i),n.offsetHeight&&(i[2]+=n.offsetHeight);const{rotation:a,offsetRotation:l=Dr.defaults.offsetRotation}=n,h=[...l];E.Vector.set(o,0,0,0),a&&(n.relativeRotation??Dr.defaults.relativeRotation)&&(E.Vector.add(a,o,o),h[0]+=90),E.Vector.add(h,o,o);const f={distance:n.viewDistance,heading:o[0],pitch:o[1],flyDuration:0,hDelta:0,pDelta:0};e.flyTo(f,i)})),e.incrementDisabledInputStack(),this.d(()=>{e.decrementDisabledInputStack()}),this.d(e.pointerMoveEvent.don(a=>{const l=a==null?void 0:a.pointerEvent;if(l&&n.enabledRotationInput&&(l.buttons===1||l.buttons===2)){const{movementX:h,movementY:f}=l;n.offsetRotation=E.Vector.add(n.offsetRotation??Dr.defaults.offsetRotation,[h*.2,f*-.2,0])}})),this.d(e.wheelEvent.don(a=>{if(!n.enabledScaleInput)return;const l=a.deltaY,f=Math.max(1,n.viewDistance)*(l*.001);n.viewDistance=n.viewDistance+f}))}}class Dr extends E.Destroyable{constructor(e){super();N(this,"_resetWithCameraEvent",this.dv(new E.Event));const r=e.viewer;if(!r)throw new Error("viewer is undefined");const s=this;let o;const i=()=>{o&&(o.destroy(),o=void 0)};this.d(i);const a=()=>{i(),s.enabled&&(o=new c3(s,e))};a(),this.d(s.enabledChanged.don(a)),this.d(s.resetWithCameraEvent.don(l=>{if(!e.actived)return;const h=Ha(r.camera);if(!h)return;const f=s.rotation;s.offsetRotation=[h[0]-(s.relativeRotation?f[0]:90),h[1]-(s.relativeRotation?f[1]:0),h[2]-(s.relativeRotation?f[2]:0)]}))}get resetWithCameraEvent(){return this._resetWithCameraEvent}resetWithCamera(e){this._resetWithCameraEvent.emit(e)}}N(Dr,"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:E.reactArrayWithUndefined(void 0),rotation:E.reactArrayWithUndefined(void 0),positionEditing:!1,rotationEditing:!1,viewDistance:1e3,offsetHeight:0,offsetRotation:E.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,relativeRotation:!0})})(Dr||(Dr={})),E.extendClassProps(Dr.prototype,Dr.createDefaultProps);class zl extends E.Destroyable{constructor(e){super();N(this,"_geoCameraController");N(this,"_geoPolylinePath");this._geoCameraController=this.dv(new Dr(e)),this._geoPolylinePath=this.dv(new Vs(e)),this._geoPolylinePath.show=!1,this._geoPolylinePath.currentTime=0;const r=()=>{(this.usePathPosition??!0)&&(this._geoCameraController.position=this._geoPolylinePath.currentPosition),(this.usePathRotation??!0)&&(this._geoCameraController.rotation=this._geoPolylinePath.currentRotation)};r(),this.d(this._geoPolylinePath.currentPositionChanged.don(r)),this.d(this._geoPolylinePath.currentRotationChanged.don(r)),this.dispose(E.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dispose(E.bind([this._geoCameraController,"viewDistance"],[this,"viewDistance"])),this.dispose(E.bind([this._geoCameraController,"offsetHeight"],[this,"offsetHeight"])),this.dispose(E.bind([this._geoCameraController,"offsetRotation"],[this,"offsetRotation"])),this.dispose(E.track([this._geoCameraController,"enabledRotationInput"],[this,"enabledRotationInput"])),this.dispose(E.track([this._geoCameraController,"enabledScaleInput"],[this,"enabledScaleInput"])),this.dv(new E.ObjResettingWithEvent(this.lineModeChanged,()=>{if(this.lineMode!==void 0){if(this.lineMode==="auto")return new h3(this,e);if(this.lineMode==="manual")return new f3(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:E.reactArray([0,-60,0]),enabledRotationInput:!0,enabledScaleInput:!0,lineMode:void 0})})(zl||(zl={})),E.extendClassProps(zl.prototype,zl.createDefaultProps);class h3 extends E.Destroyable{constructor(n,e){if(super(),!e.viewer)throw new Error("viewer is undefined");n.offsetRotation=[-90,0,0]}}class f3 extends E.Destroyable{constructor(n,e){if(super(),!e.viewer)throw new Error("viewer is undefined");const s=o=>{(o.key==="w"||o.key==="s")&&(n.polylinePath.playing=o.type==="keydown",n.polylinePath.speed=o.key==="w"||o.type==="keyup"?1:-1)};this.dispose(e.keyDownEvent.don(s)),this.dispose(e.keyUpEvent.don(s))}}class d3 extends E.Destroyable{constructor(n,e){super();const r=e.positionPropertyName??"position",s=e.positionChangedPropertyName??r+"Changed",o=e.rotationPropertyName??"rotation",i=e.rotationChangedPropertyName??o+"Changed",a=(e.positionTracking??!0)&&Reflect.has(n,r)&&Reflect.has(n,s),l=(e.rotationTracking??!0)&&Reflect.has(n,o)&&Reflect.has(n,i);if(!(!a&&!l)){if(a){const h=()=>{e.geoCameraController.position=n[r]};h();const f=n[s];this.d(f.don(h))}if(l){const h=()=>{e.geoCameraController.rotation=n[o]};h();const f=n[s];this.d(f.don(h))}}}}class p3 extends E.Destroyable{constructor(n,e){super();const r=this.dv(new Q.ESSceneObjectWithId);r.id=n;const s=this.dv(E.createNextAnimateFrameEvent(e.enabledChanged,e.positionTrackingChanged,e.rotationTrackingChanged,e.positionPropertyNameChanged,e.positionChangedPropertyNameChanged,e.rotationPropertyNameChanged,e.rotationChangedPropertyNameChanged,r.sceneObjectChanged));this.disposeVar(new E.ObjResettingWithEvent(s,()=>{const{sceneObject:o}=r;if(!(!e.enabled||!o))return new d3(o,e)}))}}class Nl extends E.Destroyable{constructor(e){super();N(this,"_geoCameraController");this._geoCameraController=this.dv(new Dr(e)),this.d(E.bind([this._geoCameraController,"enabled"],[this,"enabled"])),this.dv(new E.ObjResettingWithEvent(this.sceneObjectIdChanged,()=>{if(this.sceneObjectId)return new p3(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})})(Nl||(Nl={})),E.extendClassProps(Nl.prototype,Nl.createDefaultProps);class A3 extends E.Destroyable{constructor(e){super();N(this,"height",1e7);N(this,"cycle",60);N(this,"latitude",6.632251044444445);N(this,"_running",!1);N(this,"_sseh");N(this,"_eventDisposer");this._viewer=e,this._sseh=this.dv(new F.ScreenSpaceEventHandler(this._viewer.canvas)),this._sseh.setInputAction(()=>{this.cancel()},F.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,r=e.positionCartographic;e.flyTo({destination:F.Cartesian3.fromRadians(r.longitude,this.latitude,this.height),orientation:{heading:0,pitch:-.5*F.Math.PI,roll:0},complete:()=>{this._running=!0;var s=void 0;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((o,i)=>{if(!s){s=new Date().getTime();return}const a=(new Date().getTime()-s)/1e3,l=e.positionCartographic.longitude+a*F.Math.PI*2/this.cycle;e.setView({destination:F.Cartesian3.fromRadians(l,this.latitude,this.height),orientation:{heading:0,pitch:-.5*F.Math.PI,roll:0}}),s=new Date().getTime()})},duration:.5})}cancel(){this._running&&(this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1)}}class m3 extends E.Destroyable{constructor(e){super();N(this,"_height",this.dv(E.react(1e7)));N(this,"_cycle",this.dv(E.react(60)));N(this,"_latitude",this.dv(E.react(38)));N(this,"_inner");this._czmViewer=e;const r=this._czmViewer.viewer;if(!r)throw new Error("未初始化viewer");this._inner=this.dv(new A3(r));{const s=()=>{this._inner.height=this.height,this._inner.cycle=this.cycle,this._inner.latitude=this.latitude*Math.PI/180};s(),this.d(this.heightChanged.don(s)),this.d(this.cycleChanged.don(s)),this.d(this.latitudeChanged.don(s))}}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 y3 extends E.Destroyable{constructor(e){super();N(this,"_position",this.dv(E.reactArrayWithUndefined(void 0)));N(this,"_distance",this.dv(E.react(5e4)));N(this,"_cycle",this.dv(E.react(60)));N(this,"_heading",this.dv(E.react(0)));N(this,"_pitch",this.dv(E.react(-30)));N(this,"_transform");N(this,"_headingRadius");N(this,"_pitchRadius");N(this,"_running",!1);N(this,"_sseh");N(this,"_eventDisposer");this._viewer=e;const r=this.viewer.scene,s=this.viewer.camera;this._sseh=this.dv(new F.ScreenSpaceEventHandler(this.viewer.canvas)),this.d(()=>{this.cancel()});{const o=()=>{let i;if(this.position==null){var a=s.getPickRay(new F.Cartesian2(r.canvas.width*.5,r.canvas.height*.5));if(!a)return;i=r.globe.pick(a,r)}else i=F.Cartesian3.fromDegrees(...this.position);i&&(this._transform=F.Transforms.eastNorthUpToFixedFrame(i),this.start())};o(),this.d(this.positionChanged.don(o))}{const o=()=>{this._headingRadius=F.Math.toRadians(this.heading)};o(),this.d(this.headingChanged.don(o))}{const o=()=>{this._pitchRadius=F.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 r=this.distance*Math.sin(this._pitchRadius),s=this.distance*Math.cos(this._pitchRadius),o=new F.Cartesian3(0,r,s);e.flyTo({destination:F.Matrix4.multiplyByPoint(this._transform,o,new F.Cartesian3),orientation:{heading:this._headingRadius,pitch:this._pitchRadius,roll:0},endTransform:this._transform,complete:()=>{this._running=!0;let i;this._eventDisposer=this.viewer.scene.postUpdate.addEventListener((a,l)=>{if(!i){i=new Date().getTime();return}const h=(new Date().getTime()-i)/1e3;this._headingRadius+=h*F.Math.PI*2/this.cycle,e.lookAtTransform(this._transform,new F.HeadingPitchRange(this._headingRadius,this._pitchRadius,this.distance)),i=new Date().getTime()})},duration:.5,maximumHeight:e.positionCartographic.height})}cancel(){if(!this._running)return;this.viewer.camera.lookAtTransform(F.Matrix4.IDENTITY),this._eventDisposer&&(this._eventDisposer(),this._eventDisposer=void 0),this._running=!1}}class g3 extends E.Destroyable{constructor(e){super();N(this,"_position",this.dv(E.reactArrayWithUndefined(void 0)));N(this,"_distance",this.dv(E.react(5e4)));N(this,"_cycle",this.dv(E.react(60)));N(this,"_heading",this.dv(E.react(0)));N(this,"_pitch",this.dv(E.react(-30)));N(this,"_inner");this._czmViewer=e;const r=this._czmViewer.viewer;if(!r)throw new Error("viewer is undefined");this._inner=this.dv(new y3(r));{const s=()=>{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};s(),this.d(this.distanceChanged.don(s)),this.d(this.cycleChanged.don(s)),this.d(this.positionChanged.don(s)),this.d(this.headingChanged.don(s)),this.d(this.pitchChanged.don(s))}}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 v3 extends E.Destroyable{constructor(e){super();N(this,"_firstPersonController");N(this,"_rotateGlobe");N(this,"_rotatePoint");N(this,"_followController");N(this,"_pathCameraController");N(this,"_handler");this._viewer=e;{this._firstPersonController=this.dv(new u3(e)),this.d(this._viewer.keyDownEvent.don(r=>this._firstPersonController.keyboardCameraController.keyDown(r))),this.d(this._viewer.keyUpEvent.don(r=>this._firstPersonController.keyboardCameraController.keyUp(r)));{const{subContainer:r}=this._viewer;if(!r)throw new Error("_firstPersonControllerInit error!");const s=()=>this._firstPersonController.keyboardCameraController.abort();r.addEventListener("blur",s,!1),this.d(()=>r.removeEventListener("blur",s,!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=cf.defaultKeyStatusMap,this.d(this._firstPersonController.keyboardEnabledChanged.don(()=>{var r;(r=this._viewer.subContainer)==null||r.focus()}))}this._rotateGlobe=this.dv(new m3(e)),this._rotatePoint=this.dv(new g3(e)),this._followController=this.dv(new Nl(e)),this._pathCameraController=this.dv(new zl(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,r=4.2){this.resetNavigation(),this._changedMouseEvent("Walk");const s=this._viewer.getCameraInfo(),o=[(s==null?void 0:s.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,r=1e7,s=60){this.resetNavigation(),this._changedMouseEvent("RotateGlobe"),this._rotateGlobe.latitude=e,this._rotateGlobe.height=r,this._rotateGlobe.cycle=s,this._rotateGlobe.start()}changeToRotatePoint(e,r=5e4,s=60,o=0,i=-30){this.resetNavigation(),this._changedMouseEvent("RotatePoint"),this._rotatePoint.position=e,this._rotatePoint.distance=r,this._rotatePoint.cycle=s,this._rotatePoint.heading=o,this._rotatePoint.pitch=i,this._rotatePoint.start()}changeToFollow(e,r=0,s=0,o=-30,i=!0){this.resetNavigation(),this._changedMouseEvent("Follow"),this._followController.sceneObjectId=e,this._followController.geoCameraController.offsetRotation=[s,o,0],this._followController.geoCameraController.relativeRotation=i,r!==0?this._followController.geoCameraController.viewDistance=r:this._followController.geoCameraController.viewDistance=1e3,this._followController.enabled=!0}changeToLine(e,r=10,s=10,o=!0,i=10,a="auto"){this.resetNavigation(),this._changedMouseEvent("Line");const l=a==="auto",h=Q.ESSceneObject.getSceneObjById(e);if(!h)return;const{points:f}=h;if(!f)return;const u=Q.getDistancesFromPositions(f,"NONE"),A=u[u.length-1];this._pathCameraController.viewDistance=0,this._pathCameraController.polylinePath.positions=[...f],this._pathCameraController.polylinePath.duration=A/r*1e3,this._pathCameraController.polylinePath.loop=o,this._pathCameraController.offsetHeight=s;const v=Mw(f);this._pathCameraController.polylinePath.rotationRadius=!l||v==!1?[0]:v.map(g=>g/i*r),this._pathCameraController.enabledRotationInput=!l,this._pathCameraController.enabledScaleInput=!1,this._pathCameraController.polylinePath.playing=l,this._pathCameraController.lineMode=a,this._pathCameraController.enabled=!0}_changedMouseEvent(e){const r=this._viewer.viewer;if(!r)return;this._handler||(this._handler=new F.ScreenSpaceEventHandler(r.scene.canvas));const s=this._handler,o=r.scene.screenSpaceCameraController;this.d(()=>{s&&A1(s)}),e=="Walk"||e=="RotateGlobe"?(o.lookEventTypes=void 0,o.rotateEventTypes=void 0,o.tiltEventTypes=void 0,o.zoomEventTypes=void 0,o.translateEventTypes=void 0,s&&e=="Walk"&&(s.setInputAction(i=>{s.setInputAction(a=>{PA(r.scene,a,o)},F.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(a=>{s.removeInputAction(F.ScreenSpaceEventType.MOUSE_MOVE),s.removeInputAction(F.ScreenSpaceEventType.LEFT_UP)},F.ScreenSpaceEventType.LEFT_UP)},F.ScreenSpaceEventType.LEFT_DOWN),s.setInputAction(i=>{s.setInputAction(a=>{PA(r.scene,a,o)},F.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(a=>{s.removeInputAction(F.ScreenSpaceEventType.MOUSE_MOVE),s.removeInputAction(F.ScreenSpaceEventType.RIGHT_UP)},F.ScreenSpaceEventType.RIGHT_UP)},F.ScreenSpaceEventType.RIGHT_DOWN),s.setInputAction(i=>{s.setInputAction(a=>{PA(r.scene,a,o)},F.ScreenSpaceEventType.MOUSE_MOVE),s.setInputAction(a=>{s.removeInputAction(F.ScreenSpaceEventType.MOUSE_MOVE),s.removeInputAction(F.ScreenSpaceEventType.MIDDLE_UP)},F.ScreenSpaceEventType.MIDDLE_UP)},F.ScreenSpaceEventType.MIDDLE_DOWN))):(s&&A1(s),o.lookEventTypes=F.CameraEventType.RIGHT_DRAG,o.rotateEventTypes=F.CameraEventType.LEFT_DRAG,o.tiltEventTypes=[F.CameraEventType.MIDDLE_DRAG,F.CameraEventType.PINCH,{eventType:F.CameraEventType.LEFT_DRAG,modifier:F.KeyboardEventModifier.CTRL},{eventType:F.CameraEventType.RIGHT_DRAG,modifier:F.KeyboardEventModifier.CTRL}],o.translateEventTypes=F.CameraEventType.LEFT_DRAG,o.zoomEventTypes=[F.CameraEventType.WHEEL,F.CameraEventType.PINCH,{eventType:F.CameraEventType.RIGHT_DRAG,modifier:F.KeyboardEventModifier.SHIFT}])}}const w3=[{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 b3 extends E.Destroyable{constructor(e){super();N(this,"_show",this.dv(E.react(!1)));N(this,"cloudsPostProcess");const r=e.viewer;if(!r)throw new Error("Cesium Viewer is not initialized");const s=new F.CloudCollection;r.scene.primitives.add(s),this.dispose(()=>r.scene.primitives.remove(s));{const o=()=>{s.show=this.show};o(),this.dispose(this.showChanged.disposableOn(o))}{const o=a=>({slice:a.slice,brightness:a.brightness,scale:rt(a.scale),maximumSize:Tr(a.maximumSize),color:Oe(a.color),position:Tt(a.position)});(()=>{s.removeAll();for(let a of w3)s.add(o(a))})()}}get show(){return this._show.value}set show(e){this._show.value=e}get showChanged(){return this._show.changed}}class Vl extends E.Destroyable{constructor(n){super();const e=n.viewer;if(!e){console.warn("viewer is undefined!");return}const r=e.scene.postProcessStages.add(F.PostProcessStageLibrary.createDepthOfFieldStage());this.d(()=>e.scene.postProcessStages.remove(r));{const s=()=>{r.enabled=this.show};s(),this.d(this.showChanged.don(s))}{const s=()=>{r.uniforms.fogByDistance=this.focalDistance};s(),this.d(this.focalDistanceChanged.don(s))}{const s=()=>{r.uniforms.delta=this.delta};s(),this.d(this.deltaChanged.don(s))}{const s=()=>{r.uniforms.sigma=this.sigma};s(),this.d(this.sigmaChanged.don(s))}{const s=()=>{r.uniforms.stepSize=this.stepSize};s(),this.d(this.stepSizeChanged.don(s))}}}(t=>{t.createDefaultProps=()=>({show:!1,focalDistance:87,delta:1,sigma:3.78,stepSize:2.46})})(Vl||(Vl={})),E.extendClassProps(Vl.prototype,Vl.createDefaultProps);const _3=`
|
|
967
967
|
float getDistance(sampler2D depthTexture, vec2 texCoords)
|
|
968
968
|
{
|
|
@@ -4179,7 +4179,7 @@ export type IndexJsonType = {
|
|
|
4179
4179
|
array: number[];
|
|
4180
4180
|
}
|
|
4181
4181
|
\`\`\`
|
|
4182
|
-
`,en=class en extends Q.ESObjectWithLocation{constructor(e){super(e);N(this,"_attributes",this.disposeVar(E.react(void 0)));N(this,"_indexTypedArray",this.disposeVar(E.react(void 0)))}get typeName(){return"ESCustomPrimitive"}get defaultProps(){return en.createDefaultProps()}get attributesJson(){return this.attributes&&OS(this.attributes)}set attributesJson(e){const r=JSON.stringify(this.attributesJson),s=JSON.stringify(e);r!==s&&(this.attributes=e&&mQ(e))}get attributesJsonChanged(){return this.attributesChanged}get indexTypedArrayJson(){return this.indexTypedArray&&DS(this.indexTypedArray)}set indexTypedArrayJson(e){const r=JSON.stringify(this.indexTypedArrayJson),s=JSON.stringify(e);r!==s&&(this.indexTypedArray=e&&yQ(e))}get indexTypedArrayJsonChanged(){return this.indexTypedArrayChanged}get attributes(){return this._attributes.value}set attributes(e){this._attributes.value=e}get attributesChanged(){return this._attributes.changed}get indexTypedArray(){return this._indexTypedArray.value}set indexTypedArray(e){this._indexTypedArray.value=e}get indexTypedArrayChanged(){return this._indexTypedArray.changed}setUniformMap(e){if(Object.entries(e).some(([s,o])=>(console.warn(`setUniformMap error: key: ${s} value: ${o}`),o===null)))return;const r={...this.uniformMap??{},...e};this.uniformMap=r}setLocalBoundingSphere(e,r=[0,0,0]){if(!Number.isFinite(e)||e<=0){console.warn(`!Number.isFinite(radius) || radius <= 0 radius: ${e}`);return}this.boundingVolume={type:"LocalBoundingSphere",data:{center:r,radius:e}}}setLocalAxisedBoundingBox(e,r){if(e.some(s=>!Number.isFinite(s))||r.some(s=>!Number.isFinite(s))){console.warn(`setLocalAxisedBoundingBox error, min: ${e.toString()}, max: ${r.toString()}`);return}this.boundingVolume={type:"LocalAxisedBoundingBox",data:{min:e,max:r}}}computeLocalAxisedBoundingBoxFromAttribute(e="a_position"){if(!this.attributes||!this.attributes[e]){console.warn(`attributes[${e}]不存在!无法获取!`);return}const r=this.attributes[e];if(!("typedArray"in r)||!(r.typedArray instanceof Float32Array)){console.warn(`!('typedArray' in posAttribute) || !(posAttribute.typedArray instanceof Float32Array) attributeName: ${e}`);return}if(!("componentsPerAttribute"in r)||r.componentsPerAttribute!==3){console.warn(`!('componentsPerAttribute' in posAttribute) || posAttribute.componentsPerAttribute !== 3 attributeName: ${e}`);return}const{min:s,max:o}=en.getMinMaxPosition(r.typedArray);if(!s.some(i=>!Number.isFinite(i)||o.some(a=>!Number.isFinite(a))))return{min:s,max:o}}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.Number4Property("可视范围控制","可视范围控制[near0, near1, far1, far0]",!0,!1,[this,"viewDistanceRange"],en.defaults.viewDistanceRange),new Q.BooleanProperty("可视距离调试","可视距离调试",!1,!1,[this,"viewDistanceDebug"])]),new Q.GroupProperty("屏幕像素","屏幕像素",[new Q.NumberProperty("最大缩放值","最大缩放值,需要和屏幕像素(pixelSize)配合适用!",!0,!1,[this,"maximumScale"],3),new Q.NumberProperty("最小缩放值","最小缩放值,需要和屏幕像素(pixelSize)配合适用!",!0,!1,[this,"minimumScale"],1),new Q.NumberProperty("屏幕像素","注意物体的实际屏幕像素=pixelSize*物体的物理尺寸(m),例如:一个20米长的房子,pixelSize设置为5,那么它在屏幕上的实际像素尺寸就是5*20=100px。根据物体在屏幕上的像素大小来决定缩放值,缩放值受maximumScale、minimumScale属性限制",!0,!1,[this,"pixelSize"],5),new Q.BooleanProperty("显示缩放值","每个视口都显示各自的缩放值",!0,!1,[this,"showSceneScale"],!1)]),new Q.GroupProperty("图元属性","图元属性",[new Q.JsonProperty("模型矩阵","模型矩阵",!0,!1,[this,"modelMatrix"],en.defaults.modelMatrix),new Q.BooleanProperty("是否拣选","是否拣选",!0,!1,[this,"cull"]),new Q.JsonProperty("包围体","用来进行拣选,以剔除不再视野范围内的模型",!0,!1,[this,"boundingVolume"],BS,bQ),new Q.EnumProperty("渲染顺序","渲染顺序",!0,!1,[this,"pass"],vQ,"TRANSLUCENT"),new Q.EnumProperty("图元类型","图元类型",!0,!1,[this,"primitiveType"],gQ,"TRIANGLES"),new Q.JsonProperty("渲染状态","渲染状态",!0,!1,[this,"renderState"],IS,wQ),new Q.EvalStringProperty("顶点着色器","顶点着色器",!0,!1,[this,"vertexShaderSource"],PS,_Q),new Q.EvalStringProperty("片元着色器","片元着色器",!0,!1,[this,"fragmentShaderSource"],TS,xQ),new Q.JsonProperty("一致性变量(uniform)","一致性变量(uniform)",!0,!1,[this,"uniformMap"],FS,CQ),new Q.JsonProperty("顶点属性(attributes)","顶点属性(attributes)",!0,!1,[this,"attributesJson"],OS(kS),SQ),new Q.JsonProperty("索引(index)","索引(index)",!0,!1,[this,"indexTypedArrayJson"],DS(MS),EQ),new Q.NumberProperty("count","count",!0,!1,[this,"count"],0),new Q.NumberProperty("offset","offset",!0,!1,[this,"offset"],0),new Q.NumberProperty("instanceCount","instanceCount",!0,!1,[this,"instanceCount"],0),new Q.FunctionProperty("自动计算包围盒","根据顶点位置属性,自动计算包围盒",["string"],r=>{const s=this.computeLocalAxisedBoundingBoxFromAttribute(r);if(!s)return;const{min:o,max:i}=s;this.setLocalAxisedBoundingBox(o,i)},["position"])]),new Q.GroupProperty("本地变换","本地变换",[new Q.PositionProperty("本地偏移","本地偏移,不是经纬度!",!0,!1,[this,"localPosition"]),new Q.RotationProperty("本地姿态","本地姿态",!0,!1,[this,"localRotation"]),new Q.Number3Property("本地缩放","本地缩放",!0,!1,[this,"localScale"],[1,1,1]),new Q.JsonProperty("本地模型矩阵","本地模型矩阵,如果该属性有值,那么localPosition、localRotation、localScale等属性将不起作用。",!0,!1,[this,"localModelMatrix"])]),new Q.GroupProperty("调试","调试",[new Q.BooleanProperty("debugShowBoundingVolume","debugShowBoundingVolume",!0,!1,[this,"debugShowBoundingVolume"],!1),new Q.NumberProperty("debugOverlappingFrustums","debugOverlappingFrustums",!0,!1,[this,"debugOverlappingFrustums"],0)]),new Q.GroupProperty("Czm特有","Czm特有",[new Q.BooleanProperty("occlude","occlude",!0,!1,[this,"occlude"],!0),new Q.BooleanProperty("castShadows","castShadows",!0,!1,[this,"castShadows"],!1),new Q.BooleanProperty("receiveShadows","receiveShadows",!0,!1,[this,"receiveShadows"],!1),new Q.BooleanProperty("executeInClosestFrustum","executeInClosestFrustum",!0,!1,[this,"executeInClosestFrustum"],!1),new Q.BooleanProperty("pickOnly","pickOnly",!0,!1,[this,"pickOnly"],!1),new Q.BooleanProperty("depthForTranslucentClassification","depthForTranslucentClassification",!0,!1,[this,"depthForTranslucentClassification"],!1)])]}};N(en,"type",en.register("ESCustomPrimitive",en,{chsName:"ES自定义图元",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"ES自定义图元"})),N(en,"defaultRenderState",IS),N(en,"defaultVertexShaderSource",PS),N(en,"defaultFragmentShaderSource",TS),N(en,"defaultUniformMap",FS),N(en,"defaultBoundingVolume",BS),N(en,"defaultAttribute",kS),N(en,"defaultIndexTypedArray",MS),N(en,"defaults",{...Q.ESObjectWithLocation.defaults,allowPicking:!1,position:[116.39,39.9,0],rotation:[0,0,0],scale:[1,1,1],modelMatrix:[-.8957893500750183,-.4444788412198901,0,0,.28511078894078473,-.5746037485691958,.7671651518152995,0,-.3409886777031455,.68721837274483,.6414496315691579,0,-2.1778739967047274e6,4389222053178148e-9,4.0694736755001387e6,1],viewDistanceRange:[1e3,1e4,3e4,6e4]}),N(en,"getMinMaxPosition",E.getMinMaxPosition);let Eo=en;(t=>{t.createDefaultProps=()=>({maximumScale:void 0,minimumScale:void 0,pixelSize:void 0,showSceneScale:void 0,modelMatrix:E.reactArrayWithUndefined(void 0),cull:E.react(void 0),boundingVolume:E.reactJson(void 0),renderState:E.reactJson(void 0),primitiveType:void 0,pass:void 0,vertexShaderSource:void 0,fragmentShaderSource:void 0,uniformMap:E.reactJson(void 0),localPosition:E.reactArrayWithUndefined(void 0),localRotation:E.reactArrayWithUndefined(void 0),localScale:E.reactArrayWithUndefined(void 0),localModelMatrix:E.reactArrayWithUndefined(void 0),occlude:void 0,count:void 0,offset:void 0,instanceCount:void 0,castShadows:void 0,receiveShadows:void 0,executeInClosestFrustum:void 0,debugShowBoundingVolume:void 0,debugOverlappingFrustums:void 0,pickOnly:void 0,depthForTranslucentClassification:void 0,viewDistanceRange:E.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,...Q.ESObjectWithLocation.createDefaultProps()})})(Eo||(Eo={})),E.extendClassProps(Eo.prototype,Eo.createDefaultProps);const ri=class ri extends Q.ESGeoVector{constructor(e){super(e);N(this,"editingBindMode","lineString");N(this,"_player");this._player=this.disposeVar(new Q.Player);{const r=ri.defaults;this.dispose(E.bind([this._player,"loop"],[this,"loop"],s=>s??r.loop,s=>s??r.loop)),this.dispose(E.bind([this._player,"currentTime"],[this,"currentTime"],s=>s??r.currentTime,s=>s??r.currentTime)),this.dispose(E.bind([this._player,"duration"],[this,"duration"],s=>s??r.duration,s=>s??r.duration)),this.dispose(E.bind([this._player,"playing"],[this,"playing"],s=>s??r.playing,s=>s??r.playing)),this.dispose(E.bind([this._player,"speed"],[this,"speed"],s=>s??r.speed,s=>s??r.speed))}}get typeName(){return"ESSignalTransmission"}get defaultProps(){return ri.createDefaultProps()}get player(){return this._player}get ratio(){return this._player.ratio}set ratio(e){this._player.ratio=e}get ratioChanged(){return this._player.ratioChanged}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.NumberProperty("起始时间","信号起始传输时间",!1,!1,[this,"startTime"]),new Q.NumberProperty("传输时间","信号实际传输时间",!1,!1,[this,"transmissionTime"]),new Q.NumberProperty("高度比率","当只有两个位置点时才有效,此时信号线会自动变成有高度的曲线",!1,!1,[this,"heightRatio"]),new Q.EnumProperty("弧线类型","弧线类型",!1,!1,[this,"arcType"],[["直线","NONE"],["地理直线","GEODESIC"],["地理恒向线","RHUMB"]]),new Q.BooleanProperty("变亮","变亮",!1,!1,[this,"brightening"]),new Q.BooleanProperty("深度监测","深度监测",!1,!1,[this,"depthTest"]),new Q.UriProperty("图片路径","图片路径,若无图片,则显示内部的OD线样式",!0,!1,[this,"imageUrl"],ri.defaults.imageUrl),new Q.NumberProperty("图像重复次数","图像重复次数,有图像时才有效",!1,!1,[this,"repeat"]),new Q.EnumProperty("运动方向","运动方向,注意对图片来说只有正反向。",!1,!1,[this,"bidirectional"],[["正向",0],["反向",1],["双向",2],["无",3]])]),new Q.GroupProperty("播放器","播放器",[new Q.PlayerProperty("播放器","播放器",[this,"playing"],[this,"ratio"],[this,"loop"]),new Q.BooleanProperty("是否循环","是否循环.",!1,!1,[this,"loop"]),new Q.NumberProperty("当前时间","当前时间",!1,!1,[this.player,"currentTime"]),new Q.NumberProperty("过渡时间","过渡时间",!1,!1,[this,"duration"]),new Q.BooleanProperty("是否播放","是否播放.",!1,!1,[this,"playing"]),new Q.NumberProperty("播放速度","播放速度.",!1,!1,[this,"speed"])])]}};N(ri,"type",ri.register("ESSignalTransmission",ri,{chsName:"信号传输器",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"信号传输器"})),N(ri,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert]),N(ri,"defaults",{...Q.ESGeoVector.defaults,loop:!0,currentTime:0,playerCurrentTime:0,duration:3e3,speed:1,playing:!0,startTime:0,transmissionTime:3e3,color:[0,1,0,1],width:3,heightRatio:1,arcType:"GEODESIC",brightening:!1,depthTest:!0,imageUrl:"${esobjs-xe2-plugin-assets-script-dir}/xe2-assets/esobjs-xe2-plugin/images/signal.png",repeat:5,bidirectional:0});let Po=ri;(t=>{t.createDefaultProps=()=>({imageUrl:void 0,repeat:5,bidirectional:0,startTime:0,transmissionTime:3e3,arcType:"GEODESIC",brightening:!1,depthTest:!0,heightRatio:1,loop:!0,currentTime:0,duration:3e3,speed:1,playing:!0,...Q.ESGeoVector.createDefaultProps()})})(Po||(Po={})),E.extendClassProps(Po.prototype,Po.createDefaultProps);const Ro=class Ro extends Q.ESGeoVector{constructor(e){super(e);N(this,"editingBindMode","lineString")}get typeName(){return"ESRoad"}get defaultProps(){return Ro.createDefaultProps()}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.NumberProperty("线宽","道路宽度,单位是米!",!1,!1,[this,"width"]),new Q.EnumProperty("弧线类型","弧线类型",!1,!1,[this,"arcType"],[["直线","NONE"],["地理直线","GEODESIC"],["地理恒向线","RHUMB"]]),new Q.StringProperty("道路图片","道路图片",!1,!1,[this,"imageUrl"]),new Q.Number2Property("重复次数","重复次数,该参数以后会取消!",!1,!1,[this,"repeat"])])]}};N(Ro,"type",Ro.register("ESRoad",Ro,{chsName:"贴地道路",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"最大宽度到1000米"})),N(Ro,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert]),N(Ro,"defaults",{...Q.ESGeoVector.defaults,width:50,arcType:"GEODESIC",imageUrl:"${earthsdk3-assets-script-dir}/assets/img/roads/4.jpg",repeat:[100,1]});let To=Ro;(t=>{t.createDefaultProps=()=>({...Q.ESGeoVector.createDefaultProps(),width:50,arcType:"GEODESIC",imageUrl:"${earthsdk3-assets-script-dir}/assets/img/roads/4.jpg",repeat:[100,1],stroked:!0})})(To||(To={})),E.extendClassProps(To.prototype,To.createDefaultProps);const Uo=class Uo extends Q.ESGeoVector{constructor(e){super(e);N(this,"_deprecated",["ground"]);N(this,"_deprecatedWarningFunc",(()=>{this._deprecatedWarning()})());N(this,"editingBindMode","circular");this.stroked=!0,this.filled=!0,this.strokeColor=[1,1,1,1],this.fillColor=[1,1,1,.5]}get typeName(){return"ESGeoSmoothPolygon"}get defaultProps(){return Uo.createDefaultProps()}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.GroupProperty("czm","czm",[new Q.BooleanProperty("是否贴地","A boolean Property specifying the visibility.",!0,!1,[this,"ground"],!1),new Q.NumberProperty("厚度","厚度",!0,!1,[this,"depth"],16)])])]}};N(Uo,"type",Uo.register("ESGeoSmoothPolygon",Uo,{chsName:"平滑多边形",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"平滑多边形"})),N(Uo,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.CircularAppend,Q.ESJEditingMode.CircularInsert]),N(Uo,"defaults",{...Q.ESGeoVector.defaults,fillStyle:{color:[1,1,1,.5],material:"",materialParams:{}}});let Si=Uo;(t=>{t.createDefaultProps=()=>({...Q.ESGeoVector.createDefaultProps(),ground:!1,depth:0})})(Si||(Si={})),E.extendClassProps(Si.prototype,Si.createDefaultProps);const Mi=class Mi extends Q.ESGeoVector{constructor(e){super(e);N(this,"_deprecated",["ground"]);N(this,"_deprecatedWarningFunc",(()=>{this._deprecatedWarning()})());N(this,"_geoPolylinePath");N(this,"_currentDistance",this.disposeVar(E.react(0)));this.stroked=!0}get typeName(){return"ESGeoBezierPath"}get defaultProps(){return Mi.createDefaultProps()}updateEditing(){var e;(e=this.viewer)==null||e.startEditing(this,[Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert],{callSource:"inner"})}get geoPolylinePath(){return this._geoPolylinePath}set geoPolylinePath(e){this._geoPolylinePath=e}get geoPath(){return this._geoPolylinePath.geoPath}get ratio(){return this._geoPolylinePath.ratio}set ratio(e){this._geoPolylinePath.ratio=e}get ratioChanged(){return this._geoPolylinePath.ratioChanged}get currentDistance(){return this._currentDistance.value}set currentDistance(e){this._currentDistance.value=e}get currentDistanceChanged(){return this._currentDistance.changed}get timePosRots(){return this.geoPath.timePosRots}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.BooleanProperty("是否显示当前","是否显示当前.",!1,!1,[this,"currentPoiShow"]),new Q.NumberProperty("当前距离","当前距离",!1,!1,[this,"currentDistance"]),new Q.NumberProperty("分辨率","分辨率",!1,!1,[this,"resolution"]),new Q.NumberProperty("锐化程度","锐化程度",!1,!1,[this,"sharpness"])]),new Q.GroupProperty("GeoPath","GeoPath",[new Q.JsonProperty("timePosRots","类型为[timeStamp: number, position: [longitude: number, latitude: number, height: number], rotation: [heading: number, pitch: number, roll: number] | undefined];",!1,!0,[this,"timePosRots"],Mi.defaults.timePosRots),new Q.NumberProperty("折线超前显示时长","折线超前显示时长",!1,!1,[this,"leadTime"]),new Q.NumberProperty("折线滞后显示时长","折线滞后显示时长",!1,!1,[this,"trailTime"])]),new Q.GroupProperty("播放器","播放器",[new Q.PlayerProperty("播放器","播放器",[this,"playing"],[this._geoPolylinePath,"ratio"],[this,"loop"]),new Q.BooleanProperty("是否循环","是否循环.",!1,!1,[this,"loop"]),new Q.NumberProperty("当前时间","当前时间",!1,!1,[this,"currentTime"]),new Q.NumberProperty("过渡时间","过渡时间",!1,!1,[this,"duration"]),new Q.BooleanProperty("是否播放","是否播放.",!1,!1,[this,"playing"]),new Q.NumberProperty("播放速度","播放速度.",!1,!1,[this,"speed"])]),new Q.GroupProperty("折线","折线",[new Q.BooleanProperty("是否贴地","是否贴地.",!1,!1,[this,"ground"]),new Q.BooleanProperty("是否开启深度检测","A boolean Property specifying the visibility.",!1,!1,[this,"depthTest"]),new Q.EnumProperty("弧线类型","弧线类型",!1,!1,[this,"arcType"],[["直线","NONE"],["地理直线","GEODESIC"],["地理恒向线","RHUMB"]])])]}};N(Mi,"type",Mi.register("ESGeoBezierPath",Mi,{chsName:"贝塞尔曲线路径",tags:["GeoObjects"],description:"贝塞尔曲线路径"})),N(Mi,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert]),N(Mi,"defaults",{...Q.ESGeoVector.defaults,currentPoiShow:!0,currentDistance:0,resolution:1e3,sharpness:.85,timePosRots:[],leadTime:0,trailTime:0,loop:!1,currentTime:0,duration:3e3,playing:!1,speed:1,ground:!1,depthTest:!1,arcType:"GEODESIC"});let Bo=Mi;(t=>{t.createDefaultProps=()=>({currentPoiShow:!0,ground:!1,arcType:"GEODESIC",loop:!1,currentTime:0,duration:3e3,speed:1,playing:!1,resolution:1e3,sharpness:.85,depthTest:!1,leadTime:0,trailTime:0,...Q.ESGeoVector.createDefaultProps()})})(Bo||(Bo={})),E.extendClassProps(Bo.prototype,Bo.createDefaultProps);const vc=class vc extends dr{constructor(e,r){super(e,r);N(this,"_czmBezierPath");if(this._czmBezierPath=this.disposeVar(new Bu(r,e.id)),e.geoPolylinePath=this._czmBezierPath.geoPolylinePath,!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmBezierPath;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.track([o,"currentPoiShow"],[e,"currentPoiShow"])),this.dispose(E.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(E.bind([o,"positions"],[e,"points"])),this.dispose(E.bind([o,"currentDistance"],[e,"currentDistance"])),this.dispose(E.track([o,"resolution"],[e,"resolution"])),this.dispose(E.track([o,"sharpness"],[e,"sharpness"])),this.dispose(E.track([o.geoPath,"timePosRots"],[e.geoPath,"timePosRots"])),this.dispose(E.track([o,"leadTime"],[e,"leadTime"])),this.dispose(E.track([o,"trailTime"],[e,"trailTime"])),this.dispose(E.track([o.geoPolylinePath,"ratio"],[e.geoPolylinePath,"ratio"])),this.dispose(E.track([o,"loop"],[e,"loop"])),this.dispose(E.track([o,"currentTime"],[e,"currentTime"])),this.dispose(E.track([o,"duration"],[e,"duration"])),this.dispose(E.track([o,"playing"],[e,"playing"])),this.dispose(E.track([o,"speed"],[e,"speed"])),this.dispose(E.track([o,"depthTest"],[e,"depthTest"])),this.dispose(E.track([o,"arcType"],[e,"arcType"])),this.dispose(E.track([o,"polylineShow"],[e,"stroked"])),this.dispose(E.track([o,"width"],[e,"strokeWidth"])),this.dispose(E.track([o,"color"],[e,"strokeColor"]));{const i=()=>{o.ground=e.ground||e.strokeGround};i();const a=this.dv(E.createNextAnimateFrameEvent(e.groundChanged,e.strokeGroundChanged));this.d(a.don(i))}{const i=()=>{if(!e.stroked){o.hasDash=!1,o.hasArrow=!1;return}const h=e.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashLength=0;const f=e.strokeMaterial??"normal";f==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):f==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1)};i();const a=this.disposeVar(E.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(i))}}get czmBezierPath(){return this._czmBezierPath}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmBezierPath:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):i.positions?(Ne(o,s,r,i.positions,e),!0):!1:!1}flyIn(e,r){const{sceneObject:s,czmViewer:o,czmBezierPath:i}=this;return o.actived?s.flyInParam?super.flyIn(e,r):i.positions?(Ne(o,s,r,i.positions,e),!0):!1:!1}};N(vc,"type",vc.register("ESCesiumViewer",Bo.type,vc));let Jy=vc;const wc=class wc extends Ze{constructor(e,r){super(e,r);N(this,"_czmGeoCustomDivPoi");N(this,"_divContainer");N(this,"_hasClassDivAndPos",{});if(this._czmGeoCustomDivPoi=this.disposeVar(new It(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmGeoCustomDivPoi;o.cssAllInitial=!0,this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(E.bind([o,"position"],[e,"position"])),this.dispose(E.track([o,"opacity"],[e,"opacity"])),this.d(E.track([o,"zOrder"],[e,"zOrder"]));{const i=()=>{o.originRatioAndOffset=[...e.anchor,0,0],this._divContainer&&this._divContainer.children[0]&&(this._divContainer.children[0].style.transformOrigin=`${e.anchor[0]*100}% ${e.anchor[1]*100}%`)};i(),this.dispose(e.anchorChanged.don(i))}{const i=()=>{const l=this;return class extends E.Destroyable{constructor(f,u,A){if(super(),this._subContainer=f,!A||!(A instanceof st))return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");l._divContainer=this.disposeVar(new e.instanceClass(f,e,A))._container;{const m=()=>{l._divContainer.style.pointerEvents=l.sceneObject.editing?"none":"all"};m(),this.d(l.sceneObject.editingChanged.don(m))}{const m=()=>{l._divContainer.children[0]&&(l._divContainer.children[0].style.transform=`scale(${e.scale[1]},${e.scale[2]})`,l._divContainer.children[0].style.transformOrigin=`${e.anchor[0]*100}% ${e.anchor[1]*100}%`)};m(),this.d(e.scaleChanged.don(m))}let v=l._divContainer?l._divContainer.querySelectorAll("*[class]"):[];for(let m=0;m<v.length;m++){const p=v[m];var g=p.getBoundingClientRect();l._hasClassDivAndPos[p.className]=[p.offsetLeft,p.offsetTop,p.offsetLeft+g.width,p.offsetTop+g.height]}}}},a=()=>{try{e.instanceClass?o.instanceClass=i():o.instanceClass=void 0}catch(l){console.error(l)}};a(),this.dispose(e.instanceClassChanged.disposableOn(a))}this.dispose(o.pickedEvent.disposableOn(i=>{var h;const a=(h=Zo(i,"pickResult"))==null?void 0:h.pointerEvent;if(!a)return;const l={type:a.buttons!=0&&a.button==0?"leftClick":a.button==2?"rightClick":void 0,add:{mousePos:[a.offsetX,a.offsetY]}};if(l.type==null&&(l.type=a.type),l.type==="leftClick"){const f=Object.keys(this._hasClassDivAndPos);for(let u=0;u<f.length;u++){const A=f[u];let v=this._hasClassDivAndPos[A],g=this._divContainer.getBoundingClientRect();const m=a.clientX-g.left,p=a.clientY-g.top;if(m>=v[0]&&m<=v[2]&&p>=v[1]&&p<=v[3]){l.add.className=A;break}}}e.widgetEvent.emit(l),l.type==="leftClick"&&(e.allowPicking??!1)&&e.pickedEvent.emit(i)}))}get czmGeoCustomDivPoi(){return this._czmGeoCustomDivPoi}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmGeoCustomDivPoi:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.position&&Ue(o.viewer,i.position,1e3,Jn,e),s.flyOverEvent.emit(r,"over",o),!0):!1}};N(wc,"type",wc.register("ESCesiumViewer",Q.ESGeoDiv.type,wc));let eg=wc;const bc=class bc extends Ze{constructor(e,r){super(e,r);N(this,"_czmDivTextPoi");if(this._czmDivTextPoi=this.disposeVar(new Ur(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmDivTextPoi;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.bind([o,"position"],[e,"position"])),this.dispose(E.bind([o,"textEditingInteraction"],[e,"textEditingInteraction"])),this.dispose(E.bind([o,"textEditing"],[e,"textEditing"])),this.dispose(E.bind([o,"width"],[e,"width"])),this.dispose(E.bind([o,"text"],[e,"text"])),this.dispose(E.track([o,"originRatioAndOffset"],[e,"originRatioAndOffset"])),this.dispose(E.track([o,"opacity"],[e,"opacity"])),this.dispose(E.bind([o,"fontSize"],[e,"fontSize"])),this.dispose(E.track([o,"color"],[e,"color"])),this.dispose(E.track([o,"backgroundColor"],[e,"backgroundColor"])),this.dispose(E.track([o,"borderRadius"],[e,"borderRadius"])),this.dispose(E.track([o,"borderColor"],[e,"borderColor"])),this.dispose(E.track([o,"borderWidth"],[e,"borderWidth"])),this.dispose(E.track([o,"textAlign"],[e,"textAlign"])),this.dispose(E.track([o,"borderStyle"],[e,"borderStyle"]))}get czmDivTextPoi(){return this._czmDivTextPoi}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmDivTextPoi:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.flyTo(e),s.flyOverEvent.emit(r,"over",o),!0):!1}};N(bc,"type",bc.register("ESCesiumViewer",Q.ESGeoDivTextPoi.type,bc));let tg=bc;const PQ={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[116.2,39.56]},properties:{title:"swimming","marker-symbol":"swimming","marker-color":"#8F1312"}},{type:"Feature",geometry:{type:"Point",coordinates:[115.2,38.56]},properties:{title:"8","marker-symbol":"8","marker-color":"#46117E"}},{type:"Feature",geometry:{type:"Point",coordinates:[114.2,37.56]},properties:{title:"6","marker-symbol":"6","marker-color":"#713291"}}]},TQ=`properties是一个包含三个属性的对象,title表示标题,marker-symbol表示点位的文字内容,marker-color表示点位颜色,properties可以删除,然后使用场景对象属性设置。
|
|
4182
|
+
`,en=class en extends Q.ESObjectWithLocation{constructor(e){super(e);N(this,"_attributes",this.disposeVar(E.react(void 0)));N(this,"_indexTypedArray",this.disposeVar(E.react(void 0)))}get typeName(){return"ESCustomPrimitive"}get defaultProps(){return en.createDefaultProps()}get attributesJson(){return this.attributes&&OS(this.attributes)}set attributesJson(e){const r=JSON.stringify(this.attributesJson),s=JSON.stringify(e);r!==s&&(this.attributes=e&&mQ(e))}get attributesJsonChanged(){return this.attributesChanged}get indexTypedArrayJson(){return this.indexTypedArray&&DS(this.indexTypedArray)}set indexTypedArrayJson(e){const r=JSON.stringify(this.indexTypedArrayJson),s=JSON.stringify(e);r!==s&&(this.indexTypedArray=e&&yQ(e))}get indexTypedArrayJsonChanged(){return this.indexTypedArrayChanged}get attributes(){return this._attributes.value}set attributes(e){this._attributes.value=e}get attributesChanged(){return this._attributes.changed}get indexTypedArray(){return this._indexTypedArray.value}set indexTypedArray(e){this._indexTypedArray.value=e}get indexTypedArrayChanged(){return this._indexTypedArray.changed}setUniformMap(e){if(Object.entries(e).some(([s,o])=>(console.warn(`setUniformMap error: key: ${s} value: ${o}`),o===null)))return;const r={...this.uniformMap??{},...e};this.uniformMap=r}setLocalBoundingSphere(e,r=[0,0,0]){if(!Number.isFinite(e)||e<=0){console.warn(`!Number.isFinite(radius) || radius <= 0 radius: ${e}`);return}this.boundingVolume={type:"LocalBoundingSphere",data:{center:r,radius:e}}}setLocalAxisedBoundingBox(e,r){if(e.some(s=>!Number.isFinite(s))||r.some(s=>!Number.isFinite(s))){console.warn(`setLocalAxisedBoundingBox error, min: ${e.toString()}, max: ${r.toString()}`);return}this.boundingVolume={type:"LocalAxisedBoundingBox",data:{min:e,max:r}}}computeLocalAxisedBoundingBoxFromAttribute(e="a_position"){if(!this.attributes||!this.attributes[e]){console.warn(`attributes[${e}]不存在!无法获取!`);return}const r=this.attributes[e];if(!("typedArray"in r)||!(r.typedArray instanceof Float32Array)){console.warn(`!('typedArray' in posAttribute) || !(posAttribute.typedArray instanceof Float32Array) attributeName: ${e}`);return}if(!("componentsPerAttribute"in r)||r.componentsPerAttribute!==3){console.warn(`!('componentsPerAttribute' in posAttribute) || posAttribute.componentsPerAttribute !== 3 attributeName: ${e}`);return}const{min:s,max:o}=en.getMinMaxPosition(r.typedArray);if(!s.some(i=>!Number.isFinite(i)||o.some(a=>!Number.isFinite(a))))return{min:s,max:o}}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.Number4Property("可视范围控制","可视范围控制[near0, near1, far1, far0]",!0,!1,[this,"viewDistanceRange"],en.defaults.viewDistanceRange),new Q.BooleanProperty("可视距离调试","可视距离调试",!1,!1,[this,"viewDistanceDebug"])]),new Q.GroupProperty("屏幕像素","屏幕像素",[new Q.NumberProperty("最大缩放值","最大缩放值,需要和屏幕像素(pixelSize)配合适用!",!0,!1,[this,"maximumScale"],3),new Q.NumberProperty("最小缩放值","最小缩放值,需要和屏幕像素(pixelSize)配合适用!",!0,!1,[this,"minimumScale"],1),new Q.NumberProperty("屏幕像素","注意物体的实际屏幕像素=pixelSize*物体的物理尺寸(m),例如:一个20米长的房子,pixelSize设置为5,那么它在屏幕上的实际像素尺寸就是5*20=100px。根据物体在屏幕上的像素大小来决定缩放值,缩放值受maximumScale、minimumScale属性限制",!0,!1,[this,"pixelSize"],5),new Q.BooleanProperty("显示缩放值","每个视口都显示各自的缩放值",!0,!1,[this,"showSceneScale"],!1)]),new Q.GroupProperty("图元属性","图元属性",[new Q.JsonProperty("模型矩阵","模型矩阵",!0,!1,[this,"modelMatrix"],en.defaults.modelMatrix),new Q.BooleanProperty("是否拣选","是否拣选",!0,!1,[this,"cull"]),new Q.JsonProperty("包围体","用来进行拣选,以剔除不再视野范围内的模型",!0,!1,[this,"boundingVolume"],BS,bQ),new Q.EnumProperty("渲染顺序","渲染顺序",!0,!1,[this,"pass"],vQ,"TRANSLUCENT"),new Q.EnumProperty("图元类型","图元类型",!0,!1,[this,"primitiveType"],gQ,"TRIANGLES"),new Q.JsonProperty("渲染状态","渲染状态",!0,!1,[this,"renderState"],IS,wQ),new Q.EvalStringProperty("顶点着色器","顶点着色器",!0,!1,[this,"vertexShaderSource"],PS,_Q),new Q.EvalStringProperty("片元着色器","片元着色器",!0,!1,[this,"fragmentShaderSource"],TS,xQ),new Q.JsonProperty("一致性变量(uniform)","一致性变量(uniform)",!0,!1,[this,"uniformMap"],FS,CQ),new Q.JsonProperty("顶点属性(attributes)","顶点属性(attributes)",!0,!1,[this,"attributesJson"],OS(kS),SQ),new Q.JsonProperty("索引(index)","索引(index)",!0,!1,[this,"indexTypedArrayJson"],DS(MS),EQ),new Q.NumberProperty("count","count",!0,!1,[this,"count"],0),new Q.NumberProperty("offset","offset",!0,!1,[this,"offset"],0),new Q.NumberProperty("instanceCount","instanceCount",!0,!1,[this,"instanceCount"],0),new Q.FunctionProperty("自动计算包围盒","根据顶点位置属性,自动计算包围盒",["string"],r=>{const s=this.computeLocalAxisedBoundingBoxFromAttribute(r);if(!s)return;const{min:o,max:i}=s;this.setLocalAxisedBoundingBox(o,i)},["position"])]),new Q.GroupProperty("本地变换","本地变换",[new Q.PositionProperty("本地偏移","本地偏移,不是经纬度!",!0,!1,[this,"localPosition"]),new Q.RotationProperty("本地姿态","本地姿态",!0,!1,[this,"localRotation"]),new Q.Number3Property("本地缩放","本地缩放",!0,!1,[this,"localScale"],[1,1,1]),new Q.JsonProperty("本地模型矩阵","本地模型矩阵,如果该属性有值,那么localPosition、localRotation、localScale等属性将不起作用。",!0,!1,[this,"localModelMatrix"])]),new Q.GroupProperty("调试","调试",[new Q.BooleanProperty("debugShowBoundingVolume","debugShowBoundingVolume",!0,!1,[this,"debugShowBoundingVolume"],!1),new Q.NumberProperty("debugOverlappingFrustums","debugOverlappingFrustums",!0,!1,[this,"debugOverlappingFrustums"],0)]),new Q.GroupProperty("Czm特有","Czm特有",[new Q.BooleanProperty("occlude","occlude",!0,!1,[this,"occlude"],!0),new Q.BooleanProperty("castShadows","castShadows",!0,!1,[this,"castShadows"],!1),new Q.BooleanProperty("receiveShadows","receiveShadows",!0,!1,[this,"receiveShadows"],!1),new Q.BooleanProperty("executeInClosestFrustum","executeInClosestFrustum",!0,!1,[this,"executeInClosestFrustum"],!1),new Q.BooleanProperty("pickOnly","pickOnly",!0,!1,[this,"pickOnly"],!1),new Q.BooleanProperty("depthForTranslucentClassification","depthForTranslucentClassification",!0,!1,[this,"depthForTranslucentClassification"],!1)])]}};N(en,"type",en.register("ESCustomPrimitive",en,{chsName:"ES自定义图元",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"ES自定义图元"})),N(en,"defaultRenderState",IS),N(en,"defaultVertexShaderSource",PS),N(en,"defaultFragmentShaderSource",TS),N(en,"defaultUniformMap",FS),N(en,"defaultBoundingVolume",BS),N(en,"defaultAttribute",kS),N(en,"defaultIndexTypedArray",MS),N(en,"defaults",{...Q.ESObjectWithLocation.defaults,allowPicking:!1,position:[116.39,39.9,0],rotation:[0,0,0],scale:[1,1,1],modelMatrix:[-.8957893500750183,-.4444788412198901,0,0,.28511078894078473,-.5746037485691958,.7671651518152995,0,-.3409886777031455,.68721837274483,.6414496315691579,0,-2.1778739967047274e6,4389222053178148e-9,4.0694736755001387e6,1],viewDistanceRange:[1e3,1e4,3e4,6e4]}),N(en,"getMinMaxPosition",E.getMinMaxPosition);let Eo=en;(t=>{t.createDefaultProps=()=>({maximumScale:void 0,minimumScale:void 0,pixelSize:void 0,showSceneScale:void 0,modelMatrix:E.reactArrayWithUndefined(void 0),cull:E.react(void 0),boundingVolume:E.reactJson(void 0),renderState:E.reactJson(void 0),primitiveType:void 0,pass:void 0,vertexShaderSource:void 0,fragmentShaderSource:void 0,uniformMap:E.reactJson(void 0),localPosition:E.reactArrayWithUndefined(void 0),localRotation:E.reactArrayWithUndefined(void 0),localScale:E.reactArrayWithUndefined(void 0),localModelMatrix:E.reactArrayWithUndefined(void 0),occlude:void 0,count:void 0,offset:void 0,instanceCount:void 0,castShadows:void 0,receiveShadows:void 0,executeInClosestFrustum:void 0,debugShowBoundingVolume:void 0,debugOverlappingFrustums:void 0,pickOnly:void 0,depthForTranslucentClassification:void 0,viewDistanceRange:E.reactArrayWithUndefined(void 0),viewDistanceDebug:!1,...Q.ESObjectWithLocation.createDefaultProps()})})(Eo||(Eo={})),E.extendClassProps(Eo.prototype,Eo.createDefaultProps);const ri=class ri extends Q.ESGeoVector{constructor(e){super(e);N(this,"editingBindMode","lineString");N(this,"_player");this._player=this.disposeVar(new Q.Player);{const r=ri.defaults;this.dispose(E.bind([this._player,"loop"],[this,"loop"],s=>s??r.loop,s=>s??r.loop)),this.dispose(E.bind([this._player,"currentTime"],[this,"currentTime"],s=>s??r.currentTime,s=>s??r.currentTime)),this.dispose(E.bind([this._player,"duration"],[this,"duration"],s=>s??r.duration,s=>s??r.duration)),this.dispose(E.bind([this._player,"playing"],[this,"playing"],s=>s??r.playing,s=>s??r.playing)),this.dispose(E.bind([this._player,"speed"],[this,"speed"],s=>s??r.speed,s=>s??r.speed))}}get typeName(){return"ESSignalTransmission"}get defaultProps(){return ri.createDefaultProps()}get player(){return this._player}get ratio(){return this._player.ratio}set ratio(e){this._player.ratio=e}get ratioChanged(){return this._player.ratioChanged}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.NumberProperty("起始时间","信号起始传输时间",!1,!1,[this,"startTime"]),new Q.NumberProperty("传输时间","信号实际传输时间",!1,!1,[this,"transmissionTime"]),new Q.NumberProperty("高度比率","当只有两个位置点时才有效,此时信号线会自动变成有高度的曲线",!1,!1,[this,"heightRatio"]),new Q.EnumProperty("弧线类型","弧线类型",!1,!1,[this,"arcType"],[["直线","NONE"],["地理直线","GEODESIC"],["地理恒向线","RHUMB"]]),new Q.BooleanProperty("变亮","变亮",!1,!1,[this,"brightening"]),new Q.BooleanProperty("深度监测","深度监测",!1,!1,[this,"depthTest"]),new Q.UriProperty("图片路径","图片路径,若无图片,则显示内部的OD线样式",!0,!1,[this,"imageUrl"],ri.defaults.imageUrl),new Q.NumberProperty("图像重复次数","图像重复次数,有图像时才有效",!1,!1,[this,"repeat"]),new Q.EnumProperty("运动方向","运动方向,注意对图片来说只有正反向。",!1,!1,[this,"bidirectional"],[["正向",0],["反向",1],["双向",2],["无",3]])]),new Q.GroupProperty("播放器","播放器",[new Q.PlayerProperty("播放器","播放器",[this,"playing"],[this,"ratio"],[this,"loop"]),new Q.BooleanProperty("是否循环","是否循环.",!1,!1,[this,"loop"]),new Q.NumberProperty("当前时间","当前时间",!1,!1,[this.player,"currentTime"]),new Q.NumberProperty("过渡时间","过渡时间",!1,!1,[this,"duration"]),new Q.BooleanProperty("是否播放","是否播放.",!1,!1,[this,"playing"]),new Q.NumberProperty("播放速度","播放速度.",!1,!1,[this,"speed"])])]}};N(ri,"type",ri.register("ESSignalTransmission",ri,{chsName:"信号传输器",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"信号传输器"})),N(ri,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert]),N(ri,"defaults",{...Q.ESGeoVector.defaults,loop:!0,currentTime:0,playerCurrentTime:0,duration:3e3,speed:1,playing:!0,startTime:0,transmissionTime:3e3,color:[0,1,0,1],width:3,heightRatio:1,arcType:"GEODESIC",brightening:!1,depthTest:!0,imageUrl:"${esobjs-xe2-plugin-assets-script-dir}/xe2-assets/esobjs-xe2-plugin/images/signal.png",repeat:5,bidirectional:0});let Po=ri;(t=>{t.createDefaultProps=()=>({imageUrl:void 0,repeat:5,bidirectional:0,startTime:0,transmissionTime:3e3,arcType:"GEODESIC",brightening:!1,depthTest:!0,heightRatio:1,loop:!0,currentTime:0,duration:3e3,speed:1,playing:!0,...Q.ESGeoVector.createDefaultProps()})})(Po||(Po={})),E.extendClassProps(Po.prototype,Po.createDefaultProps);const Ro=class Ro extends Q.ESGeoVector{constructor(e){super(e);N(this,"editingBindMode","lineString")}get typeName(){return"ESRoad"}get defaultProps(){return Ro.createDefaultProps()}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.NumberProperty("线宽","道路宽度,单位是米!",!1,!1,[this,"width"]),new Q.EnumProperty("弧线类型","弧线类型",!1,!1,[this,"arcType"],[["直线","NONE"],["地理直线","GEODESIC"],["地理恒向线","RHUMB"]]),new Q.StringProperty("道路图片","道路图片",!1,!1,[this,"imageUrl"]),new Q.Number2Property("重复次数","重复次数,该参数以后会取消!",!1,!1,[this,"repeat"])])]}};N(Ro,"type",Ro.register("ESRoad",Ro,{chsName:"贴地道路",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"最大宽度到1000米"})),N(Ro,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert]),N(Ro,"defaults",{...Q.ESGeoVector.defaults,width:50,arcType:"GEODESIC",imageUrl:"${earthsdk3-assets-script-dir}/assets/img/roads/4.jpg",repeat:[100,1]});let To=Ro;(t=>{t.createDefaultProps=()=>({...Q.ESGeoVector.createDefaultProps(),width:50,arcType:"GEODESIC",imageUrl:"${earthsdk3-assets-script-dir}/assets/img/roads/4.jpg",repeat:[100,1],stroked:!0})})(To||(To={})),E.extendClassProps(To.prototype,To.createDefaultProps);const Uo=class Uo extends Q.ESGeoVector{constructor(e){super(e);N(this,"_deprecated",["ground"]);N(this,"_deprecatedWarningFunc",(()=>{this._deprecatedWarning()})());N(this,"editingBindMode","circular");this.stroked=!0,this.filled=!0,this.strokeColor=[1,1,1,1],this.fillColor=[1,1,1,.5]}get typeName(){return"ESGeoSmoothPolygon"}get defaultProps(){return Uo.createDefaultProps()}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.GroupProperty("czm","czm",[new Q.BooleanProperty("是否贴地","A boolean Property specifying the visibility.",!0,!1,[this,"ground"],!1),new Q.NumberProperty("厚度","厚度",!0,!1,[this,"depth"],16)])])]}};N(Uo,"type",Uo.register("ESGeoSmoothPolygon",Uo,{chsName:"平滑多边形",tags:["ESObjects","_ES_Impl_Cesium","_ES_Impl_UE"],description:"平滑多边形"})),N(Uo,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.CircularAppend,Q.ESJEditingMode.CircularInsert]),N(Uo,"defaults",{...Q.ESGeoVector.defaults,fillStyle:{color:[1,1,1,.5],material:"",materialParams:{}}});let Si=Uo;(t=>{t.createDefaultProps=()=>({...Q.ESGeoVector.createDefaultProps(),ground:!1,depth:0})})(Si||(Si={})),E.extendClassProps(Si.prototype,Si.createDefaultProps);const Mi=class Mi extends Q.ESGeoVector{constructor(e){super(e);N(this,"_deprecated",["ground"]);N(this,"_deprecatedWarningFunc",(()=>{this._deprecatedWarning()})());N(this,"_geoPolylinePath");N(this,"_currentDistance",this.disposeVar(E.react(0)));this.stroked=!0}get typeName(){return"ESGeoBezierPath"}get defaultProps(){return Mi.createDefaultProps()}updateEditing(){var e;(e=this.viewer)==null||e.startEditing(this,[Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert],{callSource:"inner"})}get geoPolylinePath(){return this._geoPolylinePath}set geoPolylinePath(e){this._geoPolylinePath=e}get geoPath(){return this._geoPolylinePath.geoPath}get ratio(){return this._geoPolylinePath.ratio}set ratio(e){this._geoPolylinePath.ratio=e}get ratioChanged(){return this._geoPolylinePath.ratioChanged}get currentDistance(){return this._currentDistance.value}set currentDistance(e){this._currentDistance.value=e}get currentDistanceChanged(){return this._currentDistance.changed}get timePosRots(){return this.geoPath.timePosRots}getProperties(e){return[...super.getProperties(e),new Q.GroupProperty("通用","通用",[new Q.BooleanProperty("是否显示当前","是否显示当前.",!1,!1,[this,"currentPoiShow"]),new Q.NumberProperty("当前距离","当前距离",!1,!1,[this,"currentDistance"]),new Q.NumberProperty("分辨率","分辨率",!1,!1,[this,"resolution"]),new Q.NumberProperty("锐化程度","锐化程度",!1,!1,[this,"sharpness"])]),new Q.GroupProperty("GeoPath","GeoPath",[new Q.JsonProperty("timePosRots","类型为[timeStamp: number, position: [longitude: number, latitude: number, height: number], rotation: [heading: number, pitch: number, roll: number] | undefined];",!1,!0,[this,"timePosRots"],Mi.defaults.timePosRots),new Q.NumberProperty("折线超前显示时长","折线超前显示时长",!1,!1,[this,"leadTime"]),new Q.NumberProperty("折线滞后显示时长","折线滞后显示时长",!1,!1,[this,"trailTime"])]),new Q.GroupProperty("播放器","播放器",[new Q.PlayerProperty("播放器","播放器",[this,"playing"],[this._geoPolylinePath,"ratio"],[this,"loop"]),new Q.BooleanProperty("是否循环","是否循环.",!1,!1,[this,"loop"]),new Q.NumberProperty("当前时间","当前时间",!1,!1,[this,"currentTime"]),new Q.NumberProperty("过渡时间","过渡时间",!1,!1,[this,"duration"]),new Q.BooleanProperty("是否播放","是否播放.",!1,!1,[this,"playing"]),new Q.NumberProperty("播放速度","播放速度.",!1,!1,[this,"speed"])]),new Q.GroupProperty("折线","折线",[new Q.BooleanProperty("是否贴地","是否贴地.",!1,!1,[this,"ground"]),new Q.BooleanProperty("是否开启深度检测","A boolean Property specifying the visibility.",!1,!1,[this,"depthTest"]),new Q.EnumProperty("弧线类型","弧线类型",!1,!1,[this,"arcType"],[["直线","NONE"],["地理直线","GEODESIC"],["地理恒向线","RHUMB"]])])]}};N(Mi,"type",Mi.register("ESGeoBezierPath",Mi,{chsName:"贝塞尔曲线路径",tags:["GeoObjects"],description:"贝塞尔曲线路径"})),N(Mi,"supportEditingModes",[...Q.ESGeoVector.supportEditingModes,Q.ESJEditingMode.LineStringAppend,Q.ESJEditingMode.LineStringInsert]),N(Mi,"defaults",{...Q.ESGeoVector.defaults,currentPoiShow:!0,currentDistance:0,resolution:1e3,sharpness:.85,timePosRots:[],leadTime:0,trailTime:0,loop:!1,currentTime:0,duration:3e3,playing:!1,speed:1,ground:!1,depthTest:!1,arcType:"GEODESIC"});let Bo=Mi;(t=>{t.createDefaultProps=()=>({currentPoiShow:!0,ground:!1,arcType:"GEODESIC",loop:!1,currentTime:0,duration:3e3,speed:1,playing:!1,resolution:1e3,sharpness:.85,depthTest:!1,leadTime:0,trailTime:0,...Q.ESGeoVector.createDefaultProps()})})(Bo||(Bo={})),E.extendClassProps(Bo.prototype,Bo.createDefaultProps);const vc=class vc extends dr{constructor(e,r){super(e,r);N(this,"_czmBezierPath");if(this._czmBezierPath=this.disposeVar(new Bu(r,e.id)),e.geoPolylinePath=this._czmBezierPath.geoPolylinePath,!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmBezierPath;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.track([o,"currentPoiShow"],[e,"currentPoiShow"])),this.dispose(E.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(E.bind([o,"positions"],[e,"points"])),this.dispose(E.bind([o,"currentDistance"],[e,"currentDistance"])),this.dispose(E.track([o,"resolution"],[e,"resolution"])),this.dispose(E.track([o,"sharpness"],[e,"sharpness"])),this.dispose(E.track([o.geoPath,"timePosRots"],[e.geoPath,"timePosRots"])),this.dispose(E.track([o,"leadTime"],[e,"leadTime"])),this.dispose(E.track([o,"trailTime"],[e,"trailTime"])),this.dispose(E.track([o.geoPolylinePath,"ratio"],[e.geoPolylinePath,"ratio"])),this.dispose(E.track([o,"loop"],[e,"loop"])),this.dispose(E.track([o,"currentTime"],[e,"currentTime"])),this.dispose(E.track([o,"duration"],[e,"duration"])),this.dispose(E.track([o,"playing"],[e,"playing"])),this.dispose(E.track([o,"speed"],[e,"speed"])),this.dispose(E.track([o,"depthTest"],[e,"depthTest"])),this.dispose(E.track([o,"arcType"],[e,"arcType"])),this.dispose(E.track([o,"polylineShow"],[e,"stroked"])),this.dispose(E.track([o,"width"],[e,"strokeWidth"])),this.dispose(E.track([o,"color"],[e,"strokeColor"]));{const i=()=>{o.ground=e.ground||e.strokeGround};i();const a=this.dv(E.createNextAnimateFrameEvent(e.groundChanged,e.strokeGroundChanged));this.d(a.don(i))}{const i=()=>{if(!e.stroked){o.hasDash=!1,o.hasArrow=!1;return}const h=e.strokeStyle;if(h.material==="hasDash"&&h.materialParams)try{const u=h.materialParams;Reflect.has(u,"gapColor")&&(o.gapColor=u.gapColor??[0,0,0,0]),Reflect.has(u,"dashLength")&&(o.dashLength=u.dashLength),Reflect.has(u,"dashPattern")&&(o.dashPattern=u.dashPattern)}catch(u){console.error(u)}else o.gapColor=[0,0,0,0],o.dashLength=0,o.dashLength=0;const f=e.strokeMaterial??"normal";f==="hasDash"?(o.hasDash=!0,o.hasArrow=!1):f==="hasArrow"?(o.hasDash=!1,o.hasArrow=!0):(o.hasDash=!1,o.hasArrow=!1)};i();const a=this.disposeVar(E.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(i))}}get czmBezierPath(){return this._czmBezierPath}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmBezierPath:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):i.positions?(Ne(o,s,r,i.positions,e),!0):!1:!1}flyIn(e,r){const{sceneObject:s,czmViewer:o,czmBezierPath:i}=this;return o.actived?s.flyInParam?super.flyIn(e,r):i.positions?(Ne(o,s,r,i.positions,e),!0):!1:!1}};N(vc,"type",vc.register("ESCesiumViewer",Bo.type,vc));let Jy=vc;const wc=class wc extends Ze{constructor(e,r){super(e,r);N(this,"_czmGeoCustomDivPoi");N(this,"_divContainer");N(this,"_hasClassDivAndPos",{});if(this._czmGeoCustomDivPoi=this.disposeVar(new It(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmGeoCustomDivPoi;o.cssAllInitial=!0,this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.track([o,"allowPicking"],[e,"allowPicking"])),this.dispose(E.bind([o,"position"],[e,"position"])),this.dispose(E.track([o,"opacity"],[e,"opacity"])),this.d(E.track([o,"zOrder"],[e,"zOrder"]));{const i=()=>{o.originRatioAndOffset=[...e.anchor,0,0],this._divContainer&&this._divContainer.children[0]&&(this._divContainer.children[0].style.transformOrigin=`${e.anchor[0]*100}% ${e.anchor[1]*100}%`)};i(),this.dispose(e.anchorChanged.don(i))}{const i=()=>{const l=this;return class extends E.Destroyable{constructor(f,u,A){if(super(),this._subContainer=f,!A||!(A instanceof st))return;if(!e.instanceClass)throw new Error("!sceneObject.instanceClass");l._divContainer=this.disposeVar(new e.instanceClass(f,e,A))._container;{const m=()=>{l._divContainer.style.pointerEvents=l.sceneObject.editing?"none":"all"};m(),this.d(l.sceneObject.editingChanged.don(m))}{const m=()=>{l._divContainer.children[0]&&(l._divContainer.children[0].style.transform=`scale(${e.scale[1]},${e.scale[2]})`,l._divContainer.children[0].style.transformOrigin=`${e.anchor[0]*100}% ${e.anchor[1]*100}%`)};m(),this.d(e.scaleChanged.don(m))}let v=l._divContainer?l._divContainer.querySelectorAll("*[class]"):[];for(let m=0;m<v.length;m++){const p=v[m];var g=p.getBoundingClientRect();l._hasClassDivAndPos[p.className]=[p.offsetLeft,p.offsetTop,p.offsetLeft+g.width,p.offsetTop+g.height]}}}},a=()=>{try{e.instanceClass?o.instanceClass=i():o.instanceClass=void 0}catch(l){console.error(l)}};a(),this.dispose(e.instanceClassChanged.disposableOn(a))}this.dispose(o.pickedEvent.disposableOn(i=>{var h;i.assign({sceneObject:e});const a=(h=Zo(i,"pickResult"))==null?void 0:h.pointerEvent;if(!a)return;const l={type:a.buttons!=0&&a.button==0?"leftClick":a.button==2?"rightClick":void 0,add:{mousePos:[a.offsetX,a.offsetY]}};if(l.type==null&&(l.type=a.type),l.type==="leftClick"){const f=Object.keys(this._hasClassDivAndPos);for(let u=0;u<f.length;u++){const A=f[u];let v=this._hasClassDivAndPos[A],g=this._divContainer.getBoundingClientRect();const m=a.clientX-g.left,p=a.clientY-g.top;if(m>=v[0]&&m<=v[2]&&p>=v[1]&&p<=v[3]){l.add.className=A;break}}}e.widgetEvent.emit(l),l.type==="leftClick"&&(e.allowPicking??!1)&&e.pickedEvent.emit(i)}))}get czmGeoCustomDivPoi(){return this._czmGeoCustomDivPoi}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmGeoCustomDivPoi:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.position&&Ue(o.viewer,i.position,1e3,Jn,e),s.flyOverEvent.emit(r,"over",o),!0):!1}};N(wc,"type",wc.register("ESCesiumViewer",Q.ESGeoDiv.type,wc));let eg=wc;const bc=class bc extends Ze{constructor(e,r){super(e,r);N(this,"_czmDivTextPoi");if(this._czmDivTextPoi=this.disposeVar(new Ur(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmDivTextPoi;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.bind([o,"position"],[e,"position"])),this.dispose(E.bind([o,"textEditingInteraction"],[e,"textEditingInteraction"])),this.dispose(E.bind([o,"textEditing"],[e,"textEditing"])),this.dispose(E.bind([o,"width"],[e,"width"])),this.dispose(E.bind([o,"text"],[e,"text"])),this.dispose(E.track([o,"originRatioAndOffset"],[e,"originRatioAndOffset"])),this.dispose(E.track([o,"opacity"],[e,"opacity"])),this.dispose(E.bind([o,"fontSize"],[e,"fontSize"])),this.dispose(E.track([o,"color"],[e,"color"])),this.dispose(E.track([o,"backgroundColor"],[e,"backgroundColor"])),this.dispose(E.track([o,"borderRadius"],[e,"borderRadius"])),this.dispose(E.track([o,"borderColor"],[e,"borderColor"])),this.dispose(E.track([o,"borderWidth"],[e,"borderWidth"])),this.dispose(E.track([o,"textAlign"],[e,"textAlign"])),this.dispose(E.track([o,"borderStyle"],[e,"borderStyle"]))}get czmDivTextPoi(){return this._czmDivTextPoi}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmDivTextPoi:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.flyTo(e),s.flyOverEvent.emit(r,"over",o),!0):!1}};N(bc,"type",bc.register("ESCesiumViewer",Q.ESGeoDivTextPoi.type,bc));let tg=bc;const PQ={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[116.2,39.56]},properties:{title:"swimming","marker-symbol":"swimming","marker-color":"#8F1312"}},{type:"Feature",geometry:{type:"Point",coordinates:[115.2,38.56]},properties:{title:"8","marker-symbol":"8","marker-color":"#46117E"}},{type:"Feature",geometry:{type:"Point",coordinates:[114.2,37.56]},properties:{title:"6","marker-symbol":"6","marker-color":"#713291"}}]},TQ=`properties是一个包含三个属性的对象,title表示标题,marker-symbol表示点位的文字内容,marker-color表示点位颜色,properties可以删除,然后使用场景对象属性设置。
|
|
4183
4183
|
\`\`\`
|
|
4184
4184
|
{
|
|
4185
4185
|
"type": "FeatureCollection",
|
|
@@ -4360,7 +4360,7 @@ ${RS}
|
|
|
4360
4360
|
</div>
|
|
4361
4361
|
</div>
|
|
4362
4362
|
</div>
|
|
4363
|
-
`,HQ=async(t,n)=>{const e=(n==null?void 0:n.useDefault)??Q.ESPoi2D.defaults.style.useDefault,r=(n==null?void 0:n.fontSize)??Q.ESPoi2D.defaults.style.fontSize,s=e?"${earthsdk3-assets-script-dir}/assets/img/ESPoi2D/Custom/anchor.png":(n==null?void 0:n.image)??Q.ESPoi2D.defaults.style.image,o=(n==null?void 0:n.imageSize)??Q.ESPoi2D.defaults.style.imageSize,i=(n==null?void 0:n.text)??Q.ESPoi2D.defaults.style.text,a=e?"${earthsdk3-assets-script-dir}/assets/img/ESPoi2D/Custom/textBox_01.png":(n==null?void 0:n.textBackground)??Q.ESPoi2D.defaults.style.textBackground,l=(n==null?void 0:n.textBackgroundColor)??Q.ESPoi2D.defaults.style.textBackgroundColor,h=(n==null?void 0:n.textBackgroundSize)??Q.ESPoi2D.defaults.style.textBackgroundSize,f=(n==null?void 0:n.textColor)??Q.ESPoi2D.defaults.style.textColor,u=(n==null?void 0:n.textOffset)??Q.ESPoi2D.defaults.style.textOffset;let A=QQ;A=A.replace(/{{CustomContainer}}/g,`ESPoi2DCustomContainer${t}`),A=A.replace(/{{CustomImage}}/g,`ESPoi2DCustomImage${t}`),A=A.replace(/{{CustomTextContainer}}/g,`ESPoi2DCustomTextContainer${t}`),A=A.replace(/{{FONT_SIZE}}/g,r+"px"),A=A.replace(/{{IMAGE_SRC}}/g,Q.ESSceneObject.context.getStrFromEnv(s)),A=A.replace(/{{IMAGE_WIDTH}}/g,o[0]+"px"),A=A.replace(/{{IMAGE_HEIGHT}}/g,o[1]+"px"),A=A.replace(/{{TEXT}}/g,i),A=A.replace(/{{TEXT_BACKGROUND}}/g,Q.ESSceneObject.context.getStrFromEnv(a)),A=A.replace(/{{TEXT_BACKGROUND_COLOR}}/g,`rgb(${l.map(g=>g*255).join(",")})`),A=A.replace(/{{TEXT_BACKGROUND_WIDTH}}/g,h[0]+"px"),A=A.replace(/{{TEXT_BACKGROUND_HEIGHT}}/g,h[1]+"px"),A=A.replace(/{{TEXT_COLOR}}/g,`rgb(${f.map(g=>g*255).join(",")})`),A=A.replace(/{{TEXT_OFFSET_X}}/g,u[0]+"px"),A=A.replace(/{{TEXT_OFFSET_Y}}/g,u[1]+"px");const v=document.createElement("div");return v.innerHTML=A,[v.children[0].children[0],v.children[0].children[1]]},Ot=class Ot extends Pu{constructor(e,r){super(e,r);N(this,"_widgetComponent");N(this,"_customWidgetComponent");N(this,"_textBox",[]);N(this,"_iconBox");N(this,"_icon");N(this,"_anchor");if(!r.viewer){console.warn("viewer is undefined!");return}const o=this.ad(new E.Event),i=this.ad(new E.Event);{let l;const h=this.ad(E.createNextAnimateFrameEvent(e.screenRenderChanged,i));this.widgetComponent=this.disposeVar(new E.ObjResettingWithEvent(h,()=>{if(l)return e.screenRender?new $i(e,r,l instanceof HTMLDivElement?l:l[0],!0,!1):new cd(e,r,l instanceof HTMLDivElement?l:l[0],!0,!1)},!1)),this.customWidgetComponent=this.disposeVar(new E.ObjResettingWithEvent(h,()=>{if(!(!l||e.mode!="Custom"))return e.screenRender?new $i(e,r,l[1],!0,!1):new cd(e,r,l[1],!0,!1)},!1)),this.widgetComponent.objChanged.don(()=>{e.minVisibleDistanceChanged.emit()});const f=this.dv(E.createNextAnimateFrameEvent(e.nameChanged,e.styleChanged,o));this.ad(f.don(async()=>{var u;if(e.mode!="Custom"){if(this._textBox.length==0&&e.mode!="Linear01")return;const A=e.style[Object.keys(e.style).filter(m=>m.toUpperCase()=="TEXT")[0]]??e.name,{div:v,styleObj:g}=OQ(e.mode,A,this._textBox,this._iconBox,this._icon,this._anchor);l=v,l.innerHTML=NQ(l.innerHTML,g)}else{const A=await HQ(e.id,{...e.style,text:((u=e.style)==null?void 0:u.text)??e.name});l=[A[0],A[1]]}i.emit()}))}{const l=this.ad(E.createProcessingFromAsyncFunc(async u=>{await u.promise(MQ(e.mode)).then(A=>{Ot.modeCache.value={...Ot.modeCache.value,[e.mode]:A},this._icon=A.icon,this._anchor=A.anchor,this._iconBox=A.iconBox,this._textBox=A.textBox,o.emit()})}));let h=null;const f=()=>{var u,A,v,g;if(e.mode=="Custom"){o.emit();return}if(Reflect.has(Ot.modeCache.value,e.mode))if(Ot.modeCache.value[e.mode])this._icon=(u=Ot.modeCache.value[e.mode])==null?void 0:u.icon,this._anchor=(A=Ot.modeCache.value[e.mode])==null?void 0:A.anchor,this._iconBox=(v=Ot.modeCache.value[e.mode])==null?void 0:v.iconBox,this._textBox=((g=Ot.modeCache.value[e.mode])==null?void 0:g.textBox)??[],o.emit();else{if(h)return;h=Ot.modeCache.changed.don(()=>{var m,p,d,c;Ot.modeCache.value[e.mode]&&(this._icon=(m=Ot.modeCache.value[e.mode])==null?void 0:m.icon,this._anchor=(p=Ot.modeCache.value[e.mode])==null?void 0:p.anchor,this._iconBox=(d=Ot.modeCache.value[e.mode])==null?void 0:d.iconBox,this._textBox=((c=Ot.modeCache.value[e.mode])==null?void 0:c.textBox)??[],o.emit(),h&&h(),h=null)})}else Ot.modeCache.value={...Ot.modeCache.value,[e.mode]:void 0},l.restart()};f(),this.d(e.modeChanged.don(f))}const a=this.ad(new E.Event);{const l=this.dv(E.createNextAnimateFrameEvent(e.anchorChanged,e.autoAnchorChanged,e.offsetChanged)),h=()=>{const f=this.widgetComponent.obj,u=e.autoAnchor?f.defaultAnchor:e.anchor,A=e.offset;if(f instanceof $i)u?(f.czmGeoCustomDivPoi.originRatioAndOffset=[...u,-A[0],-A[1]],f.widgetInfo.style.transformOrigin=`${u[0]*100}% ${u[1]*100}%`):f.czmGeoCustomDivPoi.originRatioAndOffset=[0,0,0,0];else{let v=100,g=100;e.sizeByContent&&f.domSize?(v=f.domSize.width/100,g=f.domSize.height/100):(v=e.size[0]/100,g=e.size[1]/100),u?f.czmCustomPrimitive.localPosition=[u[0]*v-A[0]/100,0,u[1]*g-A[1]/100]:f.czmCustomPrimitive.localPosition=[0,0,0]}e.mode=="Custom"&&a.emit()};this.d(l.don(h)),this.ad(new E.ObjResettingWithEvent(this.widgetComponent.objChanged,()=>{if(this.widgetComponent.obj==null)return;const f=new E.Destroyable;return h(),f.d(this.widgetComponent.obj.defaultAnchorChanged.don(h)),f}))}{const l=this.dv(E.createNextAnimateFrameEvent(e.styleChanged,e.showChanged,a)),h=()=>{var d,c,y,w;if(e.mode!="Custom")return;const f=this.customWidgetComponent.obj,u=((d=e.style)==null?void 0:d.imageSize)??Q.ESPoi2D.defaults.style.imageSize;((c=e.style)==null?void 0:c.textBackgroundSize)??Q.ESPoi2D.defaults.style.textBackgroundSize;const A=e.autoAnchor?this.widgetComponent.obj.defaultAnchor:e.anchor,v=((y=e.style)==null?void 0:y.textBoxAlign)??Q.ESPoi2D.defaults.style.textBoxAlign,g=v=="start"?0:v=="center"?.5:1,m=((w=e.style)==null?void 0:w.textBoxOffset)??Q.ESPoi2D.defaults.style.textBoxOffset,p=e.offset;if(f instanceof $i)A?(f.czmGeoCustomDivPoi.originRatioAndOffset=[g,.5,-p[0]-m[0]+u[0]*(A[0]-.5),-p[1]-m[1]+u[1]*(A[1]-.5)],f.widgetInfo.style.transformOrigin=`${g*100}% ${.5*100}%`):f.czmGeoCustomDivPoi.originRatioAndOffset=[0,0,0,0];else{let b=100,_=100;e.sizeByContent&&f.domSize?(b=f.domSize.width/100,_=f.domSize.height/100):(b=e.size[0]/100,_=e.size[1]/100),A?f.czmCustomPrimitive.localPosition=[g*b+(-p[0]-m[0]+u[0]*(A[0]-.5))/100,0,.5*_+(-p[1]-m[1]+u[1]*(A[1]-.5))/100]:f.czmCustomPrimitive.localPosition=[0,0,0]}};this.ad(l.don(h)),this.ad(new E.ObjResettingWithEvent(this.customWidgetComponent.objChanged,()=>{if(this.customWidgetComponent.obj==null)return;const f=new E.Destroyable,u=this.customWidgetComponent.obj,A=()=>{var v,g,m,p;u instanceof $i?(((v=e.style)==null?void 0:v.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="hover"?(u.czmGeoCustomDivPoi.show=!1,this.d(this.widgetComponent.obj.czmGeoCustomDivPoi.pickedEvent.don(d=>{var y,w;const c=(y=Zo(d,"pickResult"))==null?void 0:y.pointerEvent;c&&(u.czmGeoCustomDivPoi.show=e.show&&(((w=e.style)==null?void 0:w.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)&&c.type=="mouseenter")}))):u.czmGeoCustomDivPoi.show=e.show&&(((g=e.style)==null?void 0:g.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow):(((m=e.style)==null?void 0:m.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="hover"?(u.czmCustomPrimitive.show=!1,this.d(e.widgetEvent.don(d=>{var c;d&&(u.czmCustomPrimitive.show=e.show&&(((c=e.style)==null?void 0:c.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)&&d.type=="mouseEnter")}))):u.czmCustomPrimitive.show=e.show&&(((p=e.style)==null?void 0:p.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)};return A(),f.ad(e.styleChanged.don(A)),f}))}}get widgetComponent(){return this._widgetComponent}set widgetComponent(e){this._widgetComponent=e}get customWidgetComponent(){return this._customWidgetComponent}set customWidgetComponent(e){this._customWidgetComponent=e}flyTo(e,r){const{sceneObject:s,czmViewer:o,widgetComponent:i}=this;if(!o.actived)return!1;if(s.flyToParam||s.flyInParam)return super.flyTo(e,r);if(i.obj)i.obj.flyTo(e,r);else{const a=setTimeout(()=>{clearTimeout(a),this.flyTo(e,r)},200)}return s.flyOverEvent.emit(r,"over",o),!0}visibleDistance(e,r){var s,o,i,a,l;if((s=r.viewer)!=null&&s.camera&&e.show){const h=Q.getDistancesFromPositions([e.position,Nn(r.viewer.camera)],"NONE")[0];let f=!1;e.minVisibleDistance<e.maxVisibleDistance?f=e.minVisibleDistance<h&&h<e.maxVisibleDistance:e.maxVisibleDistance==0&&(f=h>e.minVisibleDistance);const u=this.widgetComponent.obj,A=this.customWidgetComponent.obj;u instanceof $i?(u.czmGeoCustomDivPoi.show=e.show&&f,(((o=e.style)==null?void 0:o.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="default"&&A&&(A.czmGeoCustomDivPoi.show=e.show&&f&&(((i=e.style)==null?void 0:i.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow))):(u.czmCustomPrimitive.show=e.show&&f,(((a=e.style)==null?void 0:a.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="default"&&A&&(A.czmCustomPrimitive.show=e.show&&f&&(((l=e.style)==null?void 0:l.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)))}}};N(Ot,"type",Ot.register("ESCesiumViewer",Q.ESPoi2D.type,Ot)),N(Ot,"modeCache",E.react({}));let dg=Ot;const Fc=class Fc extends Ze{constructor(e,r){super(e,r);N(this,"_czmModelPoi3D");if(!r.viewer){console.warn("viewer is undefined!");return}const o=this.dv(E.createNextAnimateFrameEvent(e.modeChanged));this.dv(new E.ObjResettingWithEvent(o,()=>{let{mode:i}=e;const a=Q.ESSceneObject.context.getStrFromEnv(`\${earthsdk3-assets-script-dir}/assets/glb/poi3d/${i}/SM_POI_${i.charAt(0).toUpperCase()+i.slice(1)}.gltf`);return this._czmModelPoi3D=new jQ(e,r,a)}))}visibleDistance(e,r){var s;if((s=r.viewer)!=null&&s.camera&&e.show){const o=Q.getDistancesFromPositions([e.position,Nn(r.viewer.camera)],"NONE")[0];let i=!1;if(e.minVisibleDistance<e.maxVisibleDistance?i=e.minVisibleDistance<o&&o<e.maxVisibleDistance:e.maxVisibleDistance==0&&(i=o>e.minVisibleDistance),!this._czmModelPoi3D)return;this._czmModelPoi3D.czmModel&&(this._czmModelPoi3D.czmModel.show=e.show&&i)}}flyTo(e,r){const{sceneObject:s,czmViewer:o}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):this._czmModelPoi3D?(this._czmModelPoi3D.flyTo(e,r),!0):!1:!1}};N(Fc,"type",Fc.register("ESCesiumViewer",Q.ESPoi3D.type,Fc));let pg=Fc;class jQ extends E.Destroyable{constructor(e,r,s){super();N(this,"czmModel");this._sceneObject=e,this._czmViewer=r,this._modelUrl=s,this.czmModel=this.ad(new tn(this._czmViewer,this._sceneObject.id));const o=this._sceneObject,i=this.czmModel;i.show=!1,i.url=this._modelUrl,i.basePath=this._modelUrl.split("/").slice(0,-1).join("/")+"/",i.activeAnimationsAnimateWhilePaused=!0,this.d(E.bind([i,"position"],[o,"position"])),this.d(jt([i,"rotation"],[o,"rotation"])),this.d(E.track([i,"scale"],[o,"scale"])),this.d(E.track([i,"show"],[o,"show"]));{const a=this.dv(E.createNextAnimateFrameEvent(o.allowPickingChanged,o.editingChanged)),l=()=>{o.allowPicking&&!o.editing?i.allowPicking=!0:i.allowPicking=!1};l(),this.d(a.don(l))}{const a=()=>{const h=document.createElement("div");h.style.position="absolute",h.style.zIndex="-1",h.style.bottom="108px",h.style.right="0px",h.innerHTML=`<div style="width: 512px; height: 128px;color: #fff;text-align: center;line-height: 128px;font-size: 50px;margin: 0 auto;">
|
|
4363
|
+
`,HQ=async(t,n)=>{const e=(n==null?void 0:n.useDefault)??Q.ESPoi2D.defaults.style.useDefault,r=(n==null?void 0:n.fontSize)??Q.ESPoi2D.defaults.style.fontSize,s=e?"${earthsdk3-assets-script-dir}/assets/img/ESPoi2D/Custom/anchor.png":(n==null?void 0:n.image)??Q.ESPoi2D.defaults.style.image,o=(n==null?void 0:n.imageSize)??Q.ESPoi2D.defaults.style.imageSize,i=(n==null?void 0:n.text)??Q.ESPoi2D.defaults.style.text,a=e?"${earthsdk3-assets-script-dir}/assets/img/ESPoi2D/Custom/textBox_01.png":(n==null?void 0:n.textBackground)??Q.ESPoi2D.defaults.style.textBackground,l=(n==null?void 0:n.textBackgroundColor)??Q.ESPoi2D.defaults.style.textBackgroundColor,h=(n==null?void 0:n.textBackgroundSize)??Q.ESPoi2D.defaults.style.textBackgroundSize,f=(n==null?void 0:n.textColor)??Q.ESPoi2D.defaults.style.textColor,u=(n==null?void 0:n.textOffset)??Q.ESPoi2D.defaults.style.textOffset;let A=QQ;A=A.replace(/{{CustomContainer}}/g,`ESPoi2DCustomContainer${t}`),A=A.replace(/{{CustomImage}}/g,`ESPoi2DCustomImage${t}`),A=A.replace(/{{CustomTextContainer}}/g,`ESPoi2DCustomTextContainer${t}`),A=A.replace(/{{FONT_SIZE}}/g,r+"px"),A=A.replace(/{{IMAGE_SRC}}/g,Q.ESSceneObject.context.getStrFromEnv(s)),A=A.replace(/{{IMAGE_WIDTH}}/g,o[0]+"px"),A=A.replace(/{{IMAGE_HEIGHT}}/g,o[1]+"px"),A=A.replace(/{{TEXT}}/g,i),A=A.replace(/{{TEXT_BACKGROUND}}/g,Q.ESSceneObject.context.getStrFromEnv(a)),A=A.replace(/{{TEXT_BACKGROUND_COLOR}}/g,`rgb(${l.map(g=>g*255).join(",")})`),A=A.replace(/{{TEXT_BACKGROUND_WIDTH}}/g,h[0]+"px"),A=A.replace(/{{TEXT_BACKGROUND_HEIGHT}}/g,h[1]+"px"),A=A.replace(/{{TEXT_COLOR}}/g,`rgb(${f.map(g=>g*255).join(",")})`),A=A.replace(/{{TEXT_OFFSET_X}}/g,u[0]+"px"),A=A.replace(/{{TEXT_OFFSET_Y}}/g,u[1]+"px");const v=document.createElement("div");return v.innerHTML=A,[v.children[0].children[0],v.children[0].children[1]]},Ot=class Ot extends Pu{constructor(e,r){super(e,r);N(this,"_widgetComponent");N(this,"_customWidgetComponent");N(this,"_textBox",[]);N(this,"_iconBox");N(this,"_icon");N(this,"_anchor");if(!r.viewer){console.warn("viewer is undefined!");return}const o=this.ad(new E.Event),i=this.ad(new E.Event);{let l;const h=this.ad(E.createNextAnimateFrameEvent(e.screenRenderChanged,i));this.widgetComponent=this.disposeVar(new E.ObjResettingWithEvent(h,()=>{if(l)return e.screenRender?new $i(e,r,l instanceof HTMLDivElement?l:l[0],!0,!1):new cd(e,r,l instanceof HTMLDivElement?l:l[0],!0,!1)},!1)),this.customWidgetComponent=this.disposeVar(new E.ObjResettingWithEvent(h,()=>{if(!(!l||e.mode!="Custom"))return e.screenRender?new $i(e,r,l[1],!0,!1):new cd(e,r,l[1],!0,!1)},!1)),this.widgetComponent.objChanged.don(()=>{e.minVisibleDistanceChanged.emit()});const f=this.dv(E.createNextAnimateFrameEvent(e.nameChanged,e.styleChanged,o));this.ad(f.don(async()=>{var u;if(e.mode!="Custom"){if(this._textBox.length==0&&e.mode!="Linear01")return;const A=e.style[Object.keys(e.style).filter(m=>m.toUpperCase()=="TEXT")[0]]??e.name,{div:v,styleObj:g}=OQ(e.mode,A,this._textBox,this._iconBox,this._icon,this._anchor);l=v,l.innerHTML=NQ(l.innerHTML,g)}else{const A=await HQ(e.id,{...e.style,text:((u=e.style)==null?void 0:u.text)??e.name});l=[A[0],A[1]]}i.emit()}))}{const l=this.ad(E.createProcessingFromAsyncFunc(async u=>{await u.promise(MQ(e.mode)).then(A=>{Ot.modeCache.value={...Ot.modeCache.value,[e.mode]:A},this._icon=A.icon,this._anchor=A.anchor,this._iconBox=A.iconBox,this._textBox=A.textBox,o.emit()})}));let h=null;const f=()=>{var u,A,v,g;if(e.mode=="Custom"){o.emit();return}if(Reflect.has(Ot.modeCache.value,e.mode))if(Ot.modeCache.value[e.mode])this._icon=(u=Ot.modeCache.value[e.mode])==null?void 0:u.icon,this._anchor=(A=Ot.modeCache.value[e.mode])==null?void 0:A.anchor,this._iconBox=(v=Ot.modeCache.value[e.mode])==null?void 0:v.iconBox,this._textBox=((g=Ot.modeCache.value[e.mode])==null?void 0:g.textBox)??[],o.emit();else{if(h)return;h=Ot.modeCache.changed.don(()=>{var m,p,d,c;Ot.modeCache.value[e.mode]&&(this._icon=(m=Ot.modeCache.value[e.mode])==null?void 0:m.icon,this._anchor=(p=Ot.modeCache.value[e.mode])==null?void 0:p.anchor,this._iconBox=(d=Ot.modeCache.value[e.mode])==null?void 0:d.iconBox,this._textBox=((c=Ot.modeCache.value[e.mode])==null?void 0:c.textBox)??[],o.emit(),h&&h(),h=null)})}else Ot.modeCache.value={...Ot.modeCache.value,[e.mode]:void 0},l.restart()};f(),this.d(e.modeChanged.don(f))}const a=this.ad(new E.Event);{const l=this.dv(E.createNextAnimateFrameEvent(e.anchorChanged,e.autoAnchorChanged,e.offsetChanged)),h=()=>{const f=this.widgetComponent.obj,u=e.autoAnchor?f.defaultAnchor:e.anchor,A=e.offset;if(f instanceof $i)u?(f.czmGeoCustomDivPoi.originRatioAndOffset=[...u,-A[0],-A[1]],f.widgetInfo.style.transformOrigin=`${u[0]*100}% ${u[1]*100}%`):f.czmGeoCustomDivPoi.originRatioAndOffset=[0,0,0,0];else{let v=100,g=100;e.sizeByContent&&f.domSize?(v=f.domSize.width/100,g=f.domSize.height/100):(v=e.size[0]/100,g=e.size[1]/100),u?f.czmCustomPrimitive.localPosition=[u[0]*v-A[0]/100,0,u[1]*g-A[1]/100]:f.czmCustomPrimitive.localPosition=[0,0,0]}e.mode=="Custom"&&a.emit()};this.d(l.don(h)),this.ad(new E.ObjResettingWithEvent(this.widgetComponent.objChanged,()=>{if(this.widgetComponent.obj==null)return;const f=new E.Destroyable;return h(),f.d(this.widgetComponent.obj.defaultAnchorChanged.don(h)),f}))}{const l=this.dv(E.createNextAnimateFrameEvent(e.styleChanged,e.showChanged,a)),h=()=>{var d,c,y;if(e.mode!="Custom")return;const f=this.customWidgetComponent.obj;if(!f)return;const u=((d=e.style)==null?void 0:d.imageSize)??Q.ESPoi2D.defaults.style.imageSize,A=e.autoAnchor?this.widgetComponent.obj.defaultAnchor:e.anchor,v=((c=e.style)==null?void 0:c.textBoxAlign)??Q.ESPoi2D.defaults.style.textBoxAlign,g=v=="start"?0:v=="center"?.5:1,m=((y=e.style)==null?void 0:y.textBoxOffset)??Q.ESPoi2D.defaults.style.textBoxOffset,p=e.offset;if(f instanceof $i)A?(f.czmGeoCustomDivPoi.originRatioAndOffset=[g,.5,-p[0]-m[0]+u[0]*(A[0]-.5),-p[1]-m[1]+u[1]*(A[1]-.5)],f.widgetInfo.style.transformOrigin=`${g*100}% ${.5*100}%`):f.czmGeoCustomDivPoi.originRatioAndOffset=[0,0,0,0];else{let w=100,b=100;e.sizeByContent&&f.domSize?(w=f.domSize.width/100,b=f.domSize.height/100):(w=e.size[0]/100,b=e.size[1]/100),A?f.czmCustomPrimitive.localPosition=[g*w+(-p[0]-m[0]+u[0]*(A[0]-.5))/100,0,.5*b+(-p[1]-m[1]+u[1]*(A[1]-.5))/100]:f.czmCustomPrimitive.localPosition=[0,0,0]}};this.ad(l.don(h)),this.ad(new E.ObjResettingWithEvent(this.customWidgetComponent.objChanged,()=>{if(this.customWidgetComponent.obj==null)return;const f=new E.Destroyable,u=this.customWidgetComponent.obj,A=()=>{var v,g,m,p;u&&(u instanceof $i?(((v=e.style)==null?void 0:v.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="hover"?(u.czmGeoCustomDivPoi.show=!1,this.d(this.widgetComponent.obj.czmGeoCustomDivPoi.pickedEvent.don(d=>{var y,w;const c=(y=Zo(d,"pickResult"))==null?void 0:y.pointerEvent;c&&(u.czmGeoCustomDivPoi.show=e.show&&(((w=e.style)==null?void 0:w.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)&&c.type=="mouseenter")}))):u.czmGeoCustomDivPoi.show=e.show&&(((g=e.style)==null?void 0:g.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow):(((m=e.style)==null?void 0:m.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="hover"?(u.czmCustomPrimitive.show=!1,this.d(e.widgetEvent.don(d=>{var c;d&&(u.czmCustomPrimitive.show=e.show&&(((c=e.style)==null?void 0:c.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)&&d.type=="mouseEnter")}))):u.czmCustomPrimitive.show=e.show&&(((p=e.style)==null?void 0:p.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow))};return A(),f.ad(e.styleChanged.don(A)),f}))}}get widgetComponent(){return this._widgetComponent}set widgetComponent(e){this._widgetComponent=e}get customWidgetComponent(){return this._customWidgetComponent}set customWidgetComponent(e){this._customWidgetComponent=e}flyTo(e,r){const{sceneObject:s,czmViewer:o,widgetComponent:i}=this;if(!o.actived)return!1;if(s.flyToParam||s.flyInParam)return super.flyTo(e,r);if(i.obj)i.obj.flyTo(e,r);else{const a=setTimeout(()=>{clearTimeout(a),this.flyTo(e,r)},200)}return s.flyOverEvent.emit(r,"over",o),!0}visibleDistance(e,r){var s,o,i,a,l;if((s=r.viewer)!=null&&s.camera&&e.show){const h=Q.getDistancesFromPositions([e.position,Nn(r.viewer.camera)],"NONE")[0];let f=!1;e.minVisibleDistance<e.maxVisibleDistance?f=e.minVisibleDistance<h&&h<e.maxVisibleDistance:e.maxVisibleDistance==0&&(f=h>e.minVisibleDistance);const u=this.widgetComponent.obj,A=this.customWidgetComponent.obj;u instanceof $i?(u.czmGeoCustomDivPoi.show=e.show&&f,(((o=e.style)==null?void 0:o.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="default"&&A&&(A.czmGeoCustomDivPoi.show=e.show&&f&&(((i=e.style)==null?void 0:i.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow))):(u.czmCustomPrimitive.show=e.show&&f,(((a=e.style)==null?void 0:a.textBoxMode)??Q.ESPoi2D.defaults.style.textBoxMode)=="default"&&A&&(A.czmCustomPrimitive.show=e.show&&f&&(((l=e.style)==null?void 0:l.textBoxShow)??Q.ESPoi2D.defaults.style.textBoxShow)))}}};N(Ot,"type",Ot.register("ESCesiumViewer",Q.ESPoi2D.type,Ot)),N(Ot,"modeCache",E.react({}));let dg=Ot;const Fc=class Fc extends Ze{constructor(e,r){super(e,r);N(this,"_czmModelPoi3D");if(!r.viewer){console.warn("viewer is undefined!");return}const o=this.dv(E.createNextAnimateFrameEvent(e.modeChanged));this.dv(new E.ObjResettingWithEvent(o,()=>{let{mode:i}=e;const a=Q.ESSceneObject.context.getStrFromEnv(`\${earthsdk3-assets-script-dir}/assets/glb/poi3d/${i}/SM_POI_${i.charAt(0).toUpperCase()+i.slice(1)}.gltf`);return this._czmModelPoi3D=new jQ(e,r,a)}))}visibleDistance(e,r){var s;if((s=r.viewer)!=null&&s.camera&&e.show){const o=Q.getDistancesFromPositions([e.position,Nn(r.viewer.camera)],"NONE")[0];let i=!1;if(e.minVisibleDistance<e.maxVisibleDistance?i=e.minVisibleDistance<o&&o<e.maxVisibleDistance:e.maxVisibleDistance==0&&(i=o>e.minVisibleDistance),!this._czmModelPoi3D)return;this._czmModelPoi3D.czmModel&&(this._czmModelPoi3D.czmModel.show=e.show&&i)}}flyTo(e,r){const{sceneObject:s,czmViewer:o}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):this._czmModelPoi3D?(this._czmModelPoi3D.flyTo(e,r),!0):!1:!1}};N(Fc,"type",Fc.register("ESCesiumViewer",Q.ESPoi3D.type,Fc));let pg=Fc;class jQ extends E.Destroyable{constructor(e,r,s){super();N(this,"czmModel");this._sceneObject=e,this._czmViewer=r,this._modelUrl=s,this.czmModel=this.ad(new tn(this._czmViewer,this._sceneObject.id));const o=this._sceneObject,i=this.czmModel;i.show=!1,i.url=this._modelUrl,i.basePath=this._modelUrl.split("/").slice(0,-1).join("/")+"/",i.activeAnimationsAnimateWhilePaused=!0,this.d(E.bind([i,"position"],[o,"position"])),this.d(jt([i,"rotation"],[o,"rotation"])),this.d(E.track([i,"scale"],[o,"scale"])),this.d(E.track([i,"show"],[o,"show"]));{const a=this.dv(E.createNextAnimateFrameEvent(o.allowPickingChanged,o.editingChanged)),l=()=>{o.allowPicking&&!o.editing?i.allowPicking=!0:i.allowPicking=!1};l(),this.d(a.don(l))}{const a=()=>{const h=document.createElement("div");h.style.position="absolute",h.style.zIndex="-1",h.style.bottom="108px",h.style.right="0px",h.innerHTML=`<div style="width: 512px; height: 128px;color: #fff;text-align: center;line-height: 128px;font-size: 50px;margin: 0 auto;">
|
|
4364
4364
|
<span style="display: inline-block;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;width: 512px;">${o.style[Object.keys(o.style).filter(f=>f.toUpperCase()=="TEXT")[0]]??o.name}</span>
|
|
4365
4365
|
</div>`,document.body.contains(h)||document.body.appendChild(h),km(h,{backgroundColor:null,allowTaint:!1,useCORS:!0}).then(f=>{var u,A;document.body.contains(h)&&document.body.removeChild(h);for(let v=0;v<i.gltf.images.length;v++){const g=i.gltf.images[v];g.name.toUpperCase().includes("TEXT")&&(g.uri=f.toDataURL("image/png",1))}for(let v=0;v<i.gltf.materials.length;v++){const g=i.gltf.materials[v];g.name.toUpperCase().includes("UI")||g.name.toUpperCase().includes("LAMBERT5")?(g.pbrMetallicRoughness.baseColorFactor=((u=o.style)==null?void 0:u.UI_Color)??[1,1,1,1],g.alphaMode&&delete g.alphaMode):g.name.toUpperCase().includes("TEXT")||(g.pbrMetallicRoughness.baseColorFactor=((A=o.style)==null?void 0:A.FX_Color)??[1,1,1,1])}i.gltfJson=i.gltf,i.activeAnimationsJson=i.gltf.animations.map((v,g)=>({index:g,loop:"REPEAT",animationTime:"(duration) => Date.now() / 1000 / duration * 2"}))}).catch(()=>{document.body.contains(h)&&document.body.removeChild(h)})};a();const l=this.dv(E.createNextAnimateFrameEvent(o.nameChanged,o.styleChanged));this.d(l.don(a))}}flyTo(e,r){const{_czmViewer:s,_sceneObject:o,czmModel:i}=this;Bn(s,o,r,e,i,!0)}}const kc=class kc extends Ze{constructor(e,r){super(e,r);N(this,"_czmCustomPrimitive");N(this,"_causticsTexture");N(this,"_foamTexture");N(this,"_heightMapTexture");N(this,"_normalMapTexture");N(this,"isTimestamp",e=>{if(e.toString().length!==13||isNaN(e))return console.log("时间戳格式错误"),!1;const s=new Date(e);return isNaN(s.getTime())?(console.log("时间戳格式错误"),!1):!0});N(this,"getClosestTimestampIndex",(e,r)=>{for(var s=0,o=1/0,i=0;i<r.length;i++){var a=Math.abs(e-r[i]);a<o&&(o=a,s=i)}return s});if(this._czmCustomPrimitive=this.dv(new mt(r,e.id)),this._causticsTexture=this.dv(new wt(r)),this._foamTexture=this.dv(new wt(r)),this._heightMapTexture=this.dv(new wt(r)),this._normalMapTexture=this.dv(new wt(r)),!r.viewer){console.warn("viewer is undefined!");return}const o=this.czmCustomPrimitive,i=this.causticsTexture,a=this.foamTexture,l=this.heightMapTexture,h=this.normalMapTexture;i.uri=Q.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/water/caustics.jpg"),a.uri=Q.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/water/foam.jpg"),l.uri=Q.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/water/heightmap.jpg"),h.uri=Q.ESSceneObject.context.getStrFromEnv("${earthsdk3-assets-script-dir}/assets/img/water/water_normalmap.png"),this.d(E.track([o,"show"],[e,"show"])),this.d(E.track([o,"allowPicking"],[e,"allowPicking"])),this.d(E.bind([o,"position"],[e,"position"])),this.d(E.bind([o,"rotation"],[e,"rotation"])),this.d(E.bind([o,"scale"],[e,"scale"])),o.pass="TRANSLUCENT",o.primitiveType="TRIANGLES",o.renderState={depthTest:{enabled:!0},cull:{enabled:!0,face:1029},depthMask:!0,blending:{enabled:!0,equationRgb:32774,equationAlpha:32774,functionSourceRgb:770,functionSourceAlpha:1,functionDestinationRgb:771,functionDestinationAlpha:771}},o.vertexShaderSource=`
|
|
4366
4366
|
in vec3 position;
|
|
@@ -4883,7 +4883,7 @@ void main()
|
|
|
4883
4883
|
{
|
|
4884
4884
|
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
|
|
4885
4885
|
}
|
|
4886
|
-
`,this._customPrimitive.uniformMap={u_color:[1,1,0,1]},this.dispose(E.track([this._customPrimitive,"show"],[this,"show"])),this.dispose(E.track([this._geoPolyline,"show"],[this,"show"])),this.dispose(E.bind([this._geoPolyline,"positions"],[this,"positions"])),this.dispose(E.bind([this._geoPolyline,"width"],[this,"outlineWidth"])),this.dispose(E.bind([this._geoPolyline,"color"],[this,"outlineColor"]));{const o=()=>{let i="暂无分析结果";this.totalArea&&(i=`表面积: ${(this.totalArea??0).toFixed(2)}平方米`),this._geoDivPoi&&(this._geoDivPoi.innerHTML=$o(i,24))};o(),this.dispose(this.totalAreaChanged.don(o)),this.dispose(E.track([this._geoDivPoi,"show"],[this,"show"])),this.dispose(this.positionsChanged.don(()=>{this._geoDivPoi&&(this.positions&&this.positions.length>=3?this._geoDivPoi.position=xS(this.positions):this._geoDivPoi.position=void 0)}))}{const o=()=>{if((!this.positions||this.positions.length<3)&&this.customPrimitive){this.totalArea=0,this.customPrimitive.position=void 0,this.customPrimitive.attributes=void 0,this.customPrimitive.indexTypedArray=void 0,this.customPrimitive.show=!1;return}const i=this.interpolationDistance??Ra.defaults.interpolationDistance,a=this.interpolation??Ra.defaults.interpolation,l=this.offsetHeight??Ra.defaults.offsetHeight,h=this.drillDepth??Ra.defaults.drillDepth,f=[];if(this.positions)for(let M=0;M<this.positions.length;++M){const D=F.Cartesian3.fromDegrees(this.positions[M][0],this.positions[M][1],this.positions[M][2]);f.push(D)}var u=rj(f);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z)){console.warn("法向量计算错误!");return}var A=ij(f),v=F.Cartesian3.normalize(A,new F.Cartesian3),g=F.Cartesian3.dot(v,u);g<0&&(u=f2(u),f.reverse());let m=F.Transforms.eastNorthUpToFixedFrame(A),p=F.Matrix4.inverseTransformation(m,new F.Matrix4);if(Math.abs(g)<.999){const M=oj(u,v);var d=f2(A),c=F.Matrix4.fromTranslation(d,new F.Matrix4);p=F.Matrix4.multiply(M,c,c),m=F.Matrix4.inverse(p,new F.Matrix4)}var y=sl(f,p),w=[],b=[],_=[];if(a&&i>0){var x=aj(y),C=sj(y),T=hj(C,x,i);const M=S0(T,m,p,u,s.scene,l,h);var I=fj(y,i);const D=S0(I,m,p,u,s.scene,l,h);_.push(...M.world_cartesian),w.push(...M.local),b.push(...M.world),_.push(...D.world_cartesian),w.push(...D.local),b.push(...D.world),y.forEach(R=>{var U=S0([R],m,p,u,s.scene,l,h);if(U.local.length>0)w.push(...U.local),b.push(...U.world),_.push(...U.world_cartesian);else{w.push(R);var L=sl([R],m);for(let V=0;V<L.length;++V){_.push(L[V]);var z=F.Cartographic.fromCartesian(L[V]);b.push([z.longitude,z.latitude,z.height+l])}}})}else{w=y,_=sl(y,m);for(let M=0;M<_.length;++M){var P=F.Cartographic.fromCartesian(_[M]);b.push([P.longitude,P.latitude,P.height+l])}}var k=lj(w);const S=uj(_,k);this.totalArea=S;const B=[];w.forEach(M=>{const D=[M.x,M.y,M.z];D&&B.push(...D)});const O={position:{typedArray:new Float32Array(B),componentsPerAttribute:3}};if(this.customPrimitive){this.customPrimitive.modelMatrix=F.Matrix4.toArray(m),this.customPrimitive.attributes=O;const M=nj([...k]);this.customPrimitive.indexTypedArray=new Uint32Array(M),this.customPrimitive.show=!0}};this.dispose(this.startEvent.don(o))}}get pickedEvent(){return this._pickedEvent}get startEvent(){return this._startEvent}start(){this._startEvent.emit()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get geoPolyline(){return this._geoPolyline}get customPrimitive(){return this._customPrimitive}get geoDivPoi(){return this._geoDivPoi}};N(Ra,"defaults",{positions:[],totalArea:0,interpolation:!0,interpolationDistance:.5,offsetHeight:0,drillDepth:3,outlineWidth:2,outlineColor:[1,1,1,1]});let Ba=Ra;(t=>{t.createDefaultProps=()=>({positions:E.reactArrayWithUndefined(void 0),show:void 0,totalArea:void 0,interpolationDistance:void 0,interpolation:void 0,offsetHeight:void 0,drillDepth:void 0,outlineWidth:void 0,outlineColor:E.reactArray([1,1,1,1])})})(Ba||(Ba={})),E.extendClassProps(Ba.prototype,Ba.createDefaultProps);function nj(t){t.length%3!==0&&console.warn("当前传入的索引不是3的倍数,可能不是三角片的索引!");const n=t.length/3|0,e=new Array(n*6);for(let r=0;r<n;++r)e[r*6+0]=t[r*3+0],e[r*6+1]=t[r*3+1],e[r*6+2]=t[r*3+2],e[r*6+3]=t[r*3+1],e[r*6+4]=t[r*3+2],e[r*6+5]=t[r*3+0];return e}function rj(t){var n=new F.Cartesian3(0,0,0),e=new F.Cartesian3(0,0,0),r=new F.Cartesian3(0,0,0),s=new F.Cartesian3(0,0,0);t[0].equals(t[t.length-1])&&t.pop();var o=t.length;for(let h=0;h<o;++h){var i=t[h],a;h==0?a=t[t.length-1]:a=t[h-1];var l;h==t.length-1?l=t[0]:l=t[h+1],n=F.Cartesian3.subtract(i,a,n),e=F.Cartesian3.subtract(i,l,e),r=F.Cartesian3.cross(n,e,r),r=F.Cartesian3.normalize(r,r),s=F.Cartesian3.add(s,r,s)}return r.x=s.x/o,r.y=s.y/o,r.z=s.z/o,r}function ij(t){var n=new F.Cartesian3(0,0,0),e=t.length;for(let s=0;s<e;++s){var r=t[s];n=F.Cartesian3.add(n,r,n)}return n.x=n.x/e,n.y=n.y/e,n.z=n.z/e,n}function f2(t){return new F.Cartesian3(-1*t.x,-1*t.y,-1*t.z)}function oj(t,n){var e=F.Cartesian3.cross(t,n,new F.Cartesian3);e=F.Cartesian3.normalize(e,e);var r=F.Cartesian3.cross(t,e,new F.Cartesian3);r=F.Cartesian3.normalize(r,r);var s=t,o=new F.Matrix4(e.x,e.y,e.z,0,r.x,r.y,r.z,0,s.x,s.y,s.z,0,0,0,0,1);return o}function sl(t,n){var e=[];for(let o=0;o<t.length;++o){var r=t[o],s=F.Matrix4.multiplyByPoint(n,r,new F.Cartesian3);e.push(s)}return e}function aj(t){var n=t[0].x,e=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(o=>{n=Math.min(n,o.x),e=Math.min(e,o.y),r=Math.max(r,o.x),s=Math.max(s,o.y)}),{minx:n,miny:e,maxx:r,maxy:s}}function sj(t){var n=[];return t.forEach(e=>{n.push([e.x,e.y])}),n.push(n[0]),n}function lj(t){var n=[];t.forEach(r=>{const s=[r.x,r.y];n.push(s)});var e=x0.from(n).triangles;return e.reverse()}function uj(t,n){for(var e=0,r=0;r<n.length;r+=3){const s=[t[n[r]],t[n[r+1]],t[n[r+2]]];e+=cj(s)}return e}function cj(t){var n=F.Cartesian3.distance(t[0],t[1]),e=F.Cartesian3.distance(t[1],t[2]),r=F.Cartesian3.distance(t[2],t[0]),s=(n+e+r)/2,o=Math.sqrt(s*(s-n)*(s-e)*(s-r));return o}function hj(t,n,e){for(var r=[],s=n.minx;s<n.maxx;s+=e)for(var o=n.miny;o<n.maxy;o+=e)pj([s,o],t)&&r.push(new F.Cartesian3(s,o,0));return r}function fj(t,n){var e=[];for(let i=0;i<t.length;++i){var r=t[i],s;i==t.length-1?s=t[0]:s=t[i+1];var o=dj(r,s,n);e.push(...o)}return e}function dj(t,n,e){var r=[],s=F.Cartesian3.distance(t,n),o=F.Cartesian3.subtract(n,t,new F.Cartesian3);o=F.Cartesian3.normalize(o,o);for(var i=e;i<s;){var a=new F.Cartesian3(o.x*i,o.y*i,o.z*i),l=F.Cartesian3.add(t,a,new F.Cartesian3);r.push(l),i+=e}return r}function pj(t,n){var e=Io(t);if(!d9(Io(n[0]),Io(n[n.length-1])))return!1;var r=[];r.push(n);var s=Un(r);return zn(e,s)}function S0(t,n,e,r,s,o,i){var a=[];t.forEach(w=>{var b=w.clone();b.z=1e5,a.push(b)});var l=sl(a,n),h=new F.Cartesian3(-1*r.x,-1*r.y,-1*r.z),f=[],u=[],A=[];for(let w=0;w<l.length;++w){var v=l[w],g=new F.Ray(v,h),m=[];try{m=s.drillPickFromRay(g,i)}catch{}if(m.length===0){g=new F.Ray(v,r);try{m=s.drillPickFromRay(g,i)}catch{}}if(m.length!==0){for(var p,d=0;d<m.length;d++){var c=m[d];if((!c.object||c.object.content)&&c.position){p=c.position;break}}if(!(!p||!p.x||isNaN(p.x))){var y=sl([p],e);y.forEach(b=>{b.z+=o}),p=sl(y,n)[0],A.push(p),p=F.Cartographic.fromCartesian(p),f.push([p.longitude,p.latitude,p.height]),u.push(t[w])}}}return{local:u,world:f,world_cartesian:A}}const fh=class fh extends Kn{constructor(e,r){super(e,r);N(this,"_czmAreaMeasurement");if(this._czmAreaMeasurement=this.disposeVar(new Ba(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmAreaMeasurement;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.bind([o,"positions"],[e,"points"])),this.dispose(E.track([o,"interpolationDistance"],[e,"interpolation"])),this.dispose(E.track([o,"offsetHeight"],[e,"offsetHeight"]));{const i=()=>{if(this.geoPolygon&&(this.geoPolygon.outline=!1),e.stroked)o.outlineWidth=e.strokeWidth;else{o.outlineWidth=0;return}o.outlineWidth=e.strokeWidth,o.outlineColor=e.strokeColor};i();const a=this.disposeVar(E.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(i))}this.dispose(e.startEvent.don(()=>{this._czmAreaMeasurement.start()}))}get czmAreaMeasurement(){return this._czmAreaMeasurement}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmAreaMeasurement:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.positions&&Ne(o,s,r,i.positions,e),!0):!1}flyIn(e,r){const{sceneObject:s,czmViewer:o,czmAreaMeasurement:i}=this;return o.actived?s.flyInParam?super.flyIn(e,r):(i.positions&&Ne(o,s,r,i.positions,e),!0):!1}};N(fh,"type",fh.register("ESCesiumViewer",Q.ESSurfaceAreaMeasurement.type,fh));let E0=fh;async function Aj(t){navigator.clipboard.writeText(t).then(function(){console.log("复制成功")},function(n){console.log("复制失败")})}const dh=class dh extends Q.EngineObject{constructor(e,r){super(e,r);N(this,"_customDiv");if(this._customDiv=this.disposeVar(new Q.ESCustomDiv(e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._customDiv;r.add(o),this.dispose(()=>r.delete(o)),o.instanceClass=class extends E.Destroyable{constructor(a,l,h){if(super(),this._subContainer=a,!h||!(h instanceof st))return;h.extensions.cursorPositionInfo.enabled=!0;const f=document.createElement("div");this._subContainer.appendChild(f),this.dispose(()=>this._subContainer.removeChild(f)),f.style.width="100%",f.style.position="absolute",f.style.height=`${Q.ESViewerStatusBar.defaults.height}px`,f.style.left="0",f.style.bottom="0",f.style.color="#fff",f.style.padding="0 20px 0 0",f.style.boxSizing="border-box",f.style.lineHeight=`${Q.ESViewerStatusBar.defaults.height}px`,f.style.zIndex="100",f.style.alignContent="center",f.style.justifyContent="space-between";const u=document.createElement("span");f.appendChild(u),this.dispose(()=>f.removeChild(u));const A=document.createElement("span");u.appendChild(A),this.dispose(()=>u.removeChild(A));const v=document.createElement("span");u.appendChild(v),v.addEventListener("dblclick",function(){let m=v.innerHTML;m.startsWith("鼠标位置")&&(m=m.slice(5)),Aj(m)}),v.style.cursor="pointer",this.dispose(()=>u.removeChild(v));const g=document.createElement("span");f.appendChild(g),this.dispose(()=>f.removeChild(g));{const m=()=>{f.style.height=(e.height??Q.ESViewerStatusBar.defaults.height)+"px",f.style.lineHeight=(e.height??Q.ESViewerStatusBar.defaults.height)+"px"};this.dispose(e.heightChanged.disposableOn(m)),m()}{const m=()=>{f.style.fontSize=(e.fontSize??Q.ESViewerStatusBar.defaults.fontSize)+"px"};this.dispose(e.fontSizeChanged.disposableOn(m)),m()}{const m=()=>{e.bgColor?f.style.background=`rgba(${e.bgColor[0]*255},${e.bgColor[1]*255},${e.bgColor[2]*255},${e.bgColor[3]})`:f.style.background=`rgba(${Q.ESViewerStatusBar.defaults.bgColor[0]},${Q.ESViewerStatusBar.defaults.bgColor[1]},${Q.ESViewerStatusBar.defaults.bgColor[2]},${Q.ESViewerStatusBar.defaults.bgColor[3]})`};this.dispose(e.bgColorChanged.disposableOn(m)),m()}{g.innerText=`Cesium 版本 : ${F.VERSION} `;let m;const p=()=>{e.show?(f.style.display="flex",m=this.disposeVar(E.createAnimateFrameWithStartValues(()=>{var b;let d="",c="";const y=h.getCameraInfo();if(y){const _=(C,T)=>y.position[C].toFixed(T),x=(C,T)=>y.rotation[C].toFixed(T);d=`帧率:${h.getFPS()}FPS 经度: ${_(0,5)}° 纬度: ${_(1,5)}° 高度: ${_(2,2)}米 偏航角: ${x(0,2)}° 俯仰角: ${x(1,2)}° 翻滚角:${x(2,2)}° `}A.innerText=d;const w=(b=h.extensions)==null?void 0:b.cursorPositionInfo.cursorPosition;if(w){const _=(x,C)=>w[x].toFixed(C);c=`鼠标位置:${_(0,5)}° ${_(1,5)}° ${_(2,2)}m`}else c="暂时无法获取鼠标位置...";v.innerText=c})),m.start()):(f.style.display="none",m.destroy())};this.dispose(e.showChanged.disposableOn(p)),p()}}}}get customDiv(){return this._customDiv}};N(dh,"type",dh.register("ESCesiumViewer",Q.ESViewerStatusBar.type,dh));let P0=dh;const ph=class ph extends Q.EngineObject{constructor(e,r){super(e,r);N(this,"_customDiv");if(this._customDiv=this.disposeVar(new Q.ESCustomDiv(e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._customDiv;r.add(o),this.dispose(()=>r.delete(o)),this.dispose(E.track([o,"show"],[e,"show"])),o.instanceClass=class extends E.Destroyable{constructor(a,l,h){if(super(),this._subContainer=a,!h||!(h instanceof st))return;h.extensions.cursorPositionInfo.enabled=!0;const f=document.createElement("div");this._subContainer.appendChild(f),this.dispose(()=>this._subContainer.removeChild(f));const u=document.createElement("div");f.appendChild(u),u.style.width="100%",u.className="ESViewerStatusBarScale",u.style.position="absolute",u.style.display="flex",u.style.height=`${Q.ESViewerStatusBarScale.defaults.height}px`,u.style.left="0",u.style.bottom="0",u.style.color="#fff",u.style.padding="0 20px 0 0",u.style.boxSizing="border-box",u.style.lineHeight=`${Q.ESViewerStatusBarScale.defaults.height}px`,u.style.zIndex="100",u.style.alignContent="center",u.style.justifyContent="space-between";const A=document.createElement("div");u.appendChild(A);const v=document.createElement("div");A.appendChild(v);const g=document.createElement("div");A.appendChild(g);const m=document.createElement("div");u.appendChild(m);const p=document.createElement("div");m.appendChild(p);const d=document.createElement("div");p.appendChild(d);const c=document.createElement("div");p.appendChild(c);const y=document.createElement("span");m.appendChild(y);{const C=()=>{u.style.height=(e.height??Q.ESViewerStatusBarScale.defaults.height)+"px",u.style.lineHeight=(e.height??Q.ESViewerStatusBarScale.defaults.height)+"px"};this.dispose(e.heightChanged.disposableOn(C)),C()}{const C=()=>{u.style.fontSize=(e.fontSize??Q.ESViewerStatusBarScale.defaults.fontSize)+"px"};this.dispose(e.fontSizeChanged.disposableOn(C)),C()}{const C=()=>{e.bgColor?u.style.background=`rgba(${e.bgColor[0]*255},${e.bgColor[1]*255},${e.bgColor[2]*255},${e.bgColor[3]})`:u.style.background=`rgba(${Q.ESViewerStatusBarScale.defaults.bgColor[0]},${Q.ESViewerStatusBarScale.defaults.bgColor[1]},${Q.ESViewerStatusBarScale.defaults.bgColor[2]},${Q.ESViewerStatusBarScale.defaults.bgColor[3]})`};this.dispose(e.bgColorChanged.disposableOn(C)),C()}A.style.display="flex",v.style.fontWeight="bold",v.style.padding="0 0 0 25px";let w="EarthSDK";v.innerText=w,g.style.fontWeight="";let b="——免费开源地球可视化开发包";g.innerText=b,m.style.width="550px",p.style.position="fixed",p.style.width="125px",p.style.height="30px",p.style.padding="0 5px",p.style.display="flex",p.style.justifyContent="flex-end",p.style.pointerEvents="auto",p.style.zIndex="101",d.style.width="125px",d.style.display="inline-block",d.style.textAlign="center",d.style.fontSize="14px",d.style.fontWeight="lighter",d.style.lineHeight="30px",d.style.color="#fff",d.innerHTML="1000km",c.style.borderRight="1px solid #fff",c.style.borderLeft="1px solid #fff",c.style.borderBottom="1px solid #fff",c.style.position="absolute",c.style.height="10px",c.style.top="15px",c.style.width="75px",c.style.right="30px",y.style.display="flex",y.style.zIndex="101",y.style.justifyContent="flex-end",y.style.right="0";const _=()=>{const C=r.viewerLegend.legend.computedLengthInMeters;if(e.show===!1||C&&C>1e6)p.style.display="none";else{p.style.display="block";const T=r.viewerLegend.legend.computedLengthInStr;T&&(d.innerHTML=T);const I=r.viewerLegend.legend.computedLengthInPixels;if(I){c.style.width=`${I}px`;const P=(135-I)/2;c.style.left=`${P}px`}}};_();const x=setInterval(()=>{_()},200);this.dispose(()=>clearInterval(x));{let C;const T=()=>{e.show?(f.style.display="block",C=this.disposeVar(E.createAnimateFrameWithStartValues(()=>{var S;let I="";const P=h.getCameraInfo();if(P){const B=(O,M)=>P.position[O].toFixed(M);I+=`帧率:${h.getFPS()}FPS 相机: ${B(2,2)}米 `}const k=(S=h.extensions)==null?void 0:S.cursorPositionInfo.cursorPosition;if(k){const B=(O,M)=>k[O].toFixed(M);I+=`位置:${B(0,5)}° ${B(1,5)}° ${B(2,2)}米`}else I+="暂时无法获取鼠标位置...";y.innerText=I})),C.start()):(f.style.display="none",C.destroy())};this.dispose(e.showChanged.disposableOn(T)),T()}}}}get customDiv(){return this._customDiv}};N(ph,"type",ph.register("ESCesiumViewer",Q.ESViewerStatusBarScale.type,ph));let T0=ph;const d2=F.Math.toDegrees,mj=new F.Cartographic;function p2(t,n,e){const r=F.Cartesian3.fromDegrees(t[0],t[1],t[2]),s=F.Cartesian3.fromDegrees(n[0],n[1],n[2]),o=F.Cartesian3.subtract(s,r,new F.Cartesian3);F.Cartesian3.normalize(o,o);const i=new F.Ray(r,o),a=e.pickFromRay(i),l=e.globe.pick(i,e);var h;if(a&&a.position&&l){const g=F.Cartesian3.distance(r,a.position),m=F.Cartesian3.distance(r,l);h=g<m?a.position:l}else a&&a.position?h=a.position:l&&(h=l);if(!h)return;const f=F.Cartesian3.distance(r,s),A=F.Cartesian3.distance(r,h)>f?s:h,v=F.Cartographic.fromCartesian(A,void 0,mj);return[d2(v.longitude),d2(v.latitude),v.height]}const Ah=class Ah extends xn{constructor(e,r){super(e,r);N(this,"_hideGeoPolylines",this.disposeVar(new Wn(this.czmViewer,this.sceneObject.id)));N(this,"_visibleGeoPolylines",this.disposeVar(new Wn(this.czmViewer,this.sceneObject.id)));const s=r.viewer;if(!s){console.warn("viewer is undefined!");return}const o=this._hideGeoPolylines,i=this._visibleGeoPolylines;this.d(E.track([o,"show"],[e,"show"])),this.d(E.track([i,"show"],[e,"show"])),this.d(E.track([i,"color"],[e,"visibleColor"])),this.d(E.track([o,"color"],[e,"invisibleColor"]));{const a=()=>{const h=e.points,f=e.heightOffset;if(!h||h.length<2||h[0].toString()===h[1].toString()){o.positions=void 0,i.positions=void 0;return}const u=[],A=[],[v,g,m]=h[0],p=[v,g,m+f];try{h.forEach((d,c)=>{if(c===0)return;const y=p2(p,d,s.scene);y?(u.push([d,y]),A.push([p,y])):A.push([p,d])}),o.positions=u,i.positions=A}catch(d){console.warn(d)}};a();const l=this.dv(E.createNextAnimateFrameEvent(e.pointsChanged,e.heightOffsetChanged));this.d(l.don(a))}}get hideGeoPolylines(){return this._hideGeoPolylines}get visibleGeoPolylines(){return this._visibleGeoPolylines}flyTo(e,r){const{sceneObject:s,czmViewer:o}=this;if(!o.actived)return!1;if(s.flyToParam||s.flyInParam)return super.flyTo(e,r);{let i=[];return this.visibleGeoPolylines.positions&&(i=[...this.visibleGeoPolylines.positions.flat()]),this.hideGeoPolylines.positions&&(i=[...i,...this.hideGeoPolylines.positions.flat()]),Ne(o,s,r,i,e),!0}}flyIn(e,r){const{sceneObject:s,czmViewer:o}=this;if(!o.actived)return!1;if(s.flyInParam)return super.flyIn(e,r);{let i=[];return this.visibleGeoPolylines.positions&&(i=[...this.visibleGeoPolylines.positions.flat()]),this.hideGeoPolylines.positions&&(i=[...i,...this.hideGeoPolylines.positions.flat()]),Ne(o,s,r,i,e),!0}}};N(Ah,"type",Ah.register("ESCesiumViewer",Q.ESVisibilityAnalysis.type,Ah));let B0=Ah;class Hu extends E.Destroyable{constructor(e,r){super();N(this,"_flyToEvent",this.dv(new E.Event));N(this,"_enableEvent",this.dv(new E.Event));N(this,"_clearEvent",this.dv(new E.Event));N(this,"_gridPoints",this.dv(E.reactJson([])));N(this,"excavationPolylines");N(this,"fillPolylines");const s=e.viewer;if(!s){console.warn("viewer is undefined!");return}const o=this.dv(new Wn(e,r)),i=this.dv(new Wn(e,r));this.excavationPolylines=o,this.fillPolylines=i;const a=o;a.color=[1,1,0,1],this.d(E.track([a,"show"],[this,"show"])),a.show=!1,a.depthTest=!0;const l=i;l.color=[0,0,1,1],this.d(E.track([l,"show"],[this,"show"])),l.show=!1;{const v=this.ad(new qr(e,r));this.d(E.track([v,"show"],[this,"show"])),this.d(E.bind([v,"allowPicking"],[this,"allowPicking"])),this.d(E.bind([v,"positions"],[this,"positions"])),this.d(E.bind([v,"depthTest"],[this,"depthTest"])),this.d(E.bind([v,"outlineWidth"],[this,"outlineWidth"])),this.d(E.bind([v,"outlineColor"],[this,"outlineColor"])),this.d(E.bind([v,"outline"],[this,"outline"])),this.d(E.bind([v,"color"],[this,"fillColor"])),this.d(E.bind([v,"fill"],[this,"filled"])),this.d(E.bind([v,"strokeGround"],[this,"strokeGround"])),this.d(E.bind([v,"ground"],[this,"fillGround"])),this.d(this.flyToEvent.don(p=>{v.flyTo(p)}));const g=()=>{v.positions=this.positions};g();const m=this.dv(E.createNextAnimateFrameEvent(this.positionsChanged));this.d(m.don(g))}const h=()=>{if(!this.positions||!this.positions.length)return;const{minPos:v,maxPos:g}=Q.getMinMaxCorner(this.positions),m=v[0],p=v[1],d=g[0],c=g[1],w={type:"Polygon",coordinates:[[...this.positions.map(k=>[k[0],k[1]])]]},b=[m,p,d,c],_=this.gridWidth,T=xE(b,_,{units:"meters",mask:w}).features.map(k=>k.geometry.coordinates),I=F.Math.toRadians;return T.map(k=>new F.Cartographic(I(k[0]),I(k[1])))},f=()=>{a.positions=[],l.positions=[],this.area=0,this.cutVolume=0,this.fillVolume=0,this.cutAndFillVolume=0,a.depthTest=!0},u=this.dv(E.createProcessingFromAsyncFunc(async v=>{const g=h();let m=0,p=300;const d=Math.ceil(g.length/p),c=[];do{let y=[];m===d-1?y=g.slice(m*p):y=g.slice(m*p,(m+1)*p);const w=s.scene.sampleHeightMostDetailed(y),b=await v.promise(w);if(m===d-1?this.progress=Math.round(this.progress+100/d):this.progress+=100/d,b&&b.length){const _=F.Math.toDegrees,x=b.map(C=>[_(C.longitude),_(C.latitude),C.height]);c.push(...x)}m++}while(m<d);!c||!c.length||(this.gridPoints=c)}));let A=null;{const v=()=>{if(!this.positions||!this.positions.length||!this.gridPoints)return;let g=0;const m=[];let p=0;const d=[];this.gridPoints.forEach(c=>{const y=this.positions;c[2]>y[0][2]?(g+=this.gridWidth*this.gridWidth*(c[2]-y[0][2]),m.push([c,[c[0],c[1],y[0][2]]])):(p+=this.gridWidth*this.gridWidth*(y[0][2]-c[2]),d.push([c,[c[0],c[1],y[0][2]]]))}),a.positions=m,l.positions=d,a.show=!0,l.show=!0,this.area=_S(this.positions),this.cutVolume=g,this.fillVolume=p,this.cutAndFillVolume=p-g,A&&clearTimeout(A),A=setTimeout(()=>{a.depthTest=!1},200)};v(),this.d(this.gridPointsChanged.don(v)),this.d(()=>clearTimeout(A))}{const v=()=>{if(!this.positions||!this.positions.length){this.planeHeight=void 0;return}this.planeHeight=this.positions[0][2]};v(),this.d(this.positionsChanged.don(v))}{const v=()=>{if(!this.planeHeight||!this.positions||!this.positions.length)return;const g=JSON.parse(JSON.stringify(this.positions.slice(1)));g.unshift([this.positions[0][0],this.positions[0][1],this.planeHeight]),this.positions=g};v(),this.d(this.planeHeightChanged.don(v))}this.d(this.enableEvent.don(()=>{f(),this.gridPoints=[],this.progress=0,u.restart()})),this.d(this.clearEvent.don(()=>{f()}))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get enableEvent(){return this._enableEvent}enableEmit(){this._enableEvent.emit()}get clearEvent(){return this._clearEvent}clearEmit(){this._clearEvent.emit()}get gridPoints(){return this._gridPoints.value}set gridPoints(e){this._gridPoints.value=e}get gridPointsChanged(){return this._gridPoints.changed}}(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:E.reactPositions(void 0),planeHeight:E.react(void 0),gridWidth:1,area:0,cutVolume:0,fillVolume:0,cutAndFillVolume:0,progress:0,depthTest:!1,outlineWidth:2,outlineColor:[1,1,1,1],outline:!0,filled:!1,fillColor:[1,1,1,1],fillGround:!1,strokeGround:!1})})(Hu||(Hu={})),E.extendClassProps(Hu.prototype,Hu.createDefaultProps);const mh=class mh extends Kn{constructor(e,r){super(e,r);N(this,"_geoVolumeMeasurement");if(this._geoVolumeMeasurement=this.dv(new Hu(this.czmViewer,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._geoVolumeMeasurement;this.d(E.track([o,"show"],[e,"show"])),this.d(E.bind([o,"positions"],[e,"points"])),this.d(E.track([o,"allowPicking"],[e,"allowPicking"])),this.d(E.bind([o,"planeHeight"],[e,"planeHeight"])),this.d(E.track([o,"gridWidth"],[e,"gridWidth"])),this.d(E.track([e,"cutVolume"],[o,"cutVolume"])),this.d(E.track([e,"fillVolume"],[o,"fillVolume"])),this.d(E.track([e,"cutAndFillVolume"],[o,"cutAndFillVolume"])),this.d(E.bind([e,"progress"],[o,"progress"])),this.d(E.track([o,"depthTest"],[e,"depthTest"])),this.d(E.track([o,"outline"],[e,"stroked"])),this.d(E.track([o,"outlineWidth"],[e,"strokeWidth"])),this.d(E.track([o,"outlineColor"],[e,"strokeColor"])),this.d(E.track([o,"filled"],[e,"filled"])),this.d(E.track([o,"fillColor"],[e,"fillColor"])),this.d(E.track([o,"fillGround"],[e,"fillGround"])),this.d(E.track([o,"strokeGround"],[e,"strokeGround"])),this.d(e.startEvent.don(()=>{o.enableEmit()})),this.d(e.clearEvent.don(()=>{o.clearEmit()}))}get geoVolumeMeasurement(){return this._geoVolumeMeasurement}flyTo(e,r){const{sceneObject:s,czmViewer:o,geoVolumeMeasurement:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):i.positions?(Ne(o,s,r,i.positions,e),!0):!1:!1}};N(mh,"type",mh.register("ESCesiumViewer",Q.ESVolumeMeasurement.type,mh));let I0=mh;const yh=class yh extends Kn{constructor(e,r){super(e,r);N(this,"czmEntity");N(this,"czmPolyline",this.ad(new Q.ESGeoLineString));const s=r.viewer;if(!s){console.warn("viewer is undefined!");return}const o=this.czmPolyline;r.add(o),this.ad(()=>r.delete(o)),this.ad(E.bind([o,"show"],[e,"show"])),this.ad(E.bind([o,"allowPicking"],[e,"allowPicking"])),this.ad(E.bind([o,"stroked"],[e,"stroked"])),this.ad(E.bind([o,"strokeColor"],[e,"strokeColor"])),this.ad(E.bind([o,"strokeWidth"],[e,"strokeWidth"])),this.ad(E.bind([o,"strokeGround"],[e,"strokeGround"]));{const h=()=>{if(!e.points||e.points.length<2)o.points=e.points;else{const u=structuredClone(e.points);u.push(u[0]),e.perPositionHeight?o.points=u:o.points=u.map(A=>(A[2]=e.height??Q.ESGeoExtrudedPolygon.defaults.height,A))}};h();const f=this.ad(E.createNextAnimateFrameEvent(e.pointsChanged,e.heightChanged,e.perPositionHeightChanged));this.ad(f.don(h))}const i=this.czmEntity=s.entities.add({polygon:{}});F.Entity.prototype&&(i.ESSceneObjectID=e.id),this.dispose(()=>s.entities.remove(i));let a=new F.PolygonHierarchy;i.polygon&&(i.polygon.hierarchy=new F.CallbackProperty(()=>a,!1));const l=()=>{const h=un(e.points??Q.ESGeoExtrudedPolygon.defaults.points);if(h.length<2){a=new F.PolygonHierarchy;return}a=new F.PolygonHierarchy(h)};l(),this.dispose(e.pointsChanged.disposableOn(l));{const h=()=>{i.show=e.show&&e.filled,this.geoPolygon&&(this.geoPolygon.show=e.show&&!i.show&&e.filled)};h();const f=this.ad(E.createNextAnimateFrameEvent(e.showChanged,e.filledChanged));this.ad(f.don(h))}{const h=()=>{i.polygon&&(i.polygon.perPositionHeight=new F.ConstantProperty(e.perPositionHeight),l())};h(),this.ad(e.perPositionHeightChanged.don(h))}{const h=()=>{i.polygon&&(i.polygon.height=new F.ConstantProperty(e.height??Q.ESGeoExtrudedPolygon.defaults.height))};h(),this.dispose(e.heightChanged.disposableOn(h))}{const h=()=>{i.polygon&&(i.polygon.extrudedHeight=new F.ConstantProperty(e.extrudedHeight??Q.ESGeoExtrudedPolygon.defaults.extrudedHeight))};h(),this.dispose(e.extrudedHeightChanged.disposableOn(h))}{const h=()=>{const f=F.Color.fromCartesian4(F.Cartesian4.fromArray(e.fillColor));i.polygon&&(i.polygon.material=f)};h(),this.dispose(e.fillColorChanged.disposableOn(h))}this.disposeVar(new E.ObjResettingWithEvent(e.allowPickingChanged,()=>{if(!e.allowPicking)return new st.ObjectsToExcludeWrapper(r,i)}))}getMinAndMaxheight(){const{sceneObject:e}=this;if(e.points){const{minPos:r,maxPos:s}=Q.getMinMaxCorner(e.points);return[r[2],s[2]]}return[0,0]}};N(yh,"type",yh.register("ESCesiumViewer",Q.ESGeoExtrudedPolygon.type,yh));let F0=yh;const gh=class gh extends Q.EngineObject{constructor(n,e){if(super(n,e),!e.viewer){console.warn("viewer is undefined!");return}const{human:s,poi:o}=n;this.dispose(E.bind([s,"position"],[n,"position"])),this.dispose(E.bind([s,"rotation"],[n,"rotation"])),this.ad(E.bind([s,"scale"],[n,"scale"])),this.ad(E.track([o,"scale"],[n,"scale"])),this.dispose(E.track([o,"rotation"],[n,"rotation"]));const i=()=>{const l=n.position;o.position=[l[0],l[1],l[2]+n.poiOffsetHeight]};i();const a=this.dv(E.createNextAnimateFrameEvent(n.positionChanged,n.poiOffsetHeightChanged));this.d(a.don(i))}};N(gh,"type",gh.register("ESCesiumViewer",Q.ESHumanPoi.type,gh));let k0=gh;const vh=class vh extends Q.EngineObject{constructor(n,e){super(n,e);const r=e.viewer;if(!r){console.warn("viewer is undefined!");return}const s=r.scene.postProcessStages,o=s.add(F.PostProcessStageLibrary.createSilhouetteStage());o.uniforms.color=F.Color.LIME,o.selected=[],this.d(()=>{o.selected=[],s.remove(o)}),this.d(n.highlightInner3DtilesetEvent.don(i=>{o.selected=[];const a=i.d(i.tilesetReady.donce(f=>{f.allTilesLoaded.addEventListener(()=>{var A,v,g,m;const u=(m=(g=(v=(A=f==null?void 0:f._root)==null?void 0:A._content)==null?void 0:v._model)==null?void 0:g._featureTables[0])==null?void 0:m._features[0];u?o.selected=[u]:console.warn("tileset?._root?._content?._model?._featureTables[0]?._features[0] is undefined !",f),a()})})),l=i.url,h=Date.now();l.includes("?reload=")?i.url=l.replace(/\?reload=\d+/,`?reload=${h}`):i.url=l+`?reload=${h}`})),this.d(n.removeHighlightInner3DtilesetEvent.don(i=>{o.selected=[]})),this.d(n.es3DTileset.tilesetReady.don(i=>{const a=()=>{const h=n.layerConfig;if(!h){i.style=void 0;return}const f=n.colorBlendMode,u=(g,m)=>{try{if(g.getPropertyIds().includes("materialName"))return F.Color.clone(F.Color.WHITE,m);const p=g.getProperty("layer"),d=g.getProperty("dataset"),c=p.toString(),y=d.toString(),w=h.find(_=>_.dataset.toString()===y&&_.layer.toString()===c);if(w&&w.value.color){const _=w.value.color;return F.Color.fromCssColorString(_,m)}const b=h.filter(_=>_.dataset.toString()===y);if(b.length==1&&b[0].value.color){const _=b[0].value.color;return F.Color.fromCssColorString(_,m)}else return F.Color.clone(F.Color.WHITE,m)}catch(p){return console.warn(p),F.Color.clone(F.Color.WHITE,m)}},A=g=>{try{if(g.getPropertyIds().includes("materialName"))return!0;const m=g.getProperty("layer"),p=g.getProperty("dataset"),d=m.toString(),c=p.toString(),y=h.find(b=>b.dataset.toString()===c&&b.layer.toString()===d);if(y&&y.value.visible===!1)return!1;if(y&&y.value.visible===!0)return!0;const w=h.filter(b=>b.dataset.toString()===c);return!(w.length==1&&w[0].value.visible===!1)}catch(m){return console.warn(m),!0}};let v;f!=="HIGHLIGHT"?v=new F.Cesium3DTileStyle({color:{evaluateColor:function(g,m){return u(g,m)}},show:{evaluate:function(g){return A(g)}}}):v=new F.Cesium3DTileStyle({show:{evaluate:function(g){return A(g)}}}),i.style=v};a();const l=this.dv(E.createNextAnimateFrameEvent(n.layerConfigChanged,n.colorBlendModeChanged));this.d(l.don(()=>{a()}))}))}};N(vh,"type",vh.register("ESCesiumViewer",Q.ESRtsTileset.type,vh));let M0=vh;const wh=class wh extends Hs{constructor(n,e){if(super(n,e),!e.viewer){console.warn("viewer is undefined!");return}}};N(wh,"type",wh.register("ESCesiumViewer",Q.ESRtsFeatureEditing.type,wh));let O0=wh;const bh=class bh extends Hs{constructor(n,e){if(super(n,e),!e.viewer){console.warn("viewer is undefined!");return}}};N(bh,"type",bh.register("ESCesiumViewer",Q.ESMsTileset.type,bh));let D0=bh;const _h=class _h extends Ze{constructor(e,r){super(e,r);N(this,"_czmGeoPoint");if(this._czmGeoPoint=this.disposeVar(new nr(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmGeoPoint;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.bind([o,"position"],[e,"position"]))}get czmGeoPoint(){return this._czmGeoPoint}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmGeoPoint:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.flyTo(e),s.flyOverEvent.emit(r,"over",o),!0):!1}};N(_h,"type",_h.register("ESCesiumViewer",Q.ESStaticMesh.type,_h));let R0=_h;const xh=class xh extends xn{constructor(n,e){super(n,e);const r=e.viewer;if(!r){console.warn("viewer is undefined!");return}const s=this.ad(new Lw(r));this.ad(n.startEvent.don(async()=>{const o=await s.getDepthsFromScreen(),{depths:i,windowPositions:a,positions:l}=s.getSkylineDepthsAndPositions(o,r.scene.canvas.width,r.scene.canvas.height,n.radius??Q.ESSkylineAnalysis.defaults.radius),h=He(r.camera.position);l.push(h),n.depths=i,n.windowPositions=a,n.points=l}))}flyTo(n,e){const{sceneObject:r,czmViewer:s}=this;return s.actived?r.flyToParam||r.flyInParam?super.flyTo(n,e):r.points?(Ne(s,r,e,r.points,n),!0):!1:!1}flyIn(n,e){const{sceneObject:r,czmViewer:s}=this;return s.actived?r.flyInParam?super.flyIn(n,e):r.points?(Ne(s,r,e,r.points,n),!0):!1:!1}};N(xh,"type",xh.register("ESCesiumViewer",Q.ESSkylineAnalysis.type,xh));let U0=xh;const Ua=class Ua extends En{constructor(e){super();N(this,"_config",this.disposeVar(E.react(Ua.defaultConfig)));N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"_pointerEventFilterFunc",this.disposeVar(E.react(Ua.defaultPointerEventFilterFunc)));if(!!e.viewer){{const r=()=>{const{config:s}=this;s.clickEnabled!==void 0&&(this.clickEnabled=s.clickEnabled),s.dblClickEnabled!==void 0&&(this.dblClickEnabled=s.dblClickEnabled)};r(),this.dispose(this.configChanged.disposableOn(r))}{const r=this.ad(new nr(e));r.pixelSize=4,r.outlineColor=[0,0,.8,1],r.outlineWidth=2,r.allowPicking=!1;{const s=()=>{if(!this.position)return;const o=[...this.position];e.editingHeightOffset&&(o[2]-=e.editingHeightOffset),r.position=o,r.show=!!this.position};s(),this.dispose(this.positionChanged.disposableOn(s))}}this.ad(new E.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new yj(e,this):void 0))}}get config(){return this._config.value}set config(e){this._config.value=e}get configChanged(){return this._config.changed}get overEvent(){return this._overEvent}over(){this._overEvent.emit()}get pointerEventFilterFunc(){return this._pointerEventFilterFunc.value}set pointerEventFilterFunc(e){this._pointerEventFilterFunc.value=e}get pointerEventFilterFuncChanged(){return this._pointerEventFilterFunc.changed}};N(Ua,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!1}),N(Ua,"defaultPointerEventFilterFunc",e=>e.button===0),N(Ua,"defaults",{...En.defaults,position:[116.39,39.9,0]});let Sr=Ua;(t=>{t.createDefaultProps=()=>({...En.createDefaultProps(),position:E.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(Sr||(Sr={})),E.extendClassProps(Sr.prototype,Sr.createDefaultProps);class yj extends E.Destroyable{constructor(e,r){super();N(this,"_doings",[]);N(this,"initDoings",this.ad(()=>{this._doings.forEach(e=>e.destroy()),this._doings.length=0}));this._czmViewer=e,this._placeEditing=r;{const s=(o,i)=>{i=="click"&&(!r.clickEnabled||!r.pointerEventFilterFunc(o))||i=="dblclick"&&(!r.dblClickEnabled||!r.pointerEventFilterFunc(o))||(r.over(),r.enabled=!1)};this.ad(e.clickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"click")})),this.ad(e.dblclickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"dblclick")}))}this.ad(e.pointerMoveEvent.don(s=>{if(!s.pointerEvent)return;const o=new gj(this,s.pointerEvent,i=>{if(!i||i[2]<-1e5){r.position=void 0;return}const a=[...i];e.editingHeightOffset&&(a[2]+=e.editingHeightOffset),r.position=a,this._doings.splice(0,this._doings.indexOf(o)+1).forEach(h=>h.destroy())});this._doings.push(o)}))}get czmViewer(){return this._czmViewer}get placeEditing(){return this._placeEditing}}class gj extends E.Destroyable{constructor(n,e,r){super(),this._owner=n;const{czmViewer:s}=this._owner,o=pw(s,e,this._owner.placeEditing.virtualHeight),[i]=E.getEventFromPromise(o);this.dispose(i.disposableOn(r))}}class $n extends En{constructor(){super()}}N($n,"defaults",{...En.defaults,position:[116.39,39.9,0]}),(t=>{t.createDefaultProps=()=>({...En.createDefaultProps(),position:E.reactArrayWithUndefined(void 0)})})($n||($n={})),E.extendClassProps($n.prototype,$n.createDefaultProps);function L0(t,n){const e=new lt(t);return e.hasArrow=!0,e.arcType="RHUMB",e.width=10,e.color=n,e}const fr=class fr extends E.Destroyable{constructor(n){if(super(),!n.viewer)return;const e=this.disposeVar(L0(n,fr.defaults.xAxisColor)),r=this.disposeVar(L0(n,fr.defaults.yAxisColor)),s=this.disposeVar(L0(n,fr.defaults.zAxisColor));{const o=()=>{e.show=this.xAxisShow&&this.show,r.show=this.yAxisShow&&this.show,s.show=this.zAxisShow&&this.show};o();const i=this.ad(E.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged,this.zAxisShowChanged));this.dispose(i.disposableOn(o))}{const o=()=>{const{position:a=fr.defaults.position,heading:l=fr.defaults.heading}=this,[h,f,u]=a,{dimensions:A=fr.defaults.dimensions}=this;s.positions=[a,[h,f,u+A[2]]];const v=Q.geoRhumbDestination(a,A[0],90+l);v&&(e.positions=[a,v]);const g=Q.geoRhumbDestination(a,A[1],0+l);g&&(r.positions=[a,g])};o();const i=this.disposeVar(E.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(i.disposableOn(o))}{const o=()=>{e.color=this.xAxisColor??fr.defaults.xAxisColor,r.color=this.yAxisColor??fr.defaults.yAxisColor,s.color=this.zAxisColor??fr.defaults.zAxisColor};o();const i=this.disposeVar(E.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged,this.zAxisColorChanged));this.dispose(i.disposableOn(o))}}};N(fr,"defaults",{position:[116.39,39.9,0],heading:0,dimensions:[1e3,1e3,1e3],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1],zAxisColor:[0,0,1,1]});let Do=fr;(t=>{t.createDefaultProps=()=>({show:!0,position:E.reactArrayWithUndefined(void 0),heading:0,dimensions:E.reactArray([1e3,1e3,1e3]),xAxisColor:E.reactArray([1,0,0,1]),yAxisColor:E.reactArray([0,1,0,1]),zAxisColor:E.reactArray([0,0,1,1]),xAxisShow:!0,yAxisShow:!0,zAxisShow:!0})})(Do||(Do={})),E.extendClassProps(Do.prototype,Do.createDefaultProps);const No=class No extends $n{constructor(e){super();N(this,"_opInfo",{step:this.ad(E.react(!1)),moved:this.ad(E.react(!1)),constraintMode:this.ad(E.react("none")),originPosition:this.disposeVar(E.reactArray($n.defaults.position)),originHeading:this.disposeVar(E.react(0)),originDimensions:this.disposeVar(E.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(E.reactArray([0,0,0])),movingPosition:this.disposeVar(E.reactArray([0,0,0])),targetPosition:this.disposeVar(E.reactArray([0,0,0])),targetHeading:this.disposeVar(E.react(0))});N(this,"_createCoordinates",e=>{const r=this.ad(new Do(e));this.dispose(this._opInfo.step.changed.disposableOn(()=>{A2(r,this._opInfo.constraintMode.value,this._opInfo.step.value)}));{const s=()=>{const i=[...this.position??No.defaults.position];e.editingHeightOffset&&(i[2]-=e.editingHeightOffset),r.position=i};s(),this.dispose(this.positionChanged.disposableOn(s))}{const s=()=>{r.heading=this.heading??0};s(),this.dispose(this.headingChanged.disposableOn(s))}{const s=()=>{r.dimensions=this._opInfo.originDimensions.value};s(),this.dispose(this._opInfo.originDimensions.changed.disposableOn(s))}return r});N(this,"_createOriginCoordinates",e=>{const r=this.ad(new Do(e));r.xAxisColor=[1,0,0,.5],r.yAxisColor=[0,1,0,.5],r.zAxisColor=[0,0,1,.5];const{originPosition:s,originHeading:o,originDimensions:i}=this._opInfo;{const a=()=>{r.position=s.value};a(),this.dispose(s.changed.disposableOn(a))}{const a=()=>{r.heading=o.value??0};a(),this.dispose(o.changed.disposableOn(a))}{const a=()=>{r.dimensions=i.value};a(),this.dispose(i.changed.disposableOn(a))}return r});N(this,"_createGrid",e=>{const r=this.ad(new gr(e));{const s=()=>{const i=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,l=this._opInfo.originDimensions.value[0],h=[];for(let f=-4;f<5;++f){const u=Q.geoRhumbDestination(i,l*.2*f,a+90);if(u){const A=Q.geoRhumbDestination(u,l,a+180),v=Q.geoRhumbDestination(u,l,a);A&&v&&h.push([A,u,v])}}for(let f=-4;f<5;++f){const u=Q.geoRhumbDestination(i,l*.2*f,a);if(u){const A=Q.geoRhumbDestination(u,l,a-90),v=Q.geoRhumbDestination(u,l,a+90);A&&v&&h.push([A,u,v])}}r.positions=h};s();const o=this.disposeVar(E.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return r});N(this,"_createHelpLine",e=>{const r=this.ad(new lt(e));r.hasDash=!0,r.arcType="RHUMB",r.color=[1,1,0,.99];{const s=()=>{r.positions=[this._opInfo.originPosition.value,this._opInfo.targetPosition.value]},o=this.ad(E.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return r});N(this,"_createCircle",e=>{const r=this.ad(new gr(e));r.arcType="RHUMB",r.width=2,r.hasDash=!0;const s=this.disposeVar(E.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originDimensions.changed)),o=()=>{const i=this._opInfo.originPosition.value,a=this._opInfo.originDimensions.value[0],l=[],h=32;for(let f=0;f<=h;++f){const u=Q.geoRhumbDestination(i,a,f*360/h);u&&l.push(u)}r.positions=[l]};return o(),this.dispose(s.disposableOn(o)),r});N(this,"_pickingXYProcessing",e=>this.ad(new E.Processing((r,s,o)=>{const i=[0,0,0],a=new F.Cartographic;return e.pointerMoveEvent.don(l=>{if(!l.pointerEvent||!e.viewer)return;const h=pr(E.getDomEventCurrentTargetPos(l.pointerEvent));if(!ja(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Qa(a,i),this._opInfo.constraintMode.value==="x"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,i,i):this._opInfo.constraintMode.value==="y"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value,i,i):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=i;const f=[0,0,0];Q.geoRhumbDestination(i,o,s,f),this._opInfo.targetPosition.value=f})})));N(this,"_pickingZProcessing",e=>this.ad(new E.Processing(()=>{const r=new F.Cartesian3,s=[0,0,0];return e.pointerMoveEvent.don(o=>{if(!o.pointerEvent||!e.viewer)return;const i=pr(E.getDomEventCurrentTargetPos(o.pointerEvent));if(!Hh(e.viewer.scene,Tt(this._opInfo.originPosition.value),i,r))return;const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(He(r,s)){this._opInfo.movingPosition.value=s;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],s[2]+a]}})})));N(this,"_pickingZAxisProcessing",e=>this.ad(new E.Processing(()=>{const r=[0,0,0],s=new F.Cartographic;return e.pointerMoveEvent.don(o=>{if(!o.pointerEvent||!e.viewer)return;const i=pr(E.getDomEventCurrentTargetPos(o.pointerEvent));if(!ja(e.viewer.scene,i,this._opInfo.originPosition.value[2],s))return;Qa(s,r);const a=Q.geoRhumbHeading(this._opInfo.originPosition.value,this._opInfo.draggingStartPosition.value),h=Q.geoRhumbHeading(this._opInfo.originPosition.value,r)-a;let f=this._opInfo.originHeading.value+h;f=F.Math.toDegrees(F.Math.negativePiToPi(F.Math.toRadians(f))),this._opInfo.movingPosition.value=r,this.heading=this._opInfo.targetHeading.value=f})})));if(!e.viewer)return;const r=this.ad(E.reactArray([1,1,1]));this.ad(e.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new zp(e,this.positionReact,r,this.axisPixelSize));{this.ad(this._opInfo.targetPosition.changed.don(o=>{if(this._opInfo.moved){const i=[...o];e.editingHeightOffset&&(i[2]+=e.editingHeightOffset),this.position=i}})),this.ad(this._opInfo.targetHeading.changed.don(o=>this._opInfo.moved&&(this.heading=o)));const s=()=>{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((o,i)=>o===this._opInfo.targetPosition.value[i])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._createCoordinates(e),o=this._createOriginCoordinates(e),i=this._createGrid(e),a=this._createHelpLine(e),l=this._createCircle(e);{const g=()=>{l.show=i.show=this.enabled&&this.showCircle,a.show=this.enabled&&this.showCircle&&this._opInfo.moved.value,s.show=this.enabled&&this.showCoordinates,o.show=this.enabled&&this.showCoordinates&&this._opInfo.moved.value};g();const m=this.ad(E.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(m.don(g))}{const g=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow,s.zAxisShow=o.zAxisShow=this.zAxisShow};g();const m=this.ad(E.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged,this.zAxisShowChanged));this.ad(m.don(g))}{const g=()=>{i.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],l.color=this._opInfo.constraintMode.value==="zAxis"?[1,1,0,.99]:[1,1,0,.5],A2(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};g(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(g))}const h=this._pickingXYProcessing(e),f=this._pickingZProcessing(e),u=this._pickingZAxisProcessing(e),A=this.ad(E.createProcessingFromAsyncFunc(async g=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",g.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await E.step(g,async m=>{const p=()=>{const b=[...this.position??No.defaults.position];e.editingHeightOffset&&(b[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=b},d=()=>this._opInfo.targetHeading.value=this._opInfo.originHeading.value=this.heading,c=()=>this._opInfo.originDimensions.value=r.value;m.disposer.dispose((p(),this.positionChanged.don(p))),m.disposer.dispose((d(),this.headingChanged.don(d))),m.disposer.dispose((c(),r.changed.don(c)));const y={constraintMode:"none",startDragPos:[0,0,0]},w=b=>{const _={position:s.position??No.defaults.position,heading:s.heading??No.defaults.heading,dimensions:s.dimensions??No.defaults.dimensions};e.viewer&&Pp(b,e.viewer.scene,_,this.axisSnapPixelSize,y,{x:this.disableX,y:this.disableY,z:this.disableZ,xy:this.disableXY,zAxis:this.disableZAxis}),this._opInfo.constraintMode.value=y.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=y.startDragPos};m.disposer.dispose(e.pointerMoveEvent.don(b=>{b.pointerEvent&&w(b.pointerEvent)})),await E.step(m,b=>new Promise((_,x)=>{b.disposer.dispose(x),b.disposer.dispose(e.pointerDownEvent.don(C=>{C.pointerEvent&&w(C.pointerEvent),C.pointerEvent&&C.pointerEvent.button===0&&y.constraintMode!=="none"&&_()}))}))}),this._opInfo.step.value=!1,await E.step(g,async m=>{if(e.incrementDisabledInputStack(),m.disposer.dispose(()=>{e.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const p=Q.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),d=Q.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);h.restart(void 0,p,d),m.disposer.dispose(()=>h.cancel())}else this._opInfo.constraintMode.value==="z"?(f.restart(),m.disposer.dispose(()=>f.cancel())):this._opInfo.constraintMode.value==="zAxis"?(u.restart(),m.disposer.dispose(()=>u.cancel())):console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await E.step(m,p=>new Promise((d,c)=>{p.disposer.dispose(c),p.disposer.dispose(e.pointerUpEvent.don(()=>{d()})),p.disposer.dispose(e.pointerOutEvent.don(()=>d()))}))});while(!0)})),v=()=>{this.enabled?A.restart():A.isRunning&&A.cancel()};v(),this.ad(this.enabledChanged.don(v))}}};N(No,"defaults",{...$n.defaults,heading:0,dimensions:[1e3,1e3,1e3],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1],zAxisColor:[0,0,1,1]});let Ii=No;(t=>{t.createDefaultProps=()=>({...$n.createDefaultProps(),heading:0,axisPixelSize:100,axisSnapPixelSize:5,showCoordinates:!0,showCircle:!0,disableX:!1,disableY:!1,disableZ:!1,disableXY:!1,disableZAxis:!1,xAxisShow:!0,yAxisShow:!0,zAxisShow:!0})})(Ii||(Ii={})),E.extendClassProps(Ii.prototype,Ii.createDefaultProps);function A2(t,n,e){t.xAxisColor=[1,0,0,.99],t.yAxisColor=[0,1,0,.99],t.zAxisColor=[0,0,1,.99],n==="x"?t.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:n==="y"?t.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:n==="z"?t.zAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:n==="xy"&&(t.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99],t.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99])}class z0 extends E.HasOwner{constructor(e){super(e);N(this,"_valid",!1);N(this,"_normal",new F.Cartesian3(0,0,0));N(this,"_origin",new F.Cartesian3(0,0,0))}get viewer(){return this.owner.czmViewer.viewer}get scene(){return this.viewer.scene}get sceneObject(){return this.owner}get valid(){return this._valid}get normal(){return this._normal}get origin(){return this._valid&&this._origin}pick(e){if(!this.normal||!this.owner.cartesian)return;const r=this.owner.cartesian,s=pr(e);return Aw(this.scene,r,this.normal,s)}}class vj extends z0{constructor(n){super(n);{const e=()=>{const s=At({position:this.sceneObject.position,rotation:this.sceneObject.rotation});this._valid=!!s,s&&(this._origin.x=s[4],this._origin.y=s[5],this._origin.z=s[6],this._normal.x=s[8],this._normal.y=s[9],this._normal.z=s[10])};e();const r=this.ad(E.createNextAnimateFrameEvent(this.sceneObject.positionChanged,this.sceneObject.rotationChanged));this.ad(r.don(e))}}}class wj extends z0{constructor(n){super(n);const e=()=>{const r=At({rotation:[this.sceneObject.selfRotation[0],0,0]});if(!r)throw new Error("PitchPlane: rm is undefined");const s=At({position:this.sceneObject.position,rotation:this.sceneObject.rotation,localModelMatrix:F.Matrix4.toArray(r)});if(this._valid=!!s,!!s){{const o=this._normal;o.x=-s[0],o.y=-s[1],o.z=-s[2]}{const o=this._origin;o.x=s[4],o.y=s[5],o.z=s[6]}}};e(),this.dispose(this.sceneObject.positionChanged.disposableOn(e)),this.dispose(this.sceneObject.rotationChanged.disposableOn(e)),this.dispose(this.sceneObject.selfRotationChanged.disposableOn(e))}}class bj extends z0{constructor(n){super(n);const e=()=>{const r=At({rotation:[this.sceneObject.selfRotation[0],this.sceneObject.selfRotation[1],0]});if(!r)throw new Error("PitchPlane: rm is undefined");const s=At({position:this.sceneObject.position,rotation:this.sceneObject.rotation,localModelMatrix:F.Matrix4.toArray(r)});if(this._valid=!!s,!!s){{const o=this._normal;o.x=-s[4],o.y=-s[5],o.z=-s[6]}{const o=this._origin;o.x=s[8],o.y=s[9],o.z=s[10]}}};e(),this.dispose(this.sceneObject.positionChanged.disposableOn(e)),this.dispose(this.sceneObject.rotationChanged.disposableOn(e)),this.dispose(this.sceneObject.selfRotationChanged.disposableOn(e))}}class ll extends E.Destroyable{constructor(e){super();N(this,"_czmTexture");N(this,"_customPrimitiveForCircle");N(this,"_circleCanvas");N(this,"_debugAxis");e.viewer&&(this._czmTexture=this.disposeVar(new wt(e)),this._czmTexture.uri="",this._createCircleCanvas(e),this._createCustomPrimitiveForCircle(e),this._createDebugAxis(e))}get czmTexture(){return this._czmTexture}get customPrimitiveForCircle(){return this._customPrimitiveForCircle}get circleCanvas(){return this._circleCanvas}get debugAxis(){return this._debugAxis}_createCircleCanvas(e){let r=this.disposeVar(E.react(!1));const s=document.createElement("canvas");s.width=s.height=256,this._circleCanvas=s.getContext("2d");{const i=()=>{const l={rotation:this.circleRotation*Math.PI/180,startRotation:this.circleStartRotation*Math.PI/180,endRotation:this.circleEndRotation*Math.PI/180},h=this._circleCanvas,f=this.color,u=`rgba(${f[0]*255|0}, ${f[1]*255|0}, ${f[2]*255|0}, ${f[3]})`;h.clearRect(0,0,256,256),h.lineWidth=6,h.beginPath(),h.arc(128,128,64,0,Math.PI*2,!1),h.strokeStyle=`rgba(0,0,0,${f[3]})`,h.stroke(),h.lineWidth=4,h.beginPath(),h.arc(128,128,64,0,Math.PI*2,!1),h.strokeStyle=u,h.stroke();{h.lineWidth=1,h.beginPath();let g=F.Math.zeroToTwoPi(l.startRotation),m=F.Math.zeroToTwoPi(l.endRotation);m<g&&(m+=F.Math.TWO_PI),(g!==m||g!==0)&&(h.moveTo(128,128),h.arc(128,128,64,g,m,m-g>Math.PI),h.lineTo(128,128),h.strokeStyle="rgba(255, 255, 0, 1.0)",h.stroke())}let A=F.Math.negativePiToPi(l.rotation);h.lineWidth=3,h.beginPath(),h.moveTo(128,128),h.arc(128,128,64,0,A,F.Math.negativePiToPi(A-0)<0),h.lineTo(128,128),h.fillStyle=`rgba(${f[0]*255|0}, ${f[1]*255|0}, ${f[2]*255|0}, 0.5)`,h.fill();{h.save(),h.font="16px console",h.textBaseline="middle";const p=`${(F.Math.negativePiToPi(A-0)*180/Math.PI*10|0)/10}°`;var v=h.measureText(p).width;h.translate(128,128),h.rotate(Math.PI*.5),A=F.Math.negativePiToPi(A-0)+0,h.rotate((A+0)*.5),h.scale(r.value?-1:1,1),h.translate(-128,-128),h.fillStyle="white",h.fillText(p,128-v*.5,54),h.lineWidth=1,h.restore()}this.czmTexture&&this.czmTexture.copyFromCanvas(s)};i();const a=this.ad(E.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged,r.changed));this.ad(a.don(i)),this.czmTexture&&this.ad(this.czmTexture.readyEvent.don(i))}{const o=()=>{const a=At({rotation:this.selfRotation});if(!a)return;const l=At({position:this.position,rotation:this.rotation,localModelMatrix:F.Matrix4.toArray(a)});if(!l)return;const{viewer:h}=e;if(!h)return;const f=F.Cartesian3.dot(h.scene.camera.directionWC,new F.Cartesian3(l[8],l[9],l[10]));r.value=f>0};o();const i=this.ad(E.createNextAnimateFrameEvent(e.cameraChanged,this.positionChanged,this.rotationChanged,this.selfRotationChanged));this.ad(i.don(o))}}_createCustomPrimitiveForCircle(e){this._customPrimitiveForCircle=this.disposeVar(_j(e)),this.dispose(E.track([this._customPrimitiveForCircle,"show"],[this,"show"])),this.dispose(E.track([this._customPrimitiveForCircle,"position"],[this,"position"])),this.dispose(E.track([this._customPrimitiveForCircle,"rotation"],[this,"rotation"])),this.dispose(E.track([this._customPrimitiveForCircle,"pixelSize"],[this,"pixelSize"]));{const r=()=>{const s=At({rotation:this.selfRotation});this._customPrimitiveForCircle&&(this._customPrimitiveForCircle.localModelMatrix=s&&F.Matrix4.toArray(s)||void 0)};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{this.customPrimitiveForCircle&&this.czmTexture&&(this.customPrimitiveForCircle.uniformMap={u_image:{type:"texture",id:this.czmTexture.id},u_color:this.color})};r(),this.dispose(this.colorChanged.disposableOn(r))}}_createDebugAxis(e){this._debugAxis=this.ad(xj(e)),this.dispose(E.track([this._debugAxis,"pixelSize"],[this,"pixelSize"])),this.dispose(E.track([this._debugAxis,"position"],[this,"position"])),this.dispose(E.track([this._debugAxis,"rotation"],[this,"rotation"])),this.dispose(E.track([this._debugAxis,"show"],[this,"debug"]));{const r=()=>{const s=At({rotation:this.selfRotation});this._debugAxis&&(this._debugAxis.localModelMatrix=s&&F.Matrix4.toArray(s)||void 0)};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{this._debugAxis&&(this._debugAxis.uniformMap={u_color:this.color})};r(),this.dispose(this.colorChanged.disposableOn(r))}}}N(ll,"defaults",{position:[116.39,39.9,100]}),(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:E.reactArrayWithUndefined(void 0),rotation:E.reactArray([0,0,0]),selfRotation:E.reactArray([0,0,0]),pixelSize:300,color:E.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(ll||(ll={})),E.extendClassProps(ll.prototype,ll.createDefaultProps);function _j(t){return Gp({type:"CzmCustomPrimitive",allowPicking:!0,positionEditing:!1,pixelSize:100,boundingVolume:{type:"LocalAxisedBoundingBox",data:{min:[0,-1,0],max:[1,0,0]}},renderState:{depthTest:{enabled:!1},cull:{enabled:!1,face:1029},depthMask:!1,blending:{enabled:!0,equationRgb:32774,equationAlpha:32774,functionSourceRgb:770,functionSourceAlpha:1,functionDestinationRgb:771,functionDestinationAlpha:771}},localPosition:[-.5,-.5,0],localRotation:[-90,0,0]},mt,t)}function xj(t){return Gp({type:"CzmCustomPrimitive",allowPicking:!0,positionEditing:!1,position:[114.86128105686282,40.86825802653499,0],primitiveType:"LINES",vertexShaderSource:`in vec3 position;
|
|
4886
|
+
`,this._customPrimitive.uniformMap={u_color:[1,1,0,1]},this.dispose(E.track([this._customPrimitive,"show"],[this,"show"])),this.dispose(E.track([this._geoPolyline,"show"],[this,"show"])),this.dispose(E.bind([this._geoPolyline,"positions"],[this,"positions"])),this.dispose(E.bind([this._geoPolyline,"width"],[this,"outlineWidth"])),this.dispose(E.bind([this._geoPolyline,"color"],[this,"outlineColor"]));{const o=()=>{let i="暂无分析结果";this.totalArea&&(i=`表面积: ${(this.totalArea??0).toFixed(2)}平方米`),this._geoDivPoi&&(this._geoDivPoi.innerHTML=$o(i,24))};o(),this.dispose(this.totalAreaChanged.don(o)),this.dispose(E.track([this._geoDivPoi,"show"],[this,"show"])),this.dispose(this.positionsChanged.don(()=>{this._geoDivPoi&&(this.positions&&this.positions.length>=3?this._geoDivPoi.position=xS(this.positions):this._geoDivPoi.position=void 0)}))}{const o=()=>{if((!this.positions||this.positions.length<3)&&this.customPrimitive){this.totalArea=0,this.customPrimitive.position=void 0,this.customPrimitive.attributes=void 0,this.customPrimitive.indexTypedArray=void 0,this.customPrimitive.show=!1;return}const i=this.interpolationDistance??Ra.defaults.interpolationDistance,a=this.interpolation??Ra.defaults.interpolation,l=this.offsetHeight??Ra.defaults.offsetHeight,h=this.drillDepth??Ra.defaults.drillDepth,f=[];if(this.positions)for(let M=0;M<this.positions.length;++M){const D=F.Cartesian3.fromDegrees(this.positions[M][0],this.positions[M][1],this.positions[M][2]);f.push(D)}var u=rj(f);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z)){console.warn("法向量计算错误!");return}var A=ij(f),v=F.Cartesian3.normalize(A,new F.Cartesian3),g=F.Cartesian3.dot(v,u);g<0&&(u=f2(u),f.reverse());let m=F.Transforms.eastNorthUpToFixedFrame(A),p=F.Matrix4.inverseTransformation(m,new F.Matrix4);if(Math.abs(g)<.999){const M=oj(u,v);var d=f2(A),c=F.Matrix4.fromTranslation(d,new F.Matrix4);p=F.Matrix4.multiply(M,c,c),m=F.Matrix4.inverse(p,new F.Matrix4)}var y=sl(f,p),w=[],b=[],_=[];if(a&&i>0){var x=aj(y),C=sj(y),T=hj(C,x,i);const M=S0(T,m,p,u,s.scene,l,h);var I=fj(y,i);const D=S0(I,m,p,u,s.scene,l,h);_.push(...M.world_cartesian),w.push(...M.local),b.push(...M.world),_.push(...D.world_cartesian),w.push(...D.local),b.push(...D.world),y.forEach(R=>{var U=S0([R],m,p,u,s.scene,l,h);if(U.local.length>0)w.push(...U.local),b.push(...U.world),_.push(...U.world_cartesian);else{w.push(R);var L=sl([R],m);for(let V=0;V<L.length;++V){_.push(L[V]);var z=F.Cartographic.fromCartesian(L[V]);b.push([z.longitude,z.latitude,z.height+l])}}})}else{w=y,_=sl(y,m);for(let M=0;M<_.length;++M){var P=F.Cartographic.fromCartesian(_[M]);b.push([P.longitude,P.latitude,P.height+l])}}var k=lj(w);const S=uj(_,k);this.totalArea=S;const B=[];w.forEach(M=>{const D=[M.x,M.y,M.z];D&&B.push(...D)});const O={position:{typedArray:new Float32Array(B),componentsPerAttribute:3}};if(this.customPrimitive){this.customPrimitive.modelMatrix=F.Matrix4.toArray(m),this.customPrimitive.attributes=O;const M=nj([...k]);this.customPrimitive.indexTypedArray=new Uint32Array(M),this.customPrimitive.show=!0}};this.dispose(this.startEvent.don(o))}}get pickedEvent(){return this._pickedEvent}get startEvent(){return this._startEvent}start(){this._startEvent.emit()}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get geoPolyline(){return this._geoPolyline}get customPrimitive(){return this._customPrimitive}get geoDivPoi(){return this._geoDivPoi}};N(Ra,"defaults",{positions:[],totalArea:0,interpolation:!0,interpolationDistance:.5,offsetHeight:0,drillDepth:3,outlineWidth:2,outlineColor:[1,1,1,1]});let Ba=Ra;(t=>{t.createDefaultProps=()=>({positions:E.reactArrayWithUndefined(void 0),show:void 0,totalArea:void 0,interpolationDistance:void 0,interpolation:void 0,offsetHeight:void 0,drillDepth:void 0,outlineWidth:void 0,outlineColor:E.reactArray([1,1,1,1])})})(Ba||(Ba={})),E.extendClassProps(Ba.prototype,Ba.createDefaultProps);function nj(t){t.length%3!==0&&console.warn("当前传入的索引不是3的倍数,可能不是三角片的索引!");const n=t.length/3|0,e=new Array(n*6);for(let r=0;r<n;++r)e[r*6+0]=t[r*3+0],e[r*6+1]=t[r*3+1],e[r*6+2]=t[r*3+2],e[r*6+3]=t[r*3+1],e[r*6+4]=t[r*3+2],e[r*6+5]=t[r*3+0];return e}function rj(t){var n=new F.Cartesian3(0,0,0),e=new F.Cartesian3(0,0,0),r=new F.Cartesian3(0,0,0),s=new F.Cartesian3(0,0,0);t[0].equals(t[t.length-1])&&t.pop();var o=t.length;for(let h=0;h<o;++h){var i=t[h],a;h==0?a=t[t.length-1]:a=t[h-1];var l;h==t.length-1?l=t[0]:l=t[h+1],n=F.Cartesian3.subtract(i,a,n),e=F.Cartesian3.subtract(i,l,e),r=F.Cartesian3.cross(n,e,r),r=F.Cartesian3.normalize(r,r),s=F.Cartesian3.add(s,r,s)}return r.x=s.x/o,r.y=s.y/o,r.z=s.z/o,r}function ij(t){var n=new F.Cartesian3(0,0,0),e=t.length;for(let s=0;s<e;++s){var r=t[s];n=F.Cartesian3.add(n,r,n)}return n.x=n.x/e,n.y=n.y/e,n.z=n.z/e,n}function f2(t){return new F.Cartesian3(-1*t.x,-1*t.y,-1*t.z)}function oj(t,n){var e=F.Cartesian3.cross(t,n,new F.Cartesian3);e=F.Cartesian3.normalize(e,e);var r=F.Cartesian3.cross(t,e,new F.Cartesian3);r=F.Cartesian3.normalize(r,r);var s=t,o=new F.Matrix4(e.x,e.y,e.z,0,r.x,r.y,r.z,0,s.x,s.y,s.z,0,0,0,0,1);return o}function sl(t,n){var e=[];for(let o=0;o<t.length;++o){var r=t[o],s=F.Matrix4.multiplyByPoint(n,r,new F.Cartesian3);e.push(s)}return e}function aj(t){var n=t[0].x,e=t[0].y,r=t[0].x,s=t[0].y;return t.forEach(o=>{n=Math.min(n,o.x),e=Math.min(e,o.y),r=Math.max(r,o.x),s=Math.max(s,o.y)}),{minx:n,miny:e,maxx:r,maxy:s}}function sj(t){var n=[];return t.forEach(e=>{n.push([e.x,e.y])}),n.push(n[0]),n}function lj(t){var n=[];t.forEach(r=>{const s=[r.x,r.y];n.push(s)});var e=x0.from(n).triangles;return e.reverse()}function uj(t,n){for(var e=0,r=0;r<n.length;r+=3){const s=[t[n[r]],t[n[r+1]],t[n[r+2]]];e+=cj(s)}return e}function cj(t){var n=F.Cartesian3.distance(t[0],t[1]),e=F.Cartesian3.distance(t[1],t[2]),r=F.Cartesian3.distance(t[2],t[0]),s=(n+e+r)/2,o=Math.sqrt(s*(s-n)*(s-e)*(s-r));return o}function hj(t,n,e){for(var r=[],s=n.minx;s<n.maxx;s+=e)for(var o=n.miny;o<n.maxy;o+=e)pj([s,o],t)&&r.push(new F.Cartesian3(s,o,0));return r}function fj(t,n){var e=[];for(let i=0;i<t.length;++i){var r=t[i],s;i==t.length-1?s=t[0]:s=t[i+1];var o=dj(r,s,n);e.push(...o)}return e}function dj(t,n,e){var r=[],s=F.Cartesian3.distance(t,n),o=F.Cartesian3.subtract(n,t,new F.Cartesian3);o=F.Cartesian3.normalize(o,o);for(var i=e;i<s;){var a=new F.Cartesian3(o.x*i,o.y*i,o.z*i),l=F.Cartesian3.add(t,a,new F.Cartesian3);r.push(l),i+=e}return r}function pj(t,n){var e=Io(t);if(!d9(Io(n[0]),Io(n[n.length-1])))return!1;var r=[];r.push(n);var s=Un(r);return zn(e,s)}function S0(t,n,e,r,s,o,i){var a=[];t.forEach(w=>{var b=w.clone();b.z=1e5,a.push(b)});var l=sl(a,n),h=new F.Cartesian3(-1*r.x,-1*r.y,-1*r.z),f=[],u=[],A=[];for(let w=0;w<l.length;++w){var v=l[w],g=new F.Ray(v,h),m=[];try{m=s.drillPickFromRay(g,i)}catch{}if(m.length===0){g=new F.Ray(v,r);try{m=s.drillPickFromRay(g,i)}catch{}}if(m.length!==0){for(var p,d=0;d<m.length;d++){var c=m[d];if((!c.object||c.object.content)&&c.position){p=c.position;break}}if(!(!p||!p.x||isNaN(p.x))){var y=sl([p],e);y.forEach(b=>{b.z+=o}),p=sl(y,n)[0],A.push(p),p=F.Cartographic.fromCartesian(p),f.push([p.longitude,p.latitude,p.height]),u.push(t[w])}}}return{local:u,world:f,world_cartesian:A}}const fh=class fh extends Kn{constructor(e,r){super(e,r);N(this,"_czmAreaMeasurement");if(this._czmAreaMeasurement=this.disposeVar(new Ba(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmAreaMeasurement;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.bind([o,"positions"],[e,"points"])),this.dispose(E.track([o,"interpolationDistance"],[e,"interpolation"])),this.dispose(E.track([o,"offsetHeight"],[e,"offsetHeight"]));{const i=()=>{if(this.geoPolygon&&(this.geoPolygon.outline=!1),e.stroked)o.outlineWidth=e.strokeWidth;else{o.outlineWidth=0;return}o.outlineWidth=e.strokeWidth,o.outlineColor=e.strokeColor};i();const a=this.disposeVar(E.createNextAnimateFrameEvent(e.strokeStyleChanged,e.strokedChanged));this.dispose(a.disposableOn(i))}this.dispose(e.startEvent.don(()=>{this._czmAreaMeasurement.start()}))}get czmAreaMeasurement(){return this._czmAreaMeasurement}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmAreaMeasurement:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.positions&&Ne(o,s,r,i.positions,e),!0):!1}flyIn(e,r){const{sceneObject:s,czmViewer:o,czmAreaMeasurement:i}=this;return o.actived?s.flyInParam?super.flyIn(e,r):(i.positions&&Ne(o,s,r,i.positions,e),!0):!1}};N(fh,"type",fh.register("ESCesiumViewer",Q.ESSurfaceAreaMeasurement.type,fh));let E0=fh;async function Aj(t){navigator.clipboard.writeText(t).then(function(){console.log("复制成功")},function(n){console.log("复制失败")})}const dh=class dh extends Q.EngineObject{constructor(e,r){super(e,r);N(this,"_customDiv");if(this._customDiv=this.disposeVar(new Q.ESCustomDiv(e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._customDiv;r.add(o),this.dispose(()=>r.delete(o)),o.instanceClass=class extends E.Destroyable{constructor(a,l,h){if(super(),this._subContainer=a,!h||!(h instanceof st))return;h.extensions.cursorPositionInfo.enabled=!0;const f=document.createElement("div");this._subContainer.appendChild(f),this.dispose(()=>this._subContainer.removeChild(f)),f.style.width="100%",f.style.position="absolute",f.style.height=`${Q.ESViewerStatusBar.defaults.height}px`,f.style.left="0",f.style.bottom="0",f.style.color="#fff",f.style.padding="0 20px 0 0",f.style.boxSizing="border-box",f.style.lineHeight=`${Q.ESViewerStatusBar.defaults.height}px`,f.style.zIndex="100",f.style.alignContent="center",f.style.justifyContent="space-between";const u=document.createElement("span");f.appendChild(u),this.dispose(()=>f.removeChild(u));const A=document.createElement("span");u.appendChild(A),this.dispose(()=>u.removeChild(A));const v=document.createElement("span");u.appendChild(v),v.addEventListener("dblclick",function(){let m=v.innerHTML;m.startsWith("鼠标位置")&&(m=m.slice(5)),Aj(m)}),v.style.cursor="pointer",this.dispose(()=>u.removeChild(v));const g=document.createElement("span");f.appendChild(g),this.dispose(()=>f.removeChild(g));{const m=()=>{f.style.height=(e.height??Q.ESViewerStatusBar.defaults.height)+"px",f.style.lineHeight=(e.height??Q.ESViewerStatusBar.defaults.height)+"px"};this.dispose(e.heightChanged.disposableOn(m)),m()}{const m=()=>{f.style.fontSize=(e.fontSize??Q.ESViewerStatusBar.defaults.fontSize)+"px"};this.dispose(e.fontSizeChanged.disposableOn(m)),m()}{const m=()=>{e.bgColor?f.style.background=`rgba(${e.bgColor[0]*255},${e.bgColor[1]*255},${e.bgColor[2]*255},${e.bgColor[3]})`:f.style.background=`rgba(${Q.ESViewerStatusBar.defaults.bgColor[0]},${Q.ESViewerStatusBar.defaults.bgColor[1]},${Q.ESViewerStatusBar.defaults.bgColor[2]},${Q.ESViewerStatusBar.defaults.bgColor[3]})`};this.dispose(e.bgColorChanged.disposableOn(m)),m()}{g.innerText=`Cesium 版本 : ${F.VERSION} `;let m;const p=()=>{e.show?(f.style.display="flex",m=this.disposeVar(E.createAnimateFrameWithStartValues(()=>{var b;let d="",c="";const y=h.getCameraInfo();if(y){const _=(C,T)=>y.position[C].toFixed(T),x=(C,T)=>y.rotation[C].toFixed(T);d=`帧率:${h.getFPS()}FPS 经度: ${_(0,5)}° 纬度: ${_(1,5)}° 高度: ${_(2,2)}米 偏航角: ${x(0,2)}° 俯仰角: ${x(1,2)}° 翻滚角:${x(2,2)}° `}A.innerText=d;const w=(b=h.extensions)==null?void 0:b.cursorPositionInfo.cursorPosition;if(w){const _=(x,C)=>w[x].toFixed(C);c=`鼠标位置:${_(0,5)}° ${_(1,5)}° ${_(2,2)}m`}else c="暂时无法获取鼠标位置...";v.innerText=c})),m.start()):(f.style.display="none",m.destroy())};this.dispose(e.showChanged.disposableOn(p)),p()}}}}get customDiv(){return this._customDiv}};N(dh,"type",dh.register("ESCesiumViewer",Q.ESViewerStatusBar.type,dh));let P0=dh;const ph=class ph extends Q.EngineObject{constructor(e,r){super(e,r);N(this,"_customDiv");if(this._customDiv=this.disposeVar(new Q.ESCustomDiv(e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._customDiv;r.add(o),this.dispose(()=>r.delete(o)),this.dispose(E.track([o,"show"],[e,"show"])),o.instanceClass=class extends E.Destroyable{constructor(a,l,h){if(super(),this._subContainer=a,!h||!(h instanceof st))return;h.extensions.cursorPositionInfo.enabled=!0;const f=document.createElement("div");this._subContainer.appendChild(f),this.dispose(()=>this._subContainer.removeChild(f));const u=document.createElement("div");f.appendChild(u),u.style.width="100%",u.className="ESViewerStatusBarScale",u.style.position="absolute",u.style.display="flex",u.style.height=`${Q.ESViewerStatusBarScale.defaults.height}px`,u.style.left="0",u.style.bottom="0",u.style.color="#fff",u.style.padding="0 20px 0 0",u.style.boxSizing="border-box",u.style.lineHeight=`${Q.ESViewerStatusBarScale.defaults.height}px`,u.style.zIndex="100",u.style.alignContent="center",u.style.justifyContent="space-between";const A=document.createElement("div");u.appendChild(A);const v=document.createElement("div");A.appendChild(v);const g=document.createElement("div");A.appendChild(g);const m=document.createElement("div");u.appendChild(m);const p=document.createElement("div");m.appendChild(p);const d=document.createElement("div");p.appendChild(d);const c=document.createElement("div");p.appendChild(c);const y=document.createElement("span");m.appendChild(y);{const C=()=>{u.style.height=(e.height??Q.ESViewerStatusBarScale.defaults.height)+"px",u.style.lineHeight=(e.height??Q.ESViewerStatusBarScale.defaults.height)+"px"};this.dispose(e.heightChanged.disposableOn(C)),C()}{const C=()=>{u.style.fontSize=(e.fontSize??Q.ESViewerStatusBarScale.defaults.fontSize)+"px"};this.dispose(e.fontSizeChanged.disposableOn(C)),C()}{const C=()=>{e.bgColor?u.style.background=`rgba(${e.bgColor[0]*255},${e.bgColor[1]*255},${e.bgColor[2]*255},${e.bgColor[3]})`:u.style.background=`rgba(${Q.ESViewerStatusBarScale.defaults.bgColor[0]},${Q.ESViewerStatusBarScale.defaults.bgColor[1]},${Q.ESViewerStatusBarScale.defaults.bgColor[2]},${Q.ESViewerStatusBarScale.defaults.bgColor[3]})`};this.dispose(e.bgColorChanged.disposableOn(C)),C()}A.style.display="flex",v.style.fontWeight="bold",v.style.padding="0 0 0 25px";let w="EarthSDK";v.innerText=w,g.style.fontWeight="";let b="——免费开源地球可视化开发包";g.innerText=b,m.style.width="550px",p.style.position="fixed",p.style.width="125px",p.style.height="30px",p.style.padding="0 5px",p.style.display="flex",p.style.justifyContent="flex-end",p.style.pointerEvents="auto",p.style.zIndex="101",d.style.width="125px",d.style.display="inline-block",d.style.textAlign="center",d.style.fontSize="14px",d.style.fontWeight="lighter",d.style.lineHeight="30px",d.style.color="#fff",d.innerHTML="1000km",c.style.borderRight="1px solid #fff",c.style.borderLeft="1px solid #fff",c.style.borderBottom="1px solid #fff",c.style.position="absolute",c.style.height="10px",c.style.top="15px",c.style.width="75px",c.style.right="30px",y.style.display="flex",y.style.zIndex="101",y.style.justifyContent="flex-end",y.style.right="0";const _=()=>{const C=r.viewerLegend.legend.computedLengthInMeters;if(e.show===!1||C&&C>1e6)p.style.display="none";else{p.style.display="block";const T=r.viewerLegend.legend.computedLengthInStr;T&&(d.innerHTML=T);const I=r.viewerLegend.legend.computedLengthInPixels;if(I){c.style.width=`${I}px`;const P=(135-I)/2;c.style.left=`${P}px`}}};_();const x=setInterval(()=>{_()},200);this.dispose(()=>clearInterval(x));{let C;const T=()=>{e.show?(f.style.display="block",C=this.disposeVar(E.createAnimateFrameWithStartValues(()=>{var S;let I="";const P=h.getCameraInfo();if(P){const B=(O,M)=>P.position[O].toFixed(M);I+=`帧率:${h.getFPS()}FPS 相机: ${B(2,2)}米 `}const k=(S=h.extensions)==null?void 0:S.cursorPositionInfo.cursorPosition;if(k){const B=(O,M)=>k[O].toFixed(M);I+=`位置:${B(0,5)}° ${B(1,5)}° ${B(2,2)}米`}else I+="暂时无法获取鼠标位置...";y.innerText=I})),C.start()):(f.style.display="none",C.destroy())};this.dispose(e.showChanged.disposableOn(T)),T()}}}}get customDiv(){return this._customDiv}};N(ph,"type",ph.register("ESCesiumViewer",Q.ESViewerStatusBarScale.type,ph));let T0=ph;const d2=F.Math.toDegrees,mj=new F.Cartographic;function p2(t,n,e){const r=F.Cartesian3.fromDegrees(t[0],t[1],t[2]),s=F.Cartesian3.fromDegrees(n[0],n[1],n[2]),o=F.Cartesian3.subtract(s,r,new F.Cartesian3);F.Cartesian3.normalize(o,o);const i=new F.Ray(r,o),a=e.pickFromRay(i),l=e.globe.pick(i,e);var h;if(a&&a.position&&l){const g=F.Cartesian3.distance(r,a.position),m=F.Cartesian3.distance(r,l);h=g<m?a.position:l}else a&&a.position?h=a.position:l&&(h=l);if(!h)return;const f=F.Cartesian3.distance(r,s),A=F.Cartesian3.distance(r,h)>f?s:h,v=F.Cartographic.fromCartesian(A,void 0,mj);return[d2(v.longitude),d2(v.latitude),v.height]}const Ah=class Ah extends xn{constructor(e,r){super(e,r);N(this,"_hideGeoPolylines",this.disposeVar(new Wn(this.czmViewer,this.sceneObject.id)));N(this,"_visibleGeoPolylines",this.disposeVar(new Wn(this.czmViewer,this.sceneObject.id)));const s=r.viewer;if(!s){console.warn("viewer is undefined!");return}const o=this._hideGeoPolylines,i=this._visibleGeoPolylines;this.d(E.track([o,"show"],[e,"show"])),this.d(E.track([i,"show"],[e,"show"])),this.d(E.track([i,"color"],[e,"visibleColor"])),this.d(E.track([o,"color"],[e,"invisibleColor"]));{const a=()=>{const h=e.points,f=e.heightOffset;if(!h||h.length<2||h[0].toString()===h[1].toString()){o.positions=void 0,i.positions=void 0;return}const u=[],A=[],[v,g,m]=h[0],p=[v,g,m+f];try{h.forEach((d,c)=>{if(c===0)return;const y=p2(p,d,s.scene);y?(u.push([d,y]),A.push([p,y])):A.push([p,d])}),o.positions=u,i.positions=A}catch(d){console.warn(d)}};a();const l=this.dv(E.createNextAnimateFrameEvent(e.pointsChanged,e.heightOffsetChanged));this.d(l.don(a))}}get hideGeoPolylines(){return this._hideGeoPolylines}get visibleGeoPolylines(){return this._visibleGeoPolylines}flyTo(e,r){const{sceneObject:s,czmViewer:o}=this;if(!o.actived)return!1;if(s.flyToParam||s.flyInParam)return super.flyTo(e,r);{let i=[];return this.visibleGeoPolylines.positions&&(i=[...this.visibleGeoPolylines.positions.flat()]),this.hideGeoPolylines.positions&&(i=[...i,...this.hideGeoPolylines.positions.flat()]),Ne(o,s,r,i,e),!0}}flyIn(e,r){const{sceneObject:s,czmViewer:o}=this;if(!o.actived)return!1;if(s.flyInParam)return super.flyIn(e,r);{let i=[];return this.visibleGeoPolylines.positions&&(i=[...this.visibleGeoPolylines.positions.flat()]),this.hideGeoPolylines.positions&&(i=[...i,...this.hideGeoPolylines.positions.flat()]),Ne(o,s,r,i,e),!0}}};N(Ah,"type",Ah.register("ESCesiumViewer",Q.ESVisibilityAnalysis.type,Ah));let B0=Ah;class Hu extends E.Destroyable{constructor(e,r){super();N(this,"_flyToEvent",this.dv(new E.Event));N(this,"_enableEvent",this.dv(new E.Event));N(this,"_clearEvent",this.dv(new E.Event));N(this,"_gridPoints",this.dv(E.reactJson([])));N(this,"excavationPolylines");N(this,"fillPolylines");const s=e.viewer;if(!s){console.warn("viewer is undefined!");return}const o=this.dv(new Wn(e,r)),i=this.dv(new Wn(e,r));this.excavationPolylines=o,this.fillPolylines=i;const a=o;a.color=[1,1,0,1],this.d(E.track([a,"show"],[this,"show"])),a.show=!1,a.depthTest=!0;const l=i;l.color=[0,0,1,1],this.d(E.track([l,"show"],[this,"show"])),l.show=!1;{const v=this.ad(new qr(e,r));this.d(E.track([v,"show"],[this,"show"])),this.d(E.bind([v,"allowPicking"],[this,"allowPicking"])),this.d(E.bind([v,"positions"],[this,"positions"])),this.d(E.bind([v,"depthTest"],[this,"depthTest"])),this.d(E.bind([v,"outlineWidth"],[this,"outlineWidth"])),this.d(E.bind([v,"outlineColor"],[this,"outlineColor"])),this.d(E.bind([v,"outline"],[this,"outline"])),this.d(E.bind([v,"color"],[this,"fillColor"])),this.d(E.bind([v,"fill"],[this,"filled"])),this.d(E.bind([v,"strokeGround"],[this,"strokeGround"])),this.d(E.bind([v,"ground"],[this,"fillGround"])),this.d(this.flyToEvent.don(p=>{v.flyTo(p)}));const g=()=>{v.positions=this.positions};g();const m=this.dv(E.createNextAnimateFrameEvent(this.positionsChanged));this.d(m.don(g))}const h=()=>{if(!this.positions||!this.positions.length)return;const{minPos:v,maxPos:g}=Q.getMinMaxCorner(this.positions),m=v[0],p=v[1],d=g[0],c=g[1],w={type:"Polygon",coordinates:[[...this.positions.map(k=>[k[0],k[1]])]]},b=[m,p,d,c],_=this.gridWidth,T=xE(b,_,{units:"meters",mask:w}).features.map(k=>k.geometry.coordinates),I=F.Math.toRadians;return T.map(k=>new F.Cartographic(I(k[0]),I(k[1])))},f=()=>{a.positions=[],l.positions=[],this.area=0,this.cutVolume=0,this.fillVolume=0,this.cutAndFillVolume=0,a.depthTest=!0},u=this.dv(E.createProcessingFromAsyncFunc(async v=>{const g=h();let m=0,p=300;const d=Math.ceil(g.length/p),c=[];do{let y=[];m===d-1?y=g.slice(m*p):y=g.slice(m*p,(m+1)*p);const w=s.scene.sampleHeightMostDetailed(y),b=await v.promise(w);if(m===d-1?this.progress=Math.round(this.progress+100/d):this.progress+=100/d,b&&b.length){const _=F.Math.toDegrees,x=b.map(C=>[_(C.longitude),_(C.latitude),C.height]);c.push(...x)}m++}while(m<d);!c||!c.length||(this.gridPoints=c)}));let A=null;{const v=()=>{if(!this.positions||!this.positions.length||!this.gridPoints)return;let g=0;const m=[];let p=0;const d=[];this.gridPoints.forEach(c=>{const y=this.positions;c[2]>y[0][2]?(g+=this.gridWidth*this.gridWidth*(c[2]-y[0][2]),m.push([c,[c[0],c[1],y[0][2]]])):(p+=this.gridWidth*this.gridWidth*(y[0][2]-c[2]),d.push([c,[c[0],c[1],y[0][2]]]))}),a.positions=m,l.positions=d,a.show=!0,l.show=!0,this.area=_S(this.positions),this.cutVolume=g,this.fillVolume=p,this.cutAndFillVolume=p-g,A&&clearTimeout(A),A=setTimeout(()=>{a.depthTest=!1},200)};v(),this.d(this.gridPointsChanged.don(v)),this.d(()=>clearTimeout(A))}{const v=()=>{if(!this.positions||!this.positions.length){this.planeHeight=void 0;return}this.planeHeight=this.positions[0][2]};v(),this.d(this.positionsChanged.don(v))}{const v=()=>{if(!this.planeHeight||!this.positions||!this.positions.length)return;const g=JSON.parse(JSON.stringify(this.positions.slice(1)));g.unshift([this.positions[0][0],this.positions[0][1],this.planeHeight]),this.positions=g};v(),this.d(this.planeHeightChanged.don(v))}this.d(this.enableEvent.don(()=>{f(),this.gridPoints=[],this.progress=0,u.restart()})),this.d(this.clearEvent.don(()=>{f()}))}get flyToEvent(){return this._flyToEvent}flyTo(e){this._flyToEvent.emit(e)}get enableEvent(){return this._enableEvent}enableEmit(){this._enableEvent.emit()}get clearEvent(){return this._clearEvent}clearEmit(){this._clearEvent.emit()}get gridPoints(){return this._gridPoints.value}set gridPoints(e){this._gridPoints.value=e}get gridPointsChanged(){return this._gridPoints.changed}}(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:E.reactPositions(void 0),planeHeight:E.react(void 0),gridWidth:1,area:0,cutVolume:0,fillVolume:0,cutAndFillVolume:0,progress:0,depthTest:!1,outlineWidth:2,outlineColor:[1,1,1,1],outline:!0,filled:!1,fillColor:[1,1,1,1],fillGround:!1,strokeGround:!1})})(Hu||(Hu={})),E.extendClassProps(Hu.prototype,Hu.createDefaultProps);const mh=class mh extends Kn{constructor(e,r){super(e,r);N(this,"_geoVolumeMeasurement");if(this._geoVolumeMeasurement=this.dv(new Hu(this.czmViewer,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._geoVolumeMeasurement;this.d(E.track([o,"show"],[e,"show"])),this.d(E.bind([o,"positions"],[e,"points"])),this.d(E.track([o,"allowPicking"],[e,"allowPicking"])),this.d(E.bind([o,"planeHeight"],[e,"planeHeight"])),this.d(E.track([o,"gridWidth"],[e,"gridWidth"])),this.d(E.track([e,"cutVolume"],[o,"cutVolume"])),this.d(E.track([e,"fillVolume"],[o,"fillVolume"])),this.d(E.track([e,"cutAndFillVolume"],[o,"cutAndFillVolume"])),this.d(E.bind([e,"progress"],[o,"progress"])),this.d(E.track([o,"depthTest"],[e,"depthTest"])),this.d(E.track([o,"outline"],[e,"stroked"])),this.d(E.track([o,"outlineWidth"],[e,"strokeWidth"])),this.d(E.track([o,"outlineColor"],[e,"strokeColor"])),this.d(E.track([o,"filled"],[e,"filled"])),this.d(E.track([o,"fillColor"],[e,"fillColor"])),this.d(E.track([o,"fillGround"],[e,"fillGround"])),this.d(E.track([o,"strokeGround"],[e,"strokeGround"])),this.d(e.startEvent.don(()=>{o.enableEmit()})),this.d(e.clearEvent.don(()=>{o.clearEmit()}))}get geoVolumeMeasurement(){return this._geoVolumeMeasurement}flyTo(e,r){const{sceneObject:s,czmViewer:o,geoVolumeMeasurement:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):i.positions?(Ne(o,s,r,i.positions,e),!0):!1:!1}};N(mh,"type",mh.register("ESCesiumViewer",Q.ESVolumeMeasurement.type,mh));let I0=mh;const yh=class yh extends Kn{constructor(e,r){super(e,r);N(this,"czmEntity");N(this,"czmPolyline",this.ad(new Q.ESGeoLineString));const s=r.viewer;if(!s){console.warn("viewer is undefined!");return}const o=this.czmPolyline;r.add(o),this.ad(()=>r.delete(o)),this.ad(E.bind([o,"show"],[e,"show"])),this.ad(E.bind([o,"allowPicking"],[e,"allowPicking"])),this.ad(E.bind([o,"stroked"],[e,"stroked"])),this.ad(E.bind([o,"strokeColor"],[e,"strokeColor"])),this.ad(E.bind([o,"strokeWidth"],[e,"strokeWidth"])),this.ad(E.bind([o,"strokeGround"],[e,"strokeGround"]));{const h=()=>{if(!e.points||e.points.length<2)o.points=e.points;else{const u=structuredClone(e.points);u.push(u[0]),e.perPositionHeight?o.points=u:o.points=u.map(A=>(A[2]=e.height??Q.ESGeoExtrudedPolygon.defaults.height,A))}};h();const f=this.ad(E.createNextAnimateFrameEvent(e.pointsChanged,e.heightChanged,e.perPositionHeightChanged));this.ad(f.don(h))}const i=this.czmEntity=s.entities.add({polygon:{}});F.Entity.prototype&&(i.ESSceneObjectID=e.id),this.dispose(()=>s.entities.remove(i));let a=new F.PolygonHierarchy;i.polygon&&(i.polygon.hierarchy=new F.CallbackProperty(()=>a,!1));const l=()=>{const h=un(e.points??Q.ESGeoExtrudedPolygon.defaults.points);if(h.length<2){a=new F.PolygonHierarchy;return}a=new F.PolygonHierarchy(h)};l(),this.dispose(e.pointsChanged.disposableOn(l));{const h=()=>{i.show=e.show&&e.filled,this.geoPolygon&&(this.geoPolygon.show=e.show&&!i.show&&e.filled)};h();const f=this.ad(E.createNextAnimateFrameEvent(e.showChanged,e.filledChanged));this.ad(f.don(h))}{const h=()=>{i.polygon&&(i.polygon.perPositionHeight=new F.ConstantProperty(e.perPositionHeight),l())};h(),this.ad(e.perPositionHeightChanged.don(h))}{const h=()=>{i.polygon&&(i.polygon.height=new F.ConstantProperty(e.height??Q.ESGeoExtrudedPolygon.defaults.height))};h(),this.dispose(e.heightChanged.disposableOn(h))}{const h=()=>{i.polygon&&(i.polygon.extrudedHeight=new F.ConstantProperty(e.extrudedHeight??Q.ESGeoExtrudedPolygon.defaults.extrudedHeight))};h(),this.dispose(e.extrudedHeightChanged.disposableOn(h))}{const h=()=>{const f=F.Color.fromCartesian4(F.Cartesian4.fromArray(e.fillColor));i.polygon&&(i.polygon.material=f)};h(),this.dispose(e.fillColorChanged.disposableOn(h))}this.disposeVar(new E.ObjResettingWithEvent(e.allowPickingChanged,()=>{if(!e.allowPicking)return new st.ObjectsToExcludeWrapper(r,i)}))}getMinAndMaxheight(){const{sceneObject:e}=this;if(e.points){const{minPos:r,maxPos:s}=Q.getMinMaxCorner(e.points);return[r[2],s[2]]}return[0,0]}};N(yh,"type",yh.register("ESCesiumViewer",Q.ESGeoExtrudedPolygon.type,yh));let F0=yh;const gh=class gh extends Q.EngineObject{constructor(n,e){if(super(n,e),!e.viewer){console.warn("viewer is undefined!");return}const{human:s,poi:o}=n;this.dispose(E.bind([s,"position"],[n,"position"])),this.dispose(E.bind([s,"rotation"],[n,"rotation"])),this.ad(E.bind([s,"scale"],[n,"scale"])),this.ad(E.track([o,"scale"],[n,"scale"])),this.dispose(E.track([o,"rotation"],[n,"rotation"]));const i=()=>{const l=n.position;o.position=[l[0],l[1],l[2]+n.poiOffsetHeight]};i();const a=this.dv(E.createNextAnimateFrameEvent(n.positionChanged,n.poiOffsetHeightChanged));this.d(a.don(i)),this.ad(o.pickedEvent.don(l=>{l.assign({sceneObject:n}),n.pickedEvent.emit(l)}))}};N(gh,"type",gh.register("ESCesiumViewer",Q.ESHumanPoi.type,gh));let k0=gh;const vh=class vh extends Q.EngineObject{constructor(n,e){super(n,e);const r=e.viewer;if(!r){console.warn("viewer is undefined!");return}const s=r.scene.postProcessStages,o=s.add(F.PostProcessStageLibrary.createSilhouetteStage());o.uniforms.color=F.Color.LIME,o.selected=[],this.d(()=>{o.selected=[],s.remove(o)}),this.d(n.highlightInner3DtilesetEvent.don(i=>{o.selected=[];const a=i.d(i.tilesetReady.donce(f=>{f.allTilesLoaded.addEventListener(()=>{var A,v,g,m;const u=(m=(g=(v=(A=f==null?void 0:f._root)==null?void 0:A._content)==null?void 0:v._model)==null?void 0:g._featureTables[0])==null?void 0:m._features[0];u?o.selected=[u]:console.warn("tileset?._root?._content?._model?._featureTables[0]?._features[0] is undefined !",f),a()})})),l=i.url,h=Date.now();l.includes("?reload=")?i.url=l.replace(/\?reload=\d+/,`?reload=${h}`):i.url=l+`?reload=${h}`})),this.d(n.removeHighlightInner3DtilesetEvent.don(i=>{o.selected=[]})),this.d(n.es3DTileset.tilesetReady.don(i=>{const a=()=>{const h=n.layerConfig;if(!h){i.style=void 0;return}const f=n.colorBlendMode,u=(g,m)=>{try{if(g.getPropertyIds().includes("materialName"))return F.Color.clone(F.Color.WHITE,m);const p=g.getProperty("layer"),d=g.getProperty("dataset"),c=p.toString(),y=d.toString(),w=h.find(_=>_.dataset.toString()===y&&_.layer.toString()===c);if(w&&w.value.color){const _=w.value.color;return F.Color.fromCssColorString(_,m)}const b=h.filter(_=>_.dataset.toString()===y);if(b.length==1&&b[0].value.color){const _=b[0].value.color;return F.Color.fromCssColorString(_,m)}else return F.Color.clone(F.Color.WHITE,m)}catch(p){return console.warn(p),F.Color.clone(F.Color.WHITE,m)}},A=g=>{try{if(g.getPropertyIds().includes("materialName"))return!0;const m=g.getProperty("layer"),p=g.getProperty("dataset"),d=m.toString(),c=p.toString(),y=h.find(b=>b.dataset.toString()===c&&b.layer.toString()===d);if(y&&y.value.visible===!1)return!1;if(y&&y.value.visible===!0)return!0;const w=h.filter(b=>b.dataset.toString()===c);return!(w.length==1&&w[0].value.visible===!1)}catch(m){return console.warn(m),!0}};let v;f!=="HIGHLIGHT"?v=new F.Cesium3DTileStyle({color:{evaluateColor:function(g,m){return u(g,m)}},show:{evaluate:function(g){return A(g)}}}):v=new F.Cesium3DTileStyle({show:{evaluate:function(g){return A(g)}}}),i.style=v};a();const l=this.dv(E.createNextAnimateFrameEvent(n.layerConfigChanged,n.colorBlendModeChanged));this.d(l.don(()=>{a()}))}))}};N(vh,"type",vh.register("ESCesiumViewer",Q.ESRtsTileset.type,vh));let M0=vh;const wh=class wh extends Hs{constructor(n,e){if(super(n,e),!e.viewer){console.warn("viewer is undefined!");return}}};N(wh,"type",wh.register("ESCesiumViewer",Q.ESRtsFeatureEditing.type,wh));let O0=wh;const bh=class bh extends Hs{constructor(n,e){if(super(n,e),!e.viewer){console.warn("viewer is undefined!");return}}};N(bh,"type",bh.register("ESCesiumViewer",Q.ESMsTileset.type,bh));let D0=bh;const _h=class _h extends Ze{constructor(e,r){super(e,r);N(this,"_czmGeoPoint");if(this._czmGeoPoint=this.disposeVar(new nr(r,e.id)),!r.viewer){console.warn("viewer is undefined!");return}const o=this._czmGeoPoint;this.dispose(E.track([o,"show"],[e,"show"])),this.dispose(E.bind([o,"position"],[e,"position"]))}get czmGeoPoint(){return this._czmGeoPoint}flyTo(e,r){const{sceneObject:s,czmViewer:o,czmGeoPoint:i}=this;return o.actived?s.flyToParam||s.flyInParam?super.flyTo(e,r):(i.flyTo(e),s.flyOverEvent.emit(r,"over",o),!0):!1}};N(_h,"type",_h.register("ESCesiumViewer",Q.ESStaticMesh.type,_h));let R0=_h;const xh=class xh extends xn{constructor(n,e){super(n,e);const r=e.viewer;if(!r){console.warn("viewer is undefined!");return}const s=this.ad(new Lw(r));this.ad(n.startEvent.don(async()=>{const o=await s.getDepthsFromScreen(),i=Number.isFinite(n.radius)?n.radius:Q.ESSkylineAnalysis.defaults.radius,{depths:a,windowPositions:l,positions:h}=s.getSkylineDepthsAndPositions(o,r.scene.canvas.width,r.scene.canvas.height,i),f=He(r.camera.position);h.push(f),n.depths=a,n.windowPositions=l,n.points=h}))}flyTo(n,e){const{sceneObject:r,czmViewer:s}=this;return s.actived?r.flyToParam||r.flyInParam?super.flyTo(n,e):r.points?(Ne(s,r,e,r.points,n),!0):!1:!1}flyIn(n,e){const{sceneObject:r,czmViewer:s}=this;return s.actived?r.flyInParam?super.flyIn(n,e):r.points?(Ne(s,r,e,r.points,n),!0):!1:!1}};N(xh,"type",xh.register("ESCesiumViewer",Q.ESSkylineAnalysis.type,xh));let U0=xh;const Ua=class Ua extends En{constructor(e){super();N(this,"_config",this.disposeVar(E.react(Ua.defaultConfig)));N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"_pointerEventFilterFunc",this.disposeVar(E.react(Ua.defaultPointerEventFilterFunc)));if(!!e.viewer){{const r=()=>{const{config:s}=this;s.clickEnabled!==void 0&&(this.clickEnabled=s.clickEnabled),s.dblClickEnabled!==void 0&&(this.dblClickEnabled=s.dblClickEnabled)};r(),this.dispose(this.configChanged.disposableOn(r))}{const r=this.ad(new nr(e));r.pixelSize=4,r.outlineColor=[0,0,.8,1],r.outlineWidth=2,r.allowPicking=!1;{const s=()=>{if(!this.position)return;const o=[...this.position];e.editingHeightOffset&&(o[2]-=e.editingHeightOffset),r.position=o,r.show=!!this.position};s(),this.dispose(this.positionChanged.disposableOn(s))}}this.ad(new E.ObjResettingWithEvent(this.enabledChanged,()=>this.enabled?new yj(e,this):void 0))}}get config(){return this._config.value}set config(e){this._config.value=e}get configChanged(){return this._config.changed}get overEvent(){return this._overEvent}over(){this._overEvent.emit()}get pointerEventFilterFunc(){return this._pointerEventFilterFunc.value}set pointerEventFilterFunc(e){this._pointerEventFilterFunc.value=e}get pointerEventFilterFuncChanged(){return this._pointerEventFilterFunc.changed}};N(Ua,"defaultConfig",{clickEnabled:!0,dblClickEnabled:!1}),N(Ua,"defaultPointerEventFilterFunc",e=>e.button===0),N(Ua,"defaults",{...En.defaults,position:[116.39,39.9,0]});let Sr=Ua;(t=>{t.createDefaultProps=()=>({...En.createDefaultProps(),position:E.reactArrayWithUndefined(void 0),virtualHeight:void 0,clickEnabled:!0,dblClickEnabled:!1})})(Sr||(Sr={})),E.extendClassProps(Sr.prototype,Sr.createDefaultProps);class yj extends E.Destroyable{constructor(e,r){super();N(this,"_doings",[]);N(this,"initDoings",this.ad(()=>{this._doings.forEach(e=>e.destroy()),this._doings.length=0}));this._czmViewer=e,this._placeEditing=r;{const s=(o,i)=>{i=="click"&&(!r.clickEnabled||!r.pointerEventFilterFunc(o))||i=="dblclick"&&(!r.dblClickEnabled||!r.pointerEventFilterFunc(o))||(r.over(),r.enabled=!1)};this.ad(e.clickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"click")})),this.ad(e.dblclickEvent.don(o=>{o.pointerEvent&&s(o.pointerEvent,"dblclick")}))}this.ad(e.pointerMoveEvent.don(s=>{if(!s.pointerEvent)return;const o=new gj(this,s.pointerEvent,i=>{if(!i||i[2]<-1e5){r.position=void 0;return}const a=[...i];e.editingHeightOffset&&(a[2]+=e.editingHeightOffset),r.position=a,this._doings.splice(0,this._doings.indexOf(o)+1).forEach(h=>h.destroy())});this._doings.push(o)}))}get czmViewer(){return this._czmViewer}get placeEditing(){return this._placeEditing}}class gj extends E.Destroyable{constructor(n,e,r){super(),this._owner=n;const{czmViewer:s}=this._owner,o=pw(s,e,this._owner.placeEditing.virtualHeight),[i]=E.getEventFromPromise(o);this.dispose(i.disposableOn(r))}}class $n extends En{constructor(){super()}}N($n,"defaults",{...En.defaults,position:[116.39,39.9,0]}),(t=>{t.createDefaultProps=()=>({...En.createDefaultProps(),position:E.reactArrayWithUndefined(void 0)})})($n||($n={})),E.extendClassProps($n.prototype,$n.createDefaultProps);function L0(t,n){const e=new lt(t);return e.hasArrow=!0,e.arcType="RHUMB",e.width=10,e.color=n,e}const fr=class fr extends E.Destroyable{constructor(n){if(super(),!n.viewer)return;const e=this.disposeVar(L0(n,fr.defaults.xAxisColor)),r=this.disposeVar(L0(n,fr.defaults.yAxisColor)),s=this.disposeVar(L0(n,fr.defaults.zAxisColor));{const o=()=>{e.show=this.xAxisShow&&this.show,r.show=this.yAxisShow&&this.show,s.show=this.zAxisShow&&this.show};o();const i=this.ad(E.createNextAnimateFrameEvent(this.showChanged,this.xAxisShowChanged,this.yAxisShowChanged,this.zAxisShowChanged));this.dispose(i.disposableOn(o))}{const o=()=>{const{position:a=fr.defaults.position,heading:l=fr.defaults.heading}=this,[h,f,u]=a,{dimensions:A=fr.defaults.dimensions}=this;s.positions=[a,[h,f,u+A[2]]];const v=Q.geoRhumbDestination(a,A[0],90+l);v&&(e.positions=[a,v]);const g=Q.geoRhumbDestination(a,A[1],0+l);g&&(r.positions=[a,g])};o();const i=this.disposeVar(E.createNextAnimateFrameEvent(this.positionChanged,this.dimensionsChanged,this.headingChanged));this.dispose(i.disposableOn(o))}{const o=()=>{e.color=this.xAxisColor??fr.defaults.xAxisColor,r.color=this.yAxisColor??fr.defaults.yAxisColor,s.color=this.zAxisColor??fr.defaults.zAxisColor};o();const i=this.disposeVar(E.createNextAnimateFrameEvent(this.xAxisColorChanged,this.yAxisColorChanged,this.zAxisColorChanged));this.dispose(i.disposableOn(o))}}};N(fr,"defaults",{position:[116.39,39.9,0],heading:0,dimensions:[1e3,1e3,1e3],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1],zAxisColor:[0,0,1,1]});let Do=fr;(t=>{t.createDefaultProps=()=>({show:!0,position:E.reactArrayWithUndefined(void 0),heading:0,dimensions:E.reactArray([1e3,1e3,1e3]),xAxisColor:E.reactArray([1,0,0,1]),yAxisColor:E.reactArray([0,1,0,1]),zAxisColor:E.reactArray([0,0,1,1]),xAxisShow:!0,yAxisShow:!0,zAxisShow:!0})})(Do||(Do={})),E.extendClassProps(Do.prototype,Do.createDefaultProps);const No=class No extends $n{constructor(e){super();N(this,"_opInfo",{step:this.ad(E.react(!1)),moved:this.ad(E.react(!1)),constraintMode:this.ad(E.react("none")),originPosition:this.disposeVar(E.reactArray($n.defaults.position)),originHeading:this.disposeVar(E.react(0)),originDimensions:this.disposeVar(E.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(E.reactArray([0,0,0])),movingPosition:this.disposeVar(E.reactArray([0,0,0])),targetPosition:this.disposeVar(E.reactArray([0,0,0])),targetHeading:this.disposeVar(E.react(0))});N(this,"_createCoordinates",e=>{const r=this.ad(new Do(e));this.dispose(this._opInfo.step.changed.disposableOn(()=>{A2(r,this._opInfo.constraintMode.value,this._opInfo.step.value)}));{const s=()=>{const i=[...this.position??No.defaults.position];e.editingHeightOffset&&(i[2]-=e.editingHeightOffset),r.position=i};s(),this.dispose(this.positionChanged.disposableOn(s))}{const s=()=>{r.heading=this.heading??0};s(),this.dispose(this.headingChanged.disposableOn(s))}{const s=()=>{r.dimensions=this._opInfo.originDimensions.value};s(),this.dispose(this._opInfo.originDimensions.changed.disposableOn(s))}return r});N(this,"_createOriginCoordinates",e=>{const r=this.ad(new Do(e));r.xAxisColor=[1,0,0,.5],r.yAxisColor=[0,1,0,.5],r.zAxisColor=[0,0,1,.5];const{originPosition:s,originHeading:o,originDimensions:i}=this._opInfo;{const a=()=>{r.position=s.value};a(),this.dispose(s.changed.disposableOn(a))}{const a=()=>{r.heading=o.value??0};a(),this.dispose(o.changed.disposableOn(a))}{const a=()=>{r.dimensions=i.value};a(),this.dispose(i.changed.disposableOn(a))}return r});N(this,"_createGrid",e=>{const r=this.ad(new gr(e));{const s=()=>{const i=this._opInfo.originPosition.value,a=this._opInfo.originHeading.value,l=this._opInfo.originDimensions.value[0],h=[];for(let f=-4;f<5;++f){const u=Q.geoRhumbDestination(i,l*.2*f,a+90);if(u){const A=Q.geoRhumbDestination(u,l,a+180),v=Q.geoRhumbDestination(u,l,a);A&&v&&h.push([A,u,v])}}for(let f=-4;f<5;++f){const u=Q.geoRhumbDestination(i,l*.2*f,a);if(u){const A=Q.geoRhumbDestination(u,l,a-90),v=Q.geoRhumbDestination(u,l,a+90);A&&v&&h.push([A,u,v])}}r.positions=h};s();const o=this.disposeVar(E.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originHeading.changed,this._opInfo.originDimensions.changed));this.dispose(o.disposableOn(s))}return r});N(this,"_createHelpLine",e=>{const r=this.ad(new lt(e));r.hasDash=!0,r.arcType="RHUMB",r.color=[1,1,0,.99];{const s=()=>{r.positions=[this._opInfo.originPosition.value,this._opInfo.targetPosition.value]},o=this.ad(E.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.targetPosition.changed));this.ad(o.don(s))}return r});N(this,"_createCircle",e=>{const r=this.ad(new gr(e));r.arcType="RHUMB",r.width=2,r.hasDash=!0;const s=this.disposeVar(E.createNextAnimateFrameEvent(this._opInfo.originPosition.changed,this._opInfo.originDimensions.changed)),o=()=>{const i=this._opInfo.originPosition.value,a=this._opInfo.originDimensions.value[0],l=[],h=32;for(let f=0;f<=h;++f){const u=Q.geoRhumbDestination(i,a,f*360/h);u&&l.push(u)}r.positions=[l]};return o(),this.dispose(s.disposableOn(o)),r});N(this,"_pickingXYProcessing",e=>this.ad(new E.Processing((r,s,o)=>{const i=[0,0,0],a=new F.Cartographic;return e.pointerMoveEvent.don(l=>{if(!l.pointerEvent||!e.viewer)return;const h=pr(E.getDomEventCurrentTargetPos(l.pointerEvent));if(!ja(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Qa(a,i),this._opInfo.constraintMode.value==="x"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,i,i):this._opInfo.constraintMode.value==="y"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value,i,i):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=i;const f=[0,0,0];Q.geoRhumbDestination(i,o,s,f),this._opInfo.targetPosition.value=f})})));N(this,"_pickingZProcessing",e=>this.ad(new E.Processing(()=>{const r=new F.Cartesian3,s=[0,0,0];return e.pointerMoveEvent.don(o=>{if(!o.pointerEvent||!e.viewer)return;const i=pr(E.getDomEventCurrentTargetPos(o.pointerEvent));if(!Hh(e.viewer.scene,Tt(this._opInfo.originPosition.value),i,r))return;const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(He(r,s)){this._opInfo.movingPosition.value=s;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],s[2]+a]}})})));N(this,"_pickingZAxisProcessing",e=>this.ad(new E.Processing(()=>{const r=[0,0,0],s=new F.Cartographic;return e.pointerMoveEvent.don(o=>{if(!o.pointerEvent||!e.viewer)return;const i=pr(E.getDomEventCurrentTargetPos(o.pointerEvent));if(!ja(e.viewer.scene,i,this._opInfo.originPosition.value[2],s))return;Qa(s,r);const a=Q.geoRhumbHeading(this._opInfo.originPosition.value,this._opInfo.draggingStartPosition.value),h=Q.geoRhumbHeading(this._opInfo.originPosition.value,r)-a;let f=this._opInfo.originHeading.value+h;f=F.Math.toDegrees(F.Math.negativePiToPi(F.Math.toRadians(f))),this._opInfo.movingPosition.value=r,this.heading=this._opInfo.targetHeading.value=f})})));if(!e.viewer)return;const r=this.ad(E.reactArray([1,1,1]));this.ad(e.dblclickEvent.don(()=>this.enabled=!1)),this.ad(new zp(e,this.positionReact,r,this.axisPixelSize));{this.ad(this._opInfo.targetPosition.changed.don(o=>{if(this._opInfo.moved){const i=[...o];e.editingHeightOffset&&(i[2]+=e.editingHeightOffset),this.position=i}})),this.ad(this._opInfo.targetHeading.changed.don(o=>this._opInfo.moved&&(this.heading=o)));const s=()=>{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((o,i)=>o===this._opInfo.targetPosition.value[i])){this._opInfo.moved.value=!0;return}};s(),this.dispose(this._opInfo.originHeading.changed.disposableOn(s)),this.dispose(this._opInfo.originPosition.changed.disposableOn(s)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(s)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(s))}{const s=this._createCoordinates(e),o=this._createOriginCoordinates(e),i=this._createGrid(e),a=this._createHelpLine(e),l=this._createCircle(e);{const g=()=>{l.show=i.show=this.enabled&&this.showCircle,a.show=this.enabled&&this.showCircle&&this._opInfo.moved.value,s.show=this.enabled&&this.showCoordinates,o.show=this.enabled&&this.showCoordinates&&this._opInfo.moved.value};g();const m=this.ad(E.createNextAnimateFrameEvent(this.enabledChanged,this.showCircleChanged,this.showCoordinatesChanged,this._opInfo.moved.changed));this.ad(m.don(g))}{const g=()=>{s.xAxisShow=o.xAxisShow=this.xAxisShow,s.yAxisShow=o.yAxisShow=this.yAxisShow,s.zAxisShow=o.zAxisShow=this.zAxisShow};g();const m=this.ad(E.createNextAnimateFrameEvent(this.xAxisShowChanged,this.yAxisShowChanged,this.zAxisShowChanged));this.ad(m.don(g))}{const g=()=>{i.color=this._opInfo.constraintMode.value!=="none"?[1,1,0,.6]:[1,1,0,.3],l.color=this._opInfo.constraintMode.value==="zAxis"?[1,1,0,.99]:[1,1,0,.5],A2(s,this._opInfo.constraintMode.value,this._opInfo.step.value)};g(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(g))}const h=this._pickingXYProcessing(e),f=this._pickingZProcessing(e),u=this._pickingZAxisProcessing(e),A=this.ad(E.createProcessingFromAsyncFunc(async g=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",g.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await E.step(g,async m=>{const p=()=>{const b=[...this.position??No.defaults.position];e.editingHeightOffset&&(b[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=b},d=()=>this._opInfo.targetHeading.value=this._opInfo.originHeading.value=this.heading,c=()=>this._opInfo.originDimensions.value=r.value;m.disposer.dispose((p(),this.positionChanged.don(p))),m.disposer.dispose((d(),this.headingChanged.don(d))),m.disposer.dispose((c(),r.changed.don(c)));const y={constraintMode:"none",startDragPos:[0,0,0]},w=b=>{const _={position:s.position??No.defaults.position,heading:s.heading??No.defaults.heading,dimensions:s.dimensions??No.defaults.dimensions};e.viewer&&Pp(b,e.viewer.scene,_,this.axisSnapPixelSize,y,{x:this.disableX,y:this.disableY,z:this.disableZ,xy:this.disableXY,zAxis:this.disableZAxis}),this._opInfo.constraintMode.value=y.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=y.startDragPos};m.disposer.dispose(e.pointerMoveEvent.don(b=>{b.pointerEvent&&w(b.pointerEvent)})),await E.step(m,b=>new Promise((_,x)=>{b.disposer.dispose(x),b.disposer.dispose(e.pointerDownEvent.don(C=>{C.pointerEvent&&w(C.pointerEvent),C.pointerEvent&&C.pointerEvent.button===0&&y.constraintMode!=="none"&&_()}))}))}),this._opInfo.step.value=!1,await E.step(g,async m=>{if(e.incrementDisabledInputStack(),m.disposer.dispose(()=>{e.decrementDisabledInputStack()}),["xy","x","y"].includes(this._opInfo.constraintMode.value)){const p=Q.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),d=Q.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);h.restart(void 0,p,d),m.disposer.dispose(()=>h.cancel())}else this._opInfo.constraintMode.value==="z"?(f.restart(),m.disposer.dispose(()=>f.cancel())):this._opInfo.constraintMode.value==="zAxis"?(u.restart(),m.disposer.dispose(()=>u.cancel())):console.warn(`pickingInfo.constraintMode error! ${this._opInfo.constraintMode.value}`);await E.step(m,p=>new Promise((d,c)=>{p.disposer.dispose(c),p.disposer.dispose(e.pointerUpEvent.don(()=>{d()})),p.disposer.dispose(e.pointerOutEvent.don(()=>d()))}))});while(!0)})),v=()=>{this.enabled?A.restart():A.isRunning&&A.cancel()};v(),this.ad(this.enabledChanged.don(v))}}};N(No,"defaults",{...$n.defaults,heading:0,dimensions:[1e3,1e3,1e3],xAxisColor:[1,0,0,1],yAxisColor:[0,1,0,1],zAxisColor:[0,0,1,1]});let Ii=No;(t=>{t.createDefaultProps=()=>({...$n.createDefaultProps(),heading:0,axisPixelSize:100,axisSnapPixelSize:5,showCoordinates:!0,showCircle:!0,disableX:!1,disableY:!1,disableZ:!1,disableXY:!1,disableZAxis:!1,xAxisShow:!0,yAxisShow:!0,zAxisShow:!0})})(Ii||(Ii={})),E.extendClassProps(Ii.prototype,Ii.createDefaultProps);function A2(t,n,e){t.xAxisColor=[1,0,0,.99],t.yAxisColor=[0,1,0,.99],t.zAxisColor=[0,0,1,.99],n==="x"?t.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:n==="y"?t.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:n==="z"?t.zAxisColor=e?[1,1,0,.8]:[1,1,0,.99]:n==="xy"&&(t.xAxisColor=e?[1,1,0,.8]:[1,1,0,.99],t.yAxisColor=e?[1,1,0,.8]:[1,1,0,.99])}class z0 extends E.HasOwner{constructor(e){super(e);N(this,"_valid",!1);N(this,"_normal",new F.Cartesian3(0,0,0));N(this,"_origin",new F.Cartesian3(0,0,0))}get viewer(){return this.owner.czmViewer.viewer}get scene(){return this.viewer.scene}get sceneObject(){return this.owner}get valid(){return this._valid}get normal(){return this._normal}get origin(){return this._valid&&this._origin}pick(e){if(!this.normal||!this.owner.cartesian)return;const r=this.owner.cartesian,s=pr(e);return Aw(this.scene,r,this.normal,s)}}class vj extends z0{constructor(n){super(n);{const e=()=>{const s=At({position:this.sceneObject.position,rotation:this.sceneObject.rotation});this._valid=!!s,s&&(this._origin.x=s[4],this._origin.y=s[5],this._origin.z=s[6],this._normal.x=s[8],this._normal.y=s[9],this._normal.z=s[10])};e();const r=this.ad(E.createNextAnimateFrameEvent(this.sceneObject.positionChanged,this.sceneObject.rotationChanged));this.ad(r.don(e))}}}class wj extends z0{constructor(n){super(n);const e=()=>{const r=At({rotation:[this.sceneObject.selfRotation[0],0,0]});if(!r)throw new Error("PitchPlane: rm is undefined");const s=At({position:this.sceneObject.position,rotation:this.sceneObject.rotation,localModelMatrix:F.Matrix4.toArray(r)});if(this._valid=!!s,!!s){{const o=this._normal;o.x=-s[0],o.y=-s[1],o.z=-s[2]}{const o=this._origin;o.x=s[4],o.y=s[5],o.z=s[6]}}};e(),this.dispose(this.sceneObject.positionChanged.disposableOn(e)),this.dispose(this.sceneObject.rotationChanged.disposableOn(e)),this.dispose(this.sceneObject.selfRotationChanged.disposableOn(e))}}class bj extends z0{constructor(n){super(n);const e=()=>{const r=At({rotation:[this.sceneObject.selfRotation[0],this.sceneObject.selfRotation[1],0]});if(!r)throw new Error("PitchPlane: rm is undefined");const s=At({position:this.sceneObject.position,rotation:this.sceneObject.rotation,localModelMatrix:F.Matrix4.toArray(r)});if(this._valid=!!s,!!s){{const o=this._normal;o.x=-s[4],o.y=-s[5],o.z=-s[6]}{const o=this._origin;o.x=s[8],o.y=s[9],o.z=s[10]}}};e(),this.dispose(this.sceneObject.positionChanged.disposableOn(e)),this.dispose(this.sceneObject.rotationChanged.disposableOn(e)),this.dispose(this.sceneObject.selfRotationChanged.disposableOn(e))}}class ll extends E.Destroyable{constructor(e){super();N(this,"_czmTexture");N(this,"_customPrimitiveForCircle");N(this,"_circleCanvas");N(this,"_debugAxis");e.viewer&&(this._czmTexture=this.disposeVar(new wt(e)),this._czmTexture.uri="",this._createCircleCanvas(e),this._createCustomPrimitiveForCircle(e),this._createDebugAxis(e))}get czmTexture(){return this._czmTexture}get customPrimitiveForCircle(){return this._customPrimitiveForCircle}get circleCanvas(){return this._circleCanvas}get debugAxis(){return this._debugAxis}_createCircleCanvas(e){let r=this.disposeVar(E.react(!1));const s=document.createElement("canvas");s.width=s.height=256,this._circleCanvas=s.getContext("2d");{const i=()=>{const l={rotation:this.circleRotation*Math.PI/180,startRotation:this.circleStartRotation*Math.PI/180,endRotation:this.circleEndRotation*Math.PI/180},h=this._circleCanvas,f=this.color,u=`rgba(${f[0]*255|0}, ${f[1]*255|0}, ${f[2]*255|0}, ${f[3]})`;h.clearRect(0,0,256,256),h.lineWidth=6,h.beginPath(),h.arc(128,128,64,0,Math.PI*2,!1),h.strokeStyle=`rgba(0,0,0,${f[3]})`,h.stroke(),h.lineWidth=4,h.beginPath(),h.arc(128,128,64,0,Math.PI*2,!1),h.strokeStyle=u,h.stroke();{h.lineWidth=1,h.beginPath();let g=F.Math.zeroToTwoPi(l.startRotation),m=F.Math.zeroToTwoPi(l.endRotation);m<g&&(m+=F.Math.TWO_PI),(g!==m||g!==0)&&(h.moveTo(128,128),h.arc(128,128,64,g,m,m-g>Math.PI),h.lineTo(128,128),h.strokeStyle="rgba(255, 255, 0, 1.0)",h.stroke())}let A=F.Math.negativePiToPi(l.rotation);h.lineWidth=3,h.beginPath(),h.moveTo(128,128),h.arc(128,128,64,0,A,F.Math.negativePiToPi(A-0)<0),h.lineTo(128,128),h.fillStyle=`rgba(${f[0]*255|0}, ${f[1]*255|0}, ${f[2]*255|0}, 0.5)`,h.fill();{h.save(),h.font="16px console",h.textBaseline="middle";const p=`${(F.Math.negativePiToPi(A-0)*180/Math.PI*10|0)/10}°`;var v=h.measureText(p).width;h.translate(128,128),h.rotate(Math.PI*.5),A=F.Math.negativePiToPi(A-0)+0,h.rotate((A+0)*.5),h.scale(r.value?-1:1,1),h.translate(-128,-128),h.fillStyle="white",h.fillText(p,128-v*.5,54),h.lineWidth=1,h.restore()}this.czmTexture&&this.czmTexture.copyFromCanvas(s)};i();const a=this.ad(E.createNextAnimateFrameEvent(this.colorChanged,this.circleRotationChanged,this.circleStartRotationChanged,this.circleEndRotationChanged,r.changed));this.ad(a.don(i)),this.czmTexture&&this.ad(this.czmTexture.readyEvent.don(i))}{const o=()=>{const a=At({rotation:this.selfRotation});if(!a)return;const l=At({position:this.position,rotation:this.rotation,localModelMatrix:F.Matrix4.toArray(a)});if(!l)return;const{viewer:h}=e;if(!h)return;const f=F.Cartesian3.dot(h.scene.camera.directionWC,new F.Cartesian3(l[8],l[9],l[10]));r.value=f>0};o();const i=this.ad(E.createNextAnimateFrameEvent(e.cameraChanged,this.positionChanged,this.rotationChanged,this.selfRotationChanged));this.ad(i.don(o))}}_createCustomPrimitiveForCircle(e){this._customPrimitiveForCircle=this.disposeVar(_j(e)),this.dispose(E.track([this._customPrimitiveForCircle,"show"],[this,"show"])),this.dispose(E.track([this._customPrimitiveForCircle,"position"],[this,"position"])),this.dispose(E.track([this._customPrimitiveForCircle,"rotation"],[this,"rotation"])),this.dispose(E.track([this._customPrimitiveForCircle,"pixelSize"],[this,"pixelSize"]));{const r=()=>{const s=At({rotation:this.selfRotation});this._customPrimitiveForCircle&&(this._customPrimitiveForCircle.localModelMatrix=s&&F.Matrix4.toArray(s)||void 0)};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{this.customPrimitiveForCircle&&this.czmTexture&&(this.customPrimitiveForCircle.uniformMap={u_image:{type:"texture",id:this.czmTexture.id},u_color:this.color})};r(),this.dispose(this.colorChanged.disposableOn(r))}}_createDebugAxis(e){this._debugAxis=this.ad(xj(e)),this.dispose(E.track([this._debugAxis,"pixelSize"],[this,"pixelSize"])),this.dispose(E.track([this._debugAxis,"position"],[this,"position"])),this.dispose(E.track([this._debugAxis,"rotation"],[this,"rotation"])),this.dispose(E.track([this._debugAxis,"show"],[this,"debug"]));{const r=()=>{const s=At({rotation:this.selfRotation});this._debugAxis&&(this._debugAxis.localModelMatrix=s&&F.Matrix4.toArray(s)||void 0)};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{this._debugAxis&&(this._debugAxis.uniformMap={u_color:this.color})};r(),this.dispose(this.colorChanged.disposableOn(r))}}}N(ll,"defaults",{position:[116.39,39.9,100]}),(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,editing:!1,position:E.reactArrayWithUndefined(void 0),rotation:E.reactArray([0,0,0]),selfRotation:E.reactArray([0,0,0]),pixelSize:300,color:E.reactArray([1,1,1,1]),circleRotation:0,circleStartRotation:0,circleEndRotation:0,debug:!1})})(ll||(ll={})),E.extendClassProps(ll.prototype,ll.createDefaultProps);function _j(t){return Gp({type:"CzmCustomPrimitive",allowPicking:!0,positionEditing:!1,pixelSize:100,boundingVolume:{type:"LocalAxisedBoundingBox",data:{min:[0,-1,0],max:[1,0,0]}},renderState:{depthTest:{enabled:!1},cull:{enabled:!1,face:1029},depthMask:!1,blending:{enabled:!0,equationRgb:32774,equationAlpha:32774,functionSourceRgb:770,functionSourceAlpha:1,functionDestinationRgb:771,functionDestinationAlpha:771}},localPosition:[-.5,-.5,0],localRotation:[-90,0,0]},mt,t)}function xj(t){return Gp({type:"CzmCustomPrimitive",allowPicking:!0,positionEditing:!1,position:[114.86128105686282,40.86825802653499,0],primitiveType:"LINES",vertexShaderSource:`in vec3 position;
|
|
4887
4887
|
void main()
|
|
4888
4888
|
{
|
|
4889
4889
|
// 如果这一句注释,要相应地注释掉attribute中的normal,也就是说顶点属性要和shader中的一一匹配!
|
|
@@ -4894,10 +4894,10 @@ void main()
|
|
|
4894
4894
|
{
|
|
4895
4895
|
out_FragColor = u_color;
|
|
4896
4896
|
}
|
|
4897
|
-
`,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},mt,t)}class Cj extends E.HasOwner{constructor(n){super(n);const{czmViewer:e}=this.owner;let r;this.dispose(()=>this.owner.hoveredPlaneType="none");const s=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const i=r=this._getStartInfo(o.pointerEvent);i&&(this.owner.hoveredPlaneType=i.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(o=>{r&&r.currentPlaneType!=="none"&&(s.restart(void 0,e,r),r=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{do{const i=this._getStartInfo(o.pointerEvent);if(!i||i.currentPlaneType==="none")break;const{currentPlaneType:a}=i,l=[...this.owner.selfRotation];l[Er.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(E.createProcessingFromAsyncFunc(async(n,e,r)=>{const s=this.owner.circles[r.currentPlaneType];e.incrementDisabledInputStack(),n.disposer.dispose(()=>e.decrementDisabledInputStack()),n.disposer.dispose(e.pointerMoveEvent.don(o=>{if(r&&o.pointerEvent){const{offsetX:i,offsetY:a}=o.pointerEvent,l=[i,a],{currentPlaneType:h}=r;if(h==="none")return;const f=this.owner.getPlane(h);if(!r.currentV)return;const u=f.pick(l);if(!u||!this.owner.cartesian)return;const A=F.Cartesian3.subtract(r.currentV,this.owner.cartesian,new F.Cartesian3);F.Cartesian3.normalize(A,A);const v=F.Cartesian3.subtract(u,this.owner.cartesian,new F.Cartesian3);if(F.Cartesian3.normalize(v,v),!f.normal||!f.origin)return;const g=N0(A,v,f.normal),m=N0(f.origin,A,f.normal),p=N0(f.origin,v,f.normal);{const d=[...this.owner.selfRotation];d[Er.rotationNum[h]]=r.startRotation+g,this.owner.selfRotation=d,s.circleStartRotation=m,s.circleEndRotation=p}}})),this.owner.movingPlaneType=r.currentPlaneType,n.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),n.disposer.dispose(()=>{s.circleStartRotation=0,s.circleEndRotation=0}),await E.step(n,o=>new Promise((i,a)=>{o.disposer.dispose(a),o.disposer.dispose(e.pointerUpEvent.don(()=>{i()})),o.disposer.dispose(e.pointerOutEvent.don(()=>{i()}))}))}))}_pickPlane(n,e,r,s,o){const i=this.owner.cartesian;if(!i)return;const{selfRotation:a}=this.owner,l=this.owner.getPlane(r).pick(s);if(!l)return;const h=F.Cartesian3.distance(i,l),f=o/4,u=f*3/128;if(!(h>=f-u&&h<=f+u))return;const v=F.Cartesian3.distance(e.camera.positionWC,l);n.currentD2c<=v||(n.currentPlaneType=r,n.currentD2c=v,n.currentV=l,n.startRotation=a[Er.rotationNum[r]])}_getStartInfo(n){var f;const{czmViewer:e}=this.owner,r=(f=e.viewer)==null?void 0:f.scene;if(!this.owner.position||!this.owner.cartesian)return;const s=ii(r,this.owner.cartesian,this.owner.pixelSize);if(!s)return;const{offsetX:o,offsetY:i}=n,a=[o,i],l=n.pointerId,h={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(h,r,"heading",a,s),this._pickPlane(h,r,"pitch",a,s),this._pickPlane(h,r,"roll",a,s),h}}function N0(t,n,e){const r=F.Cartesian3.cross(n,t,new F.Cartesian3);if(r.equals(F.Cartesian3.ZERO))return 0;F.Cartesian3.normalize(r,r);const s=F.Cartesian3.dot(r,e);let o=Math.acos(F.Cartesian3.dot(t,n))*180/Math.PI;return o=s>0?o:-o,o}const La=class La extends $n{constructor(e){super();N(this,"_hoveredPlaneType",this.disposeVar(E.react("none")));N(this,"_movingPlaneType",this.disposeVar(E.react("none")));N(this,"_circles");N(this,"_czmCameraModel");N(this,"_cartesian");N(this,"_planes",{heading:this.disposeVar(new vj(this)),pitch:this.disposeVar(new wj(this)),roll:this.disposeVar(new bj(this))});N(this,"_rotatorRunningResetting");this._czmViewer=e;const r=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new E.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Cj(this)})),this._circles={heading:this._createRotatorCircle(r,"heading"),pitch:this._createRotatorCircle(r,"pitch"),roll:this._createRotatorCircle(r,"roll")},!!r.viewer){{const o=()=>{this._cartesian=this.position&&Tt(this.position)||void 0};o(),this.dispose(this.positionChanged.disposableOn(o))}this._createCameraModel(r)}}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 tn(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(E.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],r=>r*.1)),this.dispose(E.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(E.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const r=()=>{const s=At({rotation:this.selfRotation});if(!s)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=F.Matrix4.toArray(s))};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{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)};r(),this.dispose(this.enabledChanged.disposableOn(r)),this.dispose(this.showHelperChanged.disposableOn(r))}}_createRotatorCircle(e,r){const s=this.ad(new ll(e));this.dispose(E.track([s,"position"],[this,"position"])),this.dispose(E.track([s,"pixelSize"],[this,"pixelSize"])),this.dispose(E.track([s,"debug"],[this,"debug"])),this.dispose(E.track([s,"rotation"],[this,"rotation"]));{const o=()=>{s.selfRotation=La.rotationFuncs[r](this.selfRotation),s.circleRotation=this.selfRotation[La.rotationNum[r]]};o(),this.dispose(this.selfRotationChanged.disposableOn(o))}{const o=()=>{const i=this.movingPlaneType===r,a=this.hoveredPlaneType===r,h=[0,0,0,i||a?1:.8];h[La.rotationNum[r]]=1,s.color=h};o(),this.dispose(this.movingPlaneTypeChanged.disposableOn(o)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(o))}return s}};N(La,"rotationNum",{heading:0,pitch:1,roll:2}),N(La,"rotationFuncs",{heading:([e,r,s])=>[0,0,0],pitch:([e,r,s])=>[e,0,-90],roll:([e,r,s])=>[e,r+90,0]});let Er=La;(t=>{t.createDefaultProps=()=>({...$n.createDefaultProps(),rotation:E.reactArray([0,0,0]),selfRotation:E.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(Er||(Er={})),E.extendClassProps(Er.prototype,Er.createDefaultProps);const za=class za extends E.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(n){this.positions=[n??za.defaults.positions[0],this.stopPosition??za.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(n){this.positions=[this.startPosition??za.defaults.positions[0],n??za.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(n,e){if(super(),!n.viewer)return;const s=this.ad(new lt(n,e));s.arcType="RHUMB";const o=this.ad(new nr(n,e));this.ad(E.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(E.track([o,"allowPicking"],[this,"allowPicking"]));{const i=()=>{s.show=o.show=this.show};i(),this.ad(this.showChanged.don(i))}{const i=()=>{s.width=this.width/2,o.pixelSize=this.width};i(),this.ad(this.widthChanged.don(i))}{const i=()=>{s.color=o.color=this.color};i(),this.ad(this.colorChanged.don(i))}{const i=()=>{s.positions=this.positions,o.position=this.stopPosition};i(),this.dispose(this.startPositionChanged.disposableOn(i)),this.dispose(this.stopPositionChanged.disposableOn(i))}}};N(za,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Ia=za;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:E.reactPositions(t.defaults.positions),width:10,color:E.reactArray([1,0,0,1])})})(Ia||(Ia={})),E.extendClassProps(Ia.prototype,Ia.createDefaultProps);class Fi extends $n{constructor(e){super();N(this,"_lastPosition");N(this,"_opInfo",{step:this.ad(E.react(!1)),moved:this.ad(E.react(!1)),constraintMode:this.disposeVar(E.react("none")),originPosition:this.disposeVar(E.reactArray([0,0,0])),originHeading:this.disposeVar(E.react(0)),originDimensions:this.disposeVar(E.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(E.reactArray([0,0,0])),movingPosition:this.disposeVar(E.reactArray([0,0,0])),targetPosition:this.disposeVar(E.reactArray([0,0,0])),targetHeading:this.disposeVar(E.react(0))});N(this,"_scaleAxis");N(this,"_pickingXYProcessing",e=>this.disposeVar(new E.Processing((r,s,o)=>{const i=[0,0,0],a=new F.Cartographic;return e.pointerMoveEvent.disposableOn(l=>{if(!l.pointerEvent||!e.viewer)return;const h=pr(E.getDomEventCurrentTargetPos(l.pointerEvent));if(!ja(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Qa(a,i),this._opInfo.constraintMode.value==="x"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value,i,i):this._opInfo.constraintMode.value==="y"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,i,i):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=i,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const f=[0,0,0];Q.geoRhumbDestination(i,o,s,f),this._opInfo.targetPosition.value=f;let u=this.scale[0],A=this.scale[1];const v=Q.geoDistance(f,this._opInfo.originPosition.value)-Q.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...f];const g=this._opInfo.originDimensions.value[0]/100;v!=0&&this._opInfo.constraintMode.value==="y"&&(v>0?u+=g:u-=g),v!=0&&this._opInfo.constraintMode.value==="x"&&(v>0?A+=g:A-=g),u<=0&&(u+=g),A<=0&&(A+=g),this.scale=[u??1,A??1,this.scale[2]??1]})})));N(this,"_pickingZProcessing",e=>this.disposeVar(new E.Processing(()=>{const r=new F.Cartesian3,s=[0,0,0];return e.pointerMoveEvent.disposableOn(o=>{if(!o.pointerEvent||!e.viewer)return;const i=pr(E.getDomEventCurrentTargetPos(o.pointerEvent));if(!Hh(e.viewer.scene,Tt(this._opInfo.originPosition.value),i,r))return;this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(He(r,s)){this._opInfo.movingPosition.value=s;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],s[2]+a];let h=this.scale[2];const f=s[2]-this._lastPosition[2];this._lastPosition=[...s];const u=this._opInfo.originDimensions.value[0]/100;f!=0&&(f>0?h+=u:h-=u),h<=0&&(h+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,h??1]}})})));const r=e.viewer;if(!r)return;const{scene:s}=r;this.ad(new zp(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:f,yAxis:u,xAxis:A}=this._scaleAxis,v=this._opInfo.constraintMode.value,g=this._opInfo.step;f.color=[0,0,1,.99],u.color=[0,1,0,.99],A.color=[1,0,0,.99],v==="x"?A.color=g?[1,1,0,.8]:[1,1,0,.99]:v==="y"?u.color=g?[1,1,0,.8]:[1,1,0,.99]:v==="z"&&(f.color=g?[1,1,0,.8]:[1,1,0,.99])};h(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(h)),this.dispose(this._opInfo.step.changed.disposableOn(h))}{const h=()=>{if(!this._scaleAxis)return;const{position:u=Fi.defaults.position}=this,{zAxis:A,yAxis:v,xAxis:g}=this._scaleAxis;A.startPosition=v.startPosition=g.startPosition=u;const[m,p,d]=u;A.stopPosition=[m,p,d+this._opInfo.originDimensions.value[2]];const c=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);c&&(g.stopPosition=c);const y=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);y&&(v.stopPosition=y)};h();const f=this.ad(E.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(f.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((f,u)=>f===this._opInfo.targetPosition.value[u])){this._opInfo.moved.value=!0;return}};h(),this.dispose(this._opInfo.originHeading.changed.disposableOn(h)),this.dispose(this._opInfo.originPosition.changed.disposableOn(h)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(h)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(h))}const o=this._pickingXYProcessing(e),i=this._pickingZProcessing(e),a=this.disposeVar(E.createProcessingFromAsyncFunc(async h=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await E.step(h,async f=>{const u=()=>{const g=[...this.position??Fi.defaults.position];e.editingHeightOffset&&(g[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=g};f.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const A={constraintMode:"none",startDragPos:[0,0,0]},v=g=>{if(!this.position)return;const m={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Pp(g,s,m,this.axisSnapPixelSize,A),this._opInfo.constraintMode.value=A.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=A.startDragPos};f.disposer.dispose(e.pointerMoveEvent.disposableOn(g=>{g.pointerEvent&&v(g.pointerEvent)})),await E.step(f,g=>new Promise((m,p)=>{g.disposer.dispose(p),g.disposer.dispose(e.pointerDownEvent.don(d=>{d.pointerEvent&&v(d.pointerEvent),d.pointerEvent&&d.pointerEvent.button===0&&A.constraintMode!=="none"&&m()}))}))}),this._opInfo.step.value=!1,await E.step(h,async f=>{if(e.incrementDisabledInputStack(),f.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const u=Q.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),A=Q.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);o.restart(void 0,u,A),f.disposer.dispose(()=>o.cancel())}else this._opInfo.constraintMode.value==="z"&&(i.restart(),f.disposer.dispose(()=>i.cancel()));await E.step(f,u=>new Promise((A,v)=>{u.disposer.dispose(v),u.disposer.dispose(e.pointerUpEvent.don(()=>{A()})),u.disposer.dispose(e.pointerOutEvent.don(()=>{A()}))})),this._lastPosition=void 0});while(!0)})),l=()=>{this.enabled?a.restart():a.isRunning&&a.cancel()};l(),this.dispose(this.enabledChanged.disposableOn(l))}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,r){const s=this.ad(new Ia(e));return s.width=10,this.ad(E.track([s,"show"],[this,"enabled"])),s}}(t=>{t.createDefaultProps=()=>({...$n.createDefaultProps(),scale:E.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(Fi||(Fi={})),E.extendClassProps(Fi.prototype,Fi.createDefaultProps);const Vo=class Vo extends En{constructor(e){super();N(this,"_editingPoints",this.disposeVar(new E.ObservableArray));N(this,"_cancelEvent",this.disposeVar(new E.Event));N(this,"_currentProcess");N(this,"_menuPoiEnabled",this.disposeVar(E.react(!1)));N(this,"_status",this.disposeVar(E.react("None")));N(this,"_positionsChanged",this.ad(new E.Event));N(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(r=>{for(let{start:s,deleteCount:o,items:i}of r){for(const a of i)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=s;a<s+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let r of this.editingPoints)r.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(r=>{this.ad(E.nextAnimateFrame(()=>{var s;((s=r.pointerEvent)==null?void 0:s.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(r=>{this._currentProcess&&(r?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const r=()=>{this.polylineShow=this.czmViewer.editingLineShow};r(),this.ad(this.czmViewer.editingLineShowChanged.don(r))}}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 r of this._editingPoints)r.position&&e.push([...r.position]);return e}resetPositions(e){if(this.enabled??Vo.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const r=e||[];return!(r.length===this.editingPoints.length&&r.every((s,o)=>s.every((i,a)=>{const l=this.editingPoints.get(o);return l.position&&l.position[a]===i})))}forceResetPositions(e){(this.enabled??Vo.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 r=this.ad(new lt(e));this.ad(E.track([r,"color"],[this,"polylineColor"])),this.ad(E.track([r,"width"],[this,"polylineWidth"])),this.ad(E.track([r,"show"],[this,"polylineShow"])),this.ad(E.track([r,"arcType"],[this,"polylineArcType"])),this.ad(E.track([r,"loop"],[this,"loop"]));{const s=()=>{const o=[];for(const i of this.getPositions())i[2]-=e.editingHeightOffset??0,o.push(i);r.positions=o};s(),this.ad(this.positionsChanged.don(s))}}_createCursorInfo(e){const r=this._cursorInfo=this.ad(new E.CursorInfo(e.container,E.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const s=this.status;if(r){if(!this.hideCursorInfo){r.show=!1;return}s==="Adding"?(r.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",r.show=!0):s==="Modifying"||s==="Modifying_Point"?(r.text="Esc键或左键双击:退出编辑状态",r.show=!0):s==="None"&&(r.text="",r.show=!1)}}))}};N(Vo,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),N(Vo,"defaults",{...En.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:Vo.baseImageUrl+"point-green.png",otherControlPointImageUrl:Vo.baseImageUrl+"point-yellow.png"});let cr=Vo;(t=>{t.createDefaultProps=()=>({...En.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:E.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})})(cr||(cr={})),E.extendClassProps(cr.prototype,cr.createDefaultProps);let Sj=0;class m2 extends E.Destroyable{constructor(e,r){super();N(this,"_position",this.disposeVar(E.reactArrayWithUndefined(void 0)));N(this,"_id",Sj++);N(this,"_menuPoi");r&&(this.position=r),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const s=this._menuPoi=this.ad(new os(e.czmViewer));s.enabled=!1,this.ad(E.track([s,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){s.position=void 0;return}const i=[...this.position];i[2]-=e.czmViewer.editingHeightOffset??0,s.position=i,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const i=e.editingPoints.indexOf(this)+1;i!==0&&(s.title=`控制点${i}`,i===1?s.imageUri=e.firstControlPointImageUrl??cr.defaults.firstControlPointImageUrl:s.imageUri=e.otherControlPointImageUrl??cr.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 y2 extends m2{constructor(n,e){super(n,e)}}class Lt extends cr{constructor(e){super(e);N(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new E.Event));N(this,"placeEditing");if(!e.viewer)return;const r=this.placeEditing=this.ad(new Sr(e));r.enabled=!1,this.currentProcess=this.disposeVar(E.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??Lt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??Lt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await s.promise(E.step(s,async o=>{const i=o.disposer,a=i.ad(this._addingEditingProcessing());i.dispose(()=>"adding canceled!"),i.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(l=>{i.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const r=e?e.map(s=>new y2(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...r),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??Lt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},r=E.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(E.step(s,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new Ej(this,o)));const f=a.disposer.disposeVar(new Tj(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>f.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(A=>{A?(o++,u(!0)):u(!1)})),a.disposer.dispose(f.overEvent.disposableOnce(A=>{A?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return r.start(),r}}(t=>{t.createDefaultProps=()=>({...cr.createDefaultProps()})})(Lt||(Lt={})),E.extendClassProps(Lt.prototype,Lt.createDefaultProps);class Ej extends E.Destroyable{constructor(e,r){super();N(this,"_overEvent",this.disposeVar(new E.Event));const{placeEditing:s}=e;let o=new y2(e,void 0);e.editingPoints.splice(r,0,o);const i=()=>{(e.debug??Lt.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(s.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(E.track([o,"position"],[s,"position"])),s.enabled=!0;let a=!1;const l=()=>{i(),this._overEvent.emit(!1)};this.dispose(()=>{s.enabled=!1,!a&&l()}),this.dispose(s.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??Lt.defaults.debug)&&console.log(`PointAdding creating! index(${r})`),this.dispose(()=>{(e.debug??Lt.defaults.debug)&&console.log(`PointAdding destroying! index(${r})`)})}get overEvent(){return this._overEvent}}function Pj(t,n){const e=t.editingPoints,r=n-1;return r<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(r,1),!0)}class Tj extends E.Destroyable{constructor(e,r){super();N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"_doEvent",this.disposeVar(new E.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(Pj(e,r)))),(e.debug??Lt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${r})`),this.dispose(()=>{(e.debug??Lt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${r})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class g2 extends Lt{constructor(n){super(n),this.loop=!1}}class v2 extends Lt{constructor(n){super(n),this.loop=!0}}class Ap extends m2{constructor(n,e){super(n,e);{const{menuPoi:r}=this;r.commands=[["add","增加控制点","",ht.baseImageUrl+"add.png"],["delete","删除当前控制点","",ht.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ht.baseImageUrl+"modify.png"]],r.clickCommandName="modify",r.rightClickCommandName="delete",this.dispose(r.commandEvent.disposableOn(s=>{n.menuPoiCommand(this,s)})),this.dispose(r.dbclickEvent.disposableOn(()=>{n.menuPoiCommand(this,"dbClick")}))}if(n.middlePointShow){const r=this.ad(new Rr(n.czmViewer));{r.imageUri=n.firstControlPointImageUrl??ht.defaults.firstControlPointImageUrl,r.tooltip="点击增加一个控制点",r.bgColor=[0,0,0,.6],r.fgColor=[1,1,1,1],r.size=[8,8],r.originRatioAndOffset=[.5,.5,0,0];{const s=()=>{if(!(n.enabled??ht.defaults.enabled)){r.enabled=!1,r.show=!1;return}do{const i=n.editingPoints.indexOf(this);if(i===-1)break;const a=n.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(n.loop??ht.defaults.loop)&&i+1>=a)break;const h=this.position;if(!h)break;let f=(i+1)%a;const A=n.editingPoints.get(f).position;if(!A)break;const v=Fp(h,A);if(!v)break;v[2]-=n.czmViewer.editingHeightOffset??0,r.position=v;const g=n.editingPoints.length<(n.maxPointsNum??ht.defaults.maxPointsNum);r.enabled=g,r.show=g;return}while(!1);r.enabled=!1,r.show=!1};s(),this.dispose(n.positionsChanged.disposableOn(s)),this.dispose(n.loopChanged.disposableOn(s)),this.dispose(n.enabledChanged.disposableOn(s))}this.dispose(r.clickEvent.disposableOn(s=>{if(s.button!==0||n.editingPoints.length>=(n.maxPointsNum??ht.defaults.maxPointsNum))return;const o=n.editingPoints.indexOf(this);if(o===-1)return;const i=r.position?[...r.position]:void 0;i&&(i[2]+=n.czmViewer.editingHeightOffset??0);let a=new Ap(n,i);n.editingPoints.splice(o+1,0,a),n.modify(a)}))}}}}class ht extends cr{constructor(e){super(e);N(this,"_menuPoiCommand",this.disposeVar(new E.Event));N(this,"_forceModifyPosEditorEvent",this.disposeVar(new E.Event));N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"translationEditing");{const s=this.ad(E.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new E.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new Bj(this.editingPoints.get(0),this)}))}const r=this.translationEditing=this.disposeVar(new Ii(e));r.enabled=!1,this.currentProcess=this.disposeVar(E.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??ht.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??ht.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await s.promise(E.step(s,async i=>{const a=i.disposer,l=a.ad(new Ij(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(f=>l.modify(f))),await i.promise(new Promise(f=>{a.dispose(l.overEvent.disposableOnce(u=>{f(u)}))}))})),o===-1){(this.debug??ht.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??ht.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??ht.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let l=o%this.editingPoints.length;const f=this.editingPoints.get(l).position;if(!f)return;const u=Fp(a,f);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let A=new Ap(this,u);this.editingPoints.splice(o,0,A)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,r){this._menuPoiCommand.emit(e,r)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const r=e?e.map(s=>new Ap(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...r),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...cr.createDefaultProps(),moveWithFirstPosition:!1})})(ht||(ht={})),E.extendClassProps(ht.prototype,ht.createDefaultProps);class Bj extends E.Destroyable{constructor(n,e){super(),this._firstPositionEditor=n,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((r,s)=>{if(r===void 0||s===void 0)return;var o=[r[0]-s[0],r[1]-s[1],r[2]-s[2]];const i=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<i;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 Ij extends E.Destroyable{constructor(e){super();N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"_cancelEvent",this.disposeVar(new E.Event));N(this,"_forceModifyPosEditorEvent",this.disposeVar(new E.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let r;const s=()=>{r==null||r.destroy(),r=void 0,e.status="Modifying"};this.dispose(s);const o=i=>{s(),e.status="Modifying_Point",r=new Fj(e,i),r.dispose(r.overEvent.disposableOn(()=>{s()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((i,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const l=e.editingPoints.indexOf(i);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(l,1)}else if(a==="modify")o(i);else if(a==="add"){const l=e.editingPoints.indexOf(i);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 Fj extends E.Destroyable{constructor(e,r){super();N(this,"_overEvent",this.disposeVar(new E.Event));this._modifying=e,this._posEditor=r,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:s}=this._modifying;if(s.enabled=!0,s.heading=0,this.dispose(()=>{s.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");s.position=this._posEditor.position,this.dispose(E.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class w2 extends ht{constructor(n){super(n),this.loop=!1}}class b2 extends ht{constructor(n){super(n),this.loop=!0}}class ul extends Lt{init(){const n=this.startPosition;if(!n)return;const e=this.distance,r=this.rotation,s=e*Math.cos(r[1]*Math.PI/180),o=Q.geoDestination(n,s,r[0]);if(!o){this.positions=[n];return}const i=e*Math.sin(r[1]*Math.PI/180);o[2]+=i,this.positions=[n,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=o)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const r=Q.geoHeading(this.startPosition,this.endPosition),s=Q.geoDistance(this.startPosition,this.endPosition);if(s<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],i=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[r,i,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Lt.createDefaultProps(),startPosition:E.reactArrayWithUndefined(void 0),endPosition:E.reactArrayWithUndefined(void 0),rotation:E.reactArray([90,0,0]),distance:E.react(1)})})(ul||(ul={})),E.extendClassProps(ul.prototype,ul.createDefaultProps);class Fa extends ht{init(){const n=this.startPosition;if(!n)return;const e=this.distance,r=this.rotation,s=e*Math.cos(r[1]*Math.PI/180),o=Q.geoDestination(n,s,r[0]);if(!o){this.positions=[n];return}const i=e*Math.sin(r[1]*Math.PI/180);o[2]+=i,this.positions=[n,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=o)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",ht.baseImageUrl+"add.png"],["delete","删除当前控制点","",ht.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ht.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","删除当前控制点","",ht.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ht.baseImageUrl+"modify.png"]];const r=Q.geoHeading(this.startPosition,this.endPosition),s=Q.geoDistance(this.startPosition,this.endPosition);if(Math.abs(s)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],i=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[r,i,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...ht.createDefaultProps(),startPosition:E.reactArrayWithUndefined(void 0),endPosition:E.reactArrayWithUndefined(void 0),rotation:E.reactArray([0,0,0]),distance:E.react(0)})})(Fa||(Fa={})),E.extendClassProps(Fa.prototype,Fa.createDefaultProps);class _2 extends Lt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1}}class x2 extends ht{constructor(n){super(n),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class cl extends Lt{constructor(n){super(n),n.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const r=[...this.positions[0]];r[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=n.editingHeightOffset??0,[r,s]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(n){const e=this.ad(new gr(n));e.topOrBottom="bottom",this.ad(E.track([e,"color"],[this,"polylineColor"])),this.ad(E.track([e,"width"],[this,"polylineWidth"])),this.ad(E.track([e,"show"],[this,"polylineShow"])),this.ad(E.track([e,"arcType"],[this,"polylineArcType"])),this.ad(E.track([e,"loop"],[this,"loop"])),this.ad(E.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Lt.createDefaultProps(),visibilityPositions:E.reactPositionsSet(void 0)})})(cl||(cl={})),E.extendClassProps(cl.prototype,cl.createDefaultProps);class hl extends ht{constructor(n){if(super(n),!!n.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const r=[...this.positions[0]];r[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=n.editingHeightOffset??0,[r,s]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(n){const e=this.ad(new gr(n));e.topOrBottom="bottom",this.ad(E.track([e,"color"],[this,"polylineColor"])),this.ad(E.track([e,"width"],[this,"polylineWidth"])),this.ad(E.track([e,"show"],[this,"polylineShow"])),this.ad(E.track([e,"arcType"],[this,"polylineArcType"])),this.ad(E.track([e,"loop"],[this,"loop"])),this.ad(E.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...ht.createDefaultProps(),visibilityPositions:E.reactPositionsSet(void 0)})})(hl||(hl={})),E.extendClassProps(hl.prototype,hl.createDefaultProps);class C2 extends Fa{constructor(n){super(n),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.zAxisShow=!0,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class vn extends Q.EngineObject{constructor(e,r,s){super(e,r,s??!0);N(this,"_supportEditing",this.disposeVar(E.react(!0)));N(this,"_currentEditing",this.disposeVar(E.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var o;if(this.currentEditing){if(this.currentEditing instanceof Lt&&((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 Sr&&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 Ch=class Ch extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new Sr(e));this.ad(e.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)==2&&(r.enabled=!0)}));do{if(Reflect.has(n,"position")){this.ad(E.bind([r,"position"],[n,"position"])),r.enabled=!r.position||Q.equalsN3(r.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};N(Ch,"type",Ch.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Place,Ch));let V0=Ch;const Sh=class Sh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new Er(e));r.rotation=[90,0,0],this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const s=e.getEngineObject(n);s&&(this.ad(E.bind([r,"position"],[s.czm3DTiles,"position"])),this.ad(E.bind([r,"selfRotation"],[n,"rotation"])))});break}if(Reflect.has(n,"position")&&Reflect.has(n,"rotation")){this.ad(E.bind([r,"position"],[n,"position"])),this.ad(E.bind([r,"selfRotation"],[n,"rotation"]));break}this.supportEditing=!1}while(!1)}};N(Sh,"type",Sh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Rotation,Sh));let Q0=Sh;const Eh=class Eh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new Fi(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")&&Reflect.has(n,"scale")){this.ad(E.bind([r,"position"],[n,"position"])),this.ad(E.bind([r,"scale"],[n,"scale"]));break}this.supportEditing=!1}while(!1)}};N(Eh,"type",Eh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Scale,Eh));let H0=Eh;const Ph=class Ph extends vn{constructor(n,e){super(Array.isArray(n)?n[0]:n,e,!0);const r=this.currentEditing=this.ad(new Ii(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(n)){const s=[];for(let o=0;o<n.length;o++){const i=n[o];Reflect.has(i,"position")?s.push(i.position):i.points&&s.push(...i.points)}r.position=Q.getMinMaxCorner(s).center,this.ad(r.positionChanged.disposableOn((o,i)=>{if(!(!o||!i)){var a=Tn({originPosition:i},[o])[0][0];n.forEach(l=>{if(Reflect.has(l,"position")){const h=Tn({originPosition:i},[l.position])[0][0];l.position=Vi({originPosition:i},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const h=Tn({originPosition:i},l.points)[0];l.points=Vi({originPosition:i},h.map(f=>[f[0]+a[0],f[1]+a[1],f[2]+a[2]]))[0]}})}}));break}if(Reflect.has(n,"position")){this.ad(E.bind([r,"position"],[n,"position"]));break}if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const s=e.getEngineObject(n);this.ad(E.bind([r,"position"],[s.czm3DTiles,"position"]))});break}if(Reflect.has(n,"points")){if(n.points===void 0||n.points.length===0){this.destroy();break}r.position=Q.getMinMaxCorner(n.points).center,this.ad(r.positionChanged.disposableOn((s,o)=>{if(s===void 0||o===void 0||n.points===void 0||n.points.length===0){this.destroy();return}var i=Tn({originPosition:o},[s])[0][0];const a=Tn({originPosition:o},n.points)[0];n.points=Vi({originPosition:o},a.map(l=>[l[0]+i[0],l[1]+i[1],l[2]+i[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};N(Ph,"type",Ph.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Translation,Ph));let mp=Ph;const Th=class Th extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new ul(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")){this.ad(E.bind([r,"startPosition"],[n,"position"])),this.ad(jt([r,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(E.bind([r,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(E.bind([r,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(E.bind([r,"distance"],[n,"distance"]));break}const s=Tt(n.position);if(F.Cartesian3.ZERO.equals(s)||!e.viewer)return;r.distance=ii(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1);r.startPosition&&!Q.equalsN3(r.startPosition,[0,0,0])&&r.init(),r.enabled=!0}};N(Th,"type",Th.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsAppend,Th));let j0=Th;const Bh=class Bh extends vn{constructor(n,e){var o;if(super(n,e,!0),!e.viewer)return;const r=this.currentEditing=this.ad(new Fa(e));do{if(Reflect.has(n,"position")){this.ad(E.bind([r,"startPosition"],[n,"position"])),this.ad(jt([r,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(E.bind([r,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(E.bind([r,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(E.bind([r,"distance"],[n,"distance"]));break}const i=Tt(n.position);if(F.Cartesian3.ZERO.equals(i)||!e.viewer)return;r.distance=ii(e.viewer.scene,i,100)??1}while(!1);break}if(Reflect.has(n,"points")&&((o=n.points)==null?void 0:o.length)==2){r.moveWithFirstPosition=!1;const i=()=>r.positions=n.points??[];i(),this.ad(n.pointsChanged.don(()=>!r.enabled&&i())),this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1;return}while(!1);r.init(),r.enabled=!0;const s=this.ad(E.createNextAnimateFrameEvent(r.enabledChanged,r.startPositionChanged));this.ad(s.don(()=>{(!r.enabled||!r.startPosition||Q.equalsN3(r.startPosition,[0,0,0]))&&this.destroy()}))}};N(Bh,"type",Bh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsModify,Bh));let G0=Bh;const Ih=class Ih extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new v2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Ih,"type",Ih.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularAppend,Ih));let W0=Ih;const Fh=class Fh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new b2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Fh,"type",Fh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularInsert,Fh));let q0=Fh;const kh=class kh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new g2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(kh,"type",kh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringAppend,kh));let K0=kh;const Mh=class Mh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new w2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Mh,"type",Mh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringInsert,Mh));let X0=Mh;const Oh=class Oh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new _2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Oh,"type",Oh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterAppend,Oh));let $0=Oh;const Dh=class Dh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new x2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Dh,"type",Dh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterModify,Dh));let Z0=Dh;const Rh=class Rh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new cl(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Rh,"type",Rh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityAppend,Rh));let Y0=Rh;const Uh=class Uh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new hl(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Uh,"type",Uh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityModify,Uh));let J0=Uh;const Lh=class Lh extends vn{constructor(n,e){if(super(n,e,!0),!e.viewer)return;const r=this.currentEditing=this.ad(new C2(e));do{if(Reflect.has(n,"points")){const o=Reflect.has(n,"extrudedHeight"),i=Reflect.has(n,"height"),a=Reflect.has(n,"perPositionHeight")?n.perPositionHeight:!o,l=n instanceof Q.ESClassification||n instanceof Q.ESPolygonFence;let h=Q.getMinMaxCorner(n.points).center,f=[...h],u=l?n.points[0][2]:0;a?o?f[2]=n.extrudedHeight:f[2]=n.height+u:(i&&(h[2]=n.height),o&&(f[2]=n.extrudedHeight)),r.startPosition=h,r.distance=f[2]-h[2],r.moveWithFirstPosition=!1;let A=[...h];this.ad(r.positionsChanged.don(()=>{r.positions.length===2&&(a?(n.points=n.points.map(v=>[v[0],v[1],v[2]+r.positions[0][2]-A[2]]),o?n.extrudedHeight=r.positions[1][2]:i&&(n.height=r.positions[1][2]-(l?r.positions[0][2]:0))):(i&&(n.height=r.positions[0][2]),o&&(n.extrudedHeight=r.positions[1][2])),A=[...r.positions[0]])}));break}this.supportEditing=!1;return}while(!1);r.init(),r.enabled=!0;const s=this.ad(E.createNextAnimateFrameEvent(r.enabledChanged,r.startPositionChanged));this.ad(s.don(()=>{(!r.enabled||!r.startPosition||Q.equalsN3(r.startPosition,[0,0,0]))&&this.destroy()}))}};N(Lh,"type",Lh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.HeightModify,Lh));let ew=Lh;function S2(){const t=E.createProcessingFromAsyncFunc(async(n,e,r,s,o=!0)=>{const i=Array.isArray(s)?[...s]:[s],a=r.editingID;e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"start",add:{modes:i}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"end",add:{modes:i}}),t.isRunning&&t.cancel()};n.disposer.ad(l),n.disposer.ad(r.toDestroyEvent.don(l)),n.disposer.ad(e.keyDownEvent.don(f=>{f.code=="Escape"&&l()}));let h=0;do{const f=i[h%i.length],u=await E.step(n,async A=>{const v=A.disposer,g=Q.EngineObject.contextEditing.getEngineObjConstructor(f,e.typeName);if(!g||!r.supportEditingModes().includes(f))return console.log(`未找到编辑模式或不支持当前编辑模式${f},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:f,cIndex:h}}),e.notSupportEditingCount++,!1;const m=new g(r,e);if(v.ad(()=>{!m.isDestroyed()&&m.destroy()}),m.supportEditing)e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"changed",add:{cMode:f,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${f},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:f,cIndex:h}}),e.notSupportEditingCount++,!1;return await A.promise(new Promise(d=>{m.isDestroyed()&&d(!1),v.ad(m.toDestroyEvent.don(()=>{console.log(`编辑模式${f}结束`),d(!1)})),o&&(v.ad(e.keyDownEvent.don(c=>{c.code=="Space"&&(console.log(`编辑模式${f}结束`),d(!1))})),v.ad(e.dblclickEvent.don(()=>d(!0))))}))});if(o&&u||!o&&h==i.length-1||e.notSupportEditingCount==i.length)break;h++}while(!0)});return t}function E2(){const t=E.createProcessingFromAsyncFunc(async(n,e,r,s)=>{e.editingEvent.emit({objectIDs:r.map(a=>a.id.split("_")[0]),editingID:s,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:r.map(a=>a.id.split("_")[0]),editingID:s,type:"end"}),t.isRunning&&t.cancel()};n.disposer.ad(o),n.disposer.ad(e.keyDownEvent.don(a=>{a.code=="Escape"&&o()}));const i=new mp(r,e);n.disposer.ad(()=>{!i.isDestroyed()&&i.destroy()}),await n.promise(new Promise(a=>{i.isDestroyed()&&a(),n.disposer.ad(i.toDestroyEvent.don(()=>{console.log("移动结束"),a()})),n.disposer.ad(e.dblclickEvent.don(()=>a()))}))});return t}ue.copyright=void 0;try{const t="earthsdk3-cesium",n="3.0.7-beta.15",e="2025-06-10T07:22:29.000Z",r="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="aecd0d3d9b7e380d41df5f4fece5d8ed811d6ff2",a=((Date.now()-1749540149e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${n}.${o.slice(0,8)}.${e} (距今${a}个小时)
|
|
4897
|
+
`,uniformMap:{u_color:[1,1,0,1]},name:"CzmCustomPrimitive_47fd",attributes:{position:{typedArray:{type:"Float32Array",array:[0,0,0,0,0,1]},componentsPerAttribute:3}}},mt,t)}class Cj extends E.HasOwner{constructor(n){super(n);const{czmViewer:e}=this.owner;let r;this.dispose(()=>this.owner.hoveredPlaneType="none");const s=this._createRotatorMoveProcessing();this.dispose(e.pointerMoveEvent.disposableOn(o=>{const i=r=this._getStartInfo(o.pointerEvent);i&&(this.owner.hoveredPlaneType=i.currentPlaneType)})),this.dispose(e.pointerDownEvent.disposableOn(o=>{r&&r.currentPlaneType!=="none"&&(s.restart(void 0,e,r),r=void 0)})),this.dispose(e.dblclickEvent.disposableOn(o=>{do{const i=this._getStartInfo(o.pointerEvent);if(!i||i.currentPlaneType==="none")break;const{currentPlaneType:a}=i,l=[...this.owner.selfRotation];l[Er.rotationNum[a]]=0,this.owner.selfRotation=l;return}while(!1);this.owner.enabled=!1}))}_createRotatorMoveProcessing(){return this.ad(E.createProcessingFromAsyncFunc(async(n,e,r)=>{const s=this.owner.circles[r.currentPlaneType];e.incrementDisabledInputStack(),n.disposer.dispose(()=>e.decrementDisabledInputStack()),n.disposer.dispose(e.pointerMoveEvent.don(o=>{if(r&&o.pointerEvent){const{offsetX:i,offsetY:a}=o.pointerEvent,l=[i,a],{currentPlaneType:h}=r;if(h==="none")return;const f=this.owner.getPlane(h);if(!r.currentV)return;const u=f.pick(l);if(!u||!this.owner.cartesian)return;const A=F.Cartesian3.subtract(r.currentV,this.owner.cartesian,new F.Cartesian3);F.Cartesian3.normalize(A,A);const v=F.Cartesian3.subtract(u,this.owner.cartesian,new F.Cartesian3);if(F.Cartesian3.normalize(v,v),!f.normal||!f.origin)return;const g=N0(A,v,f.normal),m=N0(f.origin,A,f.normal),p=N0(f.origin,v,f.normal);{const d=[...this.owner.selfRotation];d[Er.rotationNum[h]]=r.startRotation+g,this.owner.selfRotation=d,s.circleStartRotation=m,s.circleEndRotation=p}}})),this.owner.movingPlaneType=r.currentPlaneType,n.disposer.dispose(()=>{this.owner.movingPlaneType="none"}),n.disposer.dispose(()=>{s.circleStartRotation=0,s.circleEndRotation=0}),await E.step(n,o=>new Promise((i,a)=>{o.disposer.dispose(a),o.disposer.dispose(e.pointerUpEvent.don(()=>{i()})),o.disposer.dispose(e.pointerOutEvent.don(()=>{i()}))}))}))}_pickPlane(n,e,r,s,o){const i=this.owner.cartesian;if(!i)return;const{selfRotation:a}=this.owner,l=this.owner.getPlane(r).pick(s);if(!l)return;const h=F.Cartesian3.distance(i,l),f=o/4,u=f*3/128;if(!(h>=f-u&&h<=f+u))return;const v=F.Cartesian3.distance(e.camera.positionWC,l);n.currentD2c<=v||(n.currentPlaneType=r,n.currentD2c=v,n.currentV=l,n.startRotation=a[Er.rotationNum[r]])}_getStartInfo(n){var f;const{czmViewer:e}=this.owner,r=(f=e.viewer)==null?void 0:f.scene;if(!this.owner.position||!this.owner.cartesian)return;const s=ii(r,this.owner.cartesian,this.owner.pixelSize);if(!s)return;const{offsetX:o,offsetY:i}=n,a=[o,i],l=n.pointerId,h={currentPlaneType:"none",currentD2c:Number.POSITIVE_INFINITY,currentV:void 0,startRotation:0,pointerId:l};return this._pickPlane(h,r,"heading",a,s),this._pickPlane(h,r,"pitch",a,s),this._pickPlane(h,r,"roll",a,s),h}}function N0(t,n,e){const r=F.Cartesian3.cross(n,t,new F.Cartesian3);if(r.equals(F.Cartesian3.ZERO))return 0;F.Cartesian3.normalize(r,r);const s=F.Cartesian3.dot(r,e);let o=Math.acos(F.Cartesian3.dot(t,n))*180/Math.PI;return o=s>0?o:-o,o}const La=class La extends $n{constructor(e){super();N(this,"_hoveredPlaneType",this.disposeVar(E.react("none")));N(this,"_movingPlaneType",this.disposeVar(E.react("none")));N(this,"_circles");N(this,"_czmCameraModel");N(this,"_cartesian");N(this,"_planes",{heading:this.disposeVar(new vj(this)),pitch:this.disposeVar(new wj(this)),roll:this.disposeVar(new bj(this))});N(this,"_rotatorRunningResetting");this._czmViewer=e;const r=this._czmViewer;if(this._rotatorRunningResetting=this.disposeVar(new E.ObjResettingWithEvent(this.enabledChanged,()=>{if(this.enabled)return new Cj(this)})),this._circles={heading:this._createRotatorCircle(r,"heading"),pitch:this._createRotatorCircle(r,"pitch"),roll:this._createRotatorCircle(r,"roll")},!!r.viewer){{const o=()=>{this._cartesian=this.position&&Tt(this.position)||void 0};o(),this.dispose(this.positionChanged.disposableOn(o))}this._createCameraModel(r)}}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 tn(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(E.track([this._czmCameraModel,"pixelSize"],[this,"pixelSize"],r=>r*.1)),this.dispose(E.track([this._czmCameraModel,"position"],[this,"position"])),this.dispose(E.track([this._czmCameraModel,"rotation"],[this,"rotation"]));{const r=()=>{const s=At({rotation:this.selfRotation});if(!s)throw new Error("!rm");this._czmCameraModel&&(this._czmCameraModel.localModelMatrix=F.Matrix4.toArray(s))};r(),this.dispose(this.selfRotationChanged.disposableOn(r))}{const r=()=>{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)};r(),this.dispose(this.enabledChanged.disposableOn(r)),this.dispose(this.showHelperChanged.disposableOn(r))}}_createRotatorCircle(e,r){const s=this.ad(new ll(e));this.dispose(E.track([s,"position"],[this,"position"])),this.dispose(E.track([s,"pixelSize"],[this,"pixelSize"])),this.dispose(E.track([s,"debug"],[this,"debug"])),this.dispose(E.track([s,"rotation"],[this,"rotation"]));{const o=()=>{s.selfRotation=La.rotationFuncs[r](this.selfRotation),s.circleRotation=this.selfRotation[La.rotationNum[r]]};o(),this.dispose(this.selfRotationChanged.disposableOn(o))}{const o=()=>{const i=this.movingPlaneType===r,a=this.hoveredPlaneType===r,h=[0,0,0,i||a?1:.8];h[La.rotationNum[r]]=1,s.color=h};o(),this.dispose(this.movingPlaneTypeChanged.disposableOn(o)),this.dispose(this.hoveredPlaneTypeChanged.disposableOn(o))}return s}};N(La,"rotationNum",{heading:0,pitch:1,roll:2}),N(La,"rotationFuncs",{heading:([e,r,s])=>[0,0,0],pitch:([e,r,s])=>[e,0,-90],roll:([e,r,s])=>[e,r+90,0]});let Er=La;(t=>{t.createDefaultProps=()=>({...$n.createDefaultProps(),rotation:E.reactArray([0,0,0]),selfRotation:E.reactArray([0,0,0]),pixelSize:300,showHelper:!1,debug:!1})})(Er||(Er={})),E.extendClassProps(Er.prototype,Er.createDefaultProps);const za=class za extends E.Destroyable{get startPosition(){return this.positions&&this.positions[0]}set startPosition(n){this.positions=[n??za.defaults.positions[0],this.stopPosition??za.defaults.positions[1]]}get startPositionChanged(){return this.positionsChanged}get stopPosition(){return this.positions&&this.positions[1]}set stopPosition(n){this.positions=[this.startPosition??za.defaults.positions[0],n??za.defaults.positions[1]]}get stopPositionChanged(){return this.positionsChanged}constructor(n,e){if(super(),!n.viewer)return;const s=this.ad(new lt(n,e));s.arcType="RHUMB";const o=this.ad(new nr(n,e));this.ad(E.track([s,"allowPicking"],[this,"allowPicking"])),this.ad(E.track([o,"allowPicking"],[this,"allowPicking"]));{const i=()=>{s.show=o.show=this.show};i(),this.ad(this.showChanged.don(i))}{const i=()=>{s.width=this.width/2,o.pixelSize=this.width};i(),this.ad(this.widthChanged.don(i))}{const i=()=>{s.color=o.color=this.color};i(),this.ad(this.colorChanged.don(i))}{const i=()=>{s.positions=this.positions,o.position=this.stopPosition};i(),this.dispose(this.startPositionChanged.disposableOn(i)),this.dispose(this.stopPositionChanged.disposableOn(i))}}};N(za,"defaults",{positions:[[0,0,0],[0,0,1e6]]});let Ia=za;(t=>{t.createDefaultProps=()=>({show:!0,allowPicking:!1,positions:E.reactPositions(t.defaults.positions),width:10,color:E.reactArray([1,0,0,1])})})(Ia||(Ia={})),E.extendClassProps(Ia.prototype,Ia.createDefaultProps);class Fi extends $n{constructor(e){super();N(this,"_lastPosition");N(this,"_opInfo",{step:this.ad(E.react(!1)),moved:this.ad(E.react(!1)),constraintMode:this.disposeVar(E.react("none")),originPosition:this.disposeVar(E.reactArray([0,0,0])),originHeading:this.disposeVar(E.react(0)),originDimensions:this.disposeVar(E.reactArray([1,1,1])),draggingStartPosition:this.disposeVar(E.reactArray([0,0,0])),movingPosition:this.disposeVar(E.reactArray([0,0,0])),targetPosition:this.disposeVar(E.reactArray([0,0,0])),targetHeading:this.disposeVar(E.react(0))});N(this,"_scaleAxis");N(this,"_pickingXYProcessing",e=>this.disposeVar(new E.Processing((r,s,o)=>{const i=[0,0,0],a=new F.Cartographic;return e.pointerMoveEvent.disposableOn(l=>{if(!l.pointerEvent||!e.viewer)return;const h=pr(E.getDomEventCurrentTargetPos(l.pointerEvent));if(!ja(e.viewer.scene,h,this._opInfo.originPosition.value[2],a))return;Qa(a,i),this._opInfo.constraintMode.value==="x"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value,i,i):this._opInfo.constraintMode.value==="y"?Ho(this._opInfo.originPosition.value,this._opInfo.originHeading.value+90,i,i):this._opInfo.constraintMode.value==="xy"||console.warn("should not be here!"),this._opInfo.movingPosition.value=i,this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const f=[0,0,0];Q.geoRhumbDestination(i,o,s,f),this._opInfo.targetPosition.value=f;let u=this.scale[0],A=this.scale[1];const v=Q.geoDistance(f,this._opInfo.originPosition.value)-Q.geoDistance(this._lastPosition,this._opInfo.originPosition.value);this._lastPosition=[...f];const g=this._opInfo.originDimensions.value[0]/100;v!=0&&this._opInfo.constraintMode.value==="y"&&(v>0?u+=g:u-=g),v!=0&&this._opInfo.constraintMode.value==="x"&&(v>0?A+=g:A-=g),u<=0&&(u+=g),A<=0&&(A+=g),this.scale=[u??1,A??1,this.scale[2]??1]})})));N(this,"_pickingZProcessing",e=>this.disposeVar(new E.Processing(()=>{const r=new F.Cartesian3,s=[0,0,0];return e.pointerMoveEvent.disposableOn(o=>{if(!o.pointerEvent||!e.viewer)return;const i=pr(E.getDomEventCurrentTargetPos(o.pointerEvent));if(!Hh(e.viewer.scene,Tt(this._opInfo.originPosition.value),i,r))return;this._lastPosition||(this._lastPosition=[...this._opInfo.draggingStartPosition.value]);const a=this._opInfo.originPosition.value[2]-this._opInfo.draggingStartPosition.value[2];if(He(r,s)){this._opInfo.movingPosition.value=s;const l=this._opInfo.originPosition.value;this._opInfo.targetPosition.value=[l[0],l[1],s[2]+a];let h=this.scale[2];const f=s[2]-this._lastPosition[2];this._lastPosition=[...s];const u=this._opInfo.originDimensions.value[0]/100;f!=0&&(f>0?h+=u:h-=u),h<=0&&(h+=u),this.scale=[this.scale[0]??1,this.scale[1]??1,h??1]}})})));const r=e.viewer;if(!r)return;const{scene:s}=r;this.ad(new zp(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:f,yAxis:u,xAxis:A}=this._scaleAxis,v=this._opInfo.constraintMode.value,g=this._opInfo.step;f.color=[0,0,1,.99],u.color=[0,1,0,.99],A.color=[1,0,0,.99],v==="x"?A.color=g?[1,1,0,.8]:[1,1,0,.99]:v==="y"?u.color=g?[1,1,0,.8]:[1,1,0,.99]:v==="z"&&(f.color=g?[1,1,0,.8]:[1,1,0,.99])};h(),this.dispose(this._opInfo.constraintMode.changed.disposableOn(h)),this.dispose(this._opInfo.step.changed.disposableOn(h))}{const h=()=>{if(!this._scaleAxis)return;const{position:u=Fi.defaults.position}=this,{zAxis:A,yAxis:v,xAxis:g}=this._scaleAxis;A.startPosition=v.startPosition=g.startPosition=u;const[m,p,d]=u;A.stopPosition=[m,p,d+this._opInfo.originDimensions.value[2]];const c=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[0],90);c&&(g.stopPosition=c);const y=Q.geoRhumbDestination(u,this._opInfo.originDimensions.value[1],0);y&&(v.stopPosition=y)};h();const f=this.ad(E.createNextAnimateFrameEvent(this.positionChanged,this._opInfo.originDimensions.changed));this.ad(f.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((f,u)=>f===this._opInfo.targetPosition.value[u])){this._opInfo.moved.value=!0;return}};h(),this.dispose(this._opInfo.originHeading.changed.disposableOn(h)),this.dispose(this._opInfo.originPosition.changed.disposableOn(h)),this.dispose(this._opInfo.targetHeading.changed.disposableOn(h)),this.dispose(this._opInfo.targetPosition.changed.disposableOn(h))}const o=this._pickingXYProcessing(e),i=this._pickingZProcessing(e),a=this.disposeVar(E.createProcessingFromAsyncFunc(async h=>{do this._opInfo.step.value=!0,this._opInfo.constraintMode.value="none",h.disposer.dispose(()=>{this._opInfo.constraintMode.value="none"}),await E.step(h,async f=>{const u=()=>{const g=[...this.position??Fi.defaults.position];e.editingHeightOffset&&(g[2]-=e.editingHeightOffset),this._opInfo.targetPosition.value=this._opInfo.originPosition.value=g};f.disposer.dispose((u(),this.positionChanged.disposableOn(u)));const A={constraintMode:"none",startDragPos:[0,0,0]},v=g=>{if(!this.position)return;const m={position:this.position,dimensions:this._opInfo.originDimensions.value,heading:0};Pp(g,s,m,this.axisSnapPixelSize,A),this._opInfo.constraintMode.value=A.constraintMode,this._opInfo.movingPosition.value=this._opInfo.draggingStartPosition.value=A.startDragPos};f.disposer.dispose(e.pointerMoveEvent.disposableOn(g=>{g.pointerEvent&&v(g.pointerEvent)})),await E.step(f,g=>new Promise((m,p)=>{g.disposer.dispose(p),g.disposer.dispose(e.pointerDownEvent.don(d=>{d.pointerEvent&&v(d.pointerEvent),d.pointerEvent&&d.pointerEvent.button===0&&A.constraintMode!=="none"&&m()}))}))}),this._opInfo.step.value=!1,await E.step(h,async f=>{if(e.incrementDisabledInputStack(),f.disposer.dispose(()=>e.decrementDisabledInputStack()),["x","y"].includes(this._opInfo.constraintMode.value)){const u=Q.geoRhumbHeading(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value),A=Q.geoRhumbDistance(this._opInfo.draggingStartPosition.value,this._opInfo.originPosition.value);o.restart(void 0,u,A),f.disposer.dispose(()=>o.cancel())}else this._opInfo.constraintMode.value==="z"&&(i.restart(),f.disposer.dispose(()=>i.cancel()));await E.step(f,u=>new Promise((A,v)=>{u.disposer.dispose(v),u.disposer.dispose(e.pointerUpEvent.don(()=>{A()})),u.disposer.dispose(e.pointerOutEvent.don(()=>{A()}))})),this._lastPosition=void 0});while(!0)})),l=()=>{this.enabled?a.restart():a.isRunning&&a.cancel()};l(),this.dispose(this.enabledChanged.disposableOn(l))}get scaleAxis(){return this._scaleAxis}_createScaleAxis(e,r){const s=this.ad(new Ia(e));return s.width=10,this.ad(E.track([s,"show"],[this,"enabled"])),s}}(t=>{t.createDefaultProps=()=>({...$n.createDefaultProps(),scale:E.reactArray([1,1,1]),axisPixelSize:100,axisSnapPixelSize:5})})(Fi||(Fi={})),E.extendClassProps(Fi.prototype,Fi.createDefaultProps);const Vo=class Vo extends En{constructor(e){super();N(this,"_editingPoints",this.disposeVar(new E.ObservableArray));N(this,"_cancelEvent",this.disposeVar(new E.Event));N(this,"_currentProcess");N(this,"_menuPoiEnabled",this.disposeVar(E.react(!1)));N(this,"_status",this.disposeVar(E.react("None")));N(this,"_positionsChanged",this.ad(new E.Event));N(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(r=>{for(let{start:s,deleteCount:o,items:i}of r){for(const a of i)a.menuPoi.enabled=this.menuPoiEnabled??!1;for(let a=s;a<s+o;++a)this.editingPoints.get(a).destroy()}})),this.dispose(this.menuPoiEnabledChanged.disposableOn(()=>{for(let r of this.editingPoints)r.menuPoi.enabled=this.menuPoiEnabled??!1})),this.dispose(e.dblclickEvent.don(r=>{this.ad(E.nextAnimateFrame(()=>{var s;((s=r.pointerEvent)==null?void 0:s.button)===0&&this.enabled&&this.currentProcess&&this.currentProcess.cancel()}))})),this.dispose(this.enabledChanged.disposableOn(r=>{this._currentProcess&&(r?this._currentProcess.restart():this._currentProcess.isRunning&&this._currentProcess.cancel())}));{const r=()=>{this.polylineShow=this.czmViewer.editingLineShow};r(),this.ad(this.czmViewer.editingLineShowChanged.don(r))}}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 r of this._editingPoints)r.position&&e.push([...r.position]);return e}resetPositions(e){if(this.enabled??Vo.defaults.enabled)return console.warn("MultiPointsEditing.resetPositions error: this.enabled === true"),!1;const r=e||[];return!(r.length===this.editingPoints.length&&r.every((s,o)=>s.every((i,a)=>{const l=this.editingPoints.get(o);return l.position&&l.position[a]===i})))}forceResetPositions(e){(this.enabled??Vo.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 r=this.ad(new lt(e));this.ad(E.track([r,"color"],[this,"polylineColor"])),this.ad(E.track([r,"width"],[this,"polylineWidth"])),this.ad(E.track([r,"show"],[this,"polylineShow"])),this.ad(E.track([r,"arcType"],[this,"polylineArcType"])),this.ad(E.track([r,"loop"],[this,"loop"]));{const s=()=>{const o=[];for(const i of this.getPositions())i[2]-=e.editingHeightOffset??0,o.push(i);r.positions=o};s(),this.ad(this.positionsChanged.don(s))}}_createCursorInfo(e){const r=this._cursorInfo=this.ad(new E.CursorInfo(e.container,E.CursorFloatDiv));this.dispose(this.statusChanged.disposableOn(()=>{const s=this.status;if(r){if(!this.hideCursorInfo){r.show=!1;return}s==="Adding"?(r.text="右键/BackSpace键:删除上一个控制点;Esc键或左键双击:退出添加状态,进入修改状态",r.show=!0):s==="Modifying"||s==="Modifying_Point"?(r.text="Esc键或左键双击:退出编辑状态",r.show=!0):s==="None"&&(r.text="",r.show=!1)}}))}};N(Vo,"baseImageUrl","${earthsdk3-assets-script-dir}/assets/img/"),N(Vo,"defaults",{...En.defaults,debug:!1,polylineShow:!1,polylineWidth:1,polylineColor:[1,1,1,1],polylineArcType:"GEODESIC",maxPointsNum:Number.MAX_SAFE_INTEGER,loop:!1,firstControlPointImageUrl:Vo.baseImageUrl+"point-green.png",otherControlPointImageUrl:Vo.baseImageUrl+"point-yellow.png"});let cr=Vo;(t=>{t.createDefaultProps=()=>({...En.createDefaultProps(),loop:!1,debug:!1,polylineShow:!0,polylineWidth:1,polylineColor:E.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})})(cr||(cr={})),E.extendClassProps(cr.prototype,cr.createDefaultProps);let Sj=0;class m2 extends E.Destroyable{constructor(e,r){super();N(this,"_position",this.disposeVar(E.reactArrayWithUndefined(void 0)));N(this,"_id",Sj++);N(this,"_menuPoi");r&&(this.position=r),e.debug&&console.log(`PolylinePositionEditor creating! ${this.id}`),this.dispose(()=>{e.debug&&console.log(`PolylinePositionEditor destroying! ${this.id}`)});const s=this._menuPoi=this.ad(new os(e.czmViewer));s.enabled=!1,this.ad(E.track([s,"show"],[e,"enabled"]));{const o=()=>{if(this.position===void 0){s.position=void 0;return}const i=[...this.position];i[2]-=e.czmViewer.editingHeightOffset??0,s.position=i,e.positionsChanged.emit()};o(),this.d(this.positionChanged.don(o))}{const o=()=>{const i=e.editingPoints.indexOf(this)+1;i!==0&&(s.title=`控制点${i}`,i===1?s.imageUri=e.firstControlPointImageUrl??cr.defaults.firstControlPointImageUrl:s.imageUri=e.otherControlPointImageUrl??cr.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 y2 extends m2{constructor(n,e){super(n,e)}}class Lt extends cr{constructor(e){super(e);N(this,"_deletePreviousPointWhileAddingEvent",this.disposeVar(new E.Event));N(this,"placeEditing");if(!e.viewer)return;const r=this.placeEditing=this.ad(new Sr(e));r.enabled=!1,this.currentProcess=this.disposeVar(E.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??Lt.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1}),(this.debug??Lt.defaults.debug)&&console.log("直接进入Adding状态"),this.status="Adding",await s.promise(E.step(s,async o=>{const i=o.disposer,a=i.ad(this._addingEditingProcessing());i.dispose(()=>"adding canceled!"),i.dispose(this.cancelEvent.disposableOn(()=>a.cancel())),await o.promise(new Promise(l=>{i.dispose(a.completeEvent.disposableOnce(l))}))}))})),this.dispose(e.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)===2&&this.deletePreviousPointWhileAdding()}))}deletePreviousPointWhileAdding(){this._deletePreviousPointWhileAddingEvent.emit()}resetPositions(e){if(!super.resetPositions(e))return!0;const r=e?e.map(s=>new y2(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...r),!0}_addingEditingProcessing(){const e=()=>{if(this.maxPointsNum!==void 0)return this.editingPoints.length>=this.maxPointsNum&&(this.debug??Lt.defaults.debug)&&console.log("impl.positionEditors.length >= impl.maxPointsNum"),this.editingPoints.length>=this.maxPointsNum},r=E.createProcessingFromAsyncFunc(async s=>{let o=this.editingPoints.length;this.menuPoiEnabled=!1;do if(!await s.promise(E.step(s,async a=>{let l;!e()&&(l=a.disposer.disposeVar(new Ej(this,o)));const f=a.disposer.disposeVar(new Tj(this,o));return a.disposer.dispose(this._deletePreviousPointWhileAddingEvent.disposableOn(()=>f.do())),await a.promise(new Promise(u=>{l&&a.disposer.dispose(l.overEvent.disposableOnce(A=>{A?(o++,u(!0)):u(!1)})),a.disposer.dispose(f.overEvent.disposableOnce(A=>{A?(o--,u(!0)):u(!1)})),a.disposer.dispose(this.cancelEvent.disposableOn(()=>u(!1)))}))})))break;while(!0)});return r.start(),r}}(t=>{t.createDefaultProps=()=>({...cr.createDefaultProps()})})(Lt||(Lt={})),E.extendClassProps(Lt.prototype,Lt.createDefaultProps);class Ej extends E.Destroyable{constructor(e,r){super();N(this,"_overEvent",this.disposeVar(new E.Event));const{placeEditing:s}=e;let o=new y2(e,void 0);e.editingPoints.splice(r,0,o);const i=()=>{(e.debug??Lt.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(s.enabled??!1)throw console.error("placeEditing.enabled is true!"),new Error("placeEditing.enabled is true!");this.dispose(E.track([o,"position"],[s,"position"])),s.enabled=!0;let a=!1;const l=()=>{i(),this._overEvent.emit(!1)};this.dispose(()=>{s.enabled=!1,!a&&l()}),this.dispose(s.overEvent.disposableOnce(()=>{a=!0,o.position===void 0?l():this._overEvent.emit(!0)})),(e.debug??Lt.defaults.debug)&&console.log(`PointAdding creating! index(${r})`),this.dispose(()=>{(e.debug??Lt.defaults.debug)&&console.log(`PointAdding destroying! index(${r})`)})}get overEvent(){return this._overEvent}}function Pj(t,n){const e=t.editingPoints,r=n-1;return r<0?(console.warn("previousIndex < 0, cannot delete the point!"),!1):(e.splice(r,1),!0)}class Tj extends E.Destroyable{constructor(e,r){super();N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"_doEvent",this.disposeVar(new E.Event));this.dispose(this._doEvent.disposableOn(()=>this._overEvent.emit(Pj(e,r)))),(e.debug??Lt.defaults.debug)&&console.log(`PreviousPointDeleting creating! currentIndex(${r})`),this.dispose(()=>{(e.debug??Lt.defaults.debug)&&console.log(`PreviousPointDeleting destroying! currentIndex(${r})`)})}get overEvent(){return this._overEvent}do(){return this._doEvent.emit()}}class g2 extends Lt{constructor(n){super(n),this.loop=!1}}class v2 extends Lt{constructor(n){super(n),this.loop=!0}}class Ap extends m2{constructor(n,e){super(n,e);{const{menuPoi:r}=this;r.commands=[["add","增加控制点","",ht.baseImageUrl+"add.png"],["delete","删除当前控制点","",ht.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ht.baseImageUrl+"modify.png"]],r.clickCommandName="modify",r.rightClickCommandName="delete",this.dispose(r.commandEvent.disposableOn(s=>{n.menuPoiCommand(this,s)})),this.dispose(r.dbclickEvent.disposableOn(()=>{n.menuPoiCommand(this,"dbClick")}))}if(n.middlePointShow){const r=this.ad(new Rr(n.czmViewer));{r.imageUri=n.firstControlPointImageUrl??ht.defaults.firstControlPointImageUrl,r.tooltip="点击增加一个控制点",r.bgColor=[0,0,0,.6],r.fgColor=[1,1,1,1],r.size=[8,8],r.originRatioAndOffset=[.5,.5,0,0];{const s=()=>{if(!(n.enabled??ht.defaults.enabled)){r.enabled=!1,r.show=!1;return}do{const i=n.editingPoints.indexOf(this);if(i===-1)break;const a=n.editingPoints.length;if(a===0){console.error("impl.positionEditors.length === 0!");break}if(!(n.loop??ht.defaults.loop)&&i+1>=a)break;const h=this.position;if(!h)break;let f=(i+1)%a;const A=n.editingPoints.get(f).position;if(!A)break;const v=Fp(h,A);if(!v)break;v[2]-=n.czmViewer.editingHeightOffset??0,r.position=v;const g=n.editingPoints.length<(n.maxPointsNum??ht.defaults.maxPointsNum);r.enabled=g,r.show=g;return}while(!1);r.enabled=!1,r.show=!1};s(),this.dispose(n.positionsChanged.disposableOn(s)),this.dispose(n.loopChanged.disposableOn(s)),this.dispose(n.enabledChanged.disposableOn(s))}this.dispose(r.clickEvent.disposableOn(s=>{if(s.button!==0||n.editingPoints.length>=(n.maxPointsNum??ht.defaults.maxPointsNum))return;const o=n.editingPoints.indexOf(this);if(o===-1)return;const i=r.position?[...r.position]:void 0;i&&(i[2]+=n.czmViewer.editingHeightOffset??0);let a=new Ap(n,i);n.editingPoints.splice(o+1,0,a),n.modify(a)}))}}}}class ht extends cr{constructor(e){super(e);N(this,"_menuPoiCommand",this.disposeVar(new E.Event));N(this,"_forceModifyPosEditorEvent",this.disposeVar(new E.Event));N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"translationEditing");{const s=this.ad(E.createNextAnimateFrameEvent(this.moveWithFirstPositionChanged,this.editingPoints.changedEvent));this.ad(new E.ObjResettingWithEvent(s,()=>{if(!(!this.moveWithFirstPosition||this.editingPoints.length<=1))return new Bj(this.editingPoints.get(0),this)}))}const r=this.translationEditing=this.disposeVar(new Ii(e));r.enabled=!1,this.currentProcess=this.disposeVar(E.createProcessingFromAsyncFunc(async s=>{s.disposer.dispose(()=>{(this.debug??ht.defaults.debug)&&console.log("---editing canceled~~~"),this.status="None",this.enabled=!1});let o=-1;do if((this.debug??ht.defaults.debug)&&console.log("进入Modifying修改状态"),this.status="Modifying",o=await s.promise(E.step(s,async i=>{const a=i.disposer,l=a.ad(new Ij(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(f=>l.modify(f))),await i.promise(new Promise(f=>{a.dispose(l.overEvent.disposableOnce(u=>{f(u)}))}))})),o===-1){(this.debug??ht.defaults.debug)&&console.log("退出编辑状态");break}else{if(this.editingPoints.length>=(this.maxPointsNum??ht.defaults.maxPointsNum))return;if(this.editingPoints.length===0){console.error("impl.positionEditors.length === 0!");return}this.loop??ht.defaults.loop;const a=this.editingPoints.get(o-1).position;if(!a)return;let l=o%this.editingPoints.length;const f=this.editingPoints.get(l).position;if(!f)return;const u=Fp(a,f);if(!u)return;u&&(u[2]+=this.czmViewer.editingHeightOffset??0);let A=new Ap(this,u);this.editingPoints.splice(o,0,A)}while(!0);this.status="None",this.enabled=!1}))}menuPoiCommand(e,r){this._menuPoiCommand.emit(e,r)}modify(e){this._forceModifyPosEditorEvent.emit(e)}resetPositions(e){if(!super.resetPositions(e))return!0;const r=e?e.map(s=>new Ap(this,s)):[];return this.editingPoints.splice(0,this.editingPoints.length,...r),!0}get overEvent(){return this._overEvent}}(t=>{t.createDefaultProps=()=>({...cr.createDefaultProps(),moveWithFirstPosition:!1})})(ht||(ht={})),E.extendClassProps(ht.prototype,ht.createDefaultProps);class Bj extends E.Destroyable{constructor(n,e){super(),this._firstPositionEditor=n,this.multiPointsModifyEditing=e,this._firstPositionEditor.positionChanged.disposableOn((r,s)=>{if(r===void 0||s===void 0)return;var o=[r[0]-s[0],r[1]-s[1],r[2]-s[2]];const i=this.multiPointsModifyEditing.editingPoints.length;for(let a=1;a<i;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 Ij extends E.Destroyable{constructor(e){super();N(this,"_overEvent",this.disposeVar(new E.Event));N(this,"_cancelEvent",this.disposeVar(new E.Event));N(this,"_forceModifyPosEditorEvent",this.disposeVar(new E.Event));e.menuPoiEnabled=!0,this.dispose(()=>e.menuPoiEnabled=!1);let r;const s=()=>{r==null||r.destroy(),r=void 0,e.status="Modifying"};this.dispose(s);const o=i=>{s(),e.status="Modifying_Point",r=new Fj(e,i),r.dispose(r.overEvent.disposableOn(()=>{s()}))};this.dispose(this._forceModifyPosEditorEvent.disposableOn(o)),this.dispose(e._menuPoiCommand.disposableOn((i,a)=>{if(a==="delete"){if(e.editingPoints.length<=2)return;const l=e.editingPoints.indexOf(i);if(l===-1)throw console.error("posEditor not found"),new Error("posEditor not found");e.editingPoints.splice(l,1)}else if(a==="modify")o(i);else if(a==="add"){const l=e.editingPoints.indexOf(i);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 Fj extends E.Destroyable{constructor(e,r){super();N(this,"_overEvent",this.disposeVar(new E.Event));this._modifying=e,this._posEditor=r,this.dispose(this._posEditor.toDestroyEvent.disposableOn(()=>{this._overEvent.emit()}));const{translationEditing:s}=this._modifying;if(s.enabled=!0,s.heading=0,this.dispose(()=>{s.enabled=!1}),!this._posEditor.position)throw console.error("!this._posEditor.position"),new Error("!this._posEditor.position");s.position=this._posEditor.position,this.dispose(E.track([this._posEditor,"position"],[s,"position"])),this.dispose(s.enabledChanged.disposableOnce(o=>{o||this._overEvent.emit()}))}get overEvent(){return this._overEvent}}class w2 extends ht{constructor(n){super(n),this.loop=!1}}class b2 extends ht{constructor(n){super(n),this.loop=!0}}class ul extends Lt{init(){const n=this.startPosition;if(!n)return;const e=this.distance,r=this.rotation,s=e*Math.cos(r[1]*Math.PI/180),o=Q.geoDestination(n,s,r[0]);if(!o){this.positions=[n];return}const i=e*Math.sin(r[1]*Math.PI/180);o[2]+=i,this.positions=[n,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=o)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2;{const e=()=>{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];return}if(this.positions.length==1){this.distance=1,this.rotation=[90,0,0];return}this.startPosition=this.positions[0],this.endPosition=this.positions[1];const r=Q.geoHeading(this.startPosition,this.endPosition),s=Q.geoDistance(this.startPosition,this.endPosition);if(s<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],i=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[r,i,0],this.distance=a};e(),this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...Lt.createDefaultProps(),startPosition:E.reactArrayWithUndefined(void 0),endPosition:E.reactArrayWithUndefined(void 0),rotation:E.reactArray([90,0,0]),distance:E.react(1)})})(ul||(ul={})),E.extendClassProps(ul.prototype,ul.createDefaultProps);class Fa extends ht{init(){const n=this.startPosition;if(!n)return;const e=this.distance,r=this.rotation,s=e*Math.cos(r[1]*Math.PI/180),o=Q.geoDestination(n,s,r[0]);if(!o){this.positions=[n];return}const i=e*Math.sin(r[1]*Math.PI/180);o[2]+=i,this.positions=[n,o],this.editingPoints.length==2&&(this.editingPoints.get(0).position=n,this.editingPoints.get(1).position=o)}constructor(n){super(n),this.loop=!0,this.maxPointsNum=2,this.middlePointShow=!1,this.moveWithFirstPosition=!0;{const e=()=>{do{if(!this.positions||this.positions.length==0){this.distance=1,this.rotation=[90,0,0],this.startPosition=[0,0,0];break}if(this.startPosition=this.positions[0],this.positions.length==1){this.editingPoints.get(0).menuPoi.commands=[["add","增加控制点","",ht.baseImageUrl+"add.png"],["delete","删除当前控制点","",ht.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ht.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","删除当前控制点","",ht.baseImageUrl+"delete.png"],["modify","修改当前控制点","",ht.baseImageUrl+"modify.png"]];const r=Q.geoHeading(this.startPosition,this.endPosition),s=Q.geoDistance(this.startPosition,this.endPosition);if(Math.abs(s)<=0){this.rotation=[90,0,0],this.distance=1;return}const o=this.endPosition[2]-this.startPosition[2],i=Math.atan(o/s)*180/Math.PI,a=Math.sqrt(s*s+o*o);this.rotation=[r,i,0],this.distance=a}while(!1)};this.ad(this.positionsChanged.don(e))}}}(t=>{t.createDefaultProps=()=>({...ht.createDefaultProps(),startPosition:E.reactArrayWithUndefined(void 0),endPosition:E.reactArrayWithUndefined(void 0),rotation:E.reactArray([0,0,0]),distance:E.react(0)})})(Fa||(Fa={})),E.extendClassProps(Fa.prototype,Fa.createDefaultProps);class _2 extends Lt{constructor(n){super(n),this.loop=!1,this.polylineShow=!1}}class x2 extends ht{constructor(n){super(n),this.loop=!1,this.polylineShow=!1,this.middlePointShow=!1}}class cl extends Lt{constructor(n){super(n),n.viewer||(this.loop=!1);{const e=()=>{if(!this.positions||this.positions.length<2){this.visibilityPositions=void 0;return}const r=[...this.positions[0]];r[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=n.editingHeightOffset??0,[r,s]))};e(),this.ad(this.positionsChanged.don(e))}}createPolyline(n){const e=this.ad(new gr(n));e.topOrBottom="bottom",this.ad(E.track([e,"color"],[this,"polylineColor"])),this.ad(E.track([e,"width"],[this,"polylineWidth"])),this.ad(E.track([e,"show"],[this,"polylineShow"])),this.ad(E.track([e,"arcType"],[this,"polylineArcType"])),this.ad(E.track([e,"loop"],[this,"loop"])),this.ad(E.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...Lt.createDefaultProps(),visibilityPositions:E.reactPositionsSet(void 0)})})(cl||(cl={})),E.extendClassProps(cl.prototype,cl.createDefaultProps);class hl extends ht{constructor(n){if(super(n),!!n.viewer){this.loop=!1,this.middlePointShow=!1;{const e=()=>{if(!this.positions||this.positions.length<2)return;const r=[...this.positions[0]];r[2]-=n.editingHeightOffset??0,this.visibilityPositions=this.positions.map(s=>(s[2]-=n.editingHeightOffset??0,[r,s]))};e(),this.ad(this.positionsChanged.don(e))}}}createPolyline(n){const e=this.ad(new gr(n));e.topOrBottom="bottom",this.ad(E.track([e,"color"],[this,"polylineColor"])),this.ad(E.track([e,"width"],[this,"polylineWidth"])),this.ad(E.track([e,"show"],[this,"polylineShow"])),this.ad(E.track([e,"arcType"],[this,"polylineArcType"])),this.ad(E.track([e,"loop"],[this,"loop"])),this.ad(E.track([e,"positions"],[this,"visibilityPositions"]))}}(t=>{t.createDefaultProps=()=>({...ht.createDefaultProps(),visibilityPositions:E.reactPositionsSet(void 0)})})(hl||(hl={})),E.extendClassProps(hl.prototype,hl.createDefaultProps);class C2 extends Fa{constructor(n){super(n),this.firstControlPointImageUrl=this.otherControlPointImageUrl,this.translationEditing.xAxisShow=!1,this.translationEditing.yAxisShow=!1,this.translationEditing.zAxisShow=!0,this.translationEditing.showCircle=!1,this.rotation=[0,90,0]}}class vn extends Q.EngineObject{constructor(e,r,s){super(e,r,s??!0);N(this,"_supportEditing",this.disposeVar(E.react(!0)));N(this,"_currentEditing",this.disposeVar(E.react(void 0)));this.ad(this.supportEditingChanged.don(()=>{this.destroy()})),this.ad(this.toDestroyEvent.don(()=>{var o;if(this.currentEditing){if(this.currentEditing instanceof Lt&&((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 Sr&&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 Ch=class Ch extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new Sr(e));this.ad(e.clickEvent.don(s=>{var o;((o=s.pointerEvent)==null?void 0:o.button)==2&&(r.enabled=!0)}));do{if(Reflect.has(n,"position")){this.ad(E.bind([r,"position"],[n,"position"])),r.enabled=!r.position||Q.equalsN3(r.position,[0,0,0]);break}this.supportEditing=!1}while(!1)}};N(Ch,"type",Ch.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Place,Ch));let V0=Ch;const Sh=class Sh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new Er(e));r.rotation=[90,0,0],this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const s=e.getEngineObject(n);s&&(this.ad(E.bind([r,"position"],[s.czm3DTiles,"position"])),this.ad(E.bind([r,"selfRotation"],[n,"rotation"])))});break}if(Reflect.has(n,"position")&&Reflect.has(n,"rotation")){this.ad(E.bind([r,"position"],[n,"position"])),this.ad(E.bind([r,"selfRotation"],[n,"rotation"]));break}this.supportEditing=!1}while(!1)}};N(Sh,"type",Sh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Rotation,Sh));let Q0=Sh;const Eh=class Eh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new Fi(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")&&Reflect.has(n,"scale")){this.ad(E.bind([r,"position"],[n,"position"])),this.ad(E.bind([r,"scale"],[n,"scale"]));break}this.supportEditing=!1}while(!1)}};N(Eh,"type",Eh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Scale,Eh));let H0=Eh;const Ph=class Ph extends vn{constructor(n,e){super(Array.isArray(n)?n[0]:n,e,!0);const r=this.currentEditing=this.ad(new Ii(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Array.isArray(n)){const s=[];for(let o=0;o<n.length;o++){const i=n[o];Reflect.has(i,"position")?s.push(i.position):i.points&&s.push(...i.points)}r.position=Q.getMinMaxCorner(s).center,this.ad(r.positionChanged.disposableOn((o,i)=>{if(!(!o||!i)){var a=Tn({originPosition:i},[o])[0][0];n.forEach(l=>{if(Reflect.has(l,"position")){const h=Tn({originPosition:i},[l.position])[0][0];l.position=Vi({originPosition:i},[[h[0]+a[0],h[1]+a[1],h[2]+a[2]]])[0][0]}else if(Reflect.has(l,"points")&&l.points){const h=Tn({originPosition:i},l.points)[0];l.points=Vi({originPosition:i},h.map(f=>[f[0]+a[0],f[1]+a[1],f[2]+a[2]]))[0]}})}}));break}if(Reflect.has(n,"position")){this.ad(E.bind([r,"position"],[n,"position"]));break}if(n instanceof Q.ES3DTileset){Q.registerCreatedEventUpdate(this,n,()=>{const s=e.getEngineObject(n);this.ad(E.bind([r,"position"],[s.czm3DTiles,"position"]))});break}if(Reflect.has(n,"points")){if(n.points===void 0||n.points.length===0){this.destroy();break}r.position=Q.getMinMaxCorner(n.points).center,this.ad(r.positionChanged.disposableOn((s,o)=>{if(s===void 0||o===void 0||n.points===void 0||n.points.length===0){this.destroy();return}var i=Tn({originPosition:o},[s])[0][0];const a=Tn({originPosition:o},n.points)[0];n.points=Vi({originPosition:o},a.map(l=>[l[0]+i[0],l[1]+i[1],l[2]+i[2]]))[0]}));break}this.supportEditing=!1}while(!1)}};N(Ph,"type",Ph.registerEditing("ESCesiumViewer",Q.ESJEditingMode.Translation,Ph));let mp=Ph;const Th=class Th extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new ul(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"position")){this.ad(E.bind([r,"startPosition"],[n,"position"])),this.ad(jt([r,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(E.bind([r,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(E.bind([r,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(E.bind([r,"distance"],[n,"distance"]));break}const s=Tt(n.position);if(F.Cartesian3.ZERO.equals(s)||!e.viewer)return;r.distance=ii(e.viewer.scene,s,100)??1}while(!1);break}if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1);r.startPosition&&!Q.equalsN3(r.startPosition,[0,0,0])&&r.init(),r.enabled=!0}};N(Th,"type",Th.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsAppend,Th));let j0=Th;const Bh=class Bh extends vn{constructor(n,e){var o;if(super(n,e,!0),!e.viewer)return;const r=this.currentEditing=this.ad(new Fa(e));do{if(Reflect.has(n,"position")){this.ad(E.bind([r,"startPosition"],[n,"position"])),this.ad(jt([r,"rotation"],[n,"rotation"]));do{if(Reflect.has(n,"far")){this.ad(E.bind([r,"distance"],[n,"far"]));break}if(Reflect.has(n,"radius")){this.ad(E.bind([r,"distance"],[n,"radius"]));break}if(Reflect.has(n,"distance")){this.ad(E.bind([r,"distance"],[n,"distance"]));break}const i=Tt(n.position);if(F.Cartesian3.ZERO.equals(i)||!e.viewer)return;r.distance=ii(e.viewer.scene,i,100)??1}while(!1);break}if(Reflect.has(n,"points")&&((o=n.points)==null?void 0:o.length)==2){r.moveWithFirstPosition=!1;const i=()=>r.positions=n.points??[];i(),this.ad(n.pointsChanged.don(()=>!r.enabled&&i())),this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1;return}while(!1);r.init(),r.enabled=!0;const s=this.ad(E.createNextAnimateFrameEvent(r.enabledChanged,r.startPositionChanged));this.ad(s.don(()=>{(!r.enabled||!r.startPosition||Q.equalsN3(r.startPosition,[0,0,0]))&&this.destroy()}))}};N(Bh,"type",Bh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.DoublePointsModify,Bh));let G0=Bh;const Ih=class Ih extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new v2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Ih,"type",Ih.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularAppend,Ih));let W0=Ih;const Fh=class Fh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new b2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Fh,"type",Fh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.CircularInsert,Fh));let q0=Fh;const kh=class kh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new g2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(kh,"type",kh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringAppend,kh));let K0=kh;const Mh=class Mh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new w2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Mh,"type",Mh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.LineStringInsert,Mh));let X0=Mh;const Oh=class Oh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new _2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Oh,"type",Oh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterAppend,Oh));let $0=Oh;const Dh=class Dh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new x2(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Dh,"type",Dh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.ScatterModify,Dh));let Z0=Dh;const Rh=class Rh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new cl(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Rh,"type",Rh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityAppend,Rh));let Y0=Rh;const Uh=class Uh extends vn{constructor(n,e){super(n,e,!0);const r=this.currentEditing=this.ad(new hl(e));this.ad(r.enabledChanged.don(s=>{!s&&this.ad(E.nextAnimateFrame(()=>{this.destroy()}))}));do{if(Reflect.has(n,"points")){const s=()=>r.positions=n.points??[];s(),this.ad(n.pointsChanged.don(()=>!r.enabled&&s())),r.enabled=!0,this.ad(E.track([n,"points"],[r,"positions"]));break}this.supportEditing=!1}while(!1)}};N(Uh,"type",Uh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.VisibilityModify,Uh));let J0=Uh;const Lh=class Lh extends vn{constructor(n,e){if(super(n,e,!0),!e.viewer)return;const r=this.currentEditing=this.ad(new C2(e));do{if(Reflect.has(n,"points")){const o=Reflect.has(n,"extrudedHeight"),i=Reflect.has(n,"height"),a=Reflect.has(n,"perPositionHeight")?n.perPositionHeight:!o,l=n instanceof Q.ESClassification||n instanceof Q.ESPolygonFence;let h=Q.getMinMaxCorner(n.points).center,f=[...h],u=l?n.points[0][2]:0;a?o?f[2]=n.extrudedHeight:f[2]=n.height+u:(i&&(h[2]=n.height),o&&(f[2]=n.extrudedHeight)),r.startPosition=h,r.distance=f[2]-h[2],r.moveWithFirstPosition=!1;let A=[...h];this.ad(r.positionsChanged.don(()=>{r.positions.length===2&&(a?(n.points=n.points.map(v=>[v[0],v[1],v[2]+r.positions[0][2]-A[2]]),o?n.extrudedHeight=r.positions[1][2]:i&&(n.height=r.positions[1][2]-(l?r.positions[0][2]:0))):(i&&(n.height=r.positions[0][2]),o&&(n.extrudedHeight=r.positions[1][2])),A=[...r.positions[0]])}));break}this.supportEditing=!1;return}while(!1);r.init(),r.enabled=!0;const s=this.ad(E.createNextAnimateFrameEvent(r.enabledChanged,r.startPositionChanged));this.ad(s.don(()=>{(!r.enabled||!r.startPosition||Q.equalsN3(r.startPosition,[0,0,0]))&&this.destroy()}))}};N(Lh,"type",Lh.registerEditing("ESCesiumViewer",Q.ESJEditingMode.HeightModify,Lh));let ew=Lh;function S2(){const t=E.createProcessingFromAsyncFunc(async(n,e,r,s,o=!0)=>{const i=Array.isArray(s)?[...s]:[s],a=r.editingID;e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"start",add:{modes:i}});const l=()=>{e.notSupportEditingCount=0,e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"end",add:{modes:i}}),t.isRunning&&t.cancel()};n.disposer.ad(l),n.disposer.ad(r.toDestroyEvent.don(l)),n.disposer.ad(e.keyDownEvent.don(f=>{f.code=="Escape"&&l()}));let h=0;do{const f=i[h%i.length],u=await E.step(n,async A=>{const v=A.disposer,g=Q.EngineObject.contextEditing.getEngineObjConstructor(f,e.typeName);if(!g||!r.supportEditingModes().includes(f))return console.log(`未找到编辑模式或不支持当前编辑模式${f},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:f,cIndex:h}}),e.notSupportEditingCount++,!1;const m=new g(r,e);if(v.ad(()=>{!m.isDestroyed()&&m.destroy()}),m.supportEditing)e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"changed",add:{cMode:f,cIndex:h}}),e.notSupportEditingCount=0;else return console.log(`未找到编辑模式或不支持当前编辑模式${f},已跳过当前编辑模式,请检查输入`),e.editingEvent.emit({objectIDs:[r.id.split("_")[0]],editingID:a,type:"changedFailed",add:{cMode:f,cIndex:h}}),e.notSupportEditingCount++,!1;return await A.promise(new Promise(d=>{m.isDestroyed()&&d(!1),v.ad(m.toDestroyEvent.don(()=>{console.log(`编辑模式${f}结束`),d(!1)})),o&&(v.ad(e.keyDownEvent.don(c=>{c.code=="Space"&&(console.log(`编辑模式${f}结束`),d(!1))})),v.ad(e.dblclickEvent.don(()=>d(!0))))}))});if(o&&u||!o&&h==i.length-1||e.notSupportEditingCount==i.length)break;h++}while(!0)});return t}function E2(){const t=E.createProcessingFromAsyncFunc(async(n,e,r,s)=>{e.editingEvent.emit({objectIDs:r.map(a=>a.id.split("_")[0]),editingID:s,type:"start"});const o=()=>{e.editingEvent.emit({objectIDs:r.map(a=>a.id.split("_")[0]),editingID:s,type:"end"}),t.isRunning&&t.cancel()};n.disposer.ad(o),n.disposer.ad(e.keyDownEvent.don(a=>{a.code=="Escape"&&o()}));const i=new mp(r,e);n.disposer.ad(()=>{!i.isDestroyed()&&i.destroy()}),await n.promise(new Promise(a=>{i.isDestroyed()&&a(),n.disposer.ad(i.toDestroyEvent.don(()=>{console.log("移动结束"),a()})),n.disposer.ad(e.dblclickEvent.don(()=>a()))}))});return t}ue.copyright=void 0;try{const t="earthsdk3-cesium",n="3.0.7-beta.16",e="2025-06-12T06:25:15.000Z",r="北京西部世界科技有限公司",s="地球可视化实验室 (EarthSDK&CesiumLab) https://www.bjxbsj.cn",o="f8c981502e1315f7767c65a48856007963740962",a=((Date.now()-1749709515e3)/36e5).toFixed(1),l=`%c🌏 ${t}%c ${n}.${o.slice(0,8)}.${e} (距今${a}个小时)
|
|
4898
4898
|
%c${s?s+`
|
|
4899
4899
|
`:""}当前网站正在使用${t},此软件版权归${r}所有
|
|
4900
|
-
`;ue.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","
|
|
4900
|
+
`;ue.copyright=Object.freeze({get owner(){return"北京西部世界科技有限公司"},get ownerlink(){return OWNERLINK_},get gituri(){return GITURI_&&GITURI_.replace("${commitId}","f8c981502e1315f7767c65a48856007963740962")},get info(){return l},get date(){return"2025-06-12T06:25:15.000Z"},get author(){return"suplyang"},get version(){return"3.0.7-beta.16"},get name(){return"earthsdk3-cesium"},get commitId(){return"f8c981502e1315f7767c65a48856007963740962"},print(){console.info(this.info,`
|
|
4901
4901
|
font-size: 18px;
|
|
4902
4902
|
font-weight: 1000;
|
|
4903
4903
|
line-height: 1;
|