|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
import { Angle } from '@/utils/map/angle.ts'
|
|
|
|
|
import { ScreenSpaceEventHandler, Math, ScreenSpaceEventType } from 'cesium'
|
|
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
|
|
import { cartesian2ToCartesian3 } from '@/utils/map/coordinate'
|
|
|
|
|
let nowLatStr: string, nowLonStr: string
|
|
|
|
|
let lonlatStr = ref('')
|
|
|
|
|
let isDecimal = ref(true)
|
|
|
|
@ -15,15 +16,16 @@ onMounted(() => {
|
|
|
|
|
let _viewer = window.viewer
|
|
|
|
|
let canvas = _viewer.scene.canvas
|
|
|
|
|
let handler = new ScreenSpaceEventHandler(canvas)
|
|
|
|
|
handler.setInputAction((e: any) => {
|
|
|
|
|
handler.setInputAction((e: ScreenSpaceEventHandler.MotionEvent) => {
|
|
|
|
|
//捕获椭球体,将笛卡尔二维平面坐标转为椭球体的笛卡尔三维坐标,返回球体表面的点
|
|
|
|
|
let position: any = _viewer.scene.pickPosition(e.endPosition)
|
|
|
|
|
if (!position) {
|
|
|
|
|
position = _viewer.scene.camera.pickEllipsoid(
|
|
|
|
|
e.startPosition,
|
|
|
|
|
_viewer.scene.globe.ellipsoid,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
// let position: any = _viewer.scene.pickPosition(e.endPosition)
|
|
|
|
|
// if (!position) {
|
|
|
|
|
// position = _viewer.scene.camera.pickEllipsoid(
|
|
|
|
|
// e.startPosition,
|
|
|
|
|
// _viewer.scene.globe.ellipsoid,
|
|
|
|
|
// )
|
|
|
|
|
// }
|
|
|
|
|
let position = cartesian2ToCartesian3(_viewer, e.endPosition)
|
|
|
|
|
if (position) {
|
|
|
|
|
//将笛卡尔三维坐标转为地图坐标(弧度)
|
|
|
|
|
let cartographic =
|
|
|
|
|