| | |
| | | if (czm_seWaterHeight > -5000.0 && v_elevationPos.z < czm_seWaterHeight) { discard; } |
| | | gltf_seWater_main(); |
| | | } |
| | | `;let x=C.getFragmentShaderCallback(E,o._diffuseAttributeOrUniformName[m],!1);return A.defined(x)?x(f):f}}function W_i(o,A){let f=o._batchTable;return o._batchTable.featuresLength===0?function(m){let C={u_inverseElevationMatrix:function(E){let I=o._model,x=typeof I._elevationMatrix;if(x==="undefined")return A.Matrix4.IDENTITY;if(x==="function"?I._uniformInverseElevationMatrix=I._elevationMatrix(I._uniformInverseElevationMatrix):A.Matrix4.clone(I._elevationMatrix,I._uniformInverseElevationMatrix),A.Matrix4.inverse(I._uniformInverseElevationMatrix,I._uniformInverseElevationMatrix),I._rtcCenter){let y=new A.Matrix4,v=A.Matrix4.fromTranslation(I._rtcCenter,y);A.Matrix4.multiply(I._uniformInverseElevationMatrix,v,I._uniformInverseElevationMatrix)}return I._uniformInverseElevationModelMatrix||(I._uniformInverseElevationModelMatrix=new A.Matrix4),E&&E.model?(I._uniformInverseElevationModelMatrix=A.Matrix4.multiply(I._uniformInverseElevationMatrix,E.model,I._uniformInverseElevationModelMatrix),I._uniformInverseElevationModelMatrix):A.Matrix4.IDENTITY}};return A.combine(m,C)}:function(m){let C={tile_batchTexture:function(){return defaultValue(f._batchTexture.batchTexture,f._batchTexture.defaultTexture)},tile_textureDimensions:function(){return f._batchTexture.textureDimensions},tile_textureStep:function(){return f._batchTexture.textureStep},tile_colorBlend:function(){return getColorBlend(f)},tile_pickTexture:function(){return f._batchTexture.pickTexture},u_inverseElevationMatrix:function(E){let I=o._model,x=typeof I._elevationMatrix;if(x==="undefined")return A.Matrix4.IDENTITY;if(x==="function"?I._uniformInverseElevationMatrix=I._elevationMatrix(I._uniformInverseElevationMatrix):A.Matrix4.clone(I._elevationMatrix,I._uniformInverseElevationMatrix),A.Matrix4.inverse(I._uniformInverseElevationMatrix,I._uniformInverseElevationMatrix),I._rtcCenter){let y=new A.Matrix4,v=A.Matrix4.fromTranslation(I._rtcCenter,y);A.Matrix4.multiply(I._uniformInverseElevationMatrix,v,I._uniformInverseElevationMatrix)}return I._uniformInverseElevationModelMatrix||(I._uniformInverseElevationModelMatrix=new A.Matrix4),I._uniformInverseElevationModelMatrix=A.Matrix4.multiply(I._uniformInverseElevationMatrix,E.model,I._uniformInverseElevationModelMatrix),I._uniformInverseElevationModelMatrix}};return A.combine(m,C)}}function q_i(o){this._size=o.size,this._datatype=o.datatype,this.getValue=o.getValue}function j_i(o,A,f){try{let m=f.Ellipsoid.WGS84,C=m.scaleToGeodeticSurface(o);return A=f.Transforms.eastNorthUpToFixedFrame(C,m,A),A}catch{return f.Matrix4.clone(f.Matrix4.IDENTITY,A)}}function X_i(o){o.AutomaticUniforms.czm_seWaterHeight||(o.AutomaticUniforms.czm_seWaterHeight=new q_i({size:1,datatype:o.WebGLConstants.FLOAT,getValue:function(f){return f.seWaterHeight?f.seWaterHeight:-5e3}}),o.ShaderSource._czmBuiltinsAndUniforms.czm_seWaterHeight="uniform float czm_seWaterHeight;");var A=o.Cesium3DTileset.prototype.update;o.Cesium3DTileset.prototype.update=function(f){A.call(this,f),this.show&&this.ready&&(this._autoElevationMatrix=j_i(this.boundingSphere.center,this._autoElevationMatrix,o))},o.Cesium3DTileContentFactory.b3dm=function(f,m,C,E,I){if(f.enableModelExperimental)return o.ModelExperimental3DTileContent.fromB3dm(f,m,C,E,I);let x=new o.Batched3DModel3DTileContent(f,m,C,E,I);return x._model instanceof o.ClassificationModel||(x._model._elevationMatrix=function(y){let v=f._elevationMatrix||f._autoElevationMatrix||o.Matrix4.IDENTITY;return y=o.Matrix4.clone(v,y),y},x._model._uniformMapLoaded=W_i(x,o),x._model._vertexShaderLoaded=J_i(x,o),x._model._fragmentShaderLoaded=K_i(x,o)),x},o.ShaderProgram.prototype._setUniforms=function(f,m,C){let E,I;if(o.defined(f)){let v=this._manualUniforms;for(E=v.length,I=0;I<E;++I){let w=v[I];w.value=f[w.name](m)}}let x=this._automaticUniforms;for(E=x.length,I=0;I<E;++I){let v=x[I];v.uniform.value=v.automaticUniform.getValue(m)}let y=this._uniforms;for(E=y.length,I=0;I<E;++I)y[I].set();if(C){let v=this._gl,w=this._program;v.validateProgram(w)}}}function Z_i(o,A){let f=o.baseWaterColor||new A.Color(.2,.3,.6,1),m=o.blendColor||new A.Color(.5,.5,.5,.7),C=o.animationSpeed||.05,E=o.amplitude||2,I=o.frequency||5e3,x=o.specularIntensity||.5,y=o.fadeFactor||1,v=o.sizeAndVelocity||new A.Cartesian4(100,100,10,0),w=o.width||316,Q=o.height||316;X_i(A),A.Material._materialCache.addMaterial("SEWater",{fabric:{type:"SEWater",uniforms:{baseWaterColor:f,blendColor:m,specularMap:A.Material.DefaultImageId,normalMap:A.Material.DefaultImageId,frequency:I,animationSpeed:C,amplitude:E,specularIntensity:x,fadeFactor:y,sizeAndVelocity:v},source:Vet},translucent:function(M){var B=M.uniforms;return B.baseWaterColor.alpha<1||B.blendColor.alpha<1}})}jx.prototype._createDebugView=function(){let o=this._cesium.Material.fromType("Image"),A=new this._cesium.ViewportQuad(new this._cesium.BoundingRectangle(0,100,300,300));A.material=o,this._debugViewportQuad=this._scene.primitives.add(A);let f=this._getWaterReflectTexture();f&&(o.uniforms.image=f)};jx.prototype.debugShow=function(o){this._debugViewportQuad.show=o};jx.prototype.isDebugShow=function(){return this._debugViewportQuad.show};jx.prototype._getWaterReflectTexture=function(){return this._wTexture._colorTexture};jx.prototype._getWaterReflectTextureChangedEvent=function(){return this._wTexture._textureChangedEvent};jx.prototype._createWaterMaterial=function(){var o=new this._cesium.Material({fabric:{type:"SEWater",uniforms:{specularMap:this._cesium.buildModuleUrl("Assets/Textures/waterNormals.jpg"),normalMap:this._cesium.buildModuleUrl("Assets/Textures/waterNormals.jpg"),frequency:this._option.frequency,animationSpeed:this._option.animationSpeed,amplitude:this._option.amplitude,width:this._option.width,height:this._option.height}}});let A=this;return o._uniforms.specularMap_0=function(){return A._wTexture._colorTexture||A._scene.context.defaultTexture},o};jx.prototype.createWaterPolygonPrimitive=function(o){let A=this,f=this._scene,m=null,C=null;if(o.type==0)m=this._cesium.PolygonGeometry.fromPositions({vertexFormat:this._cesium.MaterialAppearance.MaterialSupport.ALL.vertexFormat,positions:o.positions}),C=f.groundPrimitives.add(new this._cesium.GroundPrimitive({geometryInstances:new this._cesium.GeometryInstance({geometry:m}),appearance:new this._cesium.MaterialAppearance({materialSupport:this._cesium.MaterialAppearance.MaterialSupport.ALL}),classificationType:this._cesium.ClassificationType.BOTH})),C.appearance.material=this._createWaterMaterial();else if(o.type==1)m=this._cesium.CoplanarPolygonGeometry.fromPositions({vertexFormat:this._cesium.MaterialAppearance.MaterialSupport.ALL.vertexFormat,positions:o.positions}),C=f.primitives.add(new this._cesium.Primitive({geometryInstances:new this._cesium.GeometryInstance({geometry:m}),appearance:new this._cesium.MaterialAppearance({materialSupport:this._cesium.MaterialAppearance.MaterialSupport.ALL})})),C.appearance.material=this._createWaterMaterial();else if(o.type==2){let I=new this._cesium.GeometryInstance({geometry:o.geometry});C=f.primitives.add(new this._cesium.Primitive({geometryInstances:I,appearance:new this._cesium.EllipsoidSurfaceAppearance({material:this._createWaterMaterial()}),asynchronous:!1}))}C.appearance.material.uniforms.sizeAndVelocity.x=o.width,C.appearance.material.uniforms.sizeAndVelocity.y=o.height,C.radius=.5*Math.max(o.width,o.height),C.centerPos=o.center;let E=this._cesium.Cartographic.fromCartesian(o.center);return C.waterHeight=E.height,this._trackPrimitive(C),C};jx.prototype._trackPrimitive=function(o){this._trackedPrimitives.indexOf(o)<0&&this._trackedPrimitives.push(o)};jx.prototype.destroyWaterPolygonPrimitive=function(o){this._trackedPrimitives.indexOf(o)>=0&&(this._untrackPrimitive(o),this._scene.primitives.contains(o)&&this._scene.primitives.remove(o),this._scene.groundPrimitives.contains(o)&&this._scene.groundPrimitives.remove(o))};jx.prototype._untrackPrimitive=function(o){let A=this._trackedPrimitives.indexOf(o);A!=-1&&this._trackedPrimitives.splice(A,1)};jx.prototype.isDestroyed=function(){return!1};jx.prototype.destroy=function(){return this._disposeListener&&(this._disposeListener(),this._disposeListener=null),this._wTexture&&(this._wTexture.destroy(),this._wTexture=null),this._trackedPrimitives=[],this._cesium.destroyObject(this)};var ett=jx;function es(o){this._earthCtrl=o,this._coreMap=o.coreMap}function Om(){return((1+De.nextRandomNumber())*65536|0).toString(16).substring(1)}es.createUUID=function(){return`${Om()+Om()}-${Om()}-${Om()}-${Om()}-${Om()}${Om()}${Om()}`};es.createUUIDWithoutDash=function(){return Om()+Om()+Om()+Om()+Om()+Om()+Om()+Om()};es.prototype.createUUID=function(){return es.createUUID()};es.prototype.createGroup=function(o){let A=new C6;return A.id=o.id||es.createUUID(),A.name=o.name||"\u672A\u547D\u540D\u7EC4",A};es.prototype.createImageryLayer=function(o,A){let f=new L1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.IMAGERYPROVIDERS),f),f};es.prototype.createTerrainLayer=function(o,A){let f=new F1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.TERRAINPROVIDERS),f),f};es.prototype.removeTerrainLayer=function(o){this._coreMap.terrainProvider=new pD({})};es.prototype.createFeatureLayer=function(o,A){let f=new k1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.FEATURELAYERS),f),f};es.prototype.createModelLayer=function(o,A){let f=new N1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.MODELLAYERS),f),f};es.prototype.createWfsModel=function(o,A){let f=new XO(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.MODELLAYERS),f),f};es.prototype.createModel=function(o,A){let f=new _1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.removeModel=function(o){k(o)&&o.removeFromMap()};es.prototype.createCZMLObject=function(o,A){let f=this,m=ae(o.addToMap,!0),C=new oY(o.name);return C.load(o.url),m&&f._earthCtrl.dataSources.add(C),C.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,C):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),C),C};es.prototype.createElement=function(o){let A={};return A[o.type]=o.parameters,k(o.name)&&(A.name=o.name),k(o.position)&&(A.position=o.position),this._earthCtrl.entities.add(A)};es.prototype.removeElement=function(o){k(o)?this._earthCtrl.entities.remove(o):this._earthCtrl.entities.removeAll()};es.prototype.createVideoProjection=function(o,A){o.addToMap=ae(o.addToMap,!0);let f=ae(o.sourceType,"perspective"),m=null;return f==="perspective"?(m=new p1e(this._earthCtrl,o),m.initialize(o),m.name=o.name,A?this._earthCtrl.userScene.addChild(A,m):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),m)):f==="panorama"?(m=new Cet(this._earthCtrl,o),m.initialize(o),m.name=o.name,m.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,m):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),m)):f==="fisheye"&&(m=new m1e(this._earthCtrl,o),m.initialize(o),m.name=o.name,m.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,m):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),m)),m};es.prototype.createTrack=function(o,A){let f=new Eet(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),f.initialize(o),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createSceneNode=function(o,A,f){let m=new C6(this._earthCtrl);return m.id=o,m.name=A,m.label=f,m};es.prototype.createFire=function(o,A){let f=new C1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createSmoke=function(o,A){let f=new E1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createExplosion=function(o,A){let f=new I1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createFireworks=function(o,A){let f=new x1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createRadarScan=function(o,A){let f=new y1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),f.show=!0,A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createCircleScan=function(o,A){let f=new Qet(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),f.show=!0,A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createUpDownScan=function(o){let A=new Met(this._earthCtrl,o);return A.show=!0,A};es.prototype.createWaters=function(o,A){let f=new O1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),f.show=!0,A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createHeatmap=function(o,A){let f=vet.create(this._earthCtrl,o.bbox,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createLabel=function(o,A){let f=new B1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createBillboard=function(o,A){let f=new v1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPolyline=function(o,A){let f=new w1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPolygon=function(o,A){let f=new b1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPoint=function(o,A){let f=new Q1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createBox=function(o,A){let f=new S1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createEllipsoid=function(o,A){let f=new M1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createCylinder=function(o,A){let f=new D1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createRectangle=function(o,A){let f=new T1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createEllipse=function(o,A){let f=new P1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPolylineVolume=function(o,A){let f=new R1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createEChartLayer=function(o,A){let f=new U1e(this._earthCtrl);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(o),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPointLight=function(o){return new Pet(this._earthCtrl,o)};es.prototype.createHawkeye=function(o){let A=new H1e(this._earthCtrl,o);A.name=o.name,A.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&A.addToMap(o)};es.prototype.createSpotLight=function(o){let A=new V1e(this._earthCtrl.coreMap,o.entities,o.lights);return A.name=o.name,A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createCustomShaderManager=function(o){let A=new Uet;return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createCustomShaderStage=function(o){let A=new Oet(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createModelOutline=function(o={}){let A=new Get(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.modelClick=function(o={}){let A=new Het(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createWaterPolygon=function(o){let A=new ett(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A.createWaterPolygonPrimitive(o)};var LD=es;var Qre=class extends xg{constructor(A,f){super(A),this._objectMap={},this._rootNode=null,this._isBenchUpdate=!1,this._selectSet=new g1e(A);let m=new C6(A);m.id=LD.createUUID(),m.name=ae(f.ProjectName,"root"),m.version=ae(f.version,null),m.desc=ae(f.desc,null),m.createTime=ae(f.createTime,new Date().toISOString()),m.lastUpdate=ae(f.lastUpdate,null),m.show=!0,this._rootNode=m,this._editNode=m,this._objectMap[m.id]=m,this._EventDocumentChanged=new s3("EventDocumentChanged")}finalize(){this._rootNode=null,this._objectMap={}}getChildById(A){return this._objectMap.hasOwnProperty(A)?this._objectMap[A]:null}addChild(A,f){A.addChild(f),this._objectMap[f.id]=f,this._isBenchUpdate||this.commitChanged()}removeChildById(A){let f=this._objectMap[A];k(f)&&this.removeChild(f)}removeChild(A){k(A)&&k(A.parentNode)&&(A.removeFromMap(),A.parentNode.removeChild(A)),delete this._objectMap[A.id],this._isBenchUpdate||this.commitChanged()}removeAll(){}beginUpdate(){this._isBenchUpdate=!0}endUpdate(){this._isBenchUpdate&&(this.commitChanged(),this._isBenchUpdate=!1)}commitChanged(){this._EventDocumentChanged.notifyEvent(this)}flyTo(A,f){k(A)&&k(A._primitive)&&(A=A._primitive),this._earthCtrl.coreMap.flyTo(A,f)}findLocationByID(A,f){if(!A)return;let m=this.getChildById(A);k(m)&&k(m._primitive)&&(m=m._primitive),this._earthCtrl.coreMap.flyTo(m,f)}moveLayer(A,f){let m=this.getChildById(A),C=null;for(let E=0;E<m.parentNode.childNodes.length;E++)m.parentNode.childNodes[E].id===m.id&&(C=E);f==="up"?(this._earthCtrl.coreMap.scene.imageryLayers.raise(m._primitive),this.changeLayer(m.parentNode.childNodes,C,C+1)):f==="down"&&(this._earthCtrl.coreMap.scene.imageryLayers.lower(m._primitive),this.changeLayer(m.parentNode.childNodes,C,C-1))}changeLayer(A,f,m){if(f=De.clamp(f,0,A.length-1),m=De.clamp(m,0,A.length-1),f===m)return;let C=A[f];A[f]=A[m],A[m]=C}outputJson(A){let f=this;new Promise(function(C,E){let I={IMAGERYPROVIDERS:"imageryProviders",TERRAINPROVIDERS:"terrainProviders",MODELLAYERS:"modelLayers",FEATURELAYERS:"featureLayers",USERSCENE:"userScene"},x=0,y=[];for(let v in I){let w=I[v],Q=f.rootNode.getChildByName(w);if(!Q)continue;let M=[];if(Q.childNodes.length===0)M=[];else for(let B=0;B<Q.childNodes.length;B++){let D=Q.childNodes[B].toJSON();M.push(D)}Promise.all(M).then(function(B){let D=[];if(B.length!==0){for(let R=0;R<B.length;R++)D.push(B[R]);let S=D[0].class;S!=="IMAGERY_LAYER"&&S!=="TERRAIN_LAYER"&&S!=="MODEL_LAYER"&&S!=="FEATURE_LAYER"&&(S="USER_SCENE");let P={item:S,objJson:D};y.push(P)}x++,x===5&&(C(y),x=0)})}}).then(function(C){let E={version:f.rootNode.version,projectName:f.rootNode.name,desc:f.rootNode.desc,createTime:f.rootNode.createTime,lastUpdate:new Date().toISOString(),imageryProviders:[],terrainProviders:[],modelLayers:[],featureLayers:[],userScene:[]};for(let w=0;w<C.length;w++)C[w].item==="IMAGERY_LAYER"&&(E.imageryProviders=C[w].objJson),C[w].item==="TERRAIN_LAYER"&&(E.terrainProviders=C[w].objJson),C[w].item==="MODEL_LAYER"&&(E.modelLayers=C[w].objJson),C[w].item==="FEATURE_LAYER"&&(E.featureLayers=C[w].objJson),C[w].item==="USER_SCENE"&&(E.userScene=C[w].objJson);let I={class:"ENVIRONMENT",underGround:ae(f._earthCtrl.camera.undergroundMode,null),shadow:ae(f._earthCtrl.shadows,null),depthTest:ae(f._earthCtrl.coreMap.scene.globe.depthTestAgainstTerrain,null),rain:ae(f._earthCtrl.environment.rain.show,null),snow:ae(f._earthCtrl.environment.snow.show,null),fog:ae(f._earthCtrl.environment.fog.show,null),bwMode:ae(f._earthCtrl.environment.bwMode.show,null),nightMode:ae(f._earthCtrl.environment.nightMode.show,null),colorAdjustment:{show:ae(f._earthCtrl.environment.colorAdjustment.show,null),contrast:ae(f._earthCtrl.environment.colorAdjustment.contrast,null),saturation:ae(f._earthCtrl.environment.colorAdjustment.saturation,null),brightness:ae(f._earthCtrl.environment.colorAdjustment.brightness,null)}},x={class:"SKYBOX",positiveX:ae(f._earthCtrl.environment.SkyBoxSource.positiveX,null),negativeX:ae(f._earthCtrl.environment.SkyBoxSource.negativeX,null),positiveY:ae(f._earthCtrl.environment.SkyBoxSource.positiveY,null),negativeY:ae(f._earthCtrl.environment.SkyBoxSource.negativeY,null),positiveZ:ae(f._earthCtrl.environment.SkyBoxSource.positiveZ,null),negativeZ:ae(f._earthCtrl.environment.SkyBoxSource.negativeZ,null)},y={class:"VIEWPOINT",lon:f._earthCtrl.camera.viewPoint.lon,lat:f._earthCtrl.camera.viewPoint.lat,alt:f._earthCtrl.camera.viewPoint.alt,heading:f._earthCtrl.camera.viewPoint.heading,pitch:f._earthCtrl.camera.viewPoint.pitch,roll:f._earthCtrl.camera.viewPoint.roll,duration:f._earthCtrl.camera.viewPoint.duration};E.userScene.push(I),E.userScene.push(x),E.userScene.push(y);let v=JSON.stringify(E);A&&A(v)})}};Object.defineProperties(Qre.prototype,{rootNode:{get:function(){return this._rootNode},set:function(o){this._rootNode=o}},editNode:{get:function(){return this._editNode},set:function(o){this._editNode=o}},selectSet:{get:function(){return this._selectSet}},EventDocumentChanged:{get:function(){return this._EventDocumentChanged}},EventObjectPropertyChanged:{get:function(){return this._EventObjectPropertyChanged}}});var z1e=Qre;function ttt(o){this._earthCtrl=o,this._coreMap=o.coreMap,this.initialize()}var dFi=new Oa,gFi=new Z,fFi=new Z;ttt.prototype.initialize=function(){let o=document.createElement("div");o.className="map-info-bar",o.style="position: absolute;left: 0px;bottom:0px;width: 100%;background:rgba(0,0,0,0.4); color:#e9e9e9; text-shadow:2px 2px 2px #000";let A=this._coreMap;A.container.appendChild(o);let f="float: right; min-width: 100px;margin-right: 20px;",m=document.createElement("div");m.style=f,o.appendChild(m);let C=document.createElement("div");C.style=f,o.appendChild(C);let E=document.createElement("div");E.style=f,o.appendChild(E);let I=A.scene.canvas,x=A.scene.globe.ellipsoid;new pr(I).setInputAction(function(v){let w=A.camera.pickEllipsoid(v.endPosition,x);if(w){let Q=A.scene.globe.ellipsoid.cartesianToCartographic(w),M=De.toDegrees(Q.latitude).toFixed(6),B=De.toDegrees(Q.longitude).toFixed(6),D=A.camera.positionCartographic.height.toFixed(1);E.innerHTML=`\u7ECF\u5EA6\uFF1A${B}`,C.innerHTML=`\u7EAC\u5EA6\uFF1A${M}`,m.innerHTML=`\u89C6\u70B9\u9AD8\uFF1A${D}\u7C73`}},_i.MOUSE_MOVE)};var itt=ttt;function yl(){}yl.parseBaseData=function(o,A){let f=[];if(k(A)&&k(A.imageryProviders))for(let C=0;C<A.imageryProviders.length;C++){let E=A.imageryProviders[C];if(E.enable===!1||E.show===!1)continue;if(k(E.tilingScheme)){let x=E.tilingScheme;x.type==="GeographicTilingScheme"&&(E.tilingScheme=new ph(x))}let I=LD.createImageryLayer(E);f.push(I)}let m=[];if(k(A)&&k(A.terrainProviders))for(let C=0;C<A.terrainProviders.length;C++){let E=A.terrainProviders[C];if(E.enable===!1||E.show===!1)continue;let I=LD.createTerrainLayer(E);m.push(I)}return{imageryProvider:f,terrainProvider:m}};yl.parse=function(o,A){if(!k(A))return;let f=[ds.IMAGERYPROVIDERS,ds.TERRAINPROVIDERS,ds.MODELLAYERS,ds.FEATURELAYERS,ds.USERSCENE];for(let m=0;m<f.length;m++){let C=o.factory.createSceneNode(LD.createUUID(),f[m]);C.show=!0,o.userScene.addChild(o.userScene.rootNode,C)}k(A[ds.IMAGERYPROVIDERS])&&w6(o,A[ds.IMAGERYPROVIDERS],o.userScene.rootNode.getChildByIndex(0),0),k(A[ds.TERRAINPROVIDERS])&&w6(o,A[ds.TERRAINPROVIDERS],o.userScene.rootNode.getChildByIndex(1),1),k(A[ds.MODELLAYERS])&&w6(o,A[ds.MODELLAYERS],o.userScene.rootNode.getChildByIndex(2)),k(A[ds.FEATURELAYERS])&&w6(o,A[ds.FEATURELAYERS],o.userScene.rootNode.getChildByIndex(3)),k(A[ds.USERSCENE])&&w6(o,A[ds.USERSCENE],o.userScene.rootNode.getChildByIndex(4))};function w6(o,A,f,m){for(let C=0;C<A.length;C++){let E=A[C],I=null;if(E.enable===!1)continue;k(E.class)?(E.class==="IMAGERY"&&(E.class=Xn.IMAGERY_LAYER),E.class==="TERRAIN"&&(E.class=Xn.TERRAIN_LAYER),I=E.class):(m===0?E.class=Xn.IMAGERY_LAYER:m===1&&(E.class=Xn.TERRAIN_LAYER),I=E.class);let x=yl.parserMap[I];x!==void 0&&x(o,E,f)}}function $_i(o,A,f){let m=o.factory.createSceneNode(A.id,A.name);m.show=ae(A.show,!0),o.userScene.addChild(f,m),k(A.childNodes)&&w6(o,A.childNodes,m)}function eBi(o,A,f){let m=A;if(k(m.tilingScheme)){let C=m.tilingScheme;C.type==="GeographicTilingScheme"&&(m.tilingScheme=new ph(C))}o.factory.createImageryLayer(m,f)}function tBi(o,A,f){let m=A;o.factory.createTerrainLayer(m,f)}function iBi(o,A,f){let m=A;m.addToMap=!0;let C=m.sourceType;C==="3DTiles"||C==="b3dm"||C==="osgb"||C==="s3m"||C==="ude_block"||C==="ude_model"?o.factory.createModelLayer(m,f):C==="czml"?o.factory.createCZMLObject(m,f):C==="wfsModel"&&o.factory.createWfsModel(m,f)}function rBi(o,A,f){let m=o.factory.createFeatureLayer(A,f)}function nBi(o,A,f){o.coreMap.scene.skyBox=new HN({sources:{positiveX:A.positiveX,negativeX:A.negativeX,positiveY:A.positiveY,negativeY:A.negativeY,positiveZ:A.positiveZ,negativeZ:A.negativeZ}})}function oBi(o,A,f){o.camera.undergroundMode=ae(A.underGround,!1),o.shadows=ae(A.shadow,!1),A.rain===!0&&o.environment.showEffect("rain"),A.snow===!0&&o.environment.showEffect("snow"),A.fog===!0&&o.environment.showEffect("fog"),o.coreMap.scene.globe.depthTestAgainstTerrain=ae(A.depthTest,!1),A.bwMode===!0&&o.environment.showEffect("bwMode"),A.nightMode===!0&&o.environment.showEffect("nightMode"),A.colorAdjustment.show===!0&&(o.environment.showEffect("colorAdjustment"),o.environment.colorAdjustment.contrast=A.colorAdjustment.contrast,o.environment.colorAdjustment.saturation=A.colorAdjustment.saturation,o.environment.colorAdjustment.brightness=A.colorAdjustment.brightness)}function aBi(o,A,f){o.camera.viewPoint=A,o.camera.flyTo(A.lon,A.lat,A.alt,A.heading,A.pitch,A.roll,A.duration)}function sBi(o,A,f){o.factory.createModel(A,f)}function lBi(o,A,f){o.factory.createWaters(A,f)}function ABi(o,A,f){o.factory.createExplosion(A,f)}function uBi(o,A,f){o.factory.createFireworks(A,f)}function cBi(o,A,f){o.factory.createSmoke(A,f)}function hBi(o,A,f){o.factory.createFire(A,f)}function dBi(o,A,f){A.color&&(A.color=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),o.factory.createRadarScan(A,f)}function gBi(o,A,f){A.color&&(A.color=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),o.factory.createCircleScan(A,f)}function fBi(o,A,f){A.color&&(A.color=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),o.factory.createPoint(A,f)}function pBi(o,A,f){A.fillColor&&(A.fillColor=new qe(A.fillColor.red,A.fillColor.green,A.fillColor.blue,A.fillColor.alpha)),o.factory.createLabel(A,f)}function mBi(o,A,f){o.factory.createBillboard(A,f)}function CBi(o,A,f){A.positions&&(A.positions=yl.array2DtoMercator(A.positions)),A.lineColor&&(A.lineColor=new qe(A.lineColor.red,A.lineColor.green,A.lineColor.blue,A.lineColor.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),o.factory.createPolyline(A,f)}function EBi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.positions&&(A.positions=yl.array2DtoMercator(A.positions)),o.factory.createPolygon(A,f)}function IBi(o,A,f){A.coordinates&&(A.coordinates=hi.fromDegrees(A.coordinates[0],A.coordinates[1],A.coordinates[2],A.coordinates[3])),A.fillColor&&(A.fillColor=new qe(A.fillColor.red,A.fillColor.green,A.fillColor.blue,A.fillColor.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),o.factory.createRectangle(A,f)}function xBi(o,A,f){o.factory.createEllipse(A,f)}function yBi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.position&&(A.position=Z.fromDegrees(A.position[0],A.position[1],A.position[2])),A.dimensions&&(A.dimensions=new Z(A.dimensions.x,A.dimensions.y,A.dimensions.z)),o.factory.createBox(A,f)}function vBi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.position&&(A.position=Z.fromDegrees(A.position[0],A.position[1],A.position[2])),A.radii&&(A.radii=new Z(A.radii[0],A.radii[1],A.radii[2])),o.factory.createEllipsoid(A,f)}function _Bi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.position&&(A.position=Z.fromDegrees(A.position[0],A.position[1],A.position[2])),o.factory.createCylinder(A,f)}function BBi(o,A,f){o.factory.createPolylineVolume(A,f)}function wBi(o,A,f){o.factory.createVideoProjection(A,f)}function bBi(o,A,f){o.factory.createVideoProjection(A,f)}function QBi(o,A,f){o.factory.createTrack(A,f)}function SBi(o,A,f){o.factory.createHeatmap(A,f)}function DBi(o,A,f){o.factory.createEChartLayer(A,f)}function MBi(o,A,f){let m=o.factory.createElement(A);o.userScene.addChild(f,m)}yl.array2DtoMercator=function(o){let A=[];return o.forEach(function(f){let m=Z.fromDegrees(f[0],f[1],f[2]);A.push(m)}),A};yl.parserMap={};yl.parserMap[Xn.NODE]=$_i;yl.parserMap[Xn.IMAGERY_LAYER]=eBi;yl.parserMap[Xn.TERRAIN_LAYER]=tBi;yl.parserMap[Xn.MODEL_LAYER]=iBi;yl.parserMap[Xn.FEATURE_LAYER]=rBi;yl.parserMap[Xn.SKYBOX]=nBi;yl.parserMap[Xn.ENVIRONMENT]=oBi;yl.parserMap[Xn.VIEWPOINT]=aBi;yl.parserMap[Xn.MODEL]=sBi;yl.parserMap[Xn.WATERS]=lBi;yl.parserMap[Xn.EXPLOSION]=ABi;yl.parserMap[Xn.FIREWORK]=uBi;yl.parserMap[Xn.SMOKE]=cBi;yl.parserMap[Xn.FIRE]=hBi;yl.parserMap[Xn.RADARSCAN]=dBi;yl.parserMap[Xn.CIRCLESCAN]=gBi;yl.parserMap[Xn.POINT]=fBi;yl.parserMap[Xn.LABEL]=pBi;yl.parserMap[Xn.BILLBOARD]=mBi;yl.parserMap[Xn.POLYLINE]=CBi;yl.parserMap[Xn.POLYGON]=EBi;yl.parserMap[Xn.RECTANGLE]=IBi;yl.parserMap[Xn.ELLIPSE]=xBi;yl.parserMap[Xn.BOX]=yBi;yl.parserMap[Xn.ELLIPSOID]=vBi;yl.parserMap[Xn.CYLINDER]=_Bi;yl.parserMap[Xn.POLYLINEVOLUME]=BBi;yl.parserMap[Xn.PERSPECTIVE_VIDEO_PROJECTION]=wBi;yl.parserMap[Xn.FISHEYE_VIDEO_PROJECTION]=bBi;yl.parserMap[Xn.TRACK]=QBi;yl.parserMap[Xn.HEATMAP]=SBi;yl.parserMap[Xn.ECHARTLAYER]=DBi;yl.parserMap.ELEMENT=MBi;var rtt=yl;var Y1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editBillboard=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.editBillboard=f,k(this.editBillboard)&&k(this.editBillboard.entity.billboard)?console.info(this.editBillboard.entity):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Billboard entity is need!"}))}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editBillboard.entity.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editBillboard.entity)||this.pickObject(A,this.editBillboard.entity))&&this.mCallback&&this.mCallback(this.editBillboard),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m,this.editBillboard.entity.position=m}return this.mCallback&&this.mCallback(this.editBillboard),!0}updateBillboard(A){if(k(A)&&k(this.editBillboard)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editBillboard.entity.position=A[C]:k(A[C])&&(this.editBillboard.entity.billboard[C]=A[C])}}}endEditEntity(){}},ntt=Y1e;var J1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editPoint=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.editPoint=f,k(this.editPoint)&&k(this.editPoint.entity.point)?console.info(this.editPoint.entity.point):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Point entity is need!"}))}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPoint.entity.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPoint.entity)||this.pickObject(A,this.editPoint.entity))&&this.mCallback&&this.mCallback(this.editPoint),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m,this.editPoint.entity.position=m}return this.mCallback&&this.mCallback(this.editPoint),!0}updatePoint(A){if(k(A)&&k(this.editPoint)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editPoint.entity.position=A[C]:k(A[C])&&(this.editPoint.entity.point[C]=A[C])}}}endEditEntity(){}},ott=J1e;var K1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editBox=void 0,this.pickedEntity=void 0,this.editHeightPoint=void 0,this.editWHPoint=void 0,this.pickEditHeightPoint=void 0,this.pickEditWHPoint=void 0,this.isEditing=!1,this.pointsId=[],this.height=0,this.dragPosition=void 0,this.editBox=f,k(this.editBox)&&k(this.editBox.entity.box)){let E=this.editBox.entity.position._value,I=Lt.fromCartesian(E);this.height=I.height;let x=new Z,y=new Z;this.getNorthPointByDistance(x,y),this.editHeightPoint=this.mEarthCtrl.entities.add({name:"box_edit_height_point",position:x,point:{heightReference:this.editBox.entity.box.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.editHeightPoint.id),this.editWHPoint=this.mEarthCtrl.entities.add({name:"box_edit_long_width_point",position:y,point:{heightReference:this.editBox.entity.box.heightReference,color:qe.RED,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.editWHPoint.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Box entity is need!"})}addHeight(A){let f=this.editBox.entity.position._value,m=Lt.fromCartesian(f);return this.height=m.height+A,Z.fromRadians(m.longitude,m.latitude,this.height)}getNorthPointByDistance(A,f,m){let C;console.info(this.editBox.entity.position),k(m)?C=this.editBox.entity.position.getValue(m):C=this.editBox.entity.position._value;let E=Vr.eastNorthUpToFixedFrame(C),I=new Z,x=this.editBox.entity.box.dimensions._value;x||(x=this.editBox.entity.box.dimensions.getValue(m)),Z.divideByScalar(x,2,I),Z.clone(I,A),Z.clone(I,f),A.y*=-1,Re.multiplyByPoint(E,A,A),f.y*=-1,f.z*=-1,Re.multiplyByPoint(E,f,f)}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editBox.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickEditHeightPoint=void 0,this.pickEditWHPoint=void 0):f.name==="box_edit_height_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickEditHeightPoint=f,this.pickEditWHPoint=void 0):f.name==="box_edit_long_width_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickEditHeightPoint=void 0,this.pickEditWHPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editBox)||this.pickObject(A,this.editBox.entity))&&this.mCallback&&this.mCallback(this.editBox),this.currentPoint=void 0,this.isEditing=!1,this.dragPosition=void 0,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;let f=new Date,m=jt.fromDate(f);if(k(this.currentPoint)||k(this.pickEditHeightPoint)||k(this.pickEditWHPoint)){let C=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,E=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,C);if(!E)return;let I=Lt.fromCartesian(E),x=Z.fromRadians(I.longitude,I.latitude,I.height+this.height);if(k(this.currentPoint))this.currentPoint.position=x,this.editBox.entity.position=new Kr(function(){return x},!1);else if(k(this.dragPosition)){if(k(this.pickEditWHPoint)){let w=Z.subtract(E,this.dragPosition,new Z),Q=Z.normalize(w,new Z);Z.dot(w,Q,w);let M=this.editBox.entity.box.dimensions._value;M||(M=this.editBox.entity.box.dimensions.getValue(m));let B=Z.clone(M);B.x-=w.x,B.y+=w.y,Z.abs(B,B),this.editBox.entity.box.dimensions=new Kr(function(){return B},!1)}else if(k(this.pickEditHeightPoint)){let w=Z.subtract(E,this.dragPosition,new Z),Q=this.editBox.entity.box.dimensions._value;Q||(Q=this.editBox.entity.box.dimensions.getValue(m));let M=Z.clone(Q);M.z+=w.z,Z.abs(M,M),this.editBox.entity.box.dimensions=M,this.editBox.entity.position=this.addHeight(w.z/2)}}this.dragPosition=E;let y=new Z,v=new Z;this.getNorthPointByDistance(y,v,m),this.editHeightPoint.position=y,this.editWHPoint.position=v}return this.mCallback&&this.mCallback(this.editBox),!0}updateBox(A){if(k(A)&&k(this.editBox)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editBox.entity.position=A[C]:k(A[C])&&(this.editBox.entity.box[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},att=K1e;var W1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editCylinder=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.pointsId=[],this.height=0,this.topRadiusPoint=void 0,this.pickTopRadiusPoint=void 0,this.bottomRadiusPoint=void 0,this.pickBottomRadiusPoint=void 0,this.heightPoint=void 0,this.pickHeightPoint=void 0,this.dragPosition=void 0,this.editCylinder=f,k(this.editCylinder)&&k(this.editCylinder.entity.cylinder)){let E=this.editCylinder.entity.position._value,I=Lt.fromCartesian(E);this.height=I.height;let x=this.editCylinder.entity.cylinder.topRadius._value,y=this.editCylinder.entity.cylinder.bottomRadius._value,v=new Z,w=new Z,Q=new Z;this.getNorthPointByDistance(v,w,Q),this.heightPoint=this.mEarthCtrl.entities.add({name:"cylinder_edit_height_point",position:Q,point:{heightReference:this.editCylinder.entity.cylinder.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.heightPoint.id),x>0&&(this.topRadiusPoint=this.mEarthCtrl.entities.add({name:"cylinder_edit_top_radius_point",position:v,point:{heightReference:this.editCylinder.entity.cylinder.heightReference,color:qe.RED,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.topRadiusPoint.id)),y>0&&(this.bottomRadiusPoint=this.mEarthCtrl.entities.add({name:"cylinder_edit_bottom_radius_point",position:w,point:{heightReference:this.editCylinder.entity.cylinder.heightReference,color:qe.RED,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.bottomRadiusPoint.id))}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Cylinder entity is need!"})}addHeight(A){let f=this.editCylinder.entity.position._value,m=Lt.fromCartesian(f);return this.height=m.height+A,Z.fromRadians(m.longitude,m.latitude,this.height)}getNorthPointByDistance(A,f,m){let C=this.editCylinder.entity.position._value,E=Vr.eastNorthUpToFixedFrame(C),I=this.editCylinder.entity.cylinder.length._value,x=this.editCylinder.entity.cylinder.topRadius._value,y=this.editCylinder.entity.cylinder.bottomRadius._value;x>0&&(A.z+=I/2,A.x+=x,Re.multiplyByPoint(E,A,A)),y>0&&(f.x+=y,f.z-=I/2,Re.multiplyByPoint(E,f,f)),m.z+=I/2,Re.multiplyByPoint(E,m,m)}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editCylinder.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickHeightPoint=void 0,this.pickTopRadiusPoint=void 0,this.pickBottomRadiusPoint=void 0):f.name==="cylinder_edit_height_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickHeightPoint=f,this.pickTopRadiusPoint=void 0,this.pickBottomRadiusPoint=void 0):f.name==="cylinder_edit_top_radius_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickHeightPoint=void 0,this.pickTopRadiusPoint=f,this.pickBottomRadiusPoint=void 0):f.name==="cylinder_edit_bottom_radius_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickHeightPoint=void 0,this.pickTopRadiusPoint=void 0,this.pickBottomRadiusPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editCylinder)||this.pickObject(A,this.editCylinder.entity))&&this.mCallback&&this.mCallback(this.editCylinder),this.currentPoint=void 0,this.dragPosition=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)||k(this.heightPoint)||k(this.topRadiusPoint)||k(this.bottomRadiusPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=Z.fromRadians(C.longitude,C.latitude,C.height+this.height);if(k(this.currentPoint))this.currentPoint.position=E,this.editCylinder.entity.position=E;else if(k(this.dragPosition)){if(k(this.pickHeightPoint)){let Q=Z.subtract(m,this.dragPosition,new Z),M=this.editCylinder.entity.cylinder.length._value;M+=Q.z,M=Math.abs(M),this.editCylinder.entity.position=this.addHeight(Q.z/2),this.editCylinder.entity.cylinder.length=M}else if(k(this.pickTopRadiusPoint)){let Q=Z.subtract(m,this.dragPosition,new Z),M=this.editCylinder.entity.cylinder.topRadius._value;M-=Q.x,M=Math.abs(M),this.editCylinder.entity.cylinder.topRadius=M}else if(k(this.pickBottomRadiusPoint)){let Q=Z.subtract(m,this.dragPosition,new Z),M=this.editCylinder.entity.cylinder.bottomRadius._value;M-=Q.x,M=Math.abs(M),this.editCylinder.entity.cylinder.bottomRadius=M}}this.dragPosition=m;let I=this.editCylinder.entity.cylinder.topRadius._value,x=this.editCylinder.entity.cylinder.bottomRadius._value,y=new Z,v=new Z,w=new Z;this.getNorthPointByDistance(y,v,w),I>0&&(this.topRadiusPoint.position=y),x>0&&(this.bottomRadiusPoint.position=v),this.heightPoint.position=w}return this.mCallback&&this.mCallback(this.editCylinder),!0}updateCylinder(A){if(k(A)&&k(this.editCylinder)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editCylinder.entity.position=A[C]:k(A[C])&&(this.editCylinder.entity.cylinder[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},stt=W1e;var q1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editEllipse=void 0,this.pickedEntity=void 0,this.semiMajorAxisPoint=void 0,this.semiMinorAxisPoint=void 0,this.pickSemiMajorAxisPoint=void 0,this.pickSemiMinorAxisPoint=void 0,this.pointsId=[],this.isEditing=!1,this.circle=!1,this.editEllipse=f,k(this.editEllipse)&&k(this.editEllipse.entity.ellipse)){let E=De.PI_OVER_TWO,I=this.updatePoint(E);this.semiMajorAxisPoint=this.mEarthCtrl.entities.add({name:"semi_major_axis_point",position:I,point:{heightReference:this.editEllipse.entity.ellipse.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.semiMajorAxisPoint.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Ellipse entity is need!"})}updatePoint(A){let f=new Z,m=new Z,C=new Z,E=this.editEllipse.entity.ellipse;this.semiMinorAxis=E.semiMinorAxis._value,this.semiMajorAxis=E.semiMajorAxis._value,this.circle=this.semiMajorAxis===this.semiMinorAxis;let I=ae(E.rotation,0);this.center=this.editEllipse.entity.position._value;let x=this.semiMinorAxis*this.semiMinorAxis,y=this.semiMajorAxis*this.semiMajorAxis,v=this.semiMajorAxis*this.semiMinorAxis,w=Z.magnitude(this.center),Q=Z.normalize(this.center,f),M=Z.cross(Z.UNIT_Z,this.center,m);M=Z.normalize(M,M);let B=Z.cross(Q,M,C),D=new Z;return Rx.pointOnEllipsoid(A,I,B,M,x,v,y,w,Q,D)}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editEllipse.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickSemiMajorAxisPoint=void 0,this.pickSemiMinorAxisPoint=void 0):f.name==="semi_minor_axis_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickSemiMajorAxisPoint=void 0,this.pickSemiMinorAxisPoint=f):f.name==="semi_major_axis_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickSemiMajorAxisPoint=f,this.pickSemiMinorAxisPoint=void 0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editEllipse)||this.pickObject(A,this.editEllipse.entity))&&this.mCallback&&this.mCallback(this.editEllipse),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)||k(this.pickSemiMajorAxisPoint)||k(this.pickSemiMinorAxisPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;if(k(this.currentPoint))this.currentPoint.position=m,this.editEllipse.entity.position=m;else if(k(this.pickSemiMajorAxisPoint)){let C=Z.distance(this.center,m);this.editEllipse.entity.ellipse.semiMajorAxis=C;let E=C*this.semiMinorAxis/this.semiMajorAxis;E>C&&(E=C),this.editEllipse.entity.ellipse.semiMinorAxis=E}else if(k(this.pickSemiMinorAxisPoint)){let C=Z.distance(this.center,m);this.editEllipse.entity.ellipse.semiMinorAxis=C}this.semiMajorAxisPoint.position=this.updatePoint(De.PI_OVER_TWO)}return this.mCallback&&this.mCallback(this.editEllipse),!0}updateEllipse(A){if(k(A)&&k(this.editEllipse)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editEllipse.entity.position=A[C]:k(A[C])&&(this.editEllipse.entity.ellipse[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},ltt=q1e;var j1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editEllipsoid=void 0,this.pickedEntity=void 0,this.height=0,this.isEditing=!1,this.pointsId=[],this.radiiXPoint=void 0,this.pickRadiiXPoint=void 0,this.radiiYPoint=void 0,this.pickRadiiYPoint=void 0,this.radiiZPoint=void 0,this.pickRadiiZPoint=void 0,this.dragPosition=void 0,this.editEllipsoid=f,k(this.editEllipsoid)&&k(this.editEllipsoid.entity.ellipsoid)){console.info(this.editEllipsoid.ellipsoid);let E=this.editEllipsoid.entity.position._value,I=Lt.fromCartesian(E);this.height=I.height;let x=new Z,y=new Z,v=new Z;this.getNorthPointByDistance(x,y,v),this.radiiXPoint=this.mEarthCtrl.entities.add({name:"ellipse_edit_x_point",position:x,point:{heightReference:this.editEllipsoid.entity.ellipsoid.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.radiiXPoint.id),this.radiiYPoint=this.mEarthCtrl.entities.add({name:"ellipse_edit_y_point",position:y,point:{heightReference:this.editEllipsoid.entity.ellipsoid.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.radiiYPoint.id),this.radiiZPoint=this.mEarthCtrl.entities.add({name:"ellipse_edit_z_point",position:v,point:{heightReference:this.editEllipsoid.entity.ellipsoid.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.radiiZPoint.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Ellipsoid entity is need!"})}addHeight(A){let f=this.editEllipsoid.entity.position._value,m=Lt.fromCartesian(f);return this.height=m.height+A,Z.fromRadians(m.longitude,m.latitude,this.height)}getNorthPointByDistance(A,f,m){let C=this.editEllipsoid.entity.position._value,E=Vr.eastNorthUpToFixedFrame(C),I=this.editEllipsoid.entity.ellipsoid.radii._value;A.x=I.x,Re.multiplyByPoint(E,A,A),f.y=-I.y,Re.multiplyByPoint(E,f,f),m.z=I.z,Re.multiplyByPoint(E,m,m)}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editEllipsoid.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickRadiiXPoint=void 0,this.pickRadiiYPoint=void 0,this.pickRadiiZPoint=void 0):f.name==="ellipse_edit_x_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickRadiiXPoint=f,this.pickRadiiYPoint=void 0,this.pickRadiiZPoint=void 0):f.name==="ellipse_edit_y_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickRadiiXPoint=void 0,this.pickRadiiYPoint=f,this.pickRadiiZPoint=void 0):f.name==="ellipse_edit_z_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickRadiiXPoint=void 0,this.pickRadiiYPoint=void 0,this.pickRadiiZPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editEllipsoid)||this.pickObject(A,this.editEllipsoid.entity))&&this.mCallback&&this.mCallback(this.editEllipsoid),this.currentPoint=void 0,this.dragPosition=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)||k(this.pickRadiiXPoint)||k(this.pickRadiiYPoint)||k(this.pickRadiiZPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=Z.fromRadians(C.longitude,C.latitude,C.height+this.height);if(k(this.currentPoint))this.currentPoint.position=E,this.editEllipsoid.entity.position=E;else{if(k(this.dragPosition)){let v=Z.subtract(m,this.dragPosition,new Z),w=Z.normalize(v,new Z);Z.dot(v,w,v);let Q=this.editEllipsoid.entity.ellipsoid.radii._value,M=Z.clone(Q);k(this.pickRadiiXPoint)?M.x-=v.x:k(this.pickRadiiYPoint)?M.y+=v.y:k(this.pickRadiiZPoint)&&(M.z+=v.z,this.editEllipsoid.entity.position=this.addHeight(v.z)),Z.abs(M,M),this.editEllipsoid.entity.ellipsoid.radii=M}this.dragPosition=m}let I=new Z,x=new Z,y=new Z;this.getNorthPointByDistance(I,x,y),this.radiiXPoint.position=I,this.radiiYPoint.position=x,this.radiiZPoint.position=y}return this.mCallback&&this.mCallback(this.editEllipsoid),!0}updateEllipsoid(A){if(k(A)&&k(this.editEllipsoid)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editEllipsoid.entity.position=A[C]:k(A[C])&&(this.editEllipsoid.entity.ellipsoid[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},Att=j1e;var X1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editPolygon=void 0,this.pickedEntity=void 0,this.currentPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editPolygon=f,k(this.editPolygon)&&k(this.editPolygon.entity.polygon))for(let E=0;E<this.editPolygon.entity.polygon.hierarchy._value.positions.length;E++){let I=this.editPolygon.entity.polygon.hierarchy._value.positions[E],x=this.mEarthCtrl.entities.add({name:"polygon_point",position:I,point:{color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(x.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Polygon entity is need!"})}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPolygon.entity.id?(this.isEditing=!0,this.currentPoint=void 0):f.name==="polygon_point"&&(this.currentPoint=f,this.isEditing=!0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPolygon)||this.pickObject(A,this.editPolygon.entity))&&this.mCallback&&this.mCallback(this.editPolygon),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m;let C=[];for(let E=0;E<this.pointsId.length;E++){let I=this.pointsId[E];C.push(this.mEarthCtrl.entities.getById(I).position._value)}this.editPolygon.entity.polygon.hierarchy=C}return this.mCallback&&this.mCallback(this.editPolygon),!0}updatePolygon(A){if(k(A)&&k(this.editPolygon)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];k(A[C])&&(this.editPolygon.entity.polygon[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},utt=X1e;var Z1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editModel=void 0,this.pickedEntity=void 0,this.editColor=qe.RED.withAlpha(.8),this.isEditing=!1,this.editModel=f,this.oldColor=this.editModel.entity.color,this.editModel.entity.color=this.editColor,k(this.editModel)&&k(this.editModel.entity)?console.info(this.editModel.entity):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"gltf Model is need!"}))}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f===this.editModel.parameter.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editModel)||this.pickObject(A,this.editModel.entity))&&this.mCallback&&this.mCallback(this.editModel),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=Lt.clone(C);E.longitude=De.toDegrees(E.longitude),E.latitude=De.toDegrees(E.latitude),this.editModel.lon=E.longitude,this.editModel.lat=E.latitude}return this.mCallback&&this.mCallback(this.editModel),!0}updateModel(A){if(k(A)&&k(this.editModel)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];if(k(A[C]))switch(C){case"lon":case"lat":case"alt":case"heading":case"pitch":case"roll":this.editModel[C]=A[C];break;default:this.editModel.entity[C]=A[C];break}}}}endEditEntity(){this.editModel.entity.color=this.oldColor}},ctt=Z1e;var $1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editLabel=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.editLabel=f,k(this.editLabel)&&k(this.editLabel.entity.label)?console.info(this.editLabel.entity):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Label entity is need!"}))}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editLabel.entity.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editLabel.entity)||this.pickObject(A,this.editLabel.entity))&&this.mCallback&&this.mCallback(this.editLabel),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m,this.editLabel.entity.position=m}return this.mCallback&&this.mCallback(this.editLabel),!0}updateLabel(A){if(k(A)&&k(this.editLabel)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editLabel.entity.position=A[C]:k(A[C])&&(this.editLabel.entity.label[C]=A[C])}}}endEditEntity(){}},htt=$1e;var ebe=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editPolyline=void 0,this.pickedEntity=void 0,this.currentPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editPolyline=f,k(this.editPolyline)&&k(this.editPolyline.polyline))for(let E=0;E<this.editPolyline.polyline.positions._value.length;E++){let I=this.editPolyline.polyline.positions._value[E],x=this.mEarthCtrl.entities.add({name:"polyline_point",position:I,point:{color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(x.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Polyline entity is need!"})}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPolyline.id?(this.isEditing=!0,this.currentPoint=void 0):f.name==="polyline_point"&&(this.currentPoint=f,this.isEditing=!0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPolyline)||this.pickObject(A,this.editPolyline.entity))&&this.mCallback&&this.mCallback(this.editPolyline),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m;let C=[];for(let E=0;E<this.pointsId.length;E++){let I=this.pointsId[E];C.push(this.mEarthCtrl.entities.getById(I).position._value)}this.editPolyline.polyline.positions=C}return this.mCallback&&this.mCallback(this.editPolyline),!0}updatePolyline(A){if(k(A)&&k(this.editPolyline)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];k(A[C])&&(this.editPolyline.polyline[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},dtt=ebe;var tbe=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editPolylineVolume=void 0,this.pickedEntity=void 0,this.currentPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editPolylineVolume=f,k(this.editPolylineVolume)&&k(this.editPolylineVolume.entity.polylineVolume))for(let E=0;E<this.editPolylineVolume.entity.polylineVolume.positions._value.length;E++){let I=this.editPolylineVolume.entity.polylineVolume.positions._value[E],x=this.mEarthCtrl.entities.add({name:"edit_polylineVolume_point",position:I,point:{color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(x.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"PolylineVolume entity is need!"})}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPolylineVolume.entity.id?(this.isEditing=!0,this.currentPoint=void 0):f.name==="edit_polylineVolume_point"&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPolylineVolume)||this.pickObject(A,this.editPolylineVolume.entity))&&this.mCallback&&this.mCallback(this.editPolylineVolume),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m;let C=[];for(let E=0;E<this.pointsId.length;E++){let I=this.pointsId[E];C.push(this.mEarthCtrl.entities.getById(I).position._value)}this.editPolylineVolume.entity.polylineVolume.positions=C}return this.mCallback&&this.mCallback(this.editPolylineVolume),!0}updatePolylineVolume(A){if(k(A)&&k(this.editPolylineVolume)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editPolylineVolume.entity.position=A[C]:k(A[C])&&(this.editPolylineVolume.entity.polylineVolume[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},gtt=tbe;var ibe=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editRectangle=void 0,this.pickedEntity=void 0,this.leftTopPoint=void 0,this.rightBottomPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editRectangle=f,k(this.editRectangle)&&k(this.editRectangle.entity.rectangle)){let E=this.editRectangle.entity.rectangle.coordinates._value,I=this.editRectangle.entity.rectangle.height._value,x=hi.northwest(E),y=Z.fromRadians(x.longitude,x.latitude,I),v=this.mEarthCtrl.entities.add({name:"rect_left_top_point",position:y,point:{heightReference:this.editRectangle.entity.rectangle.heightReference,color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(v.id),x=hi.southeast(E);let w=Z.fromRadians(x.longitude,x.latitude,I),Q=this.mEarthCtrl.entities.add({name:"rect_right_bottom_point",position:w,point:{heightReference:this.editRectangle.entity.rectangle.heightReference,color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(Q.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Rectangle entity is need!"})}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editRectangle.entity.id?(this.isEditing=!0,this.leftTopPoint=void 0,this.rightBottomPoint=void 0):f.name==="rect_left_top_point"?(this.leftTopPoint=f,this.rightBottomPoint=void 0,this.isEditing=!0):f.name==="rect_right_bottom_point"&&(this.rightBottomPoint=f,this.leftTopPoint=void 0,this.isEditing=!0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editRectangle)||this.pickObject(A,this.editRectangle.entity))&&this.mCallback&&this.mCallback(this.editRectangle),this.leftTopPoint=void 0,this.rightBottomPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.leftTopPoint)||k(this.rightBottomPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=this.editRectangle.entity.rectangle.coordinates._value;k(this.leftTopPoint)?(this.leftTopPoint.position=m,E.west=C.longitude,E.north=C.latitude):k(this.rightBottomPoint)&&(this.rightBottomPoint.position=m,E.south=C.latitude,E.east=C.longitude),this.editRectangle.entity.rectangle.coordinates=E}return this.mCallback&&this.mCallback(this.editRectangle),!0}updateRectangle(A){if(k(A)&&k(this.editRectangle)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editRectangle.entity.position=A[C]:k(A[C])&&(this.editRectangle.entity.rectangle[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},ftt=ibe;function pp(o,A={}){this._earthCtrl=o,this._scene=o.coreMap.scene,this.hpRoll={heading:0,pitch:0,roll:0,select:"",angle:0}}pp.prototype.start=function(o,A={}){if(this.end(),!!o){if(console.log(o),this.model=o,o._parameter)o._parameter.sourceType&&o._parameter.sourceType==="b3dm"||o._parameter.sourceType==="3DTiles"?(this.modeltype="b3dm",this.originPosition=Re.getTranslation(this.model._primitive._root.transform,new Z),this.model._parameter.transform||(this.model._parameter.transform={}),this.hpRoll={heading:this.model._parameter.transform.heading||0,pitch:this.model._parameter.transform.pitch||0,roll:this.model._parameter.transform.roll||0,select:"",angle:0}):o._parameter.sourceType&&o._parameter.sourceType==="I3S"?(this.modeltype="I3S",this.hpRoll={heading:this.model._parameter.heading||0,pitch:this.model._parameter.pitch||0,roll:this.model._parameter.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z)):o._parameter.sourceType&&o._parameter.sourceType==="s3m"?(this.modeltype="s3m",this.hpRoll={heading:this.model._parameter.heading||0,pitch:this.model._parameter.pitch||0,roll:this.model._parameter.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model.modelMatrix,new Z)):(this.modeltype="GLTF",this.originPosition=Re.getTranslation(this.model._primitive.modelMatrix,new Z),this.hpRoll={heading:this.model._parameter.heading||0,pitch:this.model._parameter.pitch||0,roll:this.model._parameter.roll||0,select:"",angle:0});else if(o._layers&&o._layers[0]&&o._layers[0]._tileset){this.modeltype="I3S";let f=this.matrixGetRotation(this.model._layers[0]._tileset._root.transform);this.model._parameter={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,sourceType:"I3S"},this.hpRoll={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z)}else if(o.fileType&&o.fileType==="OSGBCacheFile"||o.modelMatrix&&o._rectangle){this.modeltype="s3m";let f=this.matrixGetRotation(o.modelMatrix);this.model._parameter={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,sourceType:"s3m"},this.hpRoll={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model.modelMatrix,new Z)}else{console.log("\u6682\u4E0D\u652F\u6301\u8BE5\u6A21\u578B\u683C\u5F0F");return}return this.centerPoint=this.toDegrees(this.originPosition),this.initEvent(A),this}};pp.prototype.initEvent=function(o){this.editHandler=new pr(this._scene.canvas),this.modeltype==="b3dm"?this.radius=this.model._primitive.boundingSphere.radius:this.modeltype==="I3S"?this.radius=this.model._layers[0]._tileset.boundingSphere.radius:this.modeltype==="s3m"?this.radius=this.model._rootTiles[0].boundingVolume._boundingSphere.radius:this.radius=this.model._primitive._boundingSphere.radius;let A,f;this.createAxios(o.select),this.editHandler.setInputAction(m=>{A?(f=m.position,this.modeltype==="b3dm"?this.originPosition=Re.getTranslation(this.model._primitive._root.transform,new Z):this.modeltype==="I3S"?this.originPosition=Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z):this.modeltype==="s3m"?this.originPosition=Re.getTranslation(this.model.modelMatrix,new Z):this.originPosition=Re.getTranslation(this.model._primitive.modelMatrix,new Z),this.startPosition=this._scene.pickPosition(f)):f=void 0},_i.LEFT_DOWN),this._scene.pickPointInterval=500,this.editHandler.setInputAction(m=>{if(f){this._scene.screenSpaceCameraController.enableRotate=!1,this.edit(A,f,m),o.callback&&o.callback(A);return}let C=this._scene.pick(m.endPosition);if(C&&C.id)if(C.id._name&&C.id._name==="modeEditAxis"){let E=C.id._id;E==="entityPolylineY"?(A="y",this.selectAxis="y",this.setAxisStyle(!0,"y")):E==="entityPolylineX"?(A="x",this.selectAxis="x",this.setAxisStyle(!0,"x")):E==="entityPolylineZ"&&(A="z",this.selectAxis="z",this.setAxisStyle(!0,"z"))}else C.id==="axisSphereX"?A="pitch":C.id==="axisSphereY"?A="roll":C.id==="axisSphereZ"?A="heading":(A=void 0,this.setAxisStyle(!1));else A=void 0,this.setAxisStyle(!1)},_i.MOUSE_MOVE),this.editHandler.setInputAction(m=>{this.upDateHpRoll(),f=void 0,this._scene.screenSpaceCameraController.enableRotate=!0,this.rotateSector1&&this._earthCtrl.entities.remove(this.rotateSector1),this.rotateSector1=void 0,this.rotateSector2&&this._earthCtrl.entities.remove(this.rotateSector2),this.rotateSector2=void 0},_i.LEFT_UP)};pp.prototype.createAxios=function(o){let A=this.centerPoint,f=2e-5*Number(this.radius),m=18e-6*Number(this.radius),C=1.7*Number(this.radius);if((o===1||o===3)&&(this.arrowx=this._earthCtrl.entities.add({name:"modeEditAxis",id:"entityPolylineX",position:this.originPosition,polyline:{positions:new Z.fromDegreesArrayHeights([A.lon,A.lat,A.hei,A.lon+f,A.lat,A.hei]),material:new R2(qe.RED),followSurface:!1,width:25}}),this.arrowy=this._earthCtrl.entities.add({id:"entityPolylineY",name:"modeEditAxis",position:this.originPosition,polyline:{positions:new Z.fromDegreesArrayHeights([A.lon,A.lat,A.hei,A.lon,A.lat+m,A.hei]),material:new R2(qe.GREEN),followSurface:!1,width:25}}),this.arrowz=this._earthCtrl.entities.add({name:"modeEditAxis",id:"entityPolylineZ",position:this.originPosition,polyline:{positions:new Z.fromDegreesArrayHeights([A.lon,A.lat,A.hei,A.lon,A.lat,A.hei+C]),material:new R2(qe.BLUE),followSurface:!1,width:25}})),o===2||o===3){this.AxisX=this.createAxisSphere("axisSphereX",this.radius,this.originPosition,qe.RED),this.AxisY=this.createAxisSphere("axisSphereY",this.radius,this.originPosition,qe.GREEN),this.AxisZ=this.createAxisSphere("axisSphereZ",this.radius,this.originPosition,qe.BLUE);let E=Nt.fromRotationY(De.toRadians(90)),I=Re.fromRotationTranslation(E);Re.multiply(this.AxisX.modelMatrix,I,this.AxisX.modelMatrix);let x=Nt.fromRotationX(De.toRadians(90)),y=Re.fromRotationTranslation(x);Re.multiply(this.AxisY.modelMatrix,y,this.AxisY.modelMatrix)}};pp.prototype.createAxisSphere=function(o,A,f,m){let C={position:[],radius:A};for(let v=0;v<=360;v+=2){let w=Math.sin(De.toRadians(v)),Q=Math.cos(De.toRadians(v)),M=C.radius*Q,B=C.radius*w;C.position.push(new Z(M,B,0))}let E=Vr.eastNorthUpToFixedFrame(f),I=new AS({positions:C.position,width:8}),x=new Un({geometry:I,id:o}),y=new pa({geometryInstances:x,appearance:new vC({material:fa.fromType("Color")}),modelMatrix:E});return y.appearance.material.uniforms.color=m,this._scene.primitives.add(y)};pp.prototype.edit=function(o,A,f){if(o){let m=this.originPosition,C=this.startPosition,E=this._scene.pickPosition(f.endPosition),I=this.toDegrees(m),x=this.toDegrees(C),y=this.toDegrees(E),v=this._scene.cartesianToCanvasCoordinates(m),w=f.endPosition.y-A.y;if(o==="x"){let Q=x.lon-y.lon;I.lon-=Q*.7,this.setAxisPosition(I),this.setPosition(I)}else if(o==="y"){let Q=x.lat-y.lat;I.lat-=Q*.7,this.setAxisPosition(I),this.setPosition(I)}else if(o==="z"){let Q=x.hei-I.hei,M=w*Math.abs(Q/(A.y-v.y));I.hei-=M*.4,this.setAxisPosition(I),this.setPosition(I)}else if(o==="heading"){let Q=this.arge(v,A,f.endPosition,"+-",!0),M=this.hpRoll.heading-Q;this.hpRoll.select="heading",this.hpRoll.angle=M,this.setRotate("heading",M);let B=this.arge({x:I.lon,y:I.lat},{x:I.lon+this.radius,y:I.lat},{x:x.lon,y:x.lat},"360");this.setRotateLine("z",m,B,Q)}else if(o==="pitch"){let Q=this.hpRoll.pitch,M=this.arge(v,A,f.endPosition,"+-",!0),D=this.toDegrees(this._scene.camera.position).lon-I.lon,S=Z.subtract(C,m,new Z),P=Z.normalize(m,new Z),T=Z.angleBetween(S,P)*180/Math.PI;D>0?(Q+=M,x.lat-I.lat>0?this.setRotateLine("x",m,T,-M):this.setRotateLine("x",m,-T,-M)):(Q-=M,x.lat-I.lat>0?this.setRotateLine("x",m,T,M):this.setRotateLine("x",m,-T,M)),this.hpRoll.select="pitch",this.hpRoll.angle=Q,this.setRotate("pitch",Q)}else if(o==="roll"){let M=this.toDegrees(this._scene.camera.position).lat-I.lat,B=this.hpRoll.roll,D=this.arge(v,A,f.endPosition,"+-",!0),S=Z.subtract(C,m,new Z),P=Z.normalize(m,new Z),T=Z.angleBetween(S,P)*180/Math.PI;M>0?(B+=D,x.lon-I.lon>0?this.setRotateLine("y",m,T,D):this.setRotateLine("y",m,-T,D)):(B-=D,x.lon-I.lon>0?this.setRotateLine("y",m,T,-D):this.setRotateLine("y",m,-T,-D)),this.hpRoll.select="roll",this.hpRoll.angle=B,this.setRotate("roll",B)}}};pp.prototype.setPosition=function(o,A){let f=Z.fromDegrees(o.lon,o.lat,o.hei);if(this.modeltype==="b3dm"){let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(-this.hpRoll.roll),De.toRadians(this.hpRoll.pitch));this.model._primitive._root.transform=Vr.headingPitchRollToFixedFrame(f,m)}else if(this.modeltype==="I3S"){let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(this.hpRoll.pitch),De.toRadians(this.hpRoll.roll));this.model._layers[0]._tileset._root.transform=Vr.headingPitchRollToFixedFrame(f,m)}else if(this.modeltype==="s3m"){let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(this.hpRoll.pitch),De.toRadians(this.hpRoll.roll));this.model.modelMatrix=new Vr.headingPitchRollToFixedFrame(f,m)}else{let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(this.hpRoll.pitch),De.toRadians(this.hpRoll.roll)),C=Vr.localFrameToFixedFrameGenerator("north","west");this.model._primitive.modelMatrix=Vr.headingPitchRollToFixedFrame(f,m,gi.WGS84,C)}};pp.prototype.upDateHpRoll=function(){this.hpRoll.select==="heading"?(this.hpRoll.heading=this.hpRoll.angle,this.hpRoll.angle=0,this.hpRoll.select=""):this.hpRoll.select==="pitch"?(this.hpRoll.pitch=this.hpRoll.angle,this.hpRoll.angle=0,this.hpRoll.select=""):this.hpRoll.select==="roll"&&(this.hpRoll.roll=this.hpRoll.angle,this.hpRoll.angle=0,this.hpRoll.select=""),this.modeltype==="b3dm"?(this.model._parameter.transform.heading=this.hpRoll.heading,this.model._parameter.transform.roll=this.hpRoll.roll,this.model._parameter.transform.pitch=this.hpRoll.pitch):(this.model._parameter.heading=this.hpRoll.heading,this.model._parameter.roll=this.hpRoll.roll,this.model._parameter.pitch=this.hpRoll.pitch)};pp.prototype.setAxisPosition=function(o){let A=Z.fromDegrees(o.lon,o.lat,o.hei),f=2e-5*Number(this.radius),m=18e-6*Number(this.radius),C=1.7*Number(this.radius),E=Z.fromDegrees(o.lon+f,o.lat,o.hei),I=Z.fromDegrees(o.lon,o.lat+m,o.hei),x=Z.fromDegrees(o.lon,o.lat,o.hei+C);this._earthCtrl.entities.values[0]._polyline.positions=new Kr(function(){return[A,E]},!1),this._earthCtrl.entities.values[1]._polyline.positions=new Kr(function(){return[A,I]},!1),this._earthCtrl.entities.values[2]._polyline.positions=new Kr(function(){return[A,x]},!1)};pp.prototype.setAxisStyle=function(o,A){if(o){if(A==="x"){let f=this._earthCtrl.entities.getById("entityPolylineX");f._polyline._material._color._value=qe.YELLOW}else if(A==="y"){let f=this._earthCtrl.entities.getById("entityPolylineY");f._polyline._material._color._value=qe.YELLOW}else if(A==="z"){let f=this._earthCtrl.entities.getById("entityPolylineZ");f._polyline._material._color._value=qe.YELLOW}}else o||(this.selectAxis==="x"?(this.selectAxis=void 0,this._earthCtrl.entities.values[0]._polyline._material._color._value=qe.RED):this.selectAxis==="y"?(this.selectAxis=void 0,this._earthCtrl.entities.values[1]._polyline._material._color._value=qe.GREEN):this.selectAxis==="z"&&(this.selectAxis=void 0,this._earthCtrl.entities.values[2]._polyline._material._color._value=qe.BLUE))};pp.prototype.setRotate=function(o,A){let f=this.hpRoll.heading,m=this.hpRoll.pitch,C=this.hpRoll.roll;if(o==="heading"?f=A:o==="pitch"?m=A:o==="roll"&&(C=A),this.modeltype==="b3dm"){let E=new Wl(De.toRadians(f),De.toRadians(-C),De.toRadians(m));this.model._primitive._root.transform=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model._primitive._root.transform,new Z),E)}else if(this.modeltype==="I3S"){let E=new Wl(De.toRadians(f),De.toRadians(m),De.toRadians(C));this.model._layers[0]._tileset._root.transform=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z),E)}else if(this.modeltype==="s3m"){let E=new Wl(De.toRadians(f),De.toRadians(m),De.toRadians(C));this.model.modelMatrix=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model.modelMatrix,new Z),E)}else{let E=Vr.localFrameToFixedFrameGenerator("north","west"),I=new Wl(De.toRadians(f),De.toRadians(m),De.toRadians(C));this.model._primitive.modelMatrix=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model._primitive.modelMatrix,new Z),I,gi.WGS84,E)}};pp.prototype.setRotateLine=function(o,A,f,m){o==="z"?(this.rotateSector1?this.rotateSector1.ellipsoid.maximumClock=new Kr(function(){return De.toRadians(m)},!1):this.rotateSector1=this._earthCtrl.entities.add({name:"rotateSector1",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(De.toRadians(360-f),0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(0),maximumClock:De.toRadians(0),minimumCone:De.toRadians(90),maximumCone:De.toRadians(90),material:qe.ALICEBLUE.withAlpha(.3)}}),this.rotateSector2?this.rotateSector2.ellipsoid.maximumClock=new Kr(function(){return De.toRadians(m)},!1):this.rotateSector2=this._earthCtrl.entities.add({name:"rotateSector2",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(De.toRadians(360-f),0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(0),maximumClock:De.toRadians(0),minimumCone:De.toRadians(90),maximumCone:De.toRadians(90),fill:!1,outline:!0,slicePartitions:2,outlineWidth:5,outlineColor:qe.YELLOW}})):o==="x"?(this.rotateSector1?this.rotateSector1.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector1=this._earthCtrl.entities.add({name:"rotateSector1",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(90.1),maximumClock:De.toRadians(90),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),material:qe.ALICEBLUE.withAlpha(.3)}}),this.rotateSector2?this.rotateSector2.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector2=this._earthCtrl.entities.add({name:"rotateSector2",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(90.1),maximumClock:De.toRadians(90),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),fill:!1,outline:!0,slicePartitions:2,outlineWidth:5,outlineColor:qe.YELLOW}})):o==="y"&&(this.rotateSector1?this.rotateSector1.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector1=this._earthCtrl.entities.add({name:"rotateSector1",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(.1),maximumClock:De.toRadians(0),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),material:qe.ALICEBLUE.withAlpha(.3)}}),this.rotateSector2?this.rotateSector2.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector2=this._earthCtrl.entities.add({name:"rotateSector2",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(.1),maximumClock:De.toRadians(0),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),fill:!1,outline:!0,slicePartitions:2,outlineWidth:5,outlineColor:qe.YELLOW}}))};pp.prototype.end=function(){this.AxisX&&this._scene.primitives.remove(this.AxisX),this.AxisX=void 0,this.AxisY&&this._scene.primitives.remove(this.AxisY),this.AxisY=void 0,this.AxisZ&&this._scene.primitives.remove(this.AxisZ),this.AxisZ=void 0,this.arrowx&&this._earthCtrl.entities.remove(this.arrowx),this.arrowx=void 0,this.arrowy&&this._earthCtrl.entities.remove(this.arrowy),this.arrowy=void 0,this.arrowz&&this._earthCtrl.entities.remove(this.arrowz),this.arrowz=void 0,this.editHandler&&this.editHandler.destroy(),this.editHandler=void 0};pp.prototype.toDegrees=function(o){let A=Lt.fromCartesian(o);return{lon:De.toDegrees(A.longitude),lat:De.toDegrees(A.latitude),hei:A.height}};pp.prototype.arge=function(o,A,f,m="180",C=!1){let E=Math.sqrt(Math.pow(o.x-A.x,2)+Math.pow(o.y-A.y,2)),I=Math.sqrt(Math.pow(o.x-f.x,2)+Math.pow(o.y-f.y,2)),x=Math.sqrt(Math.pow(A.x-f.x,2)+Math.pow(A.y-f.y,2)),y=(Math.pow(E,2)+Math.pow(I,2)-Math.pow(x,2))/(2*E*I),v=Math.acos(y)*180/Math.PI;if(m==="360"||m==="+-"){let w=C?-1:1;this.isClockwise([[A.x,w*A.y],[o.x,w*o.y],[f.x,w*f.y],[A.x,w*A.y]])||(m==="+-"?v=-v:v=360-v)}return Number(v.toFixed(2))};pp.prototype.isClockwise=function(o){let A=ws.lineString(o);return ws.booleanClockwise(A)};pp.prototype.matrixGetRotation=function(o){let A=Vr.eastNorthUpToFixedFrame(Re.getTranslation(o,new Z),gi.WGS84,new Re),f=Re.multiply(Re.inverse(A,new Re),o,new Re),m=Re.getRotation(f,new Nt),C=yr.fromRotationMatrix(m),E=Wl.fromQuaternion(C),I=De.toDegrees(E.heading),x=De.toDegrees(E.pitch),y=De.toDegrees(E.roll);return{heading:I,pitch:x,roll:y}};var ptt=pp;function Mc(o){this._earthCtrl=o,this._coreMap=o.coreMap}Mc.prototype.editPoint=function(o,A){this._earthCtrl.tools.clearTool();let f=new ott(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("point_edit_tool",f),f};Mc.prototype.updatePoint=function(o,A){o.updatePoint(A)};Mc.prototype.editPolyline=function(o,A){this._earthCtrl.tools.clearTool();let f=new dtt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("polyline_edit_tool",f),f};Mc.prototype.updatePolyline=function(o,A){o.updatePolyline(A)};Mc.prototype.editPolygon=function(o,A){this._earthCtrl.tools.clearTool();let f=new utt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("polygon_edit_tool",f),f};Mc.prototype.updatePolygon=function(o,A){o.updatePolygon(A)};Mc.prototype.editBox=function(o,A){this._earthCtrl.tools.clearTool();let f=new att(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("box_edit_tool",f),f};Mc.prototype.updateBox=function(o,A){o.updateBox(A)};Mc.prototype.editEllipsoid=function(o,A){this._earthCtrl.tools.clearTool();let f=new Att(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("ellipsoid_edit_tool",f),f};Mc.prototype.updateEllipsoid=function(o,A){o.updateEllipsoid(A)};Mc.prototype.editCylinder=function(o,A){this._earthCtrl.tools.clearTool();let f=new stt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("cylinder_edit_tool",f),f};Mc.prototype.updateCylinder=function(o,A){o.updateCylinder(A)};Mc.prototype.editModel=function(o,A){this._earthCtrl.tools.clearTool();let f=new ctt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("model_edit_tool",f),f};Mc.prototype.updateModel=function(o,A){o.updateModel(A)};Mc.prototype.createTransformEdit=function(o){return new ptt(this._earthCtrl,{model:o})};Mc.prototype.editBillboard=function(o,A){this._earthCtrl.tools.clearTool();let f=new ntt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("billboard_edit_tool",f),f};Mc.prototype.updateBillboard=function(o,A){o.updateBillboard(A)};Mc.prototype.editLabel=function(o,A){this._earthCtrl.tools.clearTool();let f=new htt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("label_edit_tool",f),f};Mc.prototype.updateLabel=function(o,A){o.updateLabel(A)};Mc.prototype.editRectangle=function(o,A){this._earthCtrl.tools.clearTool();let f=new ftt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("rectangle_edit_tool",f),f};Mc.prototype.updateRectangle=function(o,A){o.updateRectangle(A)};Mc.prototype.editEllipse=function(o,A){this._earthCtrl.tools.clearTool();let f=new ltt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("ellipse_edit_tool",f),f};Mc.prototype.updateEllipse=function(o,A){o.updateEllipse(A)};Mc.prototype.editPolylineVolume=function(o,A){this._earthCtrl.tools.clearTool();let f=new gtt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("polylinevolume_edit_tool",f),f};Mc.prototype.updatePolylineVolume=function(o,A){o.updatePolylineVolume(A)};Mc.prototype.endEditEntity=function(o){this._earthCtrl.tools.clearTool(),o.endEditEntity(),this._earthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!0,this._earthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!0};var rbe=Mc;function mp(o){this.mEarthCtrl=o,this.scene=this.mEarthCtrl.coreMap.scene,this.entities=this.mEarthCtrl.entities,this.camera=this.mEarthCtrl.coreMap.camera,this._points=[],this.item=void 0}mp.prototype.horizontalDistance=function(o,A){let f=this,m=!1,C=[],E="",I=[],x,y=this.scene.globe.ellipsoid,v={spot:[],distance:[],label:[],polyline:[]},w={point:qe.RED,polyline:qe.fromRgba(4286644096)};k(A)&&(k(A.point)&&(w.point=A.point),k(A.polyline)&&(w.polyline=A.polyline));let Q=new nI;this.scene.primitives.add(Q);let M=new Pu,B=new pr(f.scene.canvas),D=document.createElement("div");ru(".map-widget",D),ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>');let P=document.getElementById("toolTip");P.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let R;m=!0;let T=function(U){let N=0,H=`${0}\u7C73`,J,K,X,j,ee,ie;for(let z=0;z<U.length-1;z+=1)J=y.cartesianToCartographic(U[z]),K=M.project(J),X=K.x,j=K.y,J=y.cartesianToCartographic(U[z+1]),K=M.project(J),ee=K.x,ie=K.y,N=N+Math.sqrt((X-ee)*(X-ee)+(j-ie)*(j-ie));return N>0&&(H=`${N.toFixed(2)}\u7C73`),N/1e3>=1&&(H=`${(N/1e3).toFixed(2)}\u5343\u7C73`),H},L=function(){function U(N){if(!k(N))throw new ni("positions is required!");if(N.length<2)throw new ni("positions \u7684\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E2");let H=fa.fromType(fa.ColorType);H.uniforms.color=new qe(1,1,0,.5),this.options={name:"\u76F4\u7EBF",polyline:{show:!0,positions:[],material:w.polyline,width:3,clampToGround:!0}},this.path=N,this._init()}return U.prototype._init=function(){let N=this,H=function(){return N.path};this.options.polyline.positions=new Kr(H,!1),this.lineEntity=f.entities.add(this.options),f.item=this.lineEntity,v.polyline.push(this.lineEntity)},U}();B.setInputAction(function(U){let N,H;P.style.left=`${U.endPosition.x+10}px`,P.style.top=`${U.endPosition.y+20}px`,P.style.display="block",P.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let J=!1,K=f.camera.getPickRay(U.endPosition);K&&(N=f.scene.globe.pick(K,f.scene));let X=f.scene.pick(U.endPosition);if(X){console.log("feature",X);let j=f.scene.pickPosition(U.endPosition);j&&(N=j),J=!0}if(!!N&&(H=gi.WGS84.cartesianToCartographic(N),H)){let j;J?j=f.scene.sampleHeight(H):j=f.scene.globe.getHeight(H);let ee=Z.fromDegrees(H.longitude/Math.PI*180,H.latitude/Math.PI*180,j);if(m){if(C.length<1)return;k(x)?(x.path.pop(),x.path.push(ee)):(C.push(ee),x=new L(C));let ie=T(x.path);f.entities.remove(R),R=f.entities.add({name:"\u7A7A\u95F4\u76F4\u7EBF\u8DDD\u79BB",position:x.path[x.path.length-1],label:{text:`\u603B\u957F\uFF1A${ie}`,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),disableDepthTestDistance:Number.POSITIVE_INFINITY}})}}},_i.MOUSE_MOVE);let F=function(U){I.push(U);let N=[];if(I.length>1){let H=I[I.length-2],J=I[I.length-1],K=Math.abs(H.longitude-J.longitude)*1e7,X=Math.abs(H.latitude-J.latitude)*1e7;K>X&&(X=K);let j=parseInt(X/10);j>1e3&&(j=1e3),j<2&&(j=2);for(let ee=0;ee<j;++ee)N.push(new Lt(De.lerp(H.longitude,J.longitude,ee/(j-1)),De.lerp(H.latitude,J.latitude,ee/(j-1))));N.push(J.clone())}else N=I;if(N.length>0)for(let H=0;H<N.length;H++){U=N[H];let J=f.scene.globe.getHeight(U),K=Z.fromDegrees(U.longitude/Math.PI*180,U.latitude/Math.PI*180,J);C.push(K)}};return B.setInputAction(function(U){let N,H,J=!1,K=f.camera.getPickRay(U.position);if(K&&(N=f.scene.globe.pick(K,f.scene)),f.scene.pick(U.position)){let j=f.scene.pickPosition(U.position);j&&(N=j),J=!0}if(N&&(H=gi.WGS84.cartesianToCartographic(N)),H){let j;J?j=f.scene.sampleHeight(H):j=f.scene.globe.getHeight(H);let ee=Z.fromDegrees(H.longitude/Math.PI*180,H.latitude/Math.PI*180,j);if(m){x&&x.path.pop(),F(H);let ie="0\u7C73";x&&(ie=T(x.path)),E=ie,v.spot.push(ee),v.distance.push(ie);let z=f.entities.add({position:ee,point:{pixelSize:5,color:w.point,outlineColor:qe.WHITE,outlineWidth:1,clampToGround:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:ie,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),clampToGround:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}});v.label.push(z),f._points.push(z)}}},_i.LEFT_CLICK),B.setInputAction(function(){f.entities.remove(R),f._points[f._points.length-1].label.text=E,B.destroy(),C.pop(),k(o)&&typeof o=="function"&&o(v),P.style.display="none"},_i.RIGHT_CLICK),this};mp.prototype.spaceDistance=function(o,A){let f=this;f.scene.globe.depthTestAgainstTerrain=!0;let m=new pr(f.scene.canvas),C=[],E=null,I="0\u7C73",x=null,y,v="",w,Q=document.createElement("div");ru(".map-widget",Q),ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>');let B=document.getElementById("toolTip");B.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let D={name:"",spot:[],distance:[],label:[],ployline:[]},S={point:qe.RED,polyline:qe.fromRgba(4286644096)};k(A)&&(k(A.point)&&(S.point=A.point),k(A.polyline)&&(S.polyline=A.polyline));let P=function(){function R(T){this.options={name:"\u76F4\u7EBF",polyline:{show:!0,positions:[],material:S.polyline,width:3,clampToGround:!1}},this.positions=T,this._init()}return R.prototype._init=function(){let T=this,L=function(){return T.positions};this.options.polyline.positions=new Kr(L,!1);let F=f.entities.add(this.options);f.item=F,D.ployline.push(F);let U=f.getuid();D.name=`\u65B0\u5EFA\u7A7A\u95F4\u8DDD\u79BB${U}`},R}();return m.setInputAction(function(R){if(f.scene.bim){let T=f.scene.bim.PickWorldPositionSync(R.endPosition.x,R.endPosition.y);T[0]===0?x=f.scene.pickPosition(R.endPosition):x=new Z(T[0],T[1],T[2]),console.log("????????",x)}else x=f.scene.pickPosition(R.endPosition);!x||(B.style.left=`${R.endPosition.x+10}px`,B.style.top=`${R.endPosition.y+20}px`,B.style.display="block",C.length>=2&&(k(E)?(C.pop(),C.push(x)):E=new P(C),B.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u53F3\u952E\u7ED3\u675F\uFF01</span>',I=f.getSpaceDistance(C)),f.entities.remove(w),w=f.entities.add({name:"\u7A7A\u95F4\u76F4\u7EBF\u8DDD\u79BB",position:C[C.length-1],label:{text:`\u603B\u957F\uFF1A${I}`,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),disableDepthTestDistance:Number.POSITIVE_INFINITY}}))},_i.MOUSE_MOVE),m.setInputAction(function(R){if(f.scene.bim){let L=f.scene.bim.PickWorldPositionSync(R.position.x,R.position.y);L[0]===0?x=f.scene.pickPosition(R.position):x=new Z(L[0],L[1],L[2]),console.log("????????",x)}else x=f.scene.pickPosition(R.position);if(!x)return;C.length===0&&C.push(x.clone()),C.push(x);let T=I;v=`\u603B\u957F\uFF1A${I}`,y=f.entities.add({name:"\u7A7A\u95F4\u76F4\u7EBF\u8DDD\u79BB",position:C[C.length-1],point:{pixelSize:5,color:S.point,outlineColor:qe.WHITE,outlineWidth:2,clampToGround:!1,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:T,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),heightReference:tn.NONE,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),f._points.push(y),D.spot.push(x),D.distance.push(I),D.label.push(y)},_i.LEFT_CLICK),m.setInputAction(function(R){B.style.display="none",f.entities.remove(w),f._points.length>0&&(f._points[f._points.length-1].label.text=v),m.destroy(),C.pop(),k(o)&&typeof o=="function"&&o(D)},_i.RIGHT_CLICK),this};mp.prototype.getSpaceDistance=function(o){let A=0,f="";for(let m=0;m<o.length-1;m++){let C=Lt.fromCartesian(o[m]),E=Lt.fromCartesian(o[m+1]),I=new Ig;I.setEndPoints(C,E);let x=I.surfaceDistance;x=Math.sqrt(Math.pow(x,2)+Math.pow(E.height-C.height,2)),A=A+x}return A>=1e3?f=`${(A/1e3).toFixed(2)}\u5343\u7C73`:f=`${A.toFixed(2)}\u7C73`,f};mp.prototype.getPlaneArea=function(o,A){let f=this;f.scene.globe.depthTestAgainstTerrain=!0;let m=0,C=new pr(f.scene._imageryLayerCollection),E=document.getElementById("toolTip");E||(ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>'),E=document.getElementById("toolTip")),E.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB\uFF0C\u53F3\u952E\u7ED3\u675F\uFF01</span>';let I=[],x={},y=[],v=[],w=null,Q=null,M,B={point:qe.RED,polyline:qe.fromRgba(4286644096),polygon:qe.fromRgba(4286644096).withAlpha(.5)};k(A)&&(k(A.point)&&(B.point=A.point),k(A.polyline)&&(B.polyline=A.polyline),k(A.polygon)&&(B.polygon=A.polygon));let D={mj:0,label:[],polygon:[]};E.style.display="block";let S=function(){function P(R){this.options={name:"\u591A\u8FB9\u5F62",polygon:{hierarchy:[],perPositionHeight:!0,material:B.polygon,clampToGround:!1}},this.hierarchy=R,this._init()}return P.prototype._init=function(){let R=this,T=function(){return R.hierarchy};this.options.polygon.hierarchy=new Kr(T,!1),this.polygon=f.entities.add(this.options),f.item=this.polygon,f._entity=this.polygon,D.polygon=this.polygon},P}();return C.setInputAction(function(P){if(E.style.left=`${P.endPosition.x+10}px`,E.style.top=`${P.endPosition.y+20}px`,f.scene.bim){let U=f.scene.bim.PickWorldPositionSync(P.endPosition.x,P.endPosition.y);U[0]===0?Q=f.scene.pickPosition(P.endPosition):Q=new Z(U[0],U[1],U[2])}else Q=f.scene.pickPosition(P.endPosition);if(!Q)return;let R=Lt.fromCartesian(Q),T=De.toDegrees(R.longitude),L=De.toDegrees(R.latitude),F=R.height;if(I.length>=2){k(w)?(I.pop(),I.push(Q),x=new In(I),v.pop(),v.push({lon:T,lat:L,hei:F})):(x=new In(I),w=new S(x));let U=f.getArea(v,I);f.entities.remove(M),M=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:I[I.length-1],label:{text:U,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),D.label=M}},_i.MOUSE_MOVE),C.setInputAction(function(P){if(f.scene.bim){let U=f.scene.bim.PickWorldPositionSync(P.position.x,P.position.y);U[0]===0?Q=f.scene.pickPosition(P.position):Q=new Z(U[0],U[1],U[2])}else Q=f.scene.pickPosition(P.position);if(!Q)return;let R=Lt.fromCartesian(Q);console.log("\u5DE6\u952E\u70B9",R);let T=De.toDegrees(R.longitude),L=De.toDegrees(R.latitude),F=R.height;I.length===0&&(I.push(Q.clone()),x=new In(I),v.push({lon:T,lat:L,hei:F}),I.push(Q.clone()),x=new In(I),v.push({lon:T,lat:L,hei:F})),I.push(Q),x=new In(I),y.push({lon:T,lat:L,hei:F}),v.push({lon:T,lat:L,hei:F})},_i.LEFT_CLICK),C.setInputAction(function(P){E.style.display="none",f.entities.remove(M),C.destroy();let R=f.getArea(v,I);m=R;let T=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:I[I.length-1],label:{text:R,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}});f._points.push(T),f._lable=T,D.mj=m,D.label=T,k(o)&&typeof o=="function"&&o(D)},_i.RIGHT_CLICK),this};mp.prototype.getSurfaceArea3d=function(o,A){let f=this;f.scene.globe.depthTestAgainstTerrain=!0;let m={mj:0,label:[],polygon:[]},C=!0,E=[],I={},x,y=f.scene,v=y.globe.ellipsoid,w=new nI;y.primitives.add(w);let Q,M,B=0,D={point:qe.RED,polyline:qe.fromRgba(4286644096),polygon:qe.fromRgba(4286644096).withAlpha(.5)};k(A)&&(k(A.point)&&(D.point=A.point),k(A.polyline)&&(D.polyline=A.polyline),k(A.polygon)&&(D.polygon=A.polygon));let S=document.createElement("div");ru(".map-widget",S),ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>');let R=document.getElementById("toolTip");R.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let T=new pr(y.canvas),L=function(){function U(N){if(!k(N))throw new ni("positions is required!");if(N.length<3)throw new ni("positions \u7684\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E3");this.options={polygon:{show:!0,hierarchy:void 0,material:D.polygon,clampToGround:!1}},this.path=N,this._init()}return U.prototype._init=function(){let N=this,H=function(){return N.path};this.options.polygon.hierarchy=new Kr(H,!1),this.polygonEntity=f.entities.add(this.options),f.item=this.polygonEntity,m.polygon=this.polygonEntity,f._entity=this.polygonEntity},U}();T.setInputAction(function(U){let N=0;f.entities.remove(M);let H,J,K=f.scene.camera.getPickRay(U.endPosition);K&&(H=f.scene.globe.pick(K,f.scene));let X=f.scene.pick(U.endPosition),j=!1;if(X){let ie=f.scene.pickPosition(U.endPosition);ie&&(H=ie),j=!0}if(!H)return;let ee=function(ie){let z=new Array(ie.length),oe=function(he){return he.longitude=he.longitude/Math.PI*180,he.latitude=he.latitude/Math.PI*180,he},le=function(he){let ge=0;for(let de=0;de<he.length;de++){let fe=he[de],G;de<he.length-1?G=he[de+1]:G=he[0],ge+=fe.x*G.y-G.x*fe.y}return ge/2};for(let he=0;he<ie.length;he++)z[he]=oe(v.cartesianToCartographic(ie[he]));let Ae=0;for(let he=0;he<z.length;he++)Ae+=z[he].longitude;Ae=Ae/z.length;for(let he=0;he<z.length;he++)z[he]=f.Gauss_to_XY(z[he].longitude,z[he].latitude,Ae);return Math.abs(le(z))};if(J=gi.WGS84.cartesianToCartographic(H),J&&C){if(R.style.left=`${U.endPosition.x+10}px`,R.style.top=`${U.endPosition.y+20}px`,R.style.display="block",E.length<2){B===1&&(M=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:H,label:{text:`${N}\u5E73\u65B9\u5343\u7C73`,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),f._points.push(M),m.label=M);return}if(k(x)?(x.path.positions.pop(),x.path.positions.push(H)):(E.push(H),I=new In(E),x=new L(I)),E.length>=2){R.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u53F3\u952E\u7ED3\u675F\uFF01</span>';let ie=String(ee(x.path.positions));ie=ie.substr(0,ie.indexOf(".",0)),ie.length<6?N=`${ie}\u5E73\u65B9\u7C73`:(ie=String(ie/1e6),ie=ie.substr(0,ie.indexOf(".",0)+3),N=`${ie}\u5E73\u65B9\u5343\u7C73`),m.mj=N,M=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:H,label:{text:N,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),f._points.push(M),m.label=M}}},_i.MOUSE_MOVE),T.setInputAction(function(U){let N;B=1;let H=f.scene.camera.getPickRay(U.position);H&&(N=f.scene.globe.pick(H,f.scene));let J=f.scene.pick(U.position),K=!1;if(J){let X=f.scene.pickPosition(U.position);X&&(N=X),K=!0}N&&C&&(E.push(N),I=new In(E))},_i.LEFT_CLICK),T.setInputAction(function(){T.removeInputAction(_i.LEFT_CLICK),T.removeInputAction(_i.LEFT_DOUBLE_CLICK),f.trackedEntity=void 0,C=!1,Q=w.add({show:!0,id:"measureTool",position:E[E.length-1],pixelOffset:new tt(0,20),eyeOffset:new Z(0,0,0),horizontalOrigin:iu.CENTER,verticalOrigin:on.CENTER,scale:1,color:new qe(1,1,1,1)}),R.style.display="none",T.destroy(),k(o)&&typeof o=="function"&&o(m)},_i.RIGHT_CLICK);let F=function(U){let N=0,H=0,J=0;for(let X=0;X<U.length;X++)N+=U[X].x,H+=U[X].y,J+=U[X].z;return new Z(N/U.length,H/U.length,J/U.length)};return this};mp.prototype.to_N=function(o){let f=63567523142e-4,m=Math.sqrt(6378137*6378137-f*f)/6378137;return 6378137/Math.sqrt(1-m*m*Math.sin(o)*Math.sin(o))};mp.prototype.to_Sm=function(o){let f=63567523142e-4,m=Math.sqrt(6378137*6378137-f*f)/6378137,C,E,I,x,y;return C=1+m*m*3/4+Math.pow(m,4)*45/64+Math.pow(m,6)*175/256+Math.pow(m,8)*11025/16384,E=Math.pow(m,2)*3/4+Math.pow(m,4)*15/16+Math.pow(m,6)*525/512+Math.pow(m,8)*2205/2048,I=Math.pow(m,4)*15/64+Math.pow(m,6)*105/256+Math.pow(m,8)*2205/4096,x=Math.pow(m,6)*35/512+Math.pow(m,8)*315/2048,y=Math.pow(m,8)*315/16384,6378137*(1-m*m)*(C*o-E/2*Math.sin(2*o)+I/4*Math.sin(4*o)-x/6*Math.sin(6*o)+y/8*Math.sin(8*o))};mp.prototype.to_Radian=function(o){return o*Math.PI/180};mp.prototype.Gauss_to_XY=function(o,A,f){let C=63567523142e-4,E=Math.sqrt(6378137*6378137-C*C)/C,I=0,x=0,y=0,v=0,w=this.to_Radian(f);A=this.to_Radian(A),o=this.to_Radian(o);let Q=o-w,M=Math.cos(A);v=this.to_N(A),y=v*Math.cos(A),I=Math.tan(A),x=E*M;let B=Math.pow(I,2),D=Math.pow(I,4),S=Math.pow(x,2),P=Math.pow(x,4),R=Math.pow(M,3),T=Math.pow(M,5),L=this.to_Sm(A)+Math.pow(Q,2)/2*y*M*I+Math.pow(Q,4)/24*I*y*R*(5-B+9*S+4*P)+Math.pow(Q,6)/720*I*y*T*(61-58*I*I+D+270*S-330*I*I*S),F=Q*v*M+Math.pow(Q,3)/6*v*R*(1-I*I+x*x)+Math.pow(Q,5)/120*v*T*(5-18*I*I+D+14*S-58*S*B);return new tt(F,L)};mp.prototype.getArea=function(o,A){let f=0;for(let m=0;m<o.length-2;m++){let C=(m+1)%o.length,E=(m+2)%o.length,I=this.Angle(o[m],o[C],o[E]),x=this.getdistance(A[m],A[C]),y=this.getdistance(A[C],A[E]);f+=x*y*Math.abs(Math.sin(I))}return f<1e6?f=`${f.toFixed(4)}\u5E73\u65B9\u7C73`:f=`${(f/1e6).toFixed(4)}\u5E73\u65B9\u5343\u7C73`,f};mp.prototype.getdistance=function(o,A){let f=Lt.fromCartesian(o),m=Lt.fromCartesian(A),C=new Ig;C.setEndPoints(f,m);let E=C.surfaceDistance;return E=Math.sqrt(Math.pow(E,2)+Math.pow(m.height-f.height,2)),E};mp.prototype.Bearing=function(o,A){let f=Math.PI/180,m=180/Math.PI,C=o.lat*f,E=o.lon*f,I=A.lat*f,x=A.lon*f,y=-Math.atan2(Math.sin(E-x)*Math.cos(I),Math.cos(C)*Math.sin(I)-Math.sin(C)*Math.cos(I)*Math.cos(E-x));return y<0&&(y+=Math.PI*2),y=y*m,y};mp.prototype.Angle=function(o,A,f){let m=this.Bearing(A,o),C=this.Bearing(A,f),E=m-C;return E<0&&(E+=360),E};mp.prototype.getuid=function(){return this.uuid(8,16)};mp.prototype.uuid=function(o,A){let f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),m=[],C;if(A=A||f.length,o)for(C=0;C<o;C++)m[C]=f[0|De.nextRandomNumber()*A];else{let E;for(m[8]=m[13]=m[18]=m[23]="-",m[14]="4",C=0;C<36;C++)m[C]||(E=0|De.nextRandomNumber()*16,m[C]=f[C===19?E&3|8:E])}return m.join("")};mp.prototype.deleteObject=function(){if(this.entities.remove(this.item),this._points.length>0){for(let o=0;o<this._points.length;o++)this.entities.remove(this._points[o]);this._points=[]}try{this.scene.primitives.remove(this.item)}catch(o){console.log(o)}this.item=void 0};var IJ=mp;function Tv(o,A){this._earthCtrl=o,this._coreMap=this._earthCtrl.coreMap,this._show=ae(A.show,!0),this._lon=ae(A.lon,121),this._lat=ae(A.lat,31),this._height=ae(A.height,10),this._heading=ae(A.heading,0),this._pitch=ae(A.pitch,0),this._distance=ae(A.distance,300),this._position=Z.fromDegrees(A.lon,A.lat,A.height),this._horizontalViewAngle=ae(A.horizontalViewAngle,90),this._verticalViewAngle=ae(A.verticalViewAngle,60),this._horizontalViewAngle=this.adjustViewRange(this._horizontalViewAngle),this._verticalViewAngle=this.adjustViewRange(this._verticalViewAngle),this._visibleAreaColor=ae(A.visibleAreaColor,qe.GREEN.withAlpha(.4)),this._invisibleAreaColor=ae(A.invisibleAreaColor,qe.RED.withAlpha(.4)),this._size=ae(A.size,10240),this._softShadows=ae(A.softShadows,!0),this._colorStyle=ae(A.colorStyle,qe.YELLOW),this._parameter=A,this._lineArray=[],this._visualCone=!0,this.pyramid=void 0,this.updateViewShed()}Object.defineProperties(Tv.prototype,{show:{get:function(){return this._show},set:function(o){o!==this._show&&(this._show=o,this.updateViewShed())}},distance:{get:function(){return this._distance}},heading:{get:function(){return this._heading}},pitch:{get:function(){return this._pitch}},horizontalViewAngle:{get:function(){return this._horizontalViewAngle}},verticalViewAngle:{get:function(){return this._verticalViewAngle}},colorStyle:{get:function(){return this._colorStyle},set:function(o){this._colorStyle=o}},invisibleAreaColor:{get:function(){return this._invisibleAreaColor},set:function(o){this._invisibleAreaColor=o}},visibleAreaColor:{get:function(){return this._visibleAreaColor},set:function(o){this._visibleAreaColor=o}},visualCone:{get:function(){return this._visualCone},set:function(o){this._visualCone=o,this.visualConeShow(o)}}});Tv.prototype.adjustViewRange=function(o){return o<=0?o=1:o>=180&&(o=179),o};Tv.prototype.removeFromMap=function(){let o=this;k(o.viewShedMap)&&(o.viewShedMap.enabled=!1),k(o.pyramid)&&(o._earthCtrl.entities.removeById(o.pyramid.id),o.pyramid=null);for(let A=0;A<o._lineArray.length;A++){let f=o._lineArray[A];o._earthCtrl.entities.remove(f)}o._lineArray=[]};Tv.prototype.visualConeShow=function(o){let A=this;k(A.pyramid)&&(A.pyramid.show=o);for(let f=0;f<A._lineArray.length;f++){let m=A._lineArray[f];m.show=o}};Tv.prototype.addVisualPyramid=function(){let o=this,A=new zO({radii:new Kr(function(){return new Z(o._distance,o._distance,o._distance)},!1),minimumClock:new Kr(function(){return De.toRadians(90-o._heading-o._horizontalViewAngle/2)},!1),maximumClock:new Kr(function(){return De.toRadians(90-o._heading+o._horizontalViewAngle/2)},!1),minimumCone:new Kr(function(){return De.toRadians(90-o._verticalViewAngle/2)},!1),maximumCone:new Kr(function(){return De.toRadians(90+o._verticalViewAngle/2)},!1),fill:!1,outline:!0,subdivisions:128,slicePartitions:32,stackPartitions:16,outlineColor:new Kr(function(){return o._colorStyle},!1)}),f=new Fu({position:new Kr(function(){return o._position},!1),ellipsoid:A});this.pyramid=o._earthCtrl.entities.add(f)};Tv.prototype.createLightCamera=function(){k(this.viewShedMap)?this._lightCamera=this.viewShedMap._lightCamera:this._lightCamera=new Ms(this._coreMap.scene),this._lightCamera.position=this._position};Tv.prototype.updateParameters=function(o){let A=this,f=A._lightCamera;if(!!k(o)&&(k(o.lon)||k(o.lat)||k(o.height)||k(o.heading)||k(o.pitch)||k(o.roll)||k(o.far)||k(o.distance)||k(o.verticalViewAngle)||k(o.horizontalViewAngle))){let m=this._parameter;for(let x in o)o.hasOwnProperty(x)&&k(m[x])&&(m[x]=o[x]);m.distance>=A.viewShedMap.maximumDistance&&(m.distance=A.viewShedMap.maximumDistance),A._heading=m.heading,A._pitch=m.pitch,A._distance=m.distance,A.viewShedMap._pointLightRadius=m.distance,m.verticalViewAngle=A.adjustViewRange(m.verticalViewAngle),A._verticalViewAngle=m.verticalViewAngle,m.horizontalViewAngle=A.adjustViewRange(m.horizontalViewAngle),A._horizontalViewAngle=m.horizontalViewAngle,A._position=Z.fromDegrees(m.lon,m.lat,m.height);let C=De.toRadians(m.heading);f.setView({destination:A._position,orientation:{heading:C,pitch:0,roll:0}}),f.frustum.far=m.far||1e5;let E=De.toRadians(A._horizontalViewAngle),I=De.toRadians(A._verticalViewAngle);f.frustum.aspectRatio=Math.tan(E/2)/Math.tan(I/2),E>I?f.frustum.fov=E:f.frustum.fov=I}};Tv.prototype.createShadowMap=function(){if(k(this.viewShedMap)){this.viewShedMap.enabled=!0;return}this.viewShedMap=new _4({context:this._coreMap.scene.context,lightCamera:this._lightCamera,enabled:!0,isPointLight:!0,pointLightRadius:this._distance,cascadesEnabled:!1,size:this._size,softShadows:!0,normalOffset:!1,fromLightSource:!1,visibleAreaColor:this._visibleAreaColor,invisibleAreaColor:this._invisibleAreaColor}),this._earthCtrl.viewShedMapList.push(this.viewShedMap)};var Gm=new Z;Tv.prototype.drawViewCentrum=function(){let o=this;function A(){let v=o.pyramid._ellipsoid._minimumClock.getValue(),w=o.pyramid._ellipsoid._minimumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=new EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let f=this._earthCtrl.entities.add({polyline:{positions:new Kr(A,!1),material:this._colorStyle}});this._lineArray.push(f);function m(){let v=o.pyramid._ellipsoid._maximumClock.getValue(),w=o.pyramid._ellipsoid._minimumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=new EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let C=this._earthCtrl.entities.add({polyline:{positions:new Kr(m,!1),material:this._colorStyle}});this._lineArray.push(C);function E(){let v=o.pyramid._ellipsoid._minimumClock.getValue(),w=o.pyramid._ellipsoid._maximumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=new EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let I=this._earthCtrl.entities.add({polyline:{positions:new Kr(E,!1),material:this._colorStyle}});this._lineArray.push(I);function x(){let v=o.pyramid._ellipsoid._maximumClock.getValue(),w=o.pyramid._ellipsoid._maximumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let y=this._earthCtrl.entities.add({polyline:{positions:new Kr(x,!1),material:this._colorStyle}});this._lineArray.push(y)};Tv.prototype.updateViewShed=function(){this.show?(this.createLightCamera(),this.setCameraParams(),this.createShadowMap(),this.addVisualPyramid(),this.drawViewCentrum()):this.removeFromMap()};Tv.prototype.setCameraParams=function(){this._lightCamera.frustum.near=.1,this._lightCamera.frustum.far=this._distance;let o=De.toRadians(this._horizontalViewAngle),A=De.toRadians(this._verticalViewAngle);this._lightCamera.frustum.aspectRatio=Math.tan(o/2)/Math.tan(A/2),o>A?this._lightCamera.frustum.fov=o:this._lightCamera.frustum.fov=A,this._lightCamera.setView({destination:this._position,orientation:{heading:De.toRadians(this._heading),pitch:De.toRadians(this._pitch),roll:0}})};var nbe=Tv;var obe=gi.WGS84;function Kh(o){this._cesiumViewer=o,this.coreMap=o.coreMap,this._scene=this.coreMap.scene,this.loading||this.addLoading(),this._tooltip=TBi(this.coreMap.container)}function abe(o,A){if(o===null||typeof o!="object"||o.constructor!==Object&&o.constructor!==Array)return o;if(o.constructor===Date||o.constructor===RegExp||o.constructor===Function||o.constructor===String||o.constructor===Number||o.constructor===Boolean)return new o.constructor(o);A=A||new o.constructor;for(let f in o)A[f]=typeof A[f]>"u"?abe(o[f],null):A[f];return A}function mtt(o,A){let f=abe(o),m;for(m in A)f[m]===void 0&&(f[m]=abe(A[m]));return f}function TBi(o){let A=function(f){let m=document.createElement("DIV");m.className="twipsy right";let C=document.createElement("DIV");C.className="twipsy-arrow",m.appendChild(C);let E=document.createElement("DIV");E.className="twipsy-inner",m.appendChild(E),this._div=m,this._title=E,f.appendChild(m)};return A.prototype.setVisible=function(f){this._div.style.display=f?"block":"none"},A.prototype.showAt=function(f,m){f&&m&&(this.setVisible(!0),this._title.innerHTML=m,this._div.style.left=`${f.x+30}px`,this._div.style.top=`${f.y-this._div.clientHeight/2-15}px`)},new A(o)}Kh.prototype.addToolbar=function(o,A){return A=mtt(A,{container:o}),new Kh.Toolbar(this,A)};var Ctt={shiftX:0,shiftY:0};Kh.prototype.createBillboardGroup=function(o,A,f){let m=new Kh.BillboardGroup(this,A);return m.addBillboards(o,f),m};Kh.BillboardGroup=function(o,A){this._drawHelper=o,this._scene=o._scene,this._options=mtt(A,Ctt);let f=new nI;this._scene.primitives.add(f),this._billboards=f,this._orderedBillboards=[]};Kh.BillboardGroup.prototype.createBillboard=function(o,A){let f=this._billboards.add({show:!0,position:o,pixelOffset:new tt(this._options.shiftX,this._options.shiftY),eyeOffset:new Z(0,0,-1e3),horizontalOrigin:iu.CENTER,verticalOrigin:on.CENTER,scale:.3,image:ae(this._options.iconUrl,`${globalThis.GEOWORLD_BASE_URL}Assets/Images/point.png`),color:new qe(1,1,1,1)});if(A){let E=function(x){C.enableRotate=x},I=function(){let x=0;for(let y=m._orderedBillboards.length;x<y&&m._orderedBillboards[x]!==f;++x);return x},m=this,C=this._scene.screenSpaceCameraController;if(A.dragHandlers){let x=this,y=new pr(x._scene.canvas);setListener(f,"leftDown",function(v){function w(M){f.position=M;for(let B=0,D=x._orderedBillboards.length;B<D&&x._orderedBillboards[B]!==f;++B);A.dragHandlers.onDrag&&A.dragHandlers.onDrag(I(),M)}function Q(M){y.destroy(),E(!0),A.dragHandlers.onDragEnd&&A.dragHandlers.onDragEnd(I(),M)}y.setInputAction(function(M){let B=x._scene.camera.pickEllipsoid(M.endPosition,obe);B?w(B):Q(B)},_i.MOUSE_MOVE),y.setInputAction(function(M){Q(x._scene.camera.pickEllipsoid(M.position,obe))},_i.LEFT_UP),E(!1),A.dragHandlers.onDragStart&&A.dragHandlers.onDragStart(I(),x._scene.camera.pickEllipsoid(v,obe))})}A.onDoubleClick&&setListener(f,"leftDoubleClick",function(x){A.onDoubleClick(I())}),A.onClick&&setListener(f,"leftClick",function(x){A.onClick(I())}),A.tooltip&&(setListener(f,"mouseMove",function(x){m._drawHelper._tooltip.showAt(x,A.tooltip())}),setListener(f,"mouseOut",function(x){m._drawHelper._tooltip.setVisible(!1)}))}return f};Kh.BillboardGroup.prototype.insertBillboard=function(o,A,f){this._orderedBillboards.splice(o,0,this.createBillboard(A,f))};Kh.BillboardGroup.prototype.addBillboard=function(o,A){this._orderedBillboards.push(this.createBillboard(o,A))};Kh.BillboardGroup.prototype.addBillboards=function(o,A){let f=0;for(;f<o.length;f++)this.addBillboard(o[f],A)};Kh.BillboardGroup.prototype.updateBillboardsPositions=function(o){let A=0;for(;A<o.length;A++)this.getBillboard(A).position=o[A]};Kh.BillboardGroup.prototype.countBillboards=function(){return this._orderedBillboards.length};Kh.BillboardGroup.prototype.getBillboard=function(o){return this._orderedBillboards[o]};Kh.BillboardGroup.prototype.removeBillboard=function(o){this._billboards.remove(this.getBillboard(o)),this._orderedBillboards.splice(o,1)};Kh.BillboardGroup.prototype.remove=function(){this._billboards=this._billboards&&this._billboards.removeAll()&&this._billboards.destroy()};Kh.BillboardGroup.prototype.setOnTop=function(){this._scene.primitives.raiseToTop(this._billboards)};Kh.prototype.cleanUp=function(){this._prevEntity!==void 0&&(this._cesiumViewer.entities.remove(this._prevEntity),this._prevEntity=void 0),this._markers!==void 0&&(this._markers.remove(),this._markers=void 0),this._volumeLabel!==void 0&&(this._cesiumViewer.entities.remove(this._volumeLabel),this._volumeLabel=void 0),this._tooltip.setVisible(!1)};Kh.prototype.startDrawing=function(o){let A=this,f=this._scene;f.globe.depthTestAgainstTerrain=!0;let m=this._tooltip,C=3,E=[],I=[],x;this._positions=I;let y=new pr(f.canvas);this._mouseHandler=y;let v=new Kh.BillboardGroup(this,Ctt);this._markers=v,this._prevEntity!==void 0&&(this._cesiumViewer.entities.remove(this._prevEntity),this._prevEntity=null),this._volumeLabel!==void 0&&(this._cesiumViewer.entities.remove(this._volumeLabel),this._volumeLabel=void 0),y.setInputAction(function(Q){if(Q.position!==null){let M=f.camera.getPickRay(Q.position),B=f.globe.pick(M,f),D=Lt.fromCartesian(B),S=De.toDegrees(D.longitude),P=De.toDegrees(D.latitude);if(B){if(E.length===0&&(E.push(S,P),I.push(B),x=B,v.addBillboard(x)),I.length>=4){let R=ms.wgs84ToWindowCoordinates(this._cesiumViewer.coreMap.scene,x);if(R!==void 0){let T=R.x-Q.position.x,L=R.y-Q.position.y;if(T*T+L*L<16){E.splice(E.length-2,2),I.pop(),this.isLoading(!0),this.stopDrawing(o);return}}}E.push(S,P),I.push(B),v.addBillboard(B),I.length===C&&(A._prevEntity=A._cesiumViewer.factory.createElement({type:"polygon",parameters:{hierarchy:Z.fromDegreesArray(E),material:qe.RED.withAlpha(.6),fill:!0}}),A._prevEntity.polygon.hierarchy=w())}}}.bind(this),_i.LEFT_CLICK),y.setInputAction(function(Q){let M=Q.endPosition;if(M!==null)if(I.length===0)m.showAt(M,"\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7B2C\u4E00\u4E2A\u70B9");else{let B=f.camera.getPickRay(M),D=f.globe.pick(B,f),S=Lt.fromCartesian(D),P=De.toDegrees(S.longitude),R=De.toDegrees(S.latitude);if(D&&(E.splice(E.length-2,2),I.pop(),E.push(P,R),I.push(D),v.getBillboard(I.length-1).position=D,m.showAt(M,"\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236"),I.length>=3&&I.length>=4)){let T=ms.wgs84ToWindowCoordinates(this._cesiumViewer.coreMap.scene,x);if(T!==void 0){let L=T.x-M.x,F=T.y-M.y;L*L+F*F<16?document.body.style.cursor="pointer":document.body.style.cursor="default"}}}}.bind(this),_i.MOUSE_MOVE),y.setInputAction(function(Q){I.length<C+2||(this.isLoading(!0),setTimeout(()=>{this.stopDrawing(o)},100))}.bind(this),_i.LEFT_DOUBLE_CLICK);function w(){return Z.fromDegreesArray(E)}};Kh.prototype.stopDrawing=function(o){this._mouseHandler!==void 0&&(this._mouseHandler.destroy(),this._mouseHandler=void 0),this._markers!==void 0&&(this._markers.remove(),this._markers=void 0),this._prevEntity!==void 0&&(this._cesiumViewer.entities.remove(this._prevEntity),this._prevEntity=null),this._volumeLabel!==void 0&&(this._cesiumViewer.entities.remove(this._volumeLabel),this._volumeLabel=void 0),this._tooltip.setVisible(!1),document.body.style.cursor="wait";let A=this.computeCutVolume(),f=A.maxHeight;document.body.style.cursor="default",typeof o=="function"&&o(A.volume);let m={polygon:{hierarchy:{positions:this._positions},extrudedHeight:f,closeTop:!1,closeBottom:!1,material:qe.RED.withAlpha(.5),outline:!0,outlineColor:qe.WHITE,outlineWidth:2}};this._prevEntity=this._cesiumViewer.entities.add(m),this.isLoading(!1)};Kh.prototype.addLoading=function(){let o=document.createElement("div");o.id="cesiumLoading",o.style.cssText="width: 100%;height: 100%;display:none;pointer-events: none;position: absolute;top: 0;left: 0;-moz-box-sizing: border-box;box-sizing: border-box;background-color: unset;z-index: 99999;";let A=document.createElement("img");A.style.cssText="position: relative;width: 110px;height: 110px;margin: auto;top: 50%;left: 50%;margin-top: -55px;margin-left: -55px;",A.src=`${globalThis.GEOWORLD_BASE_URL}Workers/image/loading.gif`,o.appendChild(A),this.loading=o,this.coreMap.container.appendChild(o)};Kh.prototype.isLoading=function(o){o?this.loading.style.display="block":this.loading.style.display="none"};Kh.prototype.removeLoading=function(){this.loading&&this.loading.remove(),this.loading=void 0};function PBi(o){let A=[],f=[];for(let Q=0;Q<o.length;Q++){let M=Lt.fromCartesian(o[Q]);A.push(M.longitude),f.push(M.latitude)}let m=0,C=0,E=0,I=0,x=0,y=0,v=0,w=0;for(let Q=0;Q<o.length;Q++)m=A[Q],C=f[Q],Q===o.length-1?(E=A[0],I=f[0]):(E=A[Q+1],I=f[Q+1]),y=m*I-E*C,x+=y,v+=(m+E)*y,w+=(C+I)*y;return x*=.5,v/=6*x,w/=6*x,new Lt(v,w)}function RBi(o,A,f){let m=Z.distance(o,A),C=Z.distance(A,f),E=Z.distance(f,o),I=(m+C+E)/2;return Math.sqrt(I*(I-m)*(I-C)*(I-E))}Kh.prototype.computeCutVolume=function(){let o=15e3;for(let L=0;L<this._positions.length;L++){let F=Lt.fromCartesian(this._positions[L]),U=this._scene.globe.getHeight(F);o>U&&(o=U)}let A=Math.PI/Math.pow(2,11);A=A/64;let f=new bc.fromPositions({positions:this._positions,vertexFormat:ma.FLAT_VERTEX_FORMAT,granularity:A}),m=new bc.createGeometry(f),C=0,E=0,I,x,y,v,w,Q,M,B,D,S,P,R;for(let L=0;L<m.indices.length;L+=3)I=m.indices[L],x=m.indices[L+1],y=m.indices[L+2],S=new Z(m.attributes.position.values[I*3],m.attributes.position.values[I*3+1],m.attributes.position.values[I*3+2]),P=Lt.fromCartesian(S),v=this._scene.globe.getHeight(P),M=Z.fromRadians(P.longitude,P.latitude,0),E<v&&(E=v),S=new Z(m.attributes.position.values[x*3],m.attributes.position.values[x*3+1],m.attributes.position.values[x*3+2]),P=Lt.fromCartesian(S),w=this._scene.globe.getHeight(P),B=Z.fromRadians(P.longitude,P.latitude,0),E<w&&(E=w),S=new Z(m.attributes.position.values[y*3],m.attributes.position.values[y*3+1],m.attributes.position.values[y*3+2]),P=Lt.fromCartesian(S),Q=this._scene.globe.getHeight(P),D=Z.fromRadians(P.longitude,P.latitude,0),E<Q&&(E=Q),R=RBi(M,B,D),C=C+R*(v-o+w-o+Q-o)/3;let T=PBi(this._positions);return this._volumeLabel=this._cesiumViewer.entities.add({position:Z.fromRadians(T.longitude,T.latitude,E+1e3),label:{text:`${C.toFixed(4)}\u7ACB\u65B9\u7C73`}}),{maxHeight:E,volume:C}};var sbe=Kh;function Ett(o,A){if(this.mEarthCtrl=o,this._parameter=A,this.coreMap=o.coreMap,this._color=ae(A.color,new qe(1,0,0,.7)),this._positions=A.positions,this._positions.length<3)throw new ni("invalid positions length!");this._duration=ae(A.duration,4e3),this._minHeight=ae(A.minHeight,0),this._maxHeight=ae(A.maxHeight,100),this._image=A.image,this._pps=null}function LBi(o,A){let f=Lt.fromCartesian(o[0]),m=f.longitude,C=f.latitude,E=m,I=C,x=A;for(let y=1;y<o.length;y++){let v=Lt.fromCartesian(o[y]);m>v.longitude?m=v.longitude:E<v.longitude&&(E=v.longitude),C>v.latitude?C=v.latitude:I<v.latitude&&(I=v.latitude)}return new Z.fromRadians((m+E)/2,(C+I)/2,x)}function FBi(o){if(k(o._pps))return;let A=LBi(o._positions,o._minHeight),f=Lt.fromCartesian(A),m=new kt(A.x,A.y,A.z,1),C=new Lt(f.longitude,f.latitude,o.maxHeight+100),E=Lt.toCartesian(C),I=new kt(E.x,E.y,E.z,1),x=new kt,y=new kt,v=new Z,w=o.mEarthCtrl.coreMap.scene.camera,Q=o._positions.length;o._pps=new Jo({fragmentShader:kBi(Q),uniforms:{u_floodCenterEC:function(){return Re.multiplyByVector(w._viewMatrix,m,x)},u_floodPlaneNormalEC:function(){let B=Re.multiplyByVector(w._viewMatrix,m,x),D=Re.multiplyByVector(w._viewMatrix,I,y);return v.x=D.x-B.x,v.y=D.y-B.y,v.z=D.z-B.z,Z.normalize(v,v),v},u_floodRange:function(){return o._positions},u_minHeight:function(){return o._minHeight},u_maxHeight:function(){return o._maxHeight},u_image:function(){return o.image},u_floodColor:function(){return o._color},u_positionsLength:function(){return o._positions.length}}}),o.mEarthCtrl.coreMap.scene.postProcessStages.add(o._pps)}function NBi(o){k(o._pps)&&(o.mEarthCtrl.coreMap.scene.postProcessStages.remove(o._pps),o._pps=null)}function kBi(o){return`uniform sampler2D colorTexture; |
| | | `;let x=C.getFragmentShaderCallback(E,o._diffuseAttributeOrUniformName[m],!1);return A.defined(x)?x(f):f}}function W_i(o,A){let f=o._batchTable;return o._batchTable.featuresLength===0?function(m){let C={u_inverseElevationMatrix:function(E){let I=o._model,x=typeof I._elevationMatrix;if(x==="undefined")return A.Matrix4.IDENTITY;if(x==="function"?I._uniformInverseElevationMatrix=I._elevationMatrix(I._uniformInverseElevationMatrix):A.Matrix4.clone(I._elevationMatrix,I._uniformInverseElevationMatrix),A.Matrix4.inverse(I._uniformInverseElevationMatrix,I._uniformInverseElevationMatrix),I._rtcCenter){let y=new A.Matrix4,v=A.Matrix4.fromTranslation(I._rtcCenter,y);A.Matrix4.multiply(I._uniformInverseElevationMatrix,v,I._uniformInverseElevationMatrix)}return I._uniformInverseElevationModelMatrix||(I._uniformInverseElevationModelMatrix=new A.Matrix4),E&&E.model?(I._uniformInverseElevationModelMatrix=A.Matrix4.multiply(I._uniformInverseElevationMatrix,E.model,I._uniformInverseElevationModelMatrix),I._uniformInverseElevationModelMatrix):A.Matrix4.IDENTITY}};return A.combine(m,C)}:function(m){let C={tile_batchTexture:function(){return defaultValue(f._batchTexture.batchTexture,f._batchTexture.defaultTexture)},tile_textureDimensions:function(){return f._batchTexture.textureDimensions},tile_textureStep:function(){return f._batchTexture.textureStep},tile_colorBlend:function(){return getColorBlend(f)},tile_pickTexture:function(){return f._batchTexture.pickTexture},u_inverseElevationMatrix:function(E){let I=o._model,x=typeof I._elevationMatrix;if(x==="undefined")return A.Matrix4.IDENTITY;if(x==="function"?I._uniformInverseElevationMatrix=I._elevationMatrix(I._uniformInverseElevationMatrix):A.Matrix4.clone(I._elevationMatrix,I._uniformInverseElevationMatrix),A.Matrix4.inverse(I._uniformInverseElevationMatrix,I._uniformInverseElevationMatrix),I._rtcCenter){let y=new A.Matrix4,v=A.Matrix4.fromTranslation(I._rtcCenter,y);A.Matrix4.multiply(I._uniformInverseElevationMatrix,v,I._uniformInverseElevationMatrix)}return I._uniformInverseElevationModelMatrix||(I._uniformInverseElevationModelMatrix=new A.Matrix4),I._uniformInverseElevationModelMatrix=A.Matrix4.multiply(I._uniformInverseElevationMatrix,E.model,I._uniformInverseElevationModelMatrix),I._uniformInverseElevationModelMatrix}};return A.combine(m,C)}}function q_i(o){this._size=o.size,this._datatype=o.datatype,this.getValue=o.getValue}function j_i(o,A,f){try{let m=f.Ellipsoid.WGS84,C=m.scaleToGeodeticSurface(o);return A=f.Transforms.eastNorthUpToFixedFrame(C,m,A),A}catch{return f.Matrix4.clone(f.Matrix4.IDENTITY,A)}}function X_i(o){o.AutomaticUniforms.czm_seWaterHeight||(o.AutomaticUniforms.czm_seWaterHeight=new q_i({size:1,datatype:o.WebGLConstants.FLOAT,getValue:function(f){return f.seWaterHeight?f.seWaterHeight:-5e3}}),o.ShaderSource._czmBuiltinsAndUniforms.czm_seWaterHeight="uniform float czm_seWaterHeight;");var A=o.Cesium3DTileset.prototype.update;o.Cesium3DTileset.prototype.update=function(f){A.call(this,f),this.show&&this.ready&&(this._autoElevationMatrix=j_i(this.boundingSphere.center,this._autoElevationMatrix,o))},o.Cesium3DTileContentFactory.b3dm=function(f,m,C,E,I){if(f.enableModelExperimental)return o.ModelExperimental3DTileContent.fromB3dm(f,m,C,E,I);let x=new o.Batched3DModel3DTileContent(f,m,C,E,I);return x._model instanceof o.ClassificationModel||(x._model._elevationMatrix=function(y){let v=f._elevationMatrix||f._autoElevationMatrix||o.Matrix4.IDENTITY;return y=o.Matrix4.clone(v,y),y},x._model._uniformMapLoaded=W_i(x,o),x._model._vertexShaderLoaded=J_i(x,o),x._model._fragmentShaderLoaded=K_i(x,o)),x},o.ShaderProgram.prototype._setUniforms=function(f,m,C){let E,I;if(o.defined(f)){let v=this._manualUniforms;for(E=v.length,I=0;I<E;++I){let w=v[I];w.value=f[w.name](m)}}let x=this._automaticUniforms;for(E=x.length,I=0;I<E;++I){let v=x[I];v.uniform.value=v.automaticUniform.getValue(m)}let y=this._uniforms;for(E=y.length,I=0;I<E;++I)y[I].set();if(C){let v=this._gl,w=this._program;v.validateProgram(w)}}}function Z_i(o,A){let f=o.baseWaterColor||new A.Color(.2,.3,.6,1),m=o.blendColor||new A.Color(.5,.5,.5,.7),C=o.animationSpeed||.05,E=o.amplitude||2,I=o.frequency||5e3,x=o.specularIntensity||.5,y=o.fadeFactor||1,v=o.sizeAndVelocity||new A.Cartesian4(100,100,10,0),w=o.width||316,Q=o.height||316;X_i(A),A.Material._materialCache.addMaterial("SEWater",{fabric:{type:"SEWater",uniforms:{baseWaterColor:f,blendColor:m,specularMap:A.Material.DefaultImageId,normalMap:A.Material.DefaultImageId,frequency:I,animationSpeed:C,amplitude:E,specularIntensity:x,fadeFactor:y,sizeAndVelocity:v},source:Vet},translucent:function(M){var B=M.uniforms;return B.baseWaterColor.alpha<1||B.blendColor.alpha<1}})}jx.prototype._createDebugView=function(){let o=this._cesium.Material.fromType("Image"),A=new this._cesium.ViewportQuad(new this._cesium.BoundingRectangle(0,100,300,300));A.material=o,this._debugViewportQuad=this._scene.primitives.add(A);let f=this._getWaterReflectTexture();f&&(o.uniforms.image=f)};jx.prototype.debugShow=function(o){this._debugViewportQuad.show=o};jx.prototype.isDebugShow=function(){return this._debugViewportQuad.show};jx.prototype._getWaterReflectTexture=function(){return this._wTexture._colorTexture};jx.prototype._getWaterReflectTextureChangedEvent=function(){return this._wTexture._textureChangedEvent};jx.prototype._createWaterMaterial=function(){var o=new this._cesium.Material({fabric:{type:"SEWater",uniforms:{specularMap:this._cesium.buildModuleUrl("Assets/Textures/waterNormals.jpg"),normalMap:this._cesium.buildModuleUrl("Assets/Textures/waterNormals.jpg"),frequency:this._option.frequency,animationSpeed:this._option.animationSpeed,amplitude:this._option.amplitude,width:this._option.width,height:this._option.height}}});let A=this;return o._uniforms.specularMap_0=function(){return A._wTexture._colorTexture||A._scene.context.defaultTexture},o};jx.prototype.createWaterPolygonPrimitive=function(o){let A=this,f=this._scene,m=null,C=null;if(o.type==0)m=this._cesium.PolygonGeometry.fromPositions({vertexFormat:this._cesium.MaterialAppearance.MaterialSupport.ALL.vertexFormat,positions:o.positions}),C=f.groundPrimitives.add(new this._cesium.GroundPrimitive({geometryInstances:new this._cesium.GeometryInstance({geometry:m}),appearance:new this._cesium.MaterialAppearance({materialSupport:this._cesium.MaterialAppearance.MaterialSupport.ALL}),classificationType:this._cesium.ClassificationType.BOTH})),C.appearance.material=this._createWaterMaterial();else if(o.type==1)m=this._cesium.CoplanarPolygonGeometry.fromPositions({vertexFormat:this._cesium.MaterialAppearance.MaterialSupport.ALL.vertexFormat,positions:o.positions}),C=f.primitives.add(new this._cesium.Primitive({geometryInstances:new this._cesium.GeometryInstance({geometry:m}),appearance:new this._cesium.MaterialAppearance({materialSupport:this._cesium.MaterialAppearance.MaterialSupport.ALL})})),C.appearance.material=this._createWaterMaterial();else if(o.type==2){let I=new this._cesium.GeometryInstance({geometry:o.geometry});C=f.primitives.add(new this._cesium.Primitive({geometryInstances:I,appearance:new this._cesium.EllipsoidSurfaceAppearance({material:this._createWaterMaterial()}),asynchronous:!1}))}C.appearance.material.uniforms.sizeAndVelocity.x=o.width,C.appearance.material.uniforms.sizeAndVelocity.y=o.height,C.radius=.5*Math.max(o.width,o.height),C.centerPos=o.center;let E=this._cesium.Cartographic.fromCartesian(o.center);return C.waterHeight=E.height,this._trackPrimitive(C),C};jx.prototype._trackPrimitive=function(o){this._trackedPrimitives.indexOf(o)<0&&this._trackedPrimitives.push(o)};jx.prototype.destroyWaterPolygonPrimitive=function(o){this._trackedPrimitives.indexOf(o)>=0&&(this._untrackPrimitive(o),this._scene.primitives.contains(o)&&this._scene.primitives.remove(o),this._scene.groundPrimitives.contains(o)&&this._scene.groundPrimitives.remove(o))};jx.prototype._untrackPrimitive=function(o){let A=this._trackedPrimitives.indexOf(o);A!=-1&&this._trackedPrimitives.splice(A,1)};jx.prototype.isDestroyed=function(){return!1};jx.prototype.destroy=function(){return this._disposeListener&&(this._disposeListener(),this._disposeListener=null),this._wTexture&&(this._wTexture.destroy(),this._wTexture=null),this._trackedPrimitives=[],this._cesium.destroyObject(this)};var ett=jx;function es(o){this._earthCtrl=o,this._coreMap=o.coreMap}function Om(){return((1+De.nextRandomNumber())*65536|0).toString(16).substring(1)}es.createUUID=function(){return`${Om()+Om()}-${Om()}-${Om()}-${Om()}-${Om()}${Om()}${Om()}`};es.createUUIDWithoutDash=function(){return Om()+Om()+Om()+Om()+Om()+Om()+Om()+Om()};es.prototype.createUUID=function(){return es.createUUID()};es.prototype.createGroup=function(o){let A=new C6;return A.id=o.id||es.createUUID(),A.name=o.name||"\u672A\u547D\u540D\u7EC4",A};es.prototype.createImageryLayer=function(o,A){let f=new L1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.IMAGERYPROVIDERS),f),f};es.prototype.createTerrainLayer=function(o,A){let f=new F1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.TERRAINPROVIDERS),f),f};es.prototype.removeTerrainLayer=function(o){this._coreMap.terrainProvider=new pD({})};es.prototype.createFeatureLayer=function(o,A){let f=new k1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.FEATURELAYERS),f),f};es.prototype.createModelLayer=function(o,A){let f=new N1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.MODELLAYERS),f),f};es.prototype.createWfsModel=function(o,A){let f=new XO(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.MODELLAYERS),f),f};es.prototype.createModel=function(o,A){let f=new _1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.removeModel=function(o){k(o)&&o.removeFromMap()};es.prototype.createCZMLObject=function(o,A){let f=this,m=ae(o.addToMap,!0),C=new oY(o.name);return C.load(o.url),m&&f._earthCtrl.dataSources.add(C),C.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,C):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),C),C};es.prototype.createElement=function(o){let A={};return A[o.type]=o.parameters,k(o.name)&&(A.name=o.name),k(o.position)&&(A.position=o.position),this._earthCtrl.entities.add(A)};es.prototype.removeElement=function(o){k(o)?this._earthCtrl.entities.remove(o):this._earthCtrl.entities.removeAll()};es.prototype.createVideoProjection=function(o,A){o.addToMap=ae(o.addToMap,!0);let f=ae(o.sourceType,"perspective"),m=null;return f==="perspective"?(m=new p1e(this._earthCtrl,o),m.initialize(o),m.name=o.name,A?this._earthCtrl.userScene.addChild(A,m):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),m)):f==="panorama"?(m=new Cet(this._earthCtrl,o),m.initialize(o),m.name=o.name,m.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,m):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),m)):f==="fisheye"&&(m=new m1e(this._earthCtrl,o),m.initialize(o),m.name=o.name,m.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,m):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),m)),m};es.prototype.createTrack=function(o,A){let f=new Eet(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),f.initialize(o),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createSceneNode=function(o,A,f){let m=new C6(this._earthCtrl);return m.id=o,m.name=A,m.label=f,m};es.prototype.createFire=function(o,A){let f=new C1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createSmoke=function(o,A){let f=new E1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createExplosion=function(o,A){let f=new I1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createFireworks=function(o,A){let f=new x1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createRadarScan=function(o,A){let f=new y1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),f.show=!0,A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createCircleScan=function(o,A){let f=new Qet(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),f.show=!0,A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createUpDownScan=function(o){let A=new Met(this._earthCtrl,o);return A.show=!0,A};es.prototype.createWaters=function(o,A){let f=new O1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),f.show=!0,A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createHeatmap=function(o,A){let f=vet.create(this._earthCtrl,o.bbox,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createLabel=function(o,A){let f=new B1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createBillboard=function(o,A){let f=new v1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPolyline=function(o,A){let f=new w1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPolygon=function(o,A){let f=new b1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPoint=function(o,A){let f=new Q1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createBox=function(o,A){let f=new S1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createEllipsoid=function(o,A){let f=new M1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createCylinder=function(o,A){let f=new D1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createRectangle=function(o,A){let f=new T1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createEllipse=function(o,A){let f=new P1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPolylineVolume=function(o,A){let f=new R1e(this._earthCtrl,o);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createEChartLayer=function(o,A){let f=new U1e(this._earthCtrl);return f.name=o.name,f.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&f.addToMap(o),A?this._earthCtrl.userScene.addChild(A,f):this._earthCtrl.userScene.addChild(this._earthCtrl.userScene.rootNode.getChildByName(ds.USERSCENE),f),f};es.prototype.createPointLight=function(o){return new Pet(this._earthCtrl,o)};es.prototype.createHawkeye=function(o){let A=new H1e(this._earthCtrl,o);A.name=o.name,A.id=ae(o.id,this._earthCtrl.factory.createUUID()),ae(o.addToMap,!0)&&A.addToMap(o)};es.prototype.createSpotLight=function(o){let A=new V1e(this._earthCtrl.coreMap,o.entities,o.lights);return A.name=o.name,A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createCustomShaderManager=function(o){let A=new Uet;return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createCustomShaderStage=function(o){let A=new Oet(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createModelOutline=function(o={}){let A=new Get(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.modelClick=function(o={}){let A=new Het(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A};es.prototype.createWaterPolygon=function(o){let A=new ett(this._earthCtrl,o);return A.name=ae(o.name,null),A.id=ae(o.id,this._earthCtrl.factory.createUUID()),A.createWaterPolygonPrimitive(o)};var LD=es;var Qre=class extends xg{constructor(A,f){super(A),this._objectMap={},this._rootNode=null,this._isBenchUpdate=!1,this._selectSet=new g1e(A);let m=new C6(A);m.id=LD.createUUID(),m.name=ae(f.ProjectName,"root"),m.version=ae(f.version,null),m.desc=ae(f.desc,null),m.createTime=ae(f.createTime,new Date().toISOString()),m.lastUpdate=ae(f.lastUpdate,null),m.show=!0,this._rootNode=m,this._editNode=m,this._objectMap[m.id]=m,this._EventDocumentChanged=new s3("EventDocumentChanged")}finalize(){this._rootNode=null,this._objectMap={}}getChildById(A){return this._objectMap.hasOwnProperty(A)?this._objectMap[A]:null}addChild(A,f){A.addChild(f),this._objectMap[f.id]=f,this._isBenchUpdate||this.commitChanged()}removeChildById(A){let f=this._objectMap[A];k(f)&&this.removeChild(f)}removeChild(A){k(A)&&k(A.parentNode)&&(A.removeFromMap(),A.parentNode.removeChild(A)),delete this._objectMap[A.id],this._isBenchUpdate||this.commitChanged()}removeAll(){}beginUpdate(){this._isBenchUpdate=!0}endUpdate(){this._isBenchUpdate&&(this.commitChanged(),this._isBenchUpdate=!1)}commitChanged(){this._EventDocumentChanged.notifyEvent(this)}flyTo(A,f){k(A)&&k(A._primitive)&&(A=A._primitive),this._earthCtrl.coreMap.flyTo(A,f)}findLocationByID(A,f){if(!A)return;let m=this.getChildById(A);k(m)&&k(m._primitive)&&(m=m._primitive),this._earthCtrl.coreMap.flyTo(m,f)}moveLayer(A,f){let m=this.getChildById(A),C=null;for(let E=0;E<m.parentNode.childNodes.length;E++)m.parentNode.childNodes[E].id===m.id&&(C=E);f==="up"?(this._earthCtrl.coreMap.scene.imageryLayers.raise(m._primitive),this.changeLayer(m.parentNode.childNodes,C,C+1)):f==="down"&&(this._earthCtrl.coreMap.scene.imageryLayers.lower(m._primitive),this.changeLayer(m.parentNode.childNodes,C,C-1))}changeLayer(A,f,m){if(f=De.clamp(f,0,A.length-1),m=De.clamp(m,0,A.length-1),f===m)return;let C=A[f];A[f]=A[m],A[m]=C}outputJson(A){let f=this;new Promise(function(C,E){let I={IMAGERYPROVIDERS:"imageryProviders",TERRAINPROVIDERS:"terrainProviders",MODELLAYERS:"modelLayers",FEATURELAYERS:"featureLayers",USERSCENE:"userScene"},x=0,y=[];for(let v in I){let w=I[v],Q=f.rootNode.getChildByName(w);if(!Q)continue;let M=[];if(Q.childNodes.length===0)M=[];else for(let B=0;B<Q.childNodes.length;B++){let D=Q.childNodes[B].toJSON();M.push(D)}Promise.all(M).then(function(B){let D=[];if(B.length!==0){for(let R=0;R<B.length;R++)D.push(B[R]);let S=D[0].class;S!=="IMAGERY_LAYER"&&S!=="TERRAIN_LAYER"&&S!=="MODEL_LAYER"&&S!=="FEATURE_LAYER"&&(S="USER_SCENE");let P={item:S,objJson:D};y.push(P)}x++,x===5&&(C(y),x=0)})}}).then(function(C){let E={version:f.rootNode.version,projectName:f.rootNode.name,desc:f.rootNode.desc,createTime:f.rootNode.createTime,lastUpdate:new Date().toISOString(),imageryProviders:[],terrainProviders:[],modelLayers:[],featureLayers:[],userScene:[]};for(let w=0;w<C.length;w++)C[w].item==="IMAGERY_LAYER"&&(E.imageryProviders=C[w].objJson),C[w].item==="TERRAIN_LAYER"&&(E.terrainProviders=C[w].objJson),C[w].item==="MODEL_LAYER"&&(E.modelLayers=C[w].objJson),C[w].item==="FEATURE_LAYER"&&(E.featureLayers=C[w].objJson),C[w].item==="USER_SCENE"&&(E.userScene=C[w].objJson);let I={class:"ENVIRONMENT",underGround:ae(f._earthCtrl.camera.undergroundMode,null),shadow:ae(f._earthCtrl.shadows,null),depthTest:ae(f._earthCtrl.coreMap.scene.globe.depthTestAgainstTerrain,null),rain:ae(f._earthCtrl.environment.rain.show,null),snow:ae(f._earthCtrl.environment.snow.show,null),fog:ae(f._earthCtrl.environment.fog.show,null),bwMode:ae(f._earthCtrl.environment.bwMode.show,null),nightMode:ae(f._earthCtrl.environment.nightMode.show,null),colorAdjustment:{show:ae(f._earthCtrl.environment.colorAdjustment.show,null),contrast:ae(f._earthCtrl.environment.colorAdjustment.contrast,null),saturation:ae(f._earthCtrl.environment.colorAdjustment.saturation,null),brightness:ae(f._earthCtrl.environment.colorAdjustment.brightness,null)}},x={class:"SKYBOX",positiveX:ae(f._earthCtrl.environment.SkyBoxSource.positiveX,null),negativeX:ae(f._earthCtrl.environment.SkyBoxSource.negativeX,null),positiveY:ae(f._earthCtrl.environment.SkyBoxSource.positiveY,null),negativeY:ae(f._earthCtrl.environment.SkyBoxSource.negativeY,null),positiveZ:ae(f._earthCtrl.environment.SkyBoxSource.positiveZ,null),negativeZ:ae(f._earthCtrl.environment.SkyBoxSource.negativeZ,null)},y={class:"VIEWPOINT",lon:f._earthCtrl.camera.viewPoint.lon,lat:f._earthCtrl.camera.viewPoint.lat,alt:f._earthCtrl.camera.viewPoint.alt,heading:f._earthCtrl.camera.viewPoint.heading,pitch:f._earthCtrl.camera.viewPoint.pitch,roll:f._earthCtrl.camera.viewPoint.roll,duration:f._earthCtrl.camera.viewPoint.duration};E.userScene.push(I),E.userScene.push(x),E.userScene.push(y);let v=JSON.stringify(E);A&&A(v)})}};Object.defineProperties(Qre.prototype,{rootNode:{get:function(){return this._rootNode},set:function(o){this._rootNode=o}},editNode:{get:function(){return this._editNode},set:function(o){this._editNode=o}},selectSet:{get:function(){return this._selectSet}},EventDocumentChanged:{get:function(){return this._EventDocumentChanged}},EventObjectPropertyChanged:{get:function(){return this._EventObjectPropertyChanged}}});var z1e=Qre;function ttt(o){this._earthCtrl=o,this._coreMap=o.coreMap,this.initialize()}var dFi=new Oa,gFi=new Z,fFi=new Z;ttt.prototype.initialize=function(){let o=document.createElement("div");o.className="map-info-bar",o.style="position: absolute;display: none;left: 0px;bottom:0px;width: 100%;background:rgba(0,0,0,0.4); color:#e9e9e9; text-shadow:2px 2px 2px #000";let A=this._coreMap;A.container.appendChild(o);let f="float: right; min-width: 100px;margin-right: 20px;",m=document.createElement("div");m.style=f,o.appendChild(m);let C=document.createElement("div");C.style=f,o.appendChild(C);let E=document.createElement("div");E.style=f,o.appendChild(E);let I=A.scene.canvas,x=A.scene.globe.ellipsoid;new pr(I).setInputAction(function(v){let w=A.camera.pickEllipsoid(v.endPosition,x);if(w){let Q=A.scene.globe.ellipsoid.cartesianToCartographic(w),M=De.toDegrees(Q.latitude).toFixed(6),B=De.toDegrees(Q.longitude).toFixed(6),D=A.camera.positionCartographic.height.toFixed(1);E.innerHTML=`\u7ECF\u5EA6\uFF1A${B}`,C.innerHTML=`\u7EAC\u5EA6\uFF1A${M}`,m.innerHTML=`\u89C6\u70B9\u9AD8\uFF1A${D}\u7C73`}},_i.MOUSE_MOVE)};var itt=ttt;function yl(){}yl.parseBaseData=function(o,A){let f=[];if(k(A)&&k(A.imageryProviders))for(let C=0;C<A.imageryProviders.length;C++){let E=A.imageryProviders[C];if(E.enable===!1||E.show===!1)continue;if(k(E.tilingScheme)){let x=E.tilingScheme;x.type==="GeographicTilingScheme"&&(E.tilingScheme=new ph(x))}let I=LD.createImageryLayer(E);f.push(I)}let m=[];if(k(A)&&k(A.terrainProviders))for(let C=0;C<A.terrainProviders.length;C++){let E=A.terrainProviders[C];if(E.enable===!1||E.show===!1)continue;let I=LD.createTerrainLayer(E);m.push(I)}return{imageryProvider:f,terrainProvider:m}};yl.parse=function(o,A){if(!k(A))return;let f=[ds.IMAGERYPROVIDERS,ds.TERRAINPROVIDERS,ds.MODELLAYERS,ds.FEATURELAYERS,ds.USERSCENE];for(let m=0;m<f.length;m++){let C=o.factory.createSceneNode(LD.createUUID(),f[m]);C.show=!0,o.userScene.addChild(o.userScene.rootNode,C)}k(A[ds.IMAGERYPROVIDERS])&&w6(o,A[ds.IMAGERYPROVIDERS],o.userScene.rootNode.getChildByIndex(0),0),k(A[ds.TERRAINPROVIDERS])&&w6(o,A[ds.TERRAINPROVIDERS],o.userScene.rootNode.getChildByIndex(1),1),k(A[ds.MODELLAYERS])&&w6(o,A[ds.MODELLAYERS],o.userScene.rootNode.getChildByIndex(2)),k(A[ds.FEATURELAYERS])&&w6(o,A[ds.FEATURELAYERS],o.userScene.rootNode.getChildByIndex(3)),k(A[ds.USERSCENE])&&w6(o,A[ds.USERSCENE],o.userScene.rootNode.getChildByIndex(4))};function w6(o,A,f,m){for(let C=0;C<A.length;C++){let E=A[C],I=null;if(E.enable===!1)continue;k(E.class)?(E.class==="IMAGERY"&&(E.class=Xn.IMAGERY_LAYER),E.class==="TERRAIN"&&(E.class=Xn.TERRAIN_LAYER),I=E.class):(m===0?E.class=Xn.IMAGERY_LAYER:m===1&&(E.class=Xn.TERRAIN_LAYER),I=E.class);let x=yl.parserMap[I];x!==void 0&&x(o,E,f)}}function $_i(o,A,f){let m=o.factory.createSceneNode(A.id,A.name);m.show=ae(A.show,!0),o.userScene.addChild(f,m),k(A.childNodes)&&w6(o,A.childNodes,m)}function eBi(o,A,f){let m=A;if(k(m.tilingScheme)){let C=m.tilingScheme;C.type==="GeographicTilingScheme"&&(m.tilingScheme=new ph(C))}o.factory.createImageryLayer(m,f)}function tBi(o,A,f){let m=A;o.factory.createTerrainLayer(m,f)}function iBi(o,A,f){let m=A;m.addToMap=!0;let C=m.sourceType;C==="3DTiles"||C==="b3dm"||C==="osgb"||C==="s3m"||C==="ude_block"||C==="ude_model"?o.factory.createModelLayer(m,f):C==="czml"?o.factory.createCZMLObject(m,f):C==="wfsModel"&&o.factory.createWfsModel(m,f)}function rBi(o,A,f){let m=o.factory.createFeatureLayer(A,f)}function nBi(o,A,f){o.coreMap.scene.skyBox=new HN({sources:{positiveX:A.positiveX,negativeX:A.negativeX,positiveY:A.positiveY,negativeY:A.negativeY,positiveZ:A.positiveZ,negativeZ:A.negativeZ}})}function oBi(o,A,f){o.camera.undergroundMode=ae(A.underGround,!1),o.shadows=ae(A.shadow,!1),A.rain===!0&&o.environment.showEffect("rain"),A.snow===!0&&o.environment.showEffect("snow"),A.fog===!0&&o.environment.showEffect("fog"),o.coreMap.scene.globe.depthTestAgainstTerrain=ae(A.depthTest,!1),A.bwMode===!0&&o.environment.showEffect("bwMode"),A.nightMode===!0&&o.environment.showEffect("nightMode"),A.colorAdjustment.show===!0&&(o.environment.showEffect("colorAdjustment"),o.environment.colorAdjustment.contrast=A.colorAdjustment.contrast,o.environment.colorAdjustment.saturation=A.colorAdjustment.saturation,o.environment.colorAdjustment.brightness=A.colorAdjustment.brightness)}function aBi(o,A,f){o.camera.viewPoint=A,o.camera.flyTo(A.lon,A.lat,A.alt,A.heading,A.pitch,A.roll,A.duration)}function sBi(o,A,f){o.factory.createModel(A,f)}function lBi(o,A,f){o.factory.createWaters(A,f)}function ABi(o,A,f){o.factory.createExplosion(A,f)}function uBi(o,A,f){o.factory.createFireworks(A,f)}function cBi(o,A,f){o.factory.createSmoke(A,f)}function hBi(o,A,f){o.factory.createFire(A,f)}function dBi(o,A,f){A.color&&(A.color=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),o.factory.createRadarScan(A,f)}function gBi(o,A,f){A.color&&(A.color=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),o.factory.createCircleScan(A,f)}function fBi(o,A,f){A.color&&(A.color=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.color.red,A.color.green,A.color.blue,A.color.alpha)),o.factory.createPoint(A,f)}function pBi(o,A,f){A.fillColor&&(A.fillColor=new qe(A.fillColor.red,A.fillColor.green,A.fillColor.blue,A.fillColor.alpha)),o.factory.createLabel(A,f)}function mBi(o,A,f){o.factory.createBillboard(A,f)}function CBi(o,A,f){A.positions&&(A.positions=yl.array2DtoMercator(A.positions)),A.lineColor&&(A.lineColor=new qe(A.lineColor.red,A.lineColor.green,A.lineColor.blue,A.lineColor.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),o.factory.createPolyline(A,f)}function EBi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.positions&&(A.positions=yl.array2DtoMercator(A.positions)),o.factory.createPolygon(A,f)}function IBi(o,A,f){A.coordinates&&(A.coordinates=hi.fromDegrees(A.coordinates[0],A.coordinates[1],A.coordinates[2],A.coordinates[3])),A.fillColor&&(A.fillColor=new qe(A.fillColor.red,A.fillColor.green,A.fillColor.blue,A.fillColor.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),o.factory.createRectangle(A,f)}function xBi(o,A,f){o.factory.createEllipse(A,f)}function yBi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.position&&(A.position=Z.fromDegrees(A.position[0],A.position[1],A.position[2])),A.dimensions&&(A.dimensions=new Z(A.dimensions.x,A.dimensions.y,A.dimensions.z)),o.factory.createBox(A,f)}function vBi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.position&&(A.position=Z.fromDegrees(A.position[0],A.position[1],A.position[2])),A.radii&&(A.radii=new Z(A.radii[0],A.radii[1],A.radii[2])),o.factory.createEllipsoid(A,f)}function _Bi(o,A,f){A.material&&(A.material=new qe(A.material.red,A.material.green,A.material.blue,A.material.alpha)),A.outlineColor&&(A.outlineColor=new qe(A.outlineColor.red,A.outlineColor.green,A.outlineColor.blue,A.outlineColor.alpha)),A.position&&(A.position=Z.fromDegrees(A.position[0],A.position[1],A.position[2])),o.factory.createCylinder(A,f)}function BBi(o,A,f){o.factory.createPolylineVolume(A,f)}function wBi(o,A,f){o.factory.createVideoProjection(A,f)}function bBi(o,A,f){o.factory.createVideoProjection(A,f)}function QBi(o,A,f){o.factory.createTrack(A,f)}function SBi(o,A,f){o.factory.createHeatmap(A,f)}function DBi(o,A,f){o.factory.createEChartLayer(A,f)}function MBi(o,A,f){let m=o.factory.createElement(A);o.userScene.addChild(f,m)}yl.array2DtoMercator=function(o){let A=[];return o.forEach(function(f){let m=Z.fromDegrees(f[0],f[1],f[2]);A.push(m)}),A};yl.parserMap={};yl.parserMap[Xn.NODE]=$_i;yl.parserMap[Xn.IMAGERY_LAYER]=eBi;yl.parserMap[Xn.TERRAIN_LAYER]=tBi;yl.parserMap[Xn.MODEL_LAYER]=iBi;yl.parserMap[Xn.FEATURE_LAYER]=rBi;yl.parserMap[Xn.SKYBOX]=nBi;yl.parserMap[Xn.ENVIRONMENT]=oBi;yl.parserMap[Xn.VIEWPOINT]=aBi;yl.parserMap[Xn.MODEL]=sBi;yl.parserMap[Xn.WATERS]=lBi;yl.parserMap[Xn.EXPLOSION]=ABi;yl.parserMap[Xn.FIREWORK]=uBi;yl.parserMap[Xn.SMOKE]=cBi;yl.parserMap[Xn.FIRE]=hBi;yl.parserMap[Xn.RADARSCAN]=dBi;yl.parserMap[Xn.CIRCLESCAN]=gBi;yl.parserMap[Xn.POINT]=fBi;yl.parserMap[Xn.LABEL]=pBi;yl.parserMap[Xn.BILLBOARD]=mBi;yl.parserMap[Xn.POLYLINE]=CBi;yl.parserMap[Xn.POLYGON]=EBi;yl.parserMap[Xn.RECTANGLE]=IBi;yl.parserMap[Xn.ELLIPSE]=xBi;yl.parserMap[Xn.BOX]=yBi;yl.parserMap[Xn.ELLIPSOID]=vBi;yl.parserMap[Xn.CYLINDER]=_Bi;yl.parserMap[Xn.POLYLINEVOLUME]=BBi;yl.parserMap[Xn.PERSPECTIVE_VIDEO_PROJECTION]=wBi;yl.parserMap[Xn.FISHEYE_VIDEO_PROJECTION]=bBi;yl.parserMap[Xn.TRACK]=QBi;yl.parserMap[Xn.HEATMAP]=SBi;yl.parserMap[Xn.ECHARTLAYER]=DBi;yl.parserMap.ELEMENT=MBi;var rtt=yl;var Y1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editBillboard=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.editBillboard=f,k(this.editBillboard)&&k(this.editBillboard.entity.billboard)?console.info(this.editBillboard.entity):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Billboard entity is need!"}))}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editBillboard.entity.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editBillboard.entity)||this.pickObject(A,this.editBillboard.entity))&&this.mCallback&&this.mCallback(this.editBillboard),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m,this.editBillboard.entity.position=m}return this.mCallback&&this.mCallback(this.editBillboard),!0}updateBillboard(A){if(k(A)&&k(this.editBillboard)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editBillboard.entity.position=A[C]:k(A[C])&&(this.editBillboard.entity.billboard[C]=A[C])}}}endEditEntity(){}},ntt=Y1e;var J1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editPoint=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.editPoint=f,k(this.editPoint)&&k(this.editPoint.entity.point)?console.info(this.editPoint.entity.point):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Point entity is need!"}))}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPoint.entity.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPoint.entity)||this.pickObject(A,this.editPoint.entity))&&this.mCallback&&this.mCallback(this.editPoint),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m,this.editPoint.entity.position=m}return this.mCallback&&this.mCallback(this.editPoint),!0}updatePoint(A){if(k(A)&&k(this.editPoint)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editPoint.entity.position=A[C]:k(A[C])&&(this.editPoint.entity.point[C]=A[C])}}}endEditEntity(){}},ott=J1e;var K1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editBox=void 0,this.pickedEntity=void 0,this.editHeightPoint=void 0,this.editWHPoint=void 0,this.pickEditHeightPoint=void 0,this.pickEditWHPoint=void 0,this.isEditing=!1,this.pointsId=[],this.height=0,this.dragPosition=void 0,this.editBox=f,k(this.editBox)&&k(this.editBox.entity.box)){let E=this.editBox.entity.position._value,I=Lt.fromCartesian(E);this.height=I.height;let x=new Z,y=new Z;this.getNorthPointByDistance(x,y),this.editHeightPoint=this.mEarthCtrl.entities.add({name:"box_edit_height_point",position:x,point:{heightReference:this.editBox.entity.box.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.editHeightPoint.id),this.editWHPoint=this.mEarthCtrl.entities.add({name:"box_edit_long_width_point",position:y,point:{heightReference:this.editBox.entity.box.heightReference,color:qe.RED,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.editWHPoint.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Box entity is need!"})}addHeight(A){let f=this.editBox.entity.position._value,m=Lt.fromCartesian(f);return this.height=m.height+A,Z.fromRadians(m.longitude,m.latitude,this.height)}getNorthPointByDistance(A,f,m){let C;console.info(this.editBox.entity.position),k(m)?C=this.editBox.entity.position.getValue(m):C=this.editBox.entity.position._value;let E=Vr.eastNorthUpToFixedFrame(C),I=new Z,x=this.editBox.entity.box.dimensions._value;x||(x=this.editBox.entity.box.dimensions.getValue(m)),Z.divideByScalar(x,2,I),Z.clone(I,A),Z.clone(I,f),A.y*=-1,Re.multiplyByPoint(E,A,A),f.y*=-1,f.z*=-1,Re.multiplyByPoint(E,f,f)}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editBox.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickEditHeightPoint=void 0,this.pickEditWHPoint=void 0):f.name==="box_edit_height_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickEditHeightPoint=f,this.pickEditWHPoint=void 0):f.name==="box_edit_long_width_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickEditHeightPoint=void 0,this.pickEditWHPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editBox)||this.pickObject(A,this.editBox.entity))&&this.mCallback&&this.mCallback(this.editBox),this.currentPoint=void 0,this.isEditing=!1,this.dragPosition=void 0,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;let f=new Date,m=jt.fromDate(f);if(k(this.currentPoint)||k(this.pickEditHeightPoint)||k(this.pickEditWHPoint)){let C=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,E=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,C);if(!E)return;let I=Lt.fromCartesian(E),x=Z.fromRadians(I.longitude,I.latitude,I.height+this.height);if(k(this.currentPoint))this.currentPoint.position=x,this.editBox.entity.position=new Kr(function(){return x},!1);else if(k(this.dragPosition)){if(k(this.pickEditWHPoint)){let w=Z.subtract(E,this.dragPosition,new Z),Q=Z.normalize(w,new Z);Z.dot(w,Q,w);let M=this.editBox.entity.box.dimensions._value;M||(M=this.editBox.entity.box.dimensions.getValue(m));let B=Z.clone(M);B.x-=w.x,B.y+=w.y,Z.abs(B,B),this.editBox.entity.box.dimensions=new Kr(function(){return B},!1)}else if(k(this.pickEditHeightPoint)){let w=Z.subtract(E,this.dragPosition,new Z),Q=this.editBox.entity.box.dimensions._value;Q||(Q=this.editBox.entity.box.dimensions.getValue(m));let M=Z.clone(Q);M.z+=w.z,Z.abs(M,M),this.editBox.entity.box.dimensions=M,this.editBox.entity.position=this.addHeight(w.z/2)}}this.dragPosition=E;let y=new Z,v=new Z;this.getNorthPointByDistance(y,v,m),this.editHeightPoint.position=y,this.editWHPoint.position=v}return this.mCallback&&this.mCallback(this.editBox),!0}updateBox(A){if(k(A)&&k(this.editBox)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editBox.entity.position=A[C]:k(A[C])&&(this.editBox.entity.box[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},att=K1e;var W1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editCylinder=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.pointsId=[],this.height=0,this.topRadiusPoint=void 0,this.pickTopRadiusPoint=void 0,this.bottomRadiusPoint=void 0,this.pickBottomRadiusPoint=void 0,this.heightPoint=void 0,this.pickHeightPoint=void 0,this.dragPosition=void 0,this.editCylinder=f,k(this.editCylinder)&&k(this.editCylinder.entity.cylinder)){let E=this.editCylinder.entity.position._value,I=Lt.fromCartesian(E);this.height=I.height;let x=this.editCylinder.entity.cylinder.topRadius._value,y=this.editCylinder.entity.cylinder.bottomRadius._value,v=new Z,w=new Z,Q=new Z;this.getNorthPointByDistance(v,w,Q),this.heightPoint=this.mEarthCtrl.entities.add({name:"cylinder_edit_height_point",position:Q,point:{heightReference:this.editCylinder.entity.cylinder.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.heightPoint.id),x>0&&(this.topRadiusPoint=this.mEarthCtrl.entities.add({name:"cylinder_edit_top_radius_point",position:v,point:{heightReference:this.editCylinder.entity.cylinder.heightReference,color:qe.RED,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.topRadiusPoint.id)),y>0&&(this.bottomRadiusPoint=this.mEarthCtrl.entities.add({name:"cylinder_edit_bottom_radius_point",position:w,point:{heightReference:this.editCylinder.entity.cylinder.heightReference,color:qe.RED,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.bottomRadiusPoint.id))}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Cylinder entity is need!"})}addHeight(A){let f=this.editCylinder.entity.position._value,m=Lt.fromCartesian(f);return this.height=m.height+A,Z.fromRadians(m.longitude,m.latitude,this.height)}getNorthPointByDistance(A,f,m){let C=this.editCylinder.entity.position._value,E=Vr.eastNorthUpToFixedFrame(C),I=this.editCylinder.entity.cylinder.length._value,x=this.editCylinder.entity.cylinder.topRadius._value,y=this.editCylinder.entity.cylinder.bottomRadius._value;x>0&&(A.z+=I/2,A.x+=x,Re.multiplyByPoint(E,A,A)),y>0&&(f.x+=y,f.z-=I/2,Re.multiplyByPoint(E,f,f)),m.z+=I/2,Re.multiplyByPoint(E,m,m)}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editCylinder.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickHeightPoint=void 0,this.pickTopRadiusPoint=void 0,this.pickBottomRadiusPoint=void 0):f.name==="cylinder_edit_height_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickHeightPoint=f,this.pickTopRadiusPoint=void 0,this.pickBottomRadiusPoint=void 0):f.name==="cylinder_edit_top_radius_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickHeightPoint=void 0,this.pickTopRadiusPoint=f,this.pickBottomRadiusPoint=void 0):f.name==="cylinder_edit_bottom_radius_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickHeightPoint=void 0,this.pickTopRadiusPoint=void 0,this.pickBottomRadiusPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editCylinder)||this.pickObject(A,this.editCylinder.entity))&&this.mCallback&&this.mCallback(this.editCylinder),this.currentPoint=void 0,this.dragPosition=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)||k(this.heightPoint)||k(this.topRadiusPoint)||k(this.bottomRadiusPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=Z.fromRadians(C.longitude,C.latitude,C.height+this.height);if(k(this.currentPoint))this.currentPoint.position=E,this.editCylinder.entity.position=E;else if(k(this.dragPosition)){if(k(this.pickHeightPoint)){let Q=Z.subtract(m,this.dragPosition,new Z),M=this.editCylinder.entity.cylinder.length._value;M+=Q.z,M=Math.abs(M),this.editCylinder.entity.position=this.addHeight(Q.z/2),this.editCylinder.entity.cylinder.length=M}else if(k(this.pickTopRadiusPoint)){let Q=Z.subtract(m,this.dragPosition,new Z),M=this.editCylinder.entity.cylinder.topRadius._value;M-=Q.x,M=Math.abs(M),this.editCylinder.entity.cylinder.topRadius=M}else if(k(this.pickBottomRadiusPoint)){let Q=Z.subtract(m,this.dragPosition,new Z),M=this.editCylinder.entity.cylinder.bottomRadius._value;M-=Q.x,M=Math.abs(M),this.editCylinder.entity.cylinder.bottomRadius=M}}this.dragPosition=m;let I=this.editCylinder.entity.cylinder.topRadius._value,x=this.editCylinder.entity.cylinder.bottomRadius._value,y=new Z,v=new Z,w=new Z;this.getNorthPointByDistance(y,v,w),I>0&&(this.topRadiusPoint.position=y),x>0&&(this.bottomRadiusPoint.position=v),this.heightPoint.position=w}return this.mCallback&&this.mCallback(this.editCylinder),!0}updateCylinder(A){if(k(A)&&k(this.editCylinder)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editCylinder.entity.position=A[C]:k(A[C])&&(this.editCylinder.entity.cylinder[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},stt=W1e;var q1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editEllipse=void 0,this.pickedEntity=void 0,this.semiMajorAxisPoint=void 0,this.semiMinorAxisPoint=void 0,this.pickSemiMajorAxisPoint=void 0,this.pickSemiMinorAxisPoint=void 0,this.pointsId=[],this.isEditing=!1,this.circle=!1,this.editEllipse=f,k(this.editEllipse)&&k(this.editEllipse.entity.ellipse)){let E=De.PI_OVER_TWO,I=this.updatePoint(E);this.semiMajorAxisPoint=this.mEarthCtrl.entities.add({name:"semi_major_axis_point",position:I,point:{heightReference:this.editEllipse.entity.ellipse.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.semiMajorAxisPoint.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Ellipse entity is need!"})}updatePoint(A){let f=new Z,m=new Z,C=new Z,E=this.editEllipse.entity.ellipse;this.semiMinorAxis=E.semiMinorAxis._value,this.semiMajorAxis=E.semiMajorAxis._value,this.circle=this.semiMajorAxis===this.semiMinorAxis;let I=ae(E.rotation,0);this.center=this.editEllipse.entity.position._value;let x=this.semiMinorAxis*this.semiMinorAxis,y=this.semiMajorAxis*this.semiMajorAxis,v=this.semiMajorAxis*this.semiMinorAxis,w=Z.magnitude(this.center),Q=Z.normalize(this.center,f),M=Z.cross(Z.UNIT_Z,this.center,m);M=Z.normalize(M,M);let B=Z.cross(Q,M,C),D=new Z;return Rx.pointOnEllipsoid(A,I,B,M,x,v,y,w,Q,D)}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editEllipse.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickSemiMajorAxisPoint=void 0,this.pickSemiMinorAxisPoint=void 0):f.name==="semi_minor_axis_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickSemiMajorAxisPoint=void 0,this.pickSemiMinorAxisPoint=f):f.name==="semi_major_axis_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickSemiMajorAxisPoint=f,this.pickSemiMinorAxisPoint=void 0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editEllipse)||this.pickObject(A,this.editEllipse.entity))&&this.mCallback&&this.mCallback(this.editEllipse),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)||k(this.pickSemiMajorAxisPoint)||k(this.pickSemiMinorAxisPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;if(k(this.currentPoint))this.currentPoint.position=m,this.editEllipse.entity.position=m;else if(k(this.pickSemiMajorAxisPoint)){let C=Z.distance(this.center,m);this.editEllipse.entity.ellipse.semiMajorAxis=C;let E=C*this.semiMinorAxis/this.semiMajorAxis;E>C&&(E=C),this.editEllipse.entity.ellipse.semiMinorAxis=E}else if(k(this.pickSemiMinorAxisPoint)){let C=Z.distance(this.center,m);this.editEllipse.entity.ellipse.semiMinorAxis=C}this.semiMajorAxisPoint.position=this.updatePoint(De.PI_OVER_TWO)}return this.mCallback&&this.mCallback(this.editEllipse),!0}updateEllipse(A){if(k(A)&&k(this.editEllipse)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editEllipse.entity.position=A[C]:k(A[C])&&(this.editEllipse.entity.ellipse[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},ltt=q1e;var j1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editEllipsoid=void 0,this.pickedEntity=void 0,this.height=0,this.isEditing=!1,this.pointsId=[],this.radiiXPoint=void 0,this.pickRadiiXPoint=void 0,this.radiiYPoint=void 0,this.pickRadiiYPoint=void 0,this.radiiZPoint=void 0,this.pickRadiiZPoint=void 0,this.dragPosition=void 0,this.editEllipsoid=f,k(this.editEllipsoid)&&k(this.editEllipsoid.entity.ellipsoid)){console.info(this.editEllipsoid.ellipsoid);let E=this.editEllipsoid.entity.position._value,I=Lt.fromCartesian(E);this.height=I.height;let x=new Z,y=new Z,v=new Z;this.getNorthPointByDistance(x,y,v),this.radiiXPoint=this.mEarthCtrl.entities.add({name:"ellipse_edit_x_point",position:x,point:{heightReference:this.editEllipsoid.entity.ellipsoid.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.radiiXPoint.id),this.radiiYPoint=this.mEarthCtrl.entities.add({name:"ellipse_edit_y_point",position:y,point:{heightReference:this.editEllipsoid.entity.ellipsoid.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.radiiYPoint.id),this.radiiZPoint=this.mEarthCtrl.entities.add({name:"ellipse_edit_z_point",position:v,point:{heightReference:this.editEllipsoid.entity.ellipsoid.heightReference,color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}}),this.pointsId.push(this.radiiZPoint.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Ellipsoid entity is need!"})}addHeight(A){let f=this.editEllipsoid.entity.position._value,m=Lt.fromCartesian(f);return this.height=m.height+A,Z.fromRadians(m.longitude,m.latitude,this.height)}getNorthPointByDistance(A,f,m){let C=this.editEllipsoid.entity.position._value,E=Vr.eastNorthUpToFixedFrame(C),I=this.editEllipsoid.entity.ellipsoid.radii._value;A.x=I.x,Re.multiplyByPoint(E,A,A),f.y=-I.y,Re.multiplyByPoint(E,f,f),m.z=I.z,Re.multiplyByPoint(E,m,m)}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editEllipsoid.entity.id?(this.isEditing=!0,this.currentPoint=f,this.pickRadiiXPoint=void 0,this.pickRadiiYPoint=void 0,this.pickRadiiZPoint=void 0):f.name==="ellipse_edit_x_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickRadiiXPoint=f,this.pickRadiiYPoint=void 0,this.pickRadiiZPoint=void 0):f.name==="ellipse_edit_y_point"?(this.isEditing=!0,this.currentPoint=void 0,this.pickRadiiXPoint=void 0,this.pickRadiiYPoint=f,this.pickRadiiZPoint=void 0):f.name==="ellipse_edit_z_point"&&(this.isEditing=!0,this.currentPoint=void 0,this.pickRadiiXPoint=void 0,this.pickRadiiYPoint=void 0,this.pickRadiiZPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editEllipsoid)||this.pickObject(A,this.editEllipsoid.entity))&&this.mCallback&&this.mCallback(this.editEllipsoid),this.currentPoint=void 0,this.dragPosition=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)||k(this.pickRadiiXPoint)||k(this.pickRadiiYPoint)||k(this.pickRadiiZPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=Z.fromRadians(C.longitude,C.latitude,C.height+this.height);if(k(this.currentPoint))this.currentPoint.position=E,this.editEllipsoid.entity.position=E;else{if(k(this.dragPosition)){let v=Z.subtract(m,this.dragPosition,new Z),w=Z.normalize(v,new Z);Z.dot(v,w,v);let Q=this.editEllipsoid.entity.ellipsoid.radii._value,M=Z.clone(Q);k(this.pickRadiiXPoint)?M.x-=v.x:k(this.pickRadiiYPoint)?M.y+=v.y:k(this.pickRadiiZPoint)&&(M.z+=v.z,this.editEllipsoid.entity.position=this.addHeight(v.z)),Z.abs(M,M),this.editEllipsoid.entity.ellipsoid.radii=M}this.dragPosition=m}let I=new Z,x=new Z,y=new Z;this.getNorthPointByDistance(I,x,y),this.radiiXPoint.position=I,this.radiiYPoint.position=x,this.radiiZPoint.position=y}return this.mCallback&&this.mCallback(this.editEllipsoid),!0}updateEllipsoid(A){if(k(A)&&k(this.editEllipsoid)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editEllipsoid.entity.position=A[C]:k(A[C])&&(this.editEllipsoid.entity.ellipsoid[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},Att=j1e;var X1e=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editPolygon=void 0,this.pickedEntity=void 0,this.currentPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editPolygon=f,k(this.editPolygon)&&k(this.editPolygon.entity.polygon))for(let E=0;E<this.editPolygon.entity.polygon.hierarchy._value.positions.length;E++){let I=this.editPolygon.entity.polygon.hierarchy._value.positions[E],x=this.mEarthCtrl.entities.add({name:"polygon_point",position:I,point:{color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(x.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Polygon entity is need!"})}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPolygon.entity.id?(this.isEditing=!0,this.currentPoint=void 0):f.name==="polygon_point"&&(this.currentPoint=f,this.isEditing=!0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPolygon)||this.pickObject(A,this.editPolygon.entity))&&this.mCallback&&this.mCallback(this.editPolygon),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m;let C=[];for(let E=0;E<this.pointsId.length;E++){let I=this.pointsId[E];C.push(this.mEarthCtrl.entities.getById(I).position._value)}this.editPolygon.entity.polygon.hierarchy=C}return this.mCallback&&this.mCallback(this.editPolygon),!0}updatePolygon(A){if(k(A)&&k(this.editPolygon)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];k(A[C])&&(this.editPolygon.entity.polygon[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},utt=X1e;var Z1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editModel=void 0,this.pickedEntity=void 0,this.editColor=qe.RED.withAlpha(.8),this.isEditing=!1,this.editModel=f,this.oldColor=this.editModel.entity.color,this.editModel.entity.color=this.editColor,k(this.editModel)&&k(this.editModel.entity)?console.info(this.editModel.entity):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"gltf Model is need!"}))}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f===this.editModel.parameter.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editModel)||this.pickObject(A,this.editModel.entity))&&this.mCallback&&this.mCallback(this.editModel),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=Lt.clone(C);E.longitude=De.toDegrees(E.longitude),E.latitude=De.toDegrees(E.latitude),this.editModel.lon=E.longitude,this.editModel.lat=E.latitude}return this.mCallback&&this.mCallback(this.editModel),!0}updateModel(A){if(k(A)&&k(this.editModel)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];if(k(A[C]))switch(C){case"lon":case"lat":case"alt":case"heading":case"pitch":case"roll":this.editModel[C]=A[C];break;default:this.editModel.entity[C]=A[C];break}}}}endEditEntity(){this.editModel.entity.color=this.oldColor}},ctt=Z1e;var $1e=class extends Qa{constructor(A,f,m,C){super(A,m,C),this.editLabel=void 0,this.pickedEntity=void 0,this.isEditing=!1,this.editLabel=f,k(this.editLabel)&&k(this.editLabel.entity.label)?console.info(this.editLabel.entity):(this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Label entity is need!"}))}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editLabel.entity.id&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editLabel.entity)||this.pickObject(A,this.editLabel.entity))&&this.mCallback&&this.mCallback(this.editLabel),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m,this.editLabel.entity.position=m}return this.mCallback&&this.mCallback(this.editLabel),!0}updateLabel(A){if(k(A)&&k(this.editLabel)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editLabel.entity.position=A[C]:k(A[C])&&(this.editLabel.entity.label[C]=A[C])}}}endEditEntity(){}},htt=$1e;var ebe=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editPolyline=void 0,this.pickedEntity=void 0,this.currentPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editPolyline=f,k(this.editPolyline)&&k(this.editPolyline.polyline))for(let E=0;E<this.editPolyline.polyline.positions._value.length;E++){let I=this.editPolyline.polyline.positions._value[E],x=this.mEarthCtrl.entities.add({name:"polyline_point",position:I,point:{color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(x.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Polyline entity is need!"})}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPolyline.id?(this.isEditing=!0,this.currentPoint=void 0):f.name==="polyline_point"&&(this.currentPoint=f,this.isEditing=!0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPolyline)||this.pickObject(A,this.editPolyline.entity))&&this.mCallback&&this.mCallback(this.editPolyline),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m;let C=[];for(let E=0;E<this.pointsId.length;E++){let I=this.pointsId[E];C.push(this.mEarthCtrl.entities.getById(I).position._value)}this.editPolyline.polyline.positions=C}return this.mCallback&&this.mCallback(this.editPolyline),!0}updatePolyline(A){if(k(A)&&k(this.editPolyline)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];k(A[C])&&(this.editPolyline.polyline[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},dtt=ebe;var tbe=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editPolylineVolume=void 0,this.pickedEntity=void 0,this.currentPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editPolylineVolume=f,k(this.editPolylineVolume)&&k(this.editPolylineVolume.entity.polylineVolume))for(let E=0;E<this.editPolylineVolume.entity.polylineVolume.positions._value.length;E++){let I=this.editPolylineVolume.entity.polylineVolume.positions._value[E],x=this.mEarthCtrl.entities.add({name:"edit_polylineVolume_point",position:I,point:{color:qe.WHITE,pixelSize:12,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(x.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"PolylineVolume entity is need!"})}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editPolylineVolume.entity.id?(this.isEditing=!0,this.currentPoint=void 0):f.name==="edit_polylineVolume_point"&&(this.isEditing=!0,this.currentPoint=f),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editPolylineVolume)||this.pickObject(A,this.editPolylineVolume.entity))&&this.mCallback&&this.mCallback(this.editPolylineVolume),this.currentPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.currentPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;this.currentPoint.position=m;let C=[];for(let E=0;E<this.pointsId.length;E++){let I=this.pointsId[E];C.push(this.mEarthCtrl.entities.getById(I).position._value)}this.editPolylineVolume.entity.polylineVolume.positions=C}return this.mCallback&&this.mCallback(this.editPolylineVolume),!0}updatePolylineVolume(A){if(k(A)&&k(this.editPolylineVolume)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editPolylineVolume.entity.position=A[C]:k(A[C])&&(this.editPolylineVolume.entity.polylineVolume[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},gtt=tbe;var ibe=class extends Qa{constructor(A,f,m,C){if(super(A,m,C),this.editRectangle=void 0,this.pickedEntity=void 0,this.leftTopPoint=void 0,this.rightBottomPoint=void 0,this.pointsId=[],this.isEditing=!1,this.editRectangle=f,k(this.editRectangle)&&k(this.editRectangle.entity.rectangle)){let E=this.editRectangle.entity.rectangle.coordinates._value,I=this.editRectangle.entity.rectangle.height._value,x=hi.northwest(E),y=Z.fromRadians(x.longitude,x.latitude,I),v=this.mEarthCtrl.entities.add({name:"rect_left_top_point",position:y,point:{heightReference:this.editRectangle.entity.rectangle.heightReference,color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(v.id),x=hi.southeast(E);let w=Z.fromRadians(x.longitude,x.latitude,I),Q=this.mEarthCtrl.entities.add({name:"rect_right_bottom_point",position:w,point:{heightReference:this.editRectangle.entity.rectangle.heightReference,color:qe.WHITE,pixelSize:8,outlineColor:qe.BLACK,outlineWidth:1}});this.pointsId.push(Q.id)}else this.mEnable=!1,this.mCallback&&this.mCallback({msg:"Rectangle entity is need!"})}destory(){}onLButtonDown(A){if(super.onLButtonDown(A),this.pickedEntity={},this.pickObject(A,this.pickedEntity)){let f=this.pickedEntity.pickedObject.id;f.id===this.editRectangle.entity.id?(this.isEditing=!0,this.leftTopPoint=void 0,this.rightBottomPoint=void 0):f.name==="rect_left_top_point"?(this.leftTopPoint=f,this.rightBottomPoint=void 0,this.isEditing=!0):f.name==="rect_right_bottom_point"&&(this.rightBottomPoint=f,this.leftTopPoint=void 0,this.isEditing=!0),this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!1,this.mEarthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!1}}onLButtonUp(A){return super.onLButtonUp(A)===!1||!this.isEditing?!1:((k(this.editRectangle)||this.pickObject(A,this.editRectangle.entity))&&this.mCallback&&this.mCallback(this.editRectangle),this.leftTopPoint=void 0,this.rightBottomPoint=void 0,this.isEditing=!1,!0)}onLButtonDrag(A){if(!this.isEditing)return!1;if(k(this.leftTopPoint)||k(this.rightBottomPoint)){let f=this.mEarthCtrl.coreMap.scene.globe.ellipsoid,m=this.mEarthCtrl.coreMap.camera.pickEllipsoid(A,f);if(!m)return;let C=Lt.fromCartesian(m),E=this.editRectangle.entity.rectangle.coordinates._value;k(this.leftTopPoint)?(this.leftTopPoint.position=m,E.west=C.longitude,E.north=C.latitude):k(this.rightBottomPoint)&&(this.rightBottomPoint.position=m,E.south=C.latitude,E.east=C.longitude),this.editRectangle.entity.rectangle.coordinates=E}return this.mCallback&&this.mCallback(this.editRectangle),!0}updateRectangle(A){if(k(A)&&k(this.editRectangle)){let f=Object.keys(A);for(let m=0;m<f.length;m++){let C=f[m];C==="position"?this.editRectangle.entity.position=A[C]:k(A[C])&&(this.editRectangle.entity.rectangle[C]=A[C])}}}endEditEntity(){for(let A=0;A<this.pointsId.length;A++){let f=this.pointsId[A];this.mEarthCtrl.entities.removeById(f)}this.pointsId=[]}},ftt=ibe;function pp(o,A={}){this._earthCtrl=o,this._scene=o.coreMap.scene,this.hpRoll={heading:0,pitch:0,roll:0,select:"",angle:0}}pp.prototype.start=function(o,A={}){if(this.end(),!!o){if(console.log(o),this.model=o,o._parameter)o._parameter.sourceType&&o._parameter.sourceType==="b3dm"||o._parameter.sourceType==="3DTiles"?(this.modeltype="b3dm",this.originPosition=Re.getTranslation(this.model._primitive._root.transform,new Z),this.model._parameter.transform||(this.model._parameter.transform={}),this.hpRoll={heading:this.model._parameter.transform.heading||0,pitch:this.model._parameter.transform.pitch||0,roll:this.model._parameter.transform.roll||0,select:"",angle:0}):o._parameter.sourceType&&o._parameter.sourceType==="I3S"?(this.modeltype="I3S",this.hpRoll={heading:this.model._parameter.heading||0,pitch:this.model._parameter.pitch||0,roll:this.model._parameter.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z)):o._parameter.sourceType&&o._parameter.sourceType==="s3m"?(this.modeltype="s3m",this.hpRoll={heading:this.model._parameter.heading||0,pitch:this.model._parameter.pitch||0,roll:this.model._parameter.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model.modelMatrix,new Z)):(this.modeltype="GLTF",this.originPosition=Re.getTranslation(this.model._primitive.modelMatrix,new Z),this.hpRoll={heading:this.model._parameter.heading||0,pitch:this.model._parameter.pitch||0,roll:this.model._parameter.roll||0,select:"",angle:0});else if(o._layers&&o._layers[0]&&o._layers[0]._tileset){this.modeltype="I3S";let f=this.matrixGetRotation(this.model._layers[0]._tileset._root.transform);this.model._parameter={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,sourceType:"I3S"},this.hpRoll={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z)}else if(o.fileType&&o.fileType==="OSGBCacheFile"||o.modelMatrix&&o._rectangle){this.modeltype="s3m";let f=this.matrixGetRotation(o.modelMatrix);this.model._parameter={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,sourceType:"s3m"},this.hpRoll={heading:f.heading||0,pitch:f.pitch||0,roll:f.roll||0,select:"",angle:0},this.originPosition=Re.getTranslation(this.model.modelMatrix,new Z)}else{console.log("\u6682\u4E0D\u652F\u6301\u8BE5\u6A21\u578B\u683C\u5F0F");return}return this.centerPoint=this.toDegrees(this.originPosition),this.initEvent(A),this}};pp.prototype.initEvent=function(o){this.editHandler=new pr(this._scene.canvas),this.modeltype==="b3dm"?this.radius=this.model._primitive.boundingSphere.radius:this.modeltype==="I3S"?this.radius=this.model._layers[0]._tileset.boundingSphere.radius:this.modeltype==="s3m"?this.radius=this.model._rootTiles[0].boundingVolume._boundingSphere.radius:this.radius=this.model._primitive._boundingSphere.radius;let A,f;this.createAxios(o.select),this.editHandler.setInputAction(m=>{A?(f=m.position,this.modeltype==="b3dm"?this.originPosition=Re.getTranslation(this.model._primitive._root.transform,new Z):this.modeltype==="I3S"?this.originPosition=Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z):this.modeltype==="s3m"?this.originPosition=Re.getTranslation(this.model.modelMatrix,new Z):this.originPosition=Re.getTranslation(this.model._primitive.modelMatrix,new Z),this.startPosition=this._scene.pickPosition(f)):f=void 0},_i.LEFT_DOWN),this._scene.pickPointInterval=500,this.editHandler.setInputAction(m=>{if(f){this._scene.screenSpaceCameraController.enableRotate=!1,this.edit(A,f,m),o.callback&&o.callback(A);return}let C=this._scene.pick(m.endPosition);if(C&&C.id)if(C.id._name&&C.id._name==="modeEditAxis"){let E=C.id._id;E==="entityPolylineY"?(A="y",this.selectAxis="y",this.setAxisStyle(!0,"y")):E==="entityPolylineX"?(A="x",this.selectAxis="x",this.setAxisStyle(!0,"x")):E==="entityPolylineZ"&&(A="z",this.selectAxis="z",this.setAxisStyle(!0,"z"))}else C.id==="axisSphereX"?A="pitch":C.id==="axisSphereY"?A="roll":C.id==="axisSphereZ"?A="heading":(A=void 0,this.setAxisStyle(!1));else A=void 0,this.setAxisStyle(!1)},_i.MOUSE_MOVE),this.editHandler.setInputAction(m=>{this.upDateHpRoll(),f=void 0,this._scene.screenSpaceCameraController.enableRotate=!0,this.rotateSector1&&this._earthCtrl.entities.remove(this.rotateSector1),this.rotateSector1=void 0,this.rotateSector2&&this._earthCtrl.entities.remove(this.rotateSector2),this.rotateSector2=void 0},_i.LEFT_UP)};pp.prototype.createAxios=function(o){let A=this.centerPoint,f=2e-5*Number(this.radius),m=18e-6*Number(this.radius),C=1.7*Number(this.radius);if((o===1||o===3)&&(this.arrowx=this._earthCtrl.entities.add({name:"modeEditAxis",id:"entityPolylineX",position:this.originPosition,polyline:{positions:new Z.fromDegreesArrayHeights([A.lon,A.lat,A.hei,A.lon+f,A.lat,A.hei]),material:new R2(qe.RED),followSurface:!1,width:25}}),this.arrowy=this._earthCtrl.entities.add({id:"entityPolylineY",name:"modeEditAxis",position:this.originPosition,polyline:{positions:new Z.fromDegreesArrayHeights([A.lon,A.lat,A.hei,A.lon,A.lat+m,A.hei]),material:new R2(qe.GREEN),followSurface:!1,width:25}}),this.arrowz=this._earthCtrl.entities.add({name:"modeEditAxis",id:"entityPolylineZ",position:this.originPosition,polyline:{positions:new Z.fromDegreesArrayHeights([A.lon,A.lat,A.hei,A.lon,A.lat,A.hei+C]),material:new R2(qe.BLUE),followSurface:!1,width:25}})),o===2||o===3){this.AxisX=this.createAxisSphere("axisSphereX",this.radius,this.originPosition,qe.RED),this.AxisY=this.createAxisSphere("axisSphereY",this.radius,this.originPosition,qe.GREEN),this.AxisZ=this.createAxisSphere("axisSphereZ",this.radius,this.originPosition,qe.BLUE);let E=Nt.fromRotationY(De.toRadians(90)),I=Re.fromRotationTranslation(E);Re.multiply(this.AxisX.modelMatrix,I,this.AxisX.modelMatrix);let x=Nt.fromRotationX(De.toRadians(90)),y=Re.fromRotationTranslation(x);Re.multiply(this.AxisY.modelMatrix,y,this.AxisY.modelMatrix)}};pp.prototype.createAxisSphere=function(o,A,f,m){let C={position:[],radius:A};for(let v=0;v<=360;v+=2){let w=Math.sin(De.toRadians(v)),Q=Math.cos(De.toRadians(v)),M=C.radius*Q,B=C.radius*w;C.position.push(new Z(M,B,0))}let E=Vr.eastNorthUpToFixedFrame(f),I=new AS({positions:C.position,width:8}),x=new Un({geometry:I,id:o}),y=new pa({geometryInstances:x,appearance:new vC({material:fa.fromType("Color")}),modelMatrix:E});return y.appearance.material.uniforms.color=m,this._scene.primitives.add(y)};pp.prototype.edit=function(o,A,f){if(o){let m=this.originPosition,C=this.startPosition,E=this._scene.pickPosition(f.endPosition),I=this.toDegrees(m),x=this.toDegrees(C),y=this.toDegrees(E),v=this._scene.cartesianToCanvasCoordinates(m),w=f.endPosition.y-A.y;if(o==="x"){let Q=x.lon-y.lon;I.lon-=Q*.7,this.setAxisPosition(I),this.setPosition(I)}else if(o==="y"){let Q=x.lat-y.lat;I.lat-=Q*.7,this.setAxisPosition(I),this.setPosition(I)}else if(o==="z"){let Q=x.hei-I.hei,M=w*Math.abs(Q/(A.y-v.y));I.hei-=M*.4,this.setAxisPosition(I),this.setPosition(I)}else if(o==="heading"){let Q=this.arge(v,A,f.endPosition,"+-",!0),M=this.hpRoll.heading-Q;this.hpRoll.select="heading",this.hpRoll.angle=M,this.setRotate("heading",M);let B=this.arge({x:I.lon,y:I.lat},{x:I.lon+this.radius,y:I.lat},{x:x.lon,y:x.lat},"360");this.setRotateLine("z",m,B,Q)}else if(o==="pitch"){let Q=this.hpRoll.pitch,M=this.arge(v,A,f.endPosition,"+-",!0),D=this.toDegrees(this._scene.camera.position).lon-I.lon,S=Z.subtract(C,m,new Z),P=Z.normalize(m,new Z),T=Z.angleBetween(S,P)*180/Math.PI;D>0?(Q+=M,x.lat-I.lat>0?this.setRotateLine("x",m,T,-M):this.setRotateLine("x",m,-T,-M)):(Q-=M,x.lat-I.lat>0?this.setRotateLine("x",m,T,M):this.setRotateLine("x",m,-T,M)),this.hpRoll.select="pitch",this.hpRoll.angle=Q,this.setRotate("pitch",Q)}else if(o==="roll"){let M=this.toDegrees(this._scene.camera.position).lat-I.lat,B=this.hpRoll.roll,D=this.arge(v,A,f.endPosition,"+-",!0),S=Z.subtract(C,m,new Z),P=Z.normalize(m,new Z),T=Z.angleBetween(S,P)*180/Math.PI;M>0?(B+=D,x.lon-I.lon>0?this.setRotateLine("y",m,T,D):this.setRotateLine("y",m,-T,D)):(B-=D,x.lon-I.lon>0?this.setRotateLine("y",m,T,-D):this.setRotateLine("y",m,-T,-D)),this.hpRoll.select="roll",this.hpRoll.angle=B,this.setRotate("roll",B)}}};pp.prototype.setPosition=function(o,A){let f=Z.fromDegrees(o.lon,o.lat,o.hei);if(this.modeltype==="b3dm"){let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(-this.hpRoll.roll),De.toRadians(this.hpRoll.pitch));this.model._primitive._root.transform=Vr.headingPitchRollToFixedFrame(f,m)}else if(this.modeltype==="I3S"){let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(this.hpRoll.pitch),De.toRadians(this.hpRoll.roll));this.model._layers[0]._tileset._root.transform=Vr.headingPitchRollToFixedFrame(f,m)}else if(this.modeltype==="s3m"){let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(this.hpRoll.pitch),De.toRadians(this.hpRoll.roll));this.model.modelMatrix=new Vr.headingPitchRollToFixedFrame(f,m)}else{let m=new Wl(De.toRadians(this.hpRoll.heading),De.toRadians(this.hpRoll.pitch),De.toRadians(this.hpRoll.roll)),C=Vr.localFrameToFixedFrameGenerator("north","west");this.model._primitive.modelMatrix=Vr.headingPitchRollToFixedFrame(f,m,gi.WGS84,C)}};pp.prototype.upDateHpRoll=function(){this.hpRoll.select==="heading"?(this.hpRoll.heading=this.hpRoll.angle,this.hpRoll.angle=0,this.hpRoll.select=""):this.hpRoll.select==="pitch"?(this.hpRoll.pitch=this.hpRoll.angle,this.hpRoll.angle=0,this.hpRoll.select=""):this.hpRoll.select==="roll"&&(this.hpRoll.roll=this.hpRoll.angle,this.hpRoll.angle=0,this.hpRoll.select=""),this.modeltype==="b3dm"?(this.model._parameter.transform.heading=this.hpRoll.heading,this.model._parameter.transform.roll=this.hpRoll.roll,this.model._parameter.transform.pitch=this.hpRoll.pitch):(this.model._parameter.heading=this.hpRoll.heading,this.model._parameter.roll=this.hpRoll.roll,this.model._parameter.pitch=this.hpRoll.pitch)};pp.prototype.setAxisPosition=function(o){let A=Z.fromDegrees(o.lon,o.lat,o.hei),f=2e-5*Number(this.radius),m=18e-6*Number(this.radius),C=1.7*Number(this.radius),E=Z.fromDegrees(o.lon+f,o.lat,o.hei),I=Z.fromDegrees(o.lon,o.lat+m,o.hei),x=Z.fromDegrees(o.lon,o.lat,o.hei+C);this._earthCtrl.entities.values[0]._polyline.positions=new Kr(function(){return[A,E]},!1),this._earthCtrl.entities.values[1]._polyline.positions=new Kr(function(){return[A,I]},!1),this._earthCtrl.entities.values[2]._polyline.positions=new Kr(function(){return[A,x]},!1)};pp.prototype.setAxisStyle=function(o,A){if(o){if(A==="x"){let f=this._earthCtrl.entities.getById("entityPolylineX");f._polyline._material._color._value=qe.YELLOW}else if(A==="y"){let f=this._earthCtrl.entities.getById("entityPolylineY");f._polyline._material._color._value=qe.YELLOW}else if(A==="z"){let f=this._earthCtrl.entities.getById("entityPolylineZ");f._polyline._material._color._value=qe.YELLOW}}else o||(this.selectAxis==="x"?(this.selectAxis=void 0,this._earthCtrl.entities.values[0]._polyline._material._color._value=qe.RED):this.selectAxis==="y"?(this.selectAxis=void 0,this._earthCtrl.entities.values[1]._polyline._material._color._value=qe.GREEN):this.selectAxis==="z"&&(this.selectAxis=void 0,this._earthCtrl.entities.values[2]._polyline._material._color._value=qe.BLUE))};pp.prototype.setRotate=function(o,A){let f=this.hpRoll.heading,m=this.hpRoll.pitch,C=this.hpRoll.roll;if(o==="heading"?f=A:o==="pitch"?m=A:o==="roll"&&(C=A),this.modeltype==="b3dm"){let E=new Wl(De.toRadians(f),De.toRadians(-C),De.toRadians(m));this.model._primitive._root.transform=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model._primitive._root.transform,new Z),E)}else if(this.modeltype==="I3S"){let E=new Wl(De.toRadians(f),De.toRadians(m),De.toRadians(C));this.model._layers[0]._tileset._root.transform=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model._layers[0]._tileset._root.transform,new Z),E)}else if(this.modeltype==="s3m"){let E=new Wl(De.toRadians(f),De.toRadians(m),De.toRadians(C));this.model.modelMatrix=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model.modelMatrix,new Z),E)}else{let E=Vr.localFrameToFixedFrameGenerator("north","west"),I=new Wl(De.toRadians(f),De.toRadians(m),De.toRadians(C));this.model._primitive.modelMatrix=Vr.headingPitchRollToFixedFrame(Re.getTranslation(this.model._primitive.modelMatrix,new Z),I,gi.WGS84,E)}};pp.prototype.setRotateLine=function(o,A,f,m){o==="z"?(this.rotateSector1?this.rotateSector1.ellipsoid.maximumClock=new Kr(function(){return De.toRadians(m)},!1):this.rotateSector1=this._earthCtrl.entities.add({name:"rotateSector1",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(De.toRadians(360-f),0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(0),maximumClock:De.toRadians(0),minimumCone:De.toRadians(90),maximumCone:De.toRadians(90),material:qe.ALICEBLUE.withAlpha(.3)}}),this.rotateSector2?this.rotateSector2.ellipsoid.maximumClock=new Kr(function(){return De.toRadians(m)},!1):this.rotateSector2=this._earthCtrl.entities.add({name:"rotateSector2",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(De.toRadians(360-f),0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(0),maximumClock:De.toRadians(0),minimumCone:De.toRadians(90),maximumCone:De.toRadians(90),fill:!1,outline:!0,slicePartitions:2,outlineWidth:5,outlineColor:qe.YELLOW}})):o==="x"?(this.rotateSector1?this.rotateSector1.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector1=this._earthCtrl.entities.add({name:"rotateSector1",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(90.1),maximumClock:De.toRadians(90),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),material:qe.ALICEBLUE.withAlpha(.3)}}),this.rotateSector2?this.rotateSector2.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector2=this._earthCtrl.entities.add({name:"rotateSector2",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(90.1),maximumClock:De.toRadians(90),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),fill:!1,outline:!0,slicePartitions:2,outlineWidth:5,outlineColor:qe.YELLOW}})):o==="y"&&(this.rotateSector1?this.rotateSector1.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector1=this._earthCtrl.entities.add({name:"rotateSector1",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(.1),maximumClock:De.toRadians(0),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),material:qe.ALICEBLUE.withAlpha(.3)}}),this.rotateSector2?this.rotateSector2.ellipsoid.maximumCone=new Kr(function(){return De.toRadians(m+f)},!1):this.rotateSector2=this._earthCtrl.entities.add({name:"rotateSector2",position:A,orientation:Vr.headingPitchRollQuaternion(A,new Wl(0,0,0)),ellipsoid:{radii:new Z(this.radius-.11,this.radius-.11,this.radius-.11),innerRadii:new Z(.1,.1,.1),minimumClock:De.toRadians(.1),maximumClock:De.toRadians(0),minimumCone:De.toRadians(f),maximumCone:De.toRadians(0),fill:!1,outline:!0,slicePartitions:2,outlineWidth:5,outlineColor:qe.YELLOW}}))};pp.prototype.end=function(){this.AxisX&&this._scene.primitives.remove(this.AxisX),this.AxisX=void 0,this.AxisY&&this._scene.primitives.remove(this.AxisY),this.AxisY=void 0,this.AxisZ&&this._scene.primitives.remove(this.AxisZ),this.AxisZ=void 0,this.arrowx&&this._earthCtrl.entities.remove(this.arrowx),this.arrowx=void 0,this.arrowy&&this._earthCtrl.entities.remove(this.arrowy),this.arrowy=void 0,this.arrowz&&this._earthCtrl.entities.remove(this.arrowz),this.arrowz=void 0,this.editHandler&&this.editHandler.destroy(),this.editHandler=void 0};pp.prototype.toDegrees=function(o){let A=Lt.fromCartesian(o);return{lon:De.toDegrees(A.longitude),lat:De.toDegrees(A.latitude),hei:A.height}};pp.prototype.arge=function(o,A,f,m="180",C=!1){let E=Math.sqrt(Math.pow(o.x-A.x,2)+Math.pow(o.y-A.y,2)),I=Math.sqrt(Math.pow(o.x-f.x,2)+Math.pow(o.y-f.y,2)),x=Math.sqrt(Math.pow(A.x-f.x,2)+Math.pow(A.y-f.y,2)),y=(Math.pow(E,2)+Math.pow(I,2)-Math.pow(x,2))/(2*E*I),v=Math.acos(y)*180/Math.PI;if(m==="360"||m==="+-"){let w=C?-1:1;this.isClockwise([[A.x,w*A.y],[o.x,w*o.y],[f.x,w*f.y],[A.x,w*A.y]])||(m==="+-"?v=-v:v=360-v)}return Number(v.toFixed(2))};pp.prototype.isClockwise=function(o){let A=ws.lineString(o);return ws.booleanClockwise(A)};pp.prototype.matrixGetRotation=function(o){let A=Vr.eastNorthUpToFixedFrame(Re.getTranslation(o,new Z),gi.WGS84,new Re),f=Re.multiply(Re.inverse(A,new Re),o,new Re),m=Re.getRotation(f,new Nt),C=yr.fromRotationMatrix(m),E=Wl.fromQuaternion(C),I=De.toDegrees(E.heading),x=De.toDegrees(E.pitch),y=De.toDegrees(E.roll);return{heading:I,pitch:x,roll:y}};var ptt=pp;function Mc(o){this._earthCtrl=o,this._coreMap=o.coreMap}Mc.prototype.editPoint=function(o,A){this._earthCtrl.tools.clearTool();let f=new ott(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("point_edit_tool",f),f};Mc.prototype.updatePoint=function(o,A){o.updatePoint(A)};Mc.prototype.editPolyline=function(o,A){this._earthCtrl.tools.clearTool();let f=new dtt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("polyline_edit_tool",f),f};Mc.prototype.updatePolyline=function(o,A){o.updatePolyline(A)};Mc.prototype.editPolygon=function(o,A){this._earthCtrl.tools.clearTool();let f=new utt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("polygon_edit_tool",f),f};Mc.prototype.updatePolygon=function(o,A){o.updatePolygon(A)};Mc.prototype.editBox=function(o,A){this._earthCtrl.tools.clearTool();let f=new att(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("box_edit_tool",f),f};Mc.prototype.updateBox=function(o,A){o.updateBox(A)};Mc.prototype.editEllipsoid=function(o,A){this._earthCtrl.tools.clearTool();let f=new Att(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("ellipsoid_edit_tool",f),f};Mc.prototype.updateEllipsoid=function(o,A){o.updateEllipsoid(A)};Mc.prototype.editCylinder=function(o,A){this._earthCtrl.tools.clearTool();let f=new stt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("cylinder_edit_tool",f),f};Mc.prototype.updateCylinder=function(o,A){o.updateCylinder(A)};Mc.prototype.editModel=function(o,A){this._earthCtrl.tools.clearTool();let f=new ctt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("model_edit_tool",f),f};Mc.prototype.updateModel=function(o,A){o.updateModel(A)};Mc.prototype.createTransformEdit=function(o){return new ptt(this._earthCtrl,{model:o})};Mc.prototype.editBillboard=function(o,A){this._earthCtrl.tools.clearTool();let f=new ntt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("billboard_edit_tool",f),f};Mc.prototype.updateBillboard=function(o,A){o.updateBillboard(A)};Mc.prototype.editLabel=function(o,A){this._earthCtrl.tools.clearTool();let f=new htt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("label_edit_tool",f),f};Mc.prototype.updateLabel=function(o,A){o.updateLabel(A)};Mc.prototype.editRectangle=function(o,A){this._earthCtrl.tools.clearTool();let f=new ftt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("rectangle_edit_tool",f),f};Mc.prototype.updateRectangle=function(o,A){o.updateRectangle(A)};Mc.prototype.editEllipse=function(o,A){this._earthCtrl.tools.clearTool();let f=new ltt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("ellipse_edit_tool",f),f};Mc.prototype.updateEllipse=function(o,A){o.updateEllipse(A)};Mc.prototype.editPolylineVolume=function(o,A){this._earthCtrl.tools.clearTool();let f=new gtt(this._earthCtrl,o,function(m){A&&A(m)});return this._earthCtrl.tools.registerTool("polylinevolume_edit_tool",f),f};Mc.prototype.updatePolylineVolume=function(o,A){o.updatePolylineVolume(A)};Mc.prototype.endEditEntity=function(o){this._earthCtrl.tools.clearTool(),o.endEditEntity(),this._earthCtrl.coreMap.scene.screenSpaceCameraController.enableRotate=!0,this._earthCtrl.coreMap.scene.screenSpaceCameraController.enableZoom=!0};var rbe=Mc;function mp(o){this.mEarthCtrl=o,this.scene=this.mEarthCtrl.coreMap.scene,this.entities=this.mEarthCtrl.entities,this.camera=this.mEarthCtrl.coreMap.camera,this._points=[],this.item=void 0}mp.prototype.horizontalDistance=function(o,A){let f=this,m=!1,C=[],E="",I=[],x,y=this.scene.globe.ellipsoid,v={spot:[],distance:[],label:[],polyline:[]},w={point:qe.RED,polyline:qe.fromRgba(4286644096)};k(A)&&(k(A.point)&&(w.point=A.point),k(A.polyline)&&(w.polyline=A.polyline));let Q=new nI;this.scene.primitives.add(Q);let M=new Pu,B=new pr(f.scene.canvas),D=document.createElement("div");ru(".map-widget",D),ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>');let P=document.getElementById("toolTip");P.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let R;m=!0;let T=function(U){let N=0,H=`${0}\u7C73`,J,K,X,j,ee,ie;for(let z=0;z<U.length-1;z+=1)J=y.cartesianToCartographic(U[z]),K=M.project(J),X=K.x,j=K.y,J=y.cartesianToCartographic(U[z+1]),K=M.project(J),ee=K.x,ie=K.y,N=N+Math.sqrt((X-ee)*(X-ee)+(j-ie)*(j-ie));return N>0&&(H=`${N.toFixed(2)}\u7C73`),N/1e3>=1&&(H=`${(N/1e3).toFixed(2)}\u5343\u7C73`),H},L=function(){function U(N){if(!k(N))throw new ni("positions is required!");if(N.length<2)throw new ni("positions \u7684\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E2");let H=fa.fromType(fa.ColorType);H.uniforms.color=new qe(1,1,0,.5),this.options={name:"\u76F4\u7EBF",polyline:{show:!0,positions:[],material:w.polyline,width:3,clampToGround:!0}},this.path=N,this._init()}return U.prototype._init=function(){let N=this,H=function(){return N.path};this.options.polyline.positions=new Kr(H,!1),this.lineEntity=f.entities.add(this.options),f.item=this.lineEntity,v.polyline.push(this.lineEntity)},U}();B.setInputAction(function(U){let N,H;P.style.left=`${U.endPosition.x+10}px`,P.style.top=`${U.endPosition.y+20}px`,P.style.display="block",P.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let J=!1,K=f.camera.getPickRay(U.endPosition);K&&(N=f.scene.globe.pick(K,f.scene));let X=f.scene.pick(U.endPosition);if(X){console.log("feature",X);let j=f.scene.pickPosition(U.endPosition);j&&(N=j),J=!0}if(!!N&&(H=gi.WGS84.cartesianToCartographic(N),H)){let j;J?j=f.scene.sampleHeight(H):j=f.scene.globe.getHeight(H);let ee=Z.fromDegrees(H.longitude/Math.PI*180,H.latitude/Math.PI*180,j);if(m){if(C.length<1)return;k(x)?(x.path.pop(),x.path.push(ee)):(C.push(ee),x=new L(C));let ie=T(x.path);f.entities.remove(R),R=f.entities.add({name:"\u7A7A\u95F4\u76F4\u7EBF\u8DDD\u79BB",position:x.path[x.path.length-1],label:{text:`\u603B\u957F\uFF1A${ie}`,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),disableDepthTestDistance:Number.POSITIVE_INFINITY}})}}},_i.MOUSE_MOVE);let F=function(U){I.push(U);let N=[];if(I.length>1){let H=I[I.length-2],J=I[I.length-1],K=Math.abs(H.longitude-J.longitude)*1e7,X=Math.abs(H.latitude-J.latitude)*1e7;K>X&&(X=K);let j=parseInt(X/10);j>1e3&&(j=1e3),j<2&&(j=2);for(let ee=0;ee<j;++ee)N.push(new Lt(De.lerp(H.longitude,J.longitude,ee/(j-1)),De.lerp(H.latitude,J.latitude,ee/(j-1))));N.push(J.clone())}else N=I;if(N.length>0)for(let H=0;H<N.length;H++){U=N[H];let J=f.scene.globe.getHeight(U),K=Z.fromDegrees(U.longitude/Math.PI*180,U.latitude/Math.PI*180,J);C.push(K)}};return B.setInputAction(function(U){let N,H,J=!1,K=f.camera.getPickRay(U.position);if(K&&(N=f.scene.globe.pick(K,f.scene)),f.scene.pick(U.position)){let j=f.scene.pickPosition(U.position);j&&(N=j),J=!0}if(N&&(H=gi.WGS84.cartesianToCartographic(N)),H){let j;J?j=f.scene.sampleHeight(H):j=f.scene.globe.getHeight(H);let ee=Z.fromDegrees(H.longitude/Math.PI*180,H.latitude/Math.PI*180,j);if(m){x&&x.path.pop(),F(H);let ie="0\u7C73";x&&(ie=T(x.path)),E=ie,v.spot.push(ee),v.distance.push(ie);let z=f.entities.add({position:ee,point:{pixelSize:5,color:w.point,outlineColor:qe.WHITE,outlineWidth:1,clampToGround:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:ie,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),clampToGround:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}});v.label.push(z),f._points.push(z)}}},_i.LEFT_CLICK),B.setInputAction(function(){f.entities.remove(R),f._points[f._points.length-1].label.text=E,B.destroy(),C.pop(),k(o)&&typeof o=="function"&&o(v),P.style.display="none"},_i.RIGHT_CLICK),this};mp.prototype.spaceDistance=function(o,A){let f=this;f.scene.globe.depthTestAgainstTerrain=!0;let m=new pr(f.scene.canvas),C=[],E=null,I="0\u7C73",x=null,y,v="",w,Q=document.createElement("div");ru(".map-widget",Q),ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>');let B=document.getElementById("toolTip");B.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let D={name:"",spot:[],distance:[],label:[],ployline:[]},S={point:qe.RED,polyline:qe.fromRgba(4286644096)};k(A)&&(k(A.point)&&(S.point=A.point),k(A.polyline)&&(S.polyline=A.polyline));let P=function(){function R(T){this.options={name:"\u76F4\u7EBF",polyline:{show:!0,positions:[],material:S.polyline,width:3,clampToGround:!1}},this.positions=T,this._init()}return R.prototype._init=function(){let T=this,L=function(){return T.positions};this.options.polyline.positions=new Kr(L,!1);let F=f.entities.add(this.options);f.item=F,D.ployline.push(F);let U=f.getuid();D.name=`\u65B0\u5EFA\u7A7A\u95F4\u8DDD\u79BB${U}`},R}();return m.setInputAction(function(R){if(f.scene.bim){let T=f.scene.bim.PickWorldPositionSync(R.endPosition.x,R.endPosition.y);T[0]===0?x=f.scene.pickPosition(R.endPosition):x=new Z(T[0],T[1],T[2]),console.log("????????",x)}else x=f.scene.pickPosition(R.endPosition);!x||(B.style.left=`${R.endPosition.x+10}px`,B.style.top=`${R.endPosition.y+20}px`,B.style.display="block",C.length>=2&&(k(E)?(C.pop(),C.push(x)):E=new P(C),B.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u53F3\u952E\u7ED3\u675F\uFF01</span>',I=f.getSpaceDistance(C)),f.entities.remove(w),w=f.entities.add({name:"\u7A7A\u95F4\u76F4\u7EBF\u8DDD\u79BB",position:C[C.length-1],label:{text:`\u603B\u957F\uFF1A${I}`,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),disableDepthTestDistance:Number.POSITIVE_INFINITY}}))},_i.MOUSE_MOVE),m.setInputAction(function(R){if(f.scene.bim){let L=f.scene.bim.PickWorldPositionSync(R.position.x,R.position.y);L[0]===0?x=f.scene.pickPosition(R.position):x=new Z(L[0],L[1],L[2]),console.log("????????",x)}else x=f.scene.pickPosition(R.position);if(!x)return;C.length===0&&C.push(x.clone()),C.push(x);let T=I;v=`\u603B\u957F\uFF1A${I}`,y=f.entities.add({name:"\u7A7A\u95F4\u76F4\u7EBF\u8DDD\u79BB",position:C[C.length-1],point:{pixelSize:5,color:S.point,outlineColor:qe.WHITE,outlineWidth:2,clampToGround:!1,disableDepthTestDistance:Number.POSITIVE_INFINITY},label:{text:T,show:!0,font:"26px \u6977\u4F53",fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-20),heightReference:tn.NONE,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),f._points.push(y),D.spot.push(x),D.distance.push(I),D.label.push(y)},_i.LEFT_CLICK),m.setInputAction(function(R){B.style.display="none",f.entities.remove(w),f._points.length>0&&(f._points[f._points.length-1].label.text=v),m.destroy(),C.pop(),k(o)&&typeof o=="function"&&o(D)},_i.RIGHT_CLICK),this};mp.prototype.getSpaceDistance=function(o){let A=0,f="";for(let m=0;m<o.length-1;m++){let C=Lt.fromCartesian(o[m]),E=Lt.fromCartesian(o[m+1]),I=new Ig;I.setEndPoints(C,E);let x=I.surfaceDistance;x=Math.sqrt(Math.pow(x,2)+Math.pow(E.height-C.height,2)),A=A+x}return A>=1e3?f=`${(A/1e3).toFixed(2)}\u5343\u7C73`:f=`${A.toFixed(2)}\u7C73`,f};mp.prototype.getPlaneArea=function(o,A){let f=this;f.scene.globe.depthTestAgainstTerrain=!0;let m=0,C=new pr(f.scene._imageryLayerCollection),E=document.getElementById("toolTip");E||(ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>'),E=document.getElementById("toolTip")),E.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB\uFF0C\u53F3\u952E\u7ED3\u675F\uFF01</span>';let I=[],x={},y=[],v=[],w=null,Q=null,M,B={point:qe.RED,polyline:qe.fromRgba(4286644096),polygon:qe.fromRgba(4286644096).withAlpha(.5)};k(A)&&(k(A.point)&&(B.point=A.point),k(A.polyline)&&(B.polyline=A.polyline),k(A.polygon)&&(B.polygon=A.polygon));let D={mj:0,label:[],polygon:[]};E.style.display="block";let S=function(){function P(R){this.options={name:"\u591A\u8FB9\u5F62",polygon:{hierarchy:[],perPositionHeight:!0,material:B.polygon,clampToGround:!1}},this.hierarchy=R,this._init()}return P.prototype._init=function(){let R=this,T=function(){return R.hierarchy};this.options.polygon.hierarchy=new Kr(T,!1),this.polygon=f.entities.add(this.options),f.item=this.polygon,f._entity=this.polygon,D.polygon=this.polygon},P}();return C.setInputAction(function(P){if(E.style.left=`${P.endPosition.x+10}px`,E.style.top=`${P.endPosition.y+20}px`,f.scene.bim){let U=f.scene.bim.PickWorldPositionSync(P.endPosition.x,P.endPosition.y);U[0]===0?Q=f.scene.pickPosition(P.endPosition):Q=new Z(U[0],U[1],U[2])}else Q=f.scene.pickPosition(P.endPosition);if(!Q)return;let R=Lt.fromCartesian(Q),T=De.toDegrees(R.longitude),L=De.toDegrees(R.latitude),F=R.height;if(I.length>=2){k(w)?(I.pop(),I.push(Q),x=new In(I),v.pop(),v.push({lon:T,lat:L,hei:F})):(x=new In(I),w=new S(x));let U=f.getArea(v,I);f.entities.remove(M),M=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:I[I.length-1],label:{text:U,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),D.label=M}},_i.MOUSE_MOVE),C.setInputAction(function(P){if(f.scene.bim){let U=f.scene.bim.PickWorldPositionSync(P.position.x,P.position.y);U[0]===0?Q=f.scene.pickPosition(P.position):Q=new Z(U[0],U[1],U[2])}else Q=f.scene.pickPosition(P.position);if(!Q)return;let R=Lt.fromCartesian(Q);console.log("\u5DE6\u952E\u70B9",R);let T=De.toDegrees(R.longitude),L=De.toDegrees(R.latitude),F=R.height;I.length===0&&(I.push(Q.clone()),x=new In(I),v.push({lon:T,lat:L,hei:F}),I.push(Q.clone()),x=new In(I),v.push({lon:T,lat:L,hei:F})),I.push(Q),x=new In(I),y.push({lon:T,lat:L,hei:F}),v.push({lon:T,lat:L,hei:F})},_i.LEFT_CLICK),C.setInputAction(function(P){E.style.display="none",f.entities.remove(M),C.destroy();let R=f.getArea(v,I);m=R;let T=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:I[I.length-1],label:{text:R,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}});f._points.push(T),f._lable=T,D.mj=m,D.label=T,k(o)&&typeof o=="function"&&o(D)},_i.RIGHT_CLICK),this};mp.prototype.getSurfaceArea3d=function(o,A){let f=this;f.scene.globe.depthTestAgainstTerrain=!0;let m={mj:0,label:[],polygon:[]},C=!0,E=[],I={},x,y=f.scene,v=y.globe.ellipsoid,w=new nI;y.primitives.add(w);let Q,M,B=0,D={point:qe.RED,polyline:qe.fromRgba(4286644096),polygon:qe.fromRgba(4286644096).withAlpha(.5)};k(A)&&(k(A.point)&&(D.point=A.point),k(A.polyline)&&(D.polyline=A.polyline),k(A.polygon)&&(D.polygon=A.polygon));let S=document.createElement("div");ru(".map-widget",S),ru(".map-widget",'<div id="toolTip" style="display: none;position: absolute;visibility: visible;max-width: 200px;min-width: 100px;padding: 1px 1px 1px 25px;font-size: 11px;z-index: 1000;opacity: 0.8;background-color: rgba(0,0,0,0.7);border-radius: 3px;"></div>');let R=document.getElementById("toolTip");R.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u5DE6\u952E\u5F00\u59CB,\u53F3\u952E\u7ED3\u675F\uFF01</span>';let T=new pr(y.canvas),L=function(){function U(N){if(!k(N))throw new ni("positions is required!");if(N.length<3)throw new ni("positions \u7684\u957F\u5EA6\u5FC5\u987B\u5927\u4E8E\u7B49\u4E8E3");this.options={polygon:{show:!0,hierarchy:void 0,material:D.polygon,clampToGround:!1}},this.path=N,this._init()}return U.prototype._init=function(){let N=this,H=function(){return N.path};this.options.polygon.hierarchy=new Kr(H,!1),this.polygonEntity=f.entities.add(this.options),f.item=this.polygonEntity,m.polygon=this.polygonEntity,f._entity=this.polygonEntity},U}();T.setInputAction(function(U){let N=0;f.entities.remove(M);let H,J,K=f.scene.camera.getPickRay(U.endPosition);K&&(H=f.scene.globe.pick(K,f.scene));let X=f.scene.pick(U.endPosition),j=!1;if(X){let ie=f.scene.pickPosition(U.endPosition);ie&&(H=ie),j=!0}if(!H)return;let ee=function(ie){let z=new Array(ie.length),oe=function(he){return he.longitude=he.longitude/Math.PI*180,he.latitude=he.latitude/Math.PI*180,he},le=function(he){let ge=0;for(let de=0;de<he.length;de++){let fe=he[de],G;de<he.length-1?G=he[de+1]:G=he[0],ge+=fe.x*G.y-G.x*fe.y}return ge/2};for(let he=0;he<ie.length;he++)z[he]=oe(v.cartesianToCartographic(ie[he]));let Ae=0;for(let he=0;he<z.length;he++)Ae+=z[he].longitude;Ae=Ae/z.length;for(let he=0;he<z.length;he++)z[he]=f.Gauss_to_XY(z[he].longitude,z[he].latitude,Ae);return Math.abs(le(z))};if(J=gi.WGS84.cartesianToCartographic(H),J&&C){if(R.style.left=`${U.endPosition.x+10}px`,R.style.top=`${U.endPosition.y+20}px`,R.style.display="block",E.length<2){B===1&&(M=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:H,label:{text:`${N}\u5E73\u65B9\u5343\u7C73`,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),f._points.push(M),m.label=M);return}if(k(x)?(x.path.positions.pop(),x.path.positions.push(H)):(E.push(H),I=new In(E),x=new L(I)),E.length>=2){R.innerHTML='<span style="font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px">\u53F3\u952E\u7ED3\u675F\uFF01</span>';let ie=String(ee(x.path.positions));ie=ie.substr(0,ie.indexOf(".",0)),ie.length<6?N=`${ie}\u5E73\u65B9\u7C73`:(ie=String(ie/1e6),ie=ie.substr(0,ie.indexOf(".",0)+3),N=`${ie}\u5E73\u65B9\u5343\u7C73`),m.mj=N,M=f.entities.add({name:"\u591A\u8FB9\u5F62\u9762\u79EF",position:H,label:{text:N,font:"26px \u6977\u4F53",show:!0,fillColor:qe.WHITE,style:fu.FILL_AND_OUTLINE,outlineWidth:2,verticalOrigin:on.BOTTOM,pixelOffset:new tt(20,-40),heightReference:tn.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY}}),f._points.push(M),m.label=M}}},_i.MOUSE_MOVE),T.setInputAction(function(U){let N;B=1;let H=f.scene.camera.getPickRay(U.position);H&&(N=f.scene.globe.pick(H,f.scene));let J=f.scene.pick(U.position),K=!1;if(J){let X=f.scene.pickPosition(U.position);X&&(N=X),K=!0}N&&C&&(E.push(N),I=new In(E))},_i.LEFT_CLICK),T.setInputAction(function(){T.removeInputAction(_i.LEFT_CLICK),T.removeInputAction(_i.LEFT_DOUBLE_CLICK),f.trackedEntity=void 0,C=!1,Q=w.add({show:!0,id:"measureTool",position:E[E.length-1],pixelOffset:new tt(0,20),eyeOffset:new Z(0,0,0),horizontalOrigin:iu.CENTER,verticalOrigin:on.CENTER,scale:1,color:new qe(1,1,1,1)}),R.style.display="none",T.destroy(),k(o)&&typeof o=="function"&&o(m)},_i.RIGHT_CLICK);let F=function(U){let N=0,H=0,J=0;for(let X=0;X<U.length;X++)N+=U[X].x,H+=U[X].y,J+=U[X].z;return new Z(N/U.length,H/U.length,J/U.length)};return this};mp.prototype.to_N=function(o){let f=63567523142e-4,m=Math.sqrt(6378137*6378137-f*f)/6378137;return 6378137/Math.sqrt(1-m*m*Math.sin(o)*Math.sin(o))};mp.prototype.to_Sm=function(o){let f=63567523142e-4,m=Math.sqrt(6378137*6378137-f*f)/6378137,C,E,I,x,y;return C=1+m*m*3/4+Math.pow(m,4)*45/64+Math.pow(m,6)*175/256+Math.pow(m,8)*11025/16384,E=Math.pow(m,2)*3/4+Math.pow(m,4)*15/16+Math.pow(m,6)*525/512+Math.pow(m,8)*2205/2048,I=Math.pow(m,4)*15/64+Math.pow(m,6)*105/256+Math.pow(m,8)*2205/4096,x=Math.pow(m,6)*35/512+Math.pow(m,8)*315/2048,y=Math.pow(m,8)*315/16384,6378137*(1-m*m)*(C*o-E/2*Math.sin(2*o)+I/4*Math.sin(4*o)-x/6*Math.sin(6*o)+y/8*Math.sin(8*o))};mp.prototype.to_Radian=function(o){return o*Math.PI/180};mp.prototype.Gauss_to_XY=function(o,A,f){let C=63567523142e-4,E=Math.sqrt(6378137*6378137-C*C)/C,I=0,x=0,y=0,v=0,w=this.to_Radian(f);A=this.to_Radian(A),o=this.to_Radian(o);let Q=o-w,M=Math.cos(A);v=this.to_N(A),y=v*Math.cos(A),I=Math.tan(A),x=E*M;let B=Math.pow(I,2),D=Math.pow(I,4),S=Math.pow(x,2),P=Math.pow(x,4),R=Math.pow(M,3),T=Math.pow(M,5),L=this.to_Sm(A)+Math.pow(Q,2)/2*y*M*I+Math.pow(Q,4)/24*I*y*R*(5-B+9*S+4*P)+Math.pow(Q,6)/720*I*y*T*(61-58*I*I+D+270*S-330*I*I*S),F=Q*v*M+Math.pow(Q,3)/6*v*R*(1-I*I+x*x)+Math.pow(Q,5)/120*v*T*(5-18*I*I+D+14*S-58*S*B);return new tt(F,L)};mp.prototype.getArea=function(o,A){let f=0;for(let m=0;m<o.length-2;m++){let C=(m+1)%o.length,E=(m+2)%o.length,I=this.Angle(o[m],o[C],o[E]),x=this.getdistance(A[m],A[C]),y=this.getdistance(A[C],A[E]);f+=x*y*Math.abs(Math.sin(I))}return f<1e6?f=`${f.toFixed(4)}\u5E73\u65B9\u7C73`:f=`${(f/1e6).toFixed(4)}\u5E73\u65B9\u5343\u7C73`,f};mp.prototype.getdistance=function(o,A){let f=Lt.fromCartesian(o),m=Lt.fromCartesian(A),C=new Ig;C.setEndPoints(f,m);let E=C.surfaceDistance;return E=Math.sqrt(Math.pow(E,2)+Math.pow(m.height-f.height,2)),E};mp.prototype.Bearing=function(o,A){let f=Math.PI/180,m=180/Math.PI,C=o.lat*f,E=o.lon*f,I=A.lat*f,x=A.lon*f,y=-Math.atan2(Math.sin(E-x)*Math.cos(I),Math.cos(C)*Math.sin(I)-Math.sin(C)*Math.cos(I)*Math.cos(E-x));return y<0&&(y+=Math.PI*2),y=y*m,y};mp.prototype.Angle=function(o,A,f){let m=this.Bearing(A,o),C=this.Bearing(A,f),E=m-C;return E<0&&(E+=360),E};mp.prototype.getuid=function(){return this.uuid(8,16)};mp.prototype.uuid=function(o,A){let f="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),m=[],C;if(A=A||f.length,o)for(C=0;C<o;C++)m[C]=f[0|De.nextRandomNumber()*A];else{let E;for(m[8]=m[13]=m[18]=m[23]="-",m[14]="4",C=0;C<36;C++)m[C]||(E=0|De.nextRandomNumber()*16,m[C]=f[C===19?E&3|8:E])}return m.join("")};mp.prototype.deleteObject=function(){if(this.entities.remove(this.item),this._points.length>0){for(let o=0;o<this._points.length;o++)this.entities.remove(this._points[o]);this._points=[]}try{this.scene.primitives.remove(this.item)}catch(o){console.log(o)}this.item=void 0};var IJ=mp;function Tv(o,A){this._earthCtrl=o,this._coreMap=this._earthCtrl.coreMap,this._show=ae(A.show,!0),this._lon=ae(A.lon,121),this._lat=ae(A.lat,31),this._height=ae(A.height,10),this._heading=ae(A.heading,0),this._pitch=ae(A.pitch,0),this._distance=ae(A.distance,300),this._position=Z.fromDegrees(A.lon,A.lat,A.height),this._horizontalViewAngle=ae(A.horizontalViewAngle,90),this._verticalViewAngle=ae(A.verticalViewAngle,60),this._horizontalViewAngle=this.adjustViewRange(this._horizontalViewAngle),this._verticalViewAngle=this.adjustViewRange(this._verticalViewAngle),this._visibleAreaColor=ae(A.visibleAreaColor,qe.GREEN.withAlpha(.4)),this._invisibleAreaColor=ae(A.invisibleAreaColor,qe.RED.withAlpha(.4)),this._size=ae(A.size,10240),this._softShadows=ae(A.softShadows,!0),this._colorStyle=ae(A.colorStyle,qe.YELLOW),this._parameter=A,this._lineArray=[],this._visualCone=!0,this.pyramid=void 0,this.updateViewShed()}Object.defineProperties(Tv.prototype,{show:{get:function(){return this._show},set:function(o){o!==this._show&&(this._show=o,this.updateViewShed())}},distance:{get:function(){return this._distance}},heading:{get:function(){return this._heading}},pitch:{get:function(){return this._pitch}},horizontalViewAngle:{get:function(){return this._horizontalViewAngle}},verticalViewAngle:{get:function(){return this._verticalViewAngle}},colorStyle:{get:function(){return this._colorStyle},set:function(o){this._colorStyle=o}},invisibleAreaColor:{get:function(){return this._invisibleAreaColor},set:function(o){this._invisibleAreaColor=o}},visibleAreaColor:{get:function(){return this._visibleAreaColor},set:function(o){this._visibleAreaColor=o}},visualCone:{get:function(){return this._visualCone},set:function(o){this._visualCone=o,this.visualConeShow(o)}}});Tv.prototype.adjustViewRange=function(o){return o<=0?o=1:o>=180&&(o=179),o};Tv.prototype.removeFromMap=function(){let o=this;k(o.viewShedMap)&&(o.viewShedMap.enabled=!1),k(o.pyramid)&&(o._earthCtrl.entities.removeById(o.pyramid.id),o.pyramid=null);for(let A=0;A<o._lineArray.length;A++){let f=o._lineArray[A];o._earthCtrl.entities.remove(f)}o._lineArray=[]};Tv.prototype.visualConeShow=function(o){let A=this;k(A.pyramid)&&(A.pyramid.show=o);for(let f=0;f<A._lineArray.length;f++){let m=A._lineArray[f];m.show=o}};Tv.prototype.addVisualPyramid=function(){let o=this,A=new zO({radii:new Kr(function(){return new Z(o._distance,o._distance,o._distance)},!1),minimumClock:new Kr(function(){return De.toRadians(90-o._heading-o._horizontalViewAngle/2)},!1),maximumClock:new Kr(function(){return De.toRadians(90-o._heading+o._horizontalViewAngle/2)},!1),minimumCone:new Kr(function(){return De.toRadians(90-o._verticalViewAngle/2)},!1),maximumCone:new Kr(function(){return De.toRadians(90+o._verticalViewAngle/2)},!1),fill:!1,outline:!0,subdivisions:128,slicePartitions:32,stackPartitions:16,outlineColor:new Kr(function(){return o._colorStyle},!1)}),f=new Fu({position:new Kr(function(){return o._position},!1),ellipsoid:A});this.pyramid=o._earthCtrl.entities.add(f)};Tv.prototype.createLightCamera=function(){k(this.viewShedMap)?this._lightCamera=this.viewShedMap._lightCamera:this._lightCamera=new Ms(this._coreMap.scene),this._lightCamera.position=this._position};Tv.prototype.updateParameters=function(o){let A=this,f=A._lightCamera;if(!!k(o)&&(k(o.lon)||k(o.lat)||k(o.height)||k(o.heading)||k(o.pitch)||k(o.roll)||k(o.far)||k(o.distance)||k(o.verticalViewAngle)||k(o.horizontalViewAngle))){let m=this._parameter;for(let x in o)o.hasOwnProperty(x)&&k(m[x])&&(m[x]=o[x]);m.distance>=A.viewShedMap.maximumDistance&&(m.distance=A.viewShedMap.maximumDistance),A._heading=m.heading,A._pitch=m.pitch,A._distance=m.distance,A.viewShedMap._pointLightRadius=m.distance,m.verticalViewAngle=A.adjustViewRange(m.verticalViewAngle),A._verticalViewAngle=m.verticalViewAngle,m.horizontalViewAngle=A.adjustViewRange(m.horizontalViewAngle),A._horizontalViewAngle=m.horizontalViewAngle,A._position=Z.fromDegrees(m.lon,m.lat,m.height);let C=De.toRadians(m.heading);f.setView({destination:A._position,orientation:{heading:C,pitch:0,roll:0}}),f.frustum.far=m.far||1e5;let E=De.toRadians(A._horizontalViewAngle),I=De.toRadians(A._verticalViewAngle);f.frustum.aspectRatio=Math.tan(E/2)/Math.tan(I/2),E>I?f.frustum.fov=E:f.frustum.fov=I}};Tv.prototype.createShadowMap=function(){if(k(this.viewShedMap)){this.viewShedMap.enabled=!0;return}this.viewShedMap=new _4({context:this._coreMap.scene.context,lightCamera:this._lightCamera,enabled:!0,isPointLight:!0,pointLightRadius:this._distance,cascadesEnabled:!1,size:this._size,softShadows:!0,normalOffset:!1,fromLightSource:!1,visibleAreaColor:this._visibleAreaColor,invisibleAreaColor:this._invisibleAreaColor}),this._earthCtrl.viewShedMapList.push(this.viewShedMap)};var Gm=new Z;Tv.prototype.drawViewCentrum=function(){let o=this;function A(){let v=o.pyramid._ellipsoid._minimumClock.getValue(),w=o.pyramid._ellipsoid._minimumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=new EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let f=this._earthCtrl.entities.add({polyline:{positions:new Kr(A,!1),material:this._colorStyle}});this._lineArray.push(f);function m(){let v=o.pyramid._ellipsoid._maximumClock.getValue(),w=o.pyramid._ellipsoid._minimumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=new EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let C=this._earthCtrl.entities.add({polyline:{positions:new Kr(m,!1),material:this._colorStyle}});this._lineArray.push(C);function E(){let v=o.pyramid._ellipsoid._minimumClock.getValue(),w=o.pyramid._ellipsoid._maximumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=new EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let I=this._earthCtrl.entities.add({polyline:{positions:new Kr(E,!1),material:this._colorStyle}});this._lineArray.push(I);function x(){let v=o.pyramid._ellipsoid._maximumClock.getValue(),w=o.pyramid._ellipsoid._maximumCone.getValue(),Q=o.pyramid._ellipsoid.radii.getValue(),M=Math.sin,B=Math.cos,D=M(w),S=B(w),P=M(v),R=B(v);Gm.x=Q.x*D*R,Gm.y=Q.y*D*P,Gm.z=Q.z*S;let T=EB.changeCartesian3ByScalar(o._position,Gm);return[o._position,T]}let y=this._earthCtrl.entities.add({polyline:{positions:new Kr(x,!1),material:this._colorStyle}});this._lineArray.push(y)};Tv.prototype.updateViewShed=function(){this.show?(this.createLightCamera(),this.setCameraParams(),this.createShadowMap(),this.addVisualPyramid(),this.drawViewCentrum()):this.removeFromMap()};Tv.prototype.setCameraParams=function(){this._lightCamera.frustum.near=.1,this._lightCamera.frustum.far=this._distance;let o=De.toRadians(this._horizontalViewAngle),A=De.toRadians(this._verticalViewAngle);this._lightCamera.frustum.aspectRatio=Math.tan(o/2)/Math.tan(A/2),o>A?this._lightCamera.frustum.fov=o:this._lightCamera.frustum.fov=A,this._lightCamera.setView({destination:this._position,orientation:{heading:De.toRadians(this._heading),pitch:De.toRadians(this._pitch),roll:0}})};var nbe=Tv;var obe=gi.WGS84;function Kh(o){this._cesiumViewer=o,this.coreMap=o.coreMap,this._scene=this.coreMap.scene,this.loading||this.addLoading(),this._tooltip=TBi(this.coreMap.container)}function abe(o,A){if(o===null||typeof o!="object"||o.constructor!==Object&&o.constructor!==Array)return o;if(o.constructor===Date||o.constructor===RegExp||o.constructor===Function||o.constructor===String||o.constructor===Number||o.constructor===Boolean)return new o.constructor(o);A=A||new o.constructor;for(let f in o)A[f]=typeof A[f]>"u"?abe(o[f],null):A[f];return A}function mtt(o,A){let f=abe(o),m;for(m in A)f[m]===void 0&&(f[m]=abe(A[m]));return f}function TBi(o){let A=function(f){let m=document.createElement("DIV");m.className="twipsy right";let C=document.createElement("DIV");C.className="twipsy-arrow",m.appendChild(C);let E=document.createElement("DIV");E.className="twipsy-inner",m.appendChild(E),this._div=m,this._title=E,f.appendChild(m)};return A.prototype.setVisible=function(f){this._div.style.display=f?"block":"none"},A.prototype.showAt=function(f,m){f&&m&&(this.setVisible(!0),this._title.innerHTML=m,this._div.style.left=`${f.x+30}px`,this._div.style.top=`${f.y-this._div.clientHeight/2-15}px`)},new A(o)}Kh.prototype.addToolbar=function(o,A){return A=mtt(A,{container:o}),new Kh.Toolbar(this,A)};var Ctt={shiftX:0,shiftY:0};Kh.prototype.createBillboardGroup=function(o,A,f){let m=new Kh.BillboardGroup(this,A);return m.addBillboards(o,f),m};Kh.BillboardGroup=function(o,A){this._drawHelper=o,this._scene=o._scene,this._options=mtt(A,Ctt);let f=new nI;this._scene.primitives.add(f),this._billboards=f,this._orderedBillboards=[]};Kh.BillboardGroup.prototype.createBillboard=function(o,A){let f=this._billboards.add({show:!0,position:o,pixelOffset:new tt(this._options.shiftX,this._options.shiftY),eyeOffset:new Z(0,0,-1e3),horizontalOrigin:iu.CENTER,verticalOrigin:on.CENTER,scale:.3,image:ae(this._options.iconUrl,`${globalThis.GEOWORLD_BASE_URL}Assets/Images/point.png`),color:new qe(1,1,1,1)});if(A){let E=function(x){C.enableRotate=x},I=function(){let x=0;for(let y=m._orderedBillboards.length;x<y&&m._orderedBillboards[x]!==f;++x);return x},m=this,C=this._scene.screenSpaceCameraController;if(A.dragHandlers){let x=this,y=new pr(x._scene.canvas);setListener(f,"leftDown",function(v){function w(M){f.position=M;for(let B=0,D=x._orderedBillboards.length;B<D&&x._orderedBillboards[B]!==f;++B);A.dragHandlers.onDrag&&A.dragHandlers.onDrag(I(),M)}function Q(M){y.destroy(),E(!0),A.dragHandlers.onDragEnd&&A.dragHandlers.onDragEnd(I(),M)}y.setInputAction(function(M){let B=x._scene.camera.pickEllipsoid(M.endPosition,obe);B?w(B):Q(B)},_i.MOUSE_MOVE),y.setInputAction(function(M){Q(x._scene.camera.pickEllipsoid(M.position,obe))},_i.LEFT_UP),E(!1),A.dragHandlers.onDragStart&&A.dragHandlers.onDragStart(I(),x._scene.camera.pickEllipsoid(v,obe))})}A.onDoubleClick&&setListener(f,"leftDoubleClick",function(x){A.onDoubleClick(I())}),A.onClick&&setListener(f,"leftClick",function(x){A.onClick(I())}),A.tooltip&&(setListener(f,"mouseMove",function(x){m._drawHelper._tooltip.showAt(x,A.tooltip())}),setListener(f,"mouseOut",function(x){m._drawHelper._tooltip.setVisible(!1)}))}return f};Kh.BillboardGroup.prototype.insertBillboard=function(o,A,f){this._orderedBillboards.splice(o,0,this.createBillboard(A,f))};Kh.BillboardGroup.prototype.addBillboard=function(o,A){this._orderedBillboards.push(this.createBillboard(o,A))};Kh.BillboardGroup.prototype.addBillboards=function(o,A){let f=0;for(;f<o.length;f++)this.addBillboard(o[f],A)};Kh.BillboardGroup.prototype.updateBillboardsPositions=function(o){let A=0;for(;A<o.length;A++)this.getBillboard(A).position=o[A]};Kh.BillboardGroup.prototype.countBillboards=function(){return this._orderedBillboards.length};Kh.BillboardGroup.prototype.getBillboard=function(o){return this._orderedBillboards[o]};Kh.BillboardGroup.prototype.removeBillboard=function(o){this._billboards.remove(this.getBillboard(o)),this._orderedBillboards.splice(o,1)};Kh.BillboardGroup.prototype.remove=function(){this._billboards=this._billboards&&this._billboards.removeAll()&&this._billboards.destroy()};Kh.BillboardGroup.prototype.setOnTop=function(){this._scene.primitives.raiseToTop(this._billboards)};Kh.prototype.cleanUp=function(){this._prevEntity!==void 0&&(this._cesiumViewer.entities.remove(this._prevEntity),this._prevEntity=void 0),this._markers!==void 0&&(this._markers.remove(),this._markers=void 0),this._volumeLabel!==void 0&&(this._cesiumViewer.entities.remove(this._volumeLabel),this._volumeLabel=void 0),this._tooltip.setVisible(!1)};Kh.prototype.startDrawing=function(o){let A=this,f=this._scene;f.globe.depthTestAgainstTerrain=!0;let m=this._tooltip,C=3,E=[],I=[],x;this._positions=I;let y=new pr(f.canvas);this._mouseHandler=y;let v=new Kh.BillboardGroup(this,Ctt);this._markers=v,this._prevEntity!==void 0&&(this._cesiumViewer.entities.remove(this._prevEntity),this._prevEntity=null),this._volumeLabel!==void 0&&(this._cesiumViewer.entities.remove(this._volumeLabel),this._volumeLabel=void 0),y.setInputAction(function(Q){if(Q.position!==null){let M=f.camera.getPickRay(Q.position),B=f.globe.pick(M,f),D=Lt.fromCartesian(B),S=De.toDegrees(D.longitude),P=De.toDegrees(D.latitude);if(B){if(E.length===0&&(E.push(S,P),I.push(B),x=B,v.addBillboard(x)),I.length>=4){let R=ms.wgs84ToWindowCoordinates(this._cesiumViewer.coreMap.scene,x);if(R!==void 0){let T=R.x-Q.position.x,L=R.y-Q.position.y;if(T*T+L*L<16){E.splice(E.length-2,2),I.pop(),this.isLoading(!0),this.stopDrawing(o);return}}}E.push(S,P),I.push(B),v.addBillboard(B),I.length===C&&(A._prevEntity=A._cesiumViewer.factory.createElement({type:"polygon",parameters:{hierarchy:Z.fromDegreesArray(E),material:qe.RED.withAlpha(.6),fill:!0}}),A._prevEntity.polygon.hierarchy=w())}}}.bind(this),_i.LEFT_CLICK),y.setInputAction(function(Q){let M=Q.endPosition;if(M!==null)if(I.length===0)m.showAt(M,"\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7B2C\u4E00\u4E2A\u70B9");else{let B=f.camera.getPickRay(M),D=f.globe.pick(B,f),S=Lt.fromCartesian(D),P=De.toDegrees(S.longitude),R=De.toDegrees(S.latitude);if(D&&(E.splice(E.length-2,2),I.pop(),E.push(P,R),I.push(D),v.getBillboard(I.length-1).position=D,m.showAt(M,"\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236"),I.length>=3&&I.length>=4)){let T=ms.wgs84ToWindowCoordinates(this._cesiumViewer.coreMap.scene,x);if(T!==void 0){let L=T.x-M.x,F=T.y-M.y;L*L+F*F<16?document.body.style.cursor="pointer":document.body.style.cursor="default"}}}}.bind(this),_i.MOUSE_MOVE),y.setInputAction(function(Q){I.length<C+2||(this.isLoading(!0),setTimeout(()=>{this.stopDrawing(o)},100))}.bind(this),_i.LEFT_DOUBLE_CLICK);function w(){return Z.fromDegreesArray(E)}};Kh.prototype.stopDrawing=function(o){this._mouseHandler!==void 0&&(this._mouseHandler.destroy(),this._mouseHandler=void 0),this._markers!==void 0&&(this._markers.remove(),this._markers=void 0),this._prevEntity!==void 0&&(this._cesiumViewer.entities.remove(this._prevEntity),this._prevEntity=null),this._volumeLabel!==void 0&&(this._cesiumViewer.entities.remove(this._volumeLabel),this._volumeLabel=void 0),this._tooltip.setVisible(!1),document.body.style.cursor="wait";let A=this.computeCutVolume(),f=A.maxHeight;document.body.style.cursor="default",typeof o=="function"&&o(A.volume);let m={polygon:{hierarchy:{positions:this._positions},extrudedHeight:f,closeTop:!1,closeBottom:!1,material:qe.RED.withAlpha(.5),outline:!0,outlineColor:qe.WHITE,outlineWidth:2}};this._prevEntity=this._cesiumViewer.entities.add(m),this.isLoading(!1)};Kh.prototype.addLoading=function(){let o=document.createElement("div");o.id="cesiumLoading",o.style.cssText="width: 100%;height: 100%;display:none;pointer-events: none;position: absolute;top: 0;left: 0;-moz-box-sizing: border-box;box-sizing: border-box;background-color: unset;z-index: 99999;";let A=document.createElement("img");A.style.cssText="position: relative;width: 110px;height: 110px;margin: auto;top: 50%;left: 50%;margin-top: -55px;margin-left: -55px;",A.src=`${globalThis.GEOWORLD_BASE_URL}Workers/image/loading.gif`,o.appendChild(A),this.loading=o,this.coreMap.container.appendChild(o)};Kh.prototype.isLoading=function(o){o?this.loading.style.display="block":this.loading.style.display="none"};Kh.prototype.removeLoading=function(){this.loading&&this.loading.remove(),this.loading=void 0};function PBi(o){let A=[],f=[];for(let Q=0;Q<o.length;Q++){let M=Lt.fromCartesian(o[Q]);A.push(M.longitude),f.push(M.latitude)}let m=0,C=0,E=0,I=0,x=0,y=0,v=0,w=0;for(let Q=0;Q<o.length;Q++)m=A[Q],C=f[Q],Q===o.length-1?(E=A[0],I=f[0]):(E=A[Q+1],I=f[Q+1]),y=m*I-E*C,x+=y,v+=(m+E)*y,w+=(C+I)*y;return x*=.5,v/=6*x,w/=6*x,new Lt(v,w)}function RBi(o,A,f){let m=Z.distance(o,A),C=Z.distance(A,f),E=Z.distance(f,o),I=(m+C+E)/2;return Math.sqrt(I*(I-m)*(I-C)*(I-E))}Kh.prototype.computeCutVolume=function(){let o=15e3;for(let L=0;L<this._positions.length;L++){let F=Lt.fromCartesian(this._positions[L]),U=this._scene.globe.getHeight(F);o>U&&(o=U)}let A=Math.PI/Math.pow(2,11);A=A/64;let f=new bc.fromPositions({positions:this._positions,vertexFormat:ma.FLAT_VERTEX_FORMAT,granularity:A}),m=new bc.createGeometry(f),C=0,E=0,I,x,y,v,w,Q,M,B,D,S,P,R;for(let L=0;L<m.indices.length;L+=3)I=m.indices[L],x=m.indices[L+1],y=m.indices[L+2],S=new Z(m.attributes.position.values[I*3],m.attributes.position.values[I*3+1],m.attributes.position.values[I*3+2]),P=Lt.fromCartesian(S),v=this._scene.globe.getHeight(P),M=Z.fromRadians(P.longitude,P.latitude,0),E<v&&(E=v),S=new Z(m.attributes.position.values[x*3],m.attributes.position.values[x*3+1],m.attributes.position.values[x*3+2]),P=Lt.fromCartesian(S),w=this._scene.globe.getHeight(P),B=Z.fromRadians(P.longitude,P.latitude,0),E<w&&(E=w),S=new Z(m.attributes.position.values[y*3],m.attributes.position.values[y*3+1],m.attributes.position.values[y*3+2]),P=Lt.fromCartesian(S),Q=this._scene.globe.getHeight(P),D=Z.fromRadians(P.longitude,P.latitude,0),E<Q&&(E=Q),R=RBi(M,B,D),C=C+R*(v-o+w-o+Q-o)/3;let T=PBi(this._positions);return this._volumeLabel=this._cesiumViewer.entities.add({position:Z.fromRadians(T.longitude,T.latitude,E+1e3),label:{text:`${C.toFixed(4)}\u7ACB\u65B9\u7C73`}}),{maxHeight:E,volume:C}};var sbe=Kh;function Ett(o,A){if(this.mEarthCtrl=o,this._parameter=A,this.coreMap=o.coreMap,this._color=ae(A.color,new qe(1,0,0,.7)),this._positions=A.positions,this._positions.length<3)throw new ni("invalid positions length!");this._duration=ae(A.duration,4e3),this._minHeight=ae(A.minHeight,0),this._maxHeight=ae(A.maxHeight,100),this._image=A.image,this._pps=null}function LBi(o,A){let f=Lt.fromCartesian(o[0]),m=f.longitude,C=f.latitude,E=m,I=C,x=A;for(let y=1;y<o.length;y++){let v=Lt.fromCartesian(o[y]);m>v.longitude?m=v.longitude:E<v.longitude&&(E=v.longitude),C>v.latitude?C=v.latitude:I<v.latitude&&(I=v.latitude)}return new Z.fromRadians((m+E)/2,(C+I)/2,x)}function FBi(o){if(k(o._pps))return;let A=LBi(o._positions,o._minHeight),f=Lt.fromCartesian(A),m=new kt(A.x,A.y,A.z,1),C=new Lt(f.longitude,f.latitude,o.maxHeight+100),E=Lt.toCartesian(C),I=new kt(E.x,E.y,E.z,1),x=new kt,y=new kt,v=new Z,w=o.mEarthCtrl.coreMap.scene.camera,Q=o._positions.length;o._pps=new Jo({fragmentShader:kBi(Q),uniforms:{u_floodCenterEC:function(){return Re.multiplyByVector(w._viewMatrix,m,x)},u_floodPlaneNormalEC:function(){let B=Re.multiplyByVector(w._viewMatrix,m,x),D=Re.multiplyByVector(w._viewMatrix,I,y);return v.x=D.x-B.x,v.y=D.y-B.y,v.z=D.z-B.z,Z.normalize(v,v),v},u_floodRange:function(){return o._positions},u_minHeight:function(){return o._minHeight},u_maxHeight:function(){return o._maxHeight},u_image:function(){return o.image},u_floodColor:function(){return o._color},u_positionsLength:function(){return o._positions.length}}}),o.mEarthCtrl.coreMap.scene.postProcessStages.add(o._pps)}function NBi(o){k(o._pps)&&(o.mEarthCtrl.coreMap.scene.postProcessStages.remove(o._pps),o._pps=null)}function kBi(o){return`uniform sampler2D colorTexture; |
| | | uniform sampler2D depthTexture; |
| | | in vec2 v_textureCoordinates; |
| | | uniform vec4 u_floodCenterEC; |