import e from"./h.png";class i{viewer;currentMarkPointId;init=()=>{const e="06494bcf2d4b66df7f3c586cc65af0cb",i=["0","1","2","3","4","5","6","7"];return this.viewer=new window.Cesium.Viewer("map_container",{animation:!1,homeButton:!0,geocoder:!0,baseLayerPicker:!1,timeline:!1,fullscreenButton:!0,infoBox:!0,sceneModePicker:!0,navigationInstructionsInitiallyVisible:!1,navigationHelpButton:!1,selectionIndicator:!1,imageryProvider:new window.Cesium.WebMapTileServiceImageryProvider({url:`https://t{s}.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=${e}`,subdomains:i,layer:"tdtImgLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0})}),this.viewer._cesiumWidget._creditContainer.style.display="none",this.viewer.imageryLayers.addImageryProvider(new window.Cesium.WebMapTileServiceImageryProvider({url:`https://t{s}.tianditu.gov.cn/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=${e}`,subdomains:i,layer:"tdtCiaLayer",style:"default",format:"image/jpeg",tileMatrixSetID:"GoogleMapsCompatible",show:!0})),this.initObliquePhotography(),{viewer:this.viewer}};initObliquePhotography=()=>{this.viewer.scene.globe.depthTestAgainstTerrain=!0,window.Cesium.ExperimentalFeatures.enableModelExperimental=!0;const e=window.mapObliquePhotography||[];for(let i=0;i<e.length;i++)this.createObliquePhotography(e[i])};createObliquePhotography=e=>{const i=new window.Cesium.Cesium3DTileset({url:e,skipLevelOfDetail:!0,baseScreenSpaceError:1024,maximumScreenSpaceError:128,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,loadSiblings:!0,cullWithChildrenBounds:!0,cullRequestsWhileMoving:!0,cullRequestsWhileMovingMultiplier:10,preloadWhenHidden:!0,preferLeaves:!0,maximumMemoryUsage:128,progressiveResolutionHeightFraction:.5,dynamicScreenSpaceErrorDensity:.5,dynamicScreenSpaceErrorFactor:1,dynamicScreenSpaceError:!0});i.readyPromise.then(e=>{const i=window.Cesium.Cartographic.fromCartesian(e.boundingSphere.center),t=window.Cesium.Math.toDegrees(i.longitude),r=window.Cesium.Math.toDegrees(i.latitude),n=window.Cesium.Cartesian3.fromDegrees(t,r,0),o=window.Cesium.Cartesian3.fromDegrees(t,r,5),a=window.Cesium.Cartesian3.subtract(o,n,new window.Cesium.Cartesian3);e.modelMatrix=window.Cesium.Matrix4.fromTranslation(a)}),this.viewer.scene.primitives.add(i)};flyTo=({longitude:e,latitude:i,height:t})=>{this.viewer.camera.flyTo({destination:this.getPosition(e,i,t),duration:2})};getPosition=(e,i,t=0)=>window.Cesium.Cartesian3.fromDegrees(e,i,t);clearMarkPoint=()=>{this.currentMarkPointId&&(this.viewer.entities.removeById(this.currentMarkPointId),this.currentMarkPointId=null)};getLongitudeAndLatitude=i=>{new window.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas).setInputAction(t=>{this.clearMarkPoint();const r=this.viewer.camera.pickEllipsoid(t.position,this.viewer.scene.globe.ellipsoid);if(r){const t=window.Cesium.Cartographic.fromCartesian(r),n=window.Cesium.Math.toDegrees(t.longitude),o=window.Cesium.Math.toDegrees(t.latitude);this.currentMarkPointId=window.Cesium.createGuid(),this.viewer.entities.add(new window.Cesium.Entity({id:this.currentMarkPointId,position:r,billboard:{image:e,width:23,height:25,verticalOrigin:window.Cesium.VerticalOrigin.BOTTOM,horizontalOrigin:window.Cesium.HorizontalOrigin.CENTER,heightReference:window.Cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,clampToGround:!0}})),i&&"function"==typeof i&&i(null,{longitude:n,latitude:o})}else i&&"function"==typeof i&&i(new Error("【Map】 无法获取坐标"),null)},window.Cesium.ScreenSpaceEventType.LEFT_CLICK)};addMarkPoint=({longitude:i,latitude:t})=>{const r=window.Cesium.Cartesian3.fromDegrees(i,t);this.currentMarkPointId=window.Cesium.createGuid(),this.viewer.entities.add(new window.Cesium.Entity({id:this.currentMarkPointId,position:r,billboard:{image:e,width:23,height:25,verticalOrigin:window.Cesium.VerticalOrigin.BOTTOM,horizontalOrigin:window.Cesium.HorizontalOrigin.CENTER,heightReference:window.Cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance:Number.POSITIVE_INFINITY,clampToGround:!0}}))}}export{i as default};
