|  |  | @ -6,7 +6,7 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | <script setup lang="ts"> |  |  |  | <script setup lang="ts"> | 
			
		
	
		
		
			
				
					
					|  |  |  | import { Angle } from '@/utils/map/angle.ts' |  |  |  | import { Angle } from '@/utils/map/angle.ts' | 
			
		
	
		
		
			
				
					
					|  |  |  | import { ScreenSpaceEventHandler, Math, ScreenSpaceEventType } from 'cesium' |  |  |  | import { ScreenSpaceEventHandler, Math, ScreenSpaceEventType } from 'cesium' | 
			
		
	
		
		
			
				
					
					|  |  |  | import {onMounted, ref} from "vue"; |  |  |  | import { onMounted, ref } from 'vue' | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | let nowLatStr: string, nowLonStr: string |  |  |  | let nowLatStr: string, nowLonStr: string | 
			
		
	
		
		
			
				
					
					|  |  |  | let lonlatStr = ref('') |  |  |  | let lonlatStr = ref('') | 
			
		
	
		
		
			
				
					
					|  |  |  | let isDecimal = ref(true) |  |  |  | let isDecimal = ref(true) | 
			
		
	
	
		
		
			
				
					|  |  | @ -19,24 +19,31 @@ onMounted(()=>{ | 
			
		
	
		
		
			
				
					
					|  |  |  |     //捕获椭球体,将笛卡尔二维平面坐标转为椭球体的笛卡尔三维坐标,返回球体表面的点 |  |  |  |     //捕获椭球体,将笛卡尔二维平面坐标转为椭球体的笛卡尔三维坐标,返回球体表面的点 | 
			
		
	
		
		
			
				
					
					|  |  |  |     let position: any = _viewer.scene.pickPosition(e.endPosition) |  |  |  |     let position: any = _viewer.scene.pickPosition(e.endPosition) | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (!position) { |  |  |  |     if (!position) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       position = _viewer.scene.camera.pickEllipsoid(e.startPosition, _viewer.scene.globe.ellipsoid) |  |  |  |       position = _viewer.scene.camera.pickEllipsoid( | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         e.startPosition, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         _viewer.scene.globe.ellipsoid, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       ) | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (position) { |  |  |  |     if (position) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       //将笛卡尔三维坐标转为地图坐标(弧度) |  |  |  |       //将笛卡尔三维坐标转为地图坐标(弧度) | 
			
		
	
		
		
			
				
					
					|  |  |  |       let cartographic =  _viewer.scene.globe.ellipsoid.cartesianToCartographic(position); |  |  |  |       let cartographic = | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         _viewer.scene.globe.ellipsoid.cartesianToCartographic(position) | 
			
		
	
		
		
			
				
					
					|  |  |  |       try { |  |  |  |       try { | 
			
		
	
		
		
			
				
					
					|  |  |  |         // 将地图坐标(弧度)转为十进制的度数 |  |  |  |         // 将地图坐标(弧度)转为十进制的度数 | 
			
		
	
		
		
			
				
					
					|  |  |  |         nowLatStr = Math.toDegrees(cartographic.latitude).toFixed(7) // 纬度 |  |  |  |         nowLatStr = Math.toDegrees(cartographic.latitude).toFixed(7) // 纬度 | 
			
		
	
		
		
			
				
					
					|  |  |  |         nowLonStr = Math.toDegrees(cartographic.longitude).toFixed(7) // 经度 |  |  |  |         nowLonStr = Math.toDegrees(cartographic.longitude).toFixed(7) // 经度 | 
			
		
	
		
		
			
				
					
					|  |  |  |         let camera_alt = (_viewer.camera.positionCartographic.height / 1000) // 视高 |  |  |  |         let camera_alt = _viewer.camera.positionCartographic.height / 1000 // 视高 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         // 相机低于250、俯仰角小于-80度时才计算海拔高度(否则误差大) |  |  |  |         // 相机低于250、俯仰角小于-80度时才计算海拔高度(否则误差大) | 
			
		
	
		
		
			
				
					
					|  |  |  |         let needElevation: boolean = camera_alt < 250 && (_viewer.camera.pitch < -(Math.PI/180)*80) |  |  |  |         let needElevation: boolean = | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         let elevStr = needElevation? _viewer.scene.globe.getHeight(cartographic)?.toFixed(2)?? '' : '' // 海拔 |  |  |  |           camera_alt < 250 && _viewer.camera.pitch < -(Math.PI / 180) * 80 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         let elevStr = needElevation | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           ? _viewer.scene.globe.getHeight(cartographic)?.toFixed(2) ?? '' | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           : '' // 海拔 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if(isDecimal.value) {   //如果是十进制度 |  |  |  |         if (isDecimal.value) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |           //如果是十进制度 | 
			
		
	
		
		
			
				
					
					|  |  |  |           lonlatStr.value = `经度:${nowLonStr} , 纬度:${nowLatStr} , 海拔(m):${elevStr}` |  |  |  |           lonlatStr.value = `经度:${nowLonStr} , 纬度:${nowLatStr} , 海拔(m):${elevStr}` | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         else { |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |           lonlatStr.value = `经度:${Angle.DecimalDegree2DMS(nowLonStr)} , 纬度:${Angle.DecimalDegree2DMS(nowLatStr)} , 海拔(m):${elevStr}` |  |  |  |           lonlatStr.value = `经度:${Angle.DecimalDegree2DMS(nowLonStr)} , 纬度:${Angle.DecimalDegree2DMS(nowLatStr)} , 海拔(m):${elevStr}` | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |       } catch (e) {} |  |  |  |       } catch (e) {} | 
			
		
	
	
		
		
			
				
					|  |  | @ -47,10 +54,12 @@ onMounted(()=>{ | 
			
		
	
		
		
			
				
					
					|  |  |  | function lonlatClick() { |  |  |  | function lonlatClick() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   let elevStr = lonlatStr.value.split('海拔')[1] |  |  |  |   let elevStr = lonlatStr.value.split('海拔')[1] | 
			
		
	
		
		
			
				
					
					|  |  |  |   if (isDecimal.value) { |  |  |  |   if (isDecimal.value) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     lonlatStr.value = `经度:${Angle.DecimalDegree2DMS(nowLonStr)} , 纬度:${Angle.DecimalDegree2DMS(nowLatStr)} , 海拔(m)` + elevStr |  |  |  |     lonlatStr.value = | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |       `经度:${Angle.DecimalDegree2DMS(nowLonStr)} , 纬度:${Angle.DecimalDegree2DMS(nowLatStr)} , 海拔(m)` + | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   else { |  |  |  |       elevStr | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     lonlatStr.value = `经度:${nowLonStr} , 纬度:${nowLatStr} , 海拔(m)` + elevStr |  |  |  |   } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     lonlatStr.value = | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       `经度:${nowLonStr} , 纬度:${nowLatStr} , 海拔(m)` + elevStr | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   isDecimal.value = !isDecimal.value |  |  |  |   isDecimal.value = !isDecimal.value | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | @ -84,8 +93,8 @@ function lonlatClick() { | 
			
		
	
		
		
			
				
					
					|  |  |  |   margin-left: 2rem; |  |  |  |   margin-left: 2rem; | 
			
		
	
		
		
			
				
					
					|  |  |  |   background: none; |  |  |  |   background: none; | 
			
		
	
		
		
			
				
					
					|  |  |  |   border: none; |  |  |  |   border: none; | 
			
		
	
		
		
			
				
					
					|  |  |  |   color: #FFFFFF; |  |  |  |   color: #ffffff; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |   font-size: .8rem; |  |  |  |   font-size: 0.8rem; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | #lonlatText:hover { |  |  |  | #lonlatText:hover { | 
			
		
	
		
		
			
				
					
					|  |  |  |   cursor: pointer; |  |  |  |   cursor: pointer; | 
			
		
	
	
		
		
			
				
					|  |  | 
 |