|  |  |  | @ -5,9 +5,10 @@ | 
		
	
		
			
				|  |  |  |  | --> | 
		
	
		
			
				|  |  |  |  | <script setup lang="ts"> | 
		
	
		
			
				|  |  |  |  | import { Angle } from '@/utils/map/angle.ts' | 
		
	
		
			
				|  |  |  |  | import {ScreenSpaceEventHandler, Math, ScreenSpaceEventType} from 'cesium' | 
		
	
		
			
				|  |  |  |  | import {ScreenSpaceEventHandler, Math, ScreenSpaceEventType, Cartesian3, Cartographic} from 'cesium' | 
		
	
		
			
				|  |  |  |  | import {onMounted, ref} from "vue"; | 
		
	
		
			
				|  |  |  |  | import {cartesian2ToCartesian3} from "@/utils/map/coordinate.ts"; | 
		
	
		
			
				|  |  |  |  | import {elevationProfile} from "@/utils/map/SpatialAnalysis.ts"; | 
		
	
		
			
				|  |  |  |  | let nowLatStr: string, nowLonStr: string | 
		
	
		
			
				|  |  |  |  | let lonlatStr = ref('') | 
		
	
		
			
				|  |  |  |  | let isDecimal = ref(true) | 
		
	
	
		
			
				
					|  |  |  | @ -29,7 +30,7 @@ onMounted(()=>{ | 
		
	
		
			
				|  |  |  |  |         let camera_alt = (_viewer.camera.positionCartographic.height / 1000) // 视高 | 
		
	
		
			
				|  |  |  |  |         // 相机低于250、俯仰角小于-80度时才计算海拔高度(否则误差大) | 
		
	
		
			
				|  |  |  |  |         let needElevation: boolean = camera_alt < 250 && (_viewer.camera.pitch < -(Math.PI/180)*80) | 
		
	
		
			
				|  |  |  |  |         let elevStr = needElevation? _viewer.scene.globe.getHeight(cartographic)?.toFixed(2)+'m'?? '' : '高度过高' | 
		
	
		
			
				|  |  |  |  |         let elevStr = needElevation? Cartographic.fromCartesian(position).height.toFixed(2)+'m'?? '' : '高度过高' | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         if(isDecimal.value) {   //如果是十进制度 | 
		
	
		
			
				|  |  |  |  |           lonlatStr.value = `经度: ${nowLonStr}°, 纬度: ${nowLatStr}°, 高度: ${elevStr}` | 
		
	
	
		
			
				
					|  |  |  | @ -45,7 +46,6 @@ onMounted(()=>{ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | function lonlatClick() { | 
		
	
		
			
				|  |  |  |  |   let elevStr = lonlatStr.value.split('高度')[1] | 
		
	
		
			
				|  |  |  |  |   console.log(elevStr) | 
		
	
		
			
				|  |  |  |  |   if(isDecimal.value){ | 
		
	
		
			
				|  |  |  |  |     lonlatStr.value = `经度: ${Angle.DecimalDegree2DMS(nowLonStr)}, 纬度: ${Angle.DecimalDegree2DMS(nowLatStr)}, 高度` + elevStr | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
	
		
			
				
					|  |  |  | @ -53,6 +53,7 @@ function lonlatClick() { | 
		
	
		
			
				|  |  |  |  |     lonlatStr.value = `经度: ${nowLonStr}°, 纬度: ${nowLatStr}°, 高度` + elevStr | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  |   isDecimal.value = !isDecimal.value | 
		
	
		
			
				|  |  |  |  |   elevationProfile(window.viewer, Cartesian3.fromDegrees(119.0,30.05),Cartesian3.fromDegrees(119.05,30.0),500) | 
		
	
		
			
				|  |  |  |  | } | 
		
	
		
			
				|  |  |  |  | </script> | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |