|
import { EDeviceTypeName, EHmsLevel } from '@/types/enums'
|
import cesiumOperation from '@/utils/cesium-tsa'
|
import { analyzeKmzFile, XMLToJSON } from '@/utils/cesium/kmz.js'
|
import IndexedDBService from '@/utils/indexDB'
|
import CreateFrustum from '@/utils/cesium/frustum/CreateFrustum'
|
import { useMyStore } from '@/store'
|
import { getTwoPointInfo } from '@/api/manage'
|
|
const { getEntityById, removeById, globalCesium, addLeftClickEvent, removeLeftClickEvent, flyTo } = cesiumOperation()
|
// 无人机实体
|
let droneEntity = null
|
|
// 激光实体
|
let laserEntity = null
|
|
// 两点之间线实体
|
let twoLineEntity = null
|
let myAppEntity = null;
|
export function droneFly () {
|
const store = useMyStore()
|
let deviceInfo = {} // 无人机信息
|
let dockInfo = {} // 机场信息
|
let previousPositions = []
|
let wId = ''
|
let snCode = []
|
let viewDroneInfo = {} // 获取实时经纬度
|
let waylinePoints = [] // 当前航线点
|
let currentTaskCreateTime = null // 当前飞行任务创建时间
|
let switchSaving = true // 有selectedWorkSpaceId 就为true
|
// 航线飞行处于第几个点位
|
let currentWaypointIndex = 0
|
// 速度集合
|
let droneSpeedArr = []
|
let lastTime = null
|
let viewInfoFrustum = null
|
|
// 手机设备定位
|
let me_latitude = 0;
|
let me_longitude = 0;
|
let me_altitude = 0;
|
// 扫射定位
|
let measure_target_longitude = 0;
|
let measure_target_latitude = 0;
|
let measure_target_altitude = 0;
|
|
|
async function initDock(data:any, sn:any, dockSn:any, workspaceId:any, ssLinePath:any, viewDroneInfo:any) {
|
// 获取workspaceId
|
wId = workspaceId
|
// 给无人机参数赋值
|
deviceInfo = data.deviceInfo[`${sn}`]
|
// 机场信息
|
dockInfo = data.dockInfo[`${dockSn}`]
|
viewDroneInfo = viewDroneInfo
|
console.log('导致地图不显示原因1',viewDroneInfo.longitude)
|
// 当前飞行任务创建时间
|
if (data.currentType === EDeviceTypeName.Aircraft && deviceInfo) {
|
const droneLngLat = {
|
latitude: deviceInfo.latitude || 0,
|
longitude: deviceInfo.longitude || 0,
|
}
|
// 当飞机模型存在
|
if (droneEntity) {
|
// 且在空中飞行时,实时更新飞机模型的位置
|
if (deviceInfo.mode_code && [3, 4, 5, 9, 10, 16].includes(deviceInfo.mode_code)) {
|
if (store.currentAngle == 3) {
|
viewInfoFrustum?.clear()
|
} else {
|
initCreateFrustum(deviceInfo, viewDroneInfo)
|
}
|
addFlyGltf(
|
viewDroneInfo.longitude,
|
viewDroneInfo.latitude,
|
deviceInfo.height,
|
deviceInfo.payloads[0],
|
deviceInfo.attitude_head,
|
deviceInfo,
|
dockInfo,
|
ssLinePath
|
)
|
let domain = sessionStorage.getItem('domain')
|
if (domain !== '0') {
|
addFlyLaser(
|
deviceInfo.payloads[0]
|
)
|
}
|
setelCamera(
|
viewDroneInfo.longitude,
|
viewDroneInfo.latitude,
|
deviceInfo.height,
|
deviceInfo.payloads[0],
|
deviceInfo.attitude_head,
|
)
|
} else {
|
removeById('drone_fly')
|
droneEntity = null
|
|
lastTime = null
|
viewInfoFrustum?.clear()
|
viewInfoFrustum = null
|
|
window.cesiumViewer.camera.lookAtTransform(globalCesium.Matrix4.IDENTITY)
|
store.commit('SET_CURRENTANGLE', 1)
|
}
|
} else {
|
if (deviceInfo.mode_code && [3, 4, 5, 9, 10].includes(deviceInfo.mode_code)) {
|
initCreateFrustum(deviceInfo, viewDroneInfo)
|
addFlyGltf(
|
viewDroneInfo.longitude,
|
viewDroneInfo.latitude,
|
deviceInfo.height,
|
deviceInfo.payloads[0],
|
deviceInfo.attitude_head,
|
deviceInfo,
|
dockInfo,
|
ssLinePath
|
)
|
let domain = sessionStorage.getItem('domain')
|
if (domain !== '0') {
|
addFlyLaser(
|
deviceInfo.payloads[0]
|
)
|
}
|
}
|
}
|
const imgRightBlue = new URL('@/assets/images/arrow-right-pink.png', import.meta.url).href
|
// 无人机路线轨迹,判断是否存在drone_route_remove
|
if (getEntityById('drone_route_remove')) {
|
window.cesiumViewer.entities.add({
|
name: 'drone_route_remove',
|
id: 'drone_route_remove',
|
polyline: {
|
width: 7,
|
positions: previousPositions,
|
material: new ImageTrailMaterial({
|
color: globalCesium.Color.ORANGE,
|
speed: 10,
|
image: imgRightBlue,
|
repeat: { x: 1, y: 0 },
|
}),
|
clampToGround: false,
|
},
|
})
|
}
|
|
if (data.deviceInfo[data.currentSn].mode_code && [3, 4, 5, 9, 10].includes(deviceInfo.mode_code)) {
|
if (switchSaving) return (switchSaving = false)
|
// console.log('5555', data.deviceInfo[data.currentSn].longitude)
|
const newPositions = globalCesium.Cartesian3.fromDegrees(
|
data.deviceInfo[data.currentSn].longitude,
|
data.deviceInfo[data.currentSn].latitude,
|
Math.floor(viewDroneInfo.elevation),
|
)
|
//若刷新,恢复无人机之前的路线轨迹
|
const dataIndexedDB = await IndexedDBService.getDataById(wId)
|
if (previousPositions.length == 0 && dataIndexedDB) {
|
previousPositions = previousPositions.concat(dataIndexedDB?.temporaryflightData)
|
} else {
|
previousPositions = previousPositions.concat(newPositions)
|
}
|
// 保存无人机当前执行的路线,防止刷新数据丢失
|
if (!dataIndexedDB) {
|
await IndexedDBService.addData({
|
id: wId,
|
temporaryflightData: previousPositions,
|
})
|
} else {
|
await IndexedDBService.updateData(wId, {temporaryflightData: previousPositions})
|
}
|
// 更新线段的位置
|
const drone_route_remove = getEntityById('drone_route_remove')
|
if (!drone_route_remove) return
|
drone_route_remove.polyline.positions = previousPositions
|
drone_route_remove.polyline._material._repeat._value.x = Math.floor(previousPositions.length / 7)
|
} else if ([0, 14].includes(deviceInfo.mode_code)) {
|
previousPositions = []
|
await IndexedDBService.deleteData(wId)
|
const drone_route_remove = getEntityById('drone_route_remove')
|
if (!drone_route_remove) return
|
drone_route_remove.polyline.positions = previousPositions
|
removeById('drone_route_remove')
|
viewInfoFrustum?.clear()
|
viewInfoFrustum = null
|
}
|
}
|
if (data.currentType === EDeviceTypeName.Dock && data.dockInfo[data.currentSn]) {
|
if (!deviceInfo?.basic_osd?.longitude || !deviceInfo?.basic_osd?.latitude) return
|
console.log('6666', deviceInfo?.basic_osd?.longitude)
|
if (snCode.includes(data.currentSn)) return
|
snCode.push(data.currentSn)
|
}
|
}
|
|
const imgLaser = new URL('@/assets/images/laser.png', import.meta.url).href
|
// 增加激光扫射点
|
function addFlyLaser(payloads:any) {
|
const startPosition = globalCesium.Cartesian3.fromDegrees(
|
me_longitude, me_latitude, 0
|
)
|
const position = globalCesium.Cartesian3.fromDegrees(
|
payloads.measure_target_longitude, payloads.measure_target_latitude, payloads.measure_target_altitude
|
)
|
measure_target_longitude = payloads.measure_target_longitude;
|
measure_target_latitude = payloads.measure_target_latitude;
|
measure_target_altitude = payloads.measure_target_altitude;
|
|
if (laserEntity && laserEntity != null) {
|
laserEntity.position = new globalCesium.CallbackProperty(function () {
|
return position
|
}, false)
|
// laserEntity.orientation = new globalCesium.CallbackProperty(function () {
|
// return orientation
|
// }, false)
|
|
laserEntity.show = true
|
|
window.cesiumViewer.scene.requestRender()
|
} else {
|
laserEntity = window.cesiumViewer.entities.add({
|
position,
|
id: 'laser_coordinate',
|
billboard: {
|
image: imgLaser,
|
outlineWidth: 0,
|
width: 36,
|
height: 36,
|
scale: 1.0,
|
}
|
})
|
}
|
removeById('route_two_line')
|
twoLineEntity = window.cesiumViewer.entities.add({
|
id: 'route_two_line',
|
polyline: {
|
positions: new globalCesium.CallbackProperty(() => [startPosition, position], false),
|
width: 5,
|
material: new globalCesium.PolylineDashMaterialProperty({
|
color: globalCesium.Color.YELLOW, // 虚线颜色
|
dashLength: 6.0, // 虚线段的长度
|
}),
|
zIndex: 1,
|
clampToGround: false,
|
}
|
})
|
// 增加激光扫射信息
|
laserEntity.label = new globalCesium.LabelGraphics({
|
text: `目标海拔:${Math.ceil(payloads.measure_target_altitude)}m\n测距距离:${Math.round(
|
Math.ceil(payloads.measure_target_distance),
|
)}m`,
|
font: '13px monospace',
|
showBackground: true,
|
horizontalOrigin: globalCesium.HorizontalOrigin.CENTER,
|
verticalOrigin: globalCesium.VerticalOrigin.BOTTOM,
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
pixelOffset: new globalCesium.Cartesian2(0, -40),
|
show: true,
|
})
|
}
|
|
function addFlyGltf (lng:any, lat:any, alt:any, payloads:any, attitude_head:any, deviceInfo:any, dockInfo:any, ssLinePath:any) {
|
const { gimbal_pitch, gimbal_yaw } = payloads
|
const position = globalCesium.Cartesian3.fromDegrees(
|
lng, lat, alt
|
)
|
|
const heading = globalCesium.Math.toRadians(Number(attitude_head)) //135度转弧度
|
const pitch = globalCesium.Math.toRadians(0)
|
const roll = 0
|
const hpr = new globalCesium.HeadingPitchRoll(heading, pitch, roll)
|
const orientation = globalCesium.Transforms.headingPitchRollQuaternion(
|
position,
|
hpr,
|
)
|
|
if (droneEntity && droneEntity != null) {
|
droneEntity.position = new globalCesium.CallbackProperty(function () {
|
return position
|
}, false)
|
|
droneEntity.orientation = new globalCesium.CallbackProperty(function () {
|
return orientation
|
}, false)
|
|
droneEntity.show = true
|
|
window.cesiumViewer.scene.requestRender()
|
} else {
|
droneEntity = window.cesiumViewer.entities.add({
|
show: true,
|
position,
|
id: 'drone_fly',
|
orientation: orientation,
|
model: {
|
uri: '/pilot-h5/gltf/dajiang-processed.gltf', //注意entitits.add方式加载gltf文件时,这里是uri,不是url,并且这种方式只能加载.glb格式的文件
|
scale: 1, //缩放比例
|
minimumPixelSize: 64, //最小像素大小,可以避免太小看不见
|
maximumScale: 128, //模型的最大比例尺大小。minimumPixelSize的上限
|
incrementallyLoadTextures: true, //加载模型后纹理是否可以继续流入
|
runAnimations: true, //是否启动模型中制定的gltf动画
|
clampAnimations: true, //制定gltf动画是否在没有关键帧的持续时间内保持最后一个姿势
|
shadows: globalCesium.ShadowMode.ENABLED,
|
heightReference: globalCesium.HeightReference.NONE,
|
},
|
})
|
}
|
|
// 创建无人机信息
|
createDroneEntityLabel(droneEntity, deviceInfo, dockInfo, ssLinePath)
|
}
|
// 创建无人机信息
|
async function createDroneEntityLabel (entity:any, deviceInfo:any, dockInfo:any, ssLinePath:any) {
|
deviceInfo = deviceInfo
|
if (currentTaskCreateTime === null) return
|
if (!deviceInfo?.longitude && !deviceInfo?.latitude) return
|
if (deviceInfo.mode_code !== 5) {
|
currentTaskCreateTime = null
|
return
|
}
|
const executingWayline = store.executingWayline
|
if (!executingWayline?.id) return
|
if (waylinePoints.length === 0) {
|
// 改成获取航线地址
|
// const routeRes = await getRoutePlanningUrl(
|
// wId,
|
// executingWayline.id,
|
// )
|
// const routeData = routeRes.data
|
// if (routeData.code !== 0) return this.$message.error('获取航线信息失败!')
|
waylinePoints = await getWaylineFilePoints(ssLinePath)
|
}
|
|
const nextPoint = waylinePoints[currentWaypointIndex]
|
if (!nextPoint) return
|
// 两点之间的距离
|
console.log('8888', deviceInfo.longitude)
|
const devicePosition = globalCesium.Cartesian3.fromDegrees(
|
Number(deviceInfo.longitude),
|
Number(deviceInfo.latitude),
|
0,
|
)
|
console.log('9999', nextPoint.longitude)
|
const targetPosition = globalCesium.Cartesian3.fromDegrees(
|
Number(nextPoint.longitude),
|
Number(nextPoint.latitude),
|
0,
|
)
|
// 距离下个点位的距离
|
let distance = globalCesium.Cartesian3.distance(
|
devicePosition,
|
targetPosition,
|
)
|
const dockPosition = {
|
longitude: dockInfo?.basic_osd?.longitude,
|
latitude: dockInfo?.basic_osd?.latitude,
|
}
|
|
const distArr = waylinePoints.map((lnglat, index) => {
|
const { longitude, latitude } = lnglat
|
console.log('10000', longitude)
|
// 两点之间的距离
|
let devicePosition = null
|
if (index === 0) {
|
devicePosition = globalCesium.Cartesian3.fromDegrees(
|
Number(dockPosition.longitude),
|
Number(dockPosition.latitude),
|
0,
|
)
|
} else {
|
console.log('110', prevPoint.longitude)
|
const prevPoint = waylinePoints[index - 1]
|
devicePosition = globalCesium.Cartesian3.fromDegrees(
|
Number(prevPoint.longitude),
|
Number(prevPoint.latitude),
|
0,
|
)
|
}
|
const targetPosition = globalCesium.Cartesian3.fromDegrees(
|
Number(longitude),
|
Number(latitude),
|
0,
|
)
|
let distance = globalCesium.Cartesian3.distance(
|
devicePosition,
|
targetPosition,
|
)
|
return Math.round(distance)
|
})
|
// 计算到达点位和之前点位的总距离
|
let sum = null
|
if (distArr.length > 2) {
|
sum = distArr
|
.slice(0, currentWaypointIndex)
|
.reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
} else {
|
sum = distArr.reduce(
|
(accumulator, currentValue) => accumulator + currentValue,
|
0,
|
)
|
}
|
|
if (sum == 0) {
|
sum = distArr[0]
|
}
|
|
// 距离机场的位置
|
const homeDistance = Math.floor(deviceInfo.home_distance) || 0
|
// 速度
|
let horizontalSpeed = deviceInfo.horizontal_speed || 0
|
if (!droneSpeedArr.includes(horizontalSpeed) && horizontalSpeed > 1) {
|
droneSpeedArr.push(horizontalSpeed)
|
}
|
// 平均速度
|
const averageSpeed =
|
droneSpeedArr.reduce((sum, current) => sum + current, 0) /
|
droneSpeedArr.length
|
// 已用时间
|
let usedTime = Math.round((new Date().getTime() - currentTaskCreateTime) / 1000) - 30
|
let throughDistance = usedTime * averageSpeed
|
|
if (throughDistance < 0) {
|
throughDistance = 0
|
usedTime = 0
|
}
|
if (isNaN(throughDistance)) {
|
throughDistance = 0
|
}
|
if (isNaN(usedTime)) {
|
usedTime = 0
|
}
|
if (usedTime > 60) {
|
const minute = Math.floor(usedTime / 60)
|
const second = Math.round(usedTime % 60)
|
usedTime = `${minute}m${second}s`
|
} else {
|
usedTime = Math.round(usedTime) + 's'
|
}
|
|
if (horizontalSpeed < 5) {
|
horizontalSpeed = 10
|
}
|
// 预计到达下一个航点时间
|
let arrivalTime = distance / horizontalSpeed
|
if (arrivalTime === Infinity || isNaN(arrivalTime)) {
|
arrivalTime = 0
|
}
|
if (arrivalTime > 60) {
|
const minute = Math.floor(arrivalTime / 60)
|
const second = Math.round(arrivalTime % 60)
|
arrivalTime = `${minute}m${second}s`
|
} else {
|
arrivalTime = Math.round(arrivalTime) + 's'
|
}
|
entity.label = new globalCesium.LabelGraphics({
|
text: `距离机场水平距离:${homeDistance}m\n距离下一个航点:${Math.round(
|
distance,
|
)}m\n预计到达下一航点时间:${arrivalTime}\n本次飞行时间:${usedTime}\n本次航线平面里程:${Math.round(
|
throughDistance,
|
)}m`,
|
font: '13px monospace',
|
showBackground: true,
|
horizontalOrigin: globalCesium.HorizontalOrigin.CENTER,
|
verticalOrigin: globalCesium.VerticalOrigin.BOTTOM,
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
pixelOffset: new globalCesium.Cartesian2(0, -40),
|
show: true,
|
})
|
}
|
async function getWaylineFilePoints(fileUrl:any) {
|
const fileRes = await analyzeKmzFile(fileUrl);
|
const waylineContent = await fileRes['fileInfoObj']?.['wpmz/waylines.wpml'];
|
const xml = XMLToJSON(waylineContent);
|
const placemarkArr = xml?.Document?.Folder.Placemark;
|
const points = placemarkArr.map((placemark) => {
|
const lnglat = placemark.Point.coordinates?.['#text'].split(',');
|
return {
|
longitude: lnglat[0],
|
latitude: lnglat[1],
|
};
|
});
|
return points;
|
}
|
|
function setelCamera (lng, lat, alt, payloads, attitude_head) {
|
const { gimbal_pitch, gimbal_yaw } = payloads
|
let time = 0
|
|
let current = store.currentAngle
|
var heading = globalCesium.Math.toRadians(Number(gimbal_yaw || attitude_head)) // 相机左右方向
|
|
if (current == 1) {
|
lastTime = null
|
droneEntity.show = true
|
window.cesiumViewer.camera.lookAtTransform(globalCesium.Matrix4.IDENTITY)
|
} else if (current == 2) {
|
lastTime = null
|
droneEntity.show = true
|
window.cesiumViewer.camera.lookAtTransform(globalCesium.Matrix4.IDENTITY)
|
|
let center = globalCesium.Cartesian3.fromDegrees(lng, lat)
|
|
window.cesiumViewer.camera.lookAt(center, new globalCesium.Cartesian3(0.0, 0, 1500))
|
} else if (current == 3) {
|
droneEntity.show = false
|
|
let curTime = Date.now()
|
if (lastTime && lastTime != null) {
|
time = (curTime - lastTime) / 1000
|
}
|
|
window.cesiumViewer.camera.lookAtTransform(globalCesium.Matrix4.IDENTITY)
|
let center = globalCesium.Cartesian3.fromDegrees(lng, lat, alt)
|
var pitch = globalCesium.Math.toRadians(pitchAngle({ gimbal_pitch })) // 相机上下方向,负值表示向下看
|
|
window.cesiumViewer.camera.flyTo({
|
destination: center,
|
orientation: {
|
heading,
|
pitch,
|
roll: 0
|
},
|
duration: time,
|
complete () {
|
window.cesiumViewer.camera.lookAt(center, new globalCesium.HeadingPitchRange(
|
heading,
|
pitch,
|
0.01
|
))
|
}
|
})
|
|
lastTime = Date.now()
|
}
|
}
|
// pitch
|
function pitchAngle (options) {
|
const gimbal_pitch = Number(options?.gimbal_pitch) || 0
|
return gimbal_pitch
|
}
|
// 创建视锥
|
function initCreateFrustum (deviceInfo:any, test:any) {
|
|
if (!deviceInfo || !deviceInfo.longitude || !deviceInfo.latitude) return
|
|
const attitude_head = 180 + deviceInfo.attitude_head
|
|
const gimbal_pitch = 90 - pitchAngle({ gimbal_pitch: deviceInfo.payloads[0].gimbal_pitch })
|
|
viewInfoFrustum?.clear()
|
viewInfoFrustum = new CreateFrustum(window.cesiumViewer, {
|
position: {
|
longitude: test.longitude,
|
latitude: test.latitude,
|
altitude: deviceInfo.height,
|
},
|
width: 30,
|
height: 30,
|
fov: 20.0,
|
near: 3.0,
|
far: 250.0,
|
roll: gimbal_pitch,
|
pitch: 0,
|
heading: attitude_head,
|
})
|
}
|
|
// 获取手机定位和激光发射定位的高度和距离
|
function getTwoHeightWidth(workspaceId:String) {
|
// 国内地图不会为0或者小于0
|
console.log('自身定位经纬度1', me_latitude)
|
console.log('自身定位经纬度2', me_longitude)
|
console.log('激光扫过定位1', measure_target_latitude)
|
console.log('激光扫过定位2', measure_target_longitude)
|
if (me_latitude <= 0 || me_longitude <= 0 || measure_target_latitude <= 0 || measure_target_longitude <= 0) return
|
getTwoPointInfo(workspaceId,me_latitude,me_longitude,measure_target_latitude,measure_target_longitude).then((res:any) => {
|
const heightDifference = res.data.heightDifference
|
const distance = res.data.distance
|
// 增加激光扫射信息
|
myAppEntity.label = new globalCesium.LabelGraphics({
|
text: `高度:${Math.ceil(heightDifference)}m\n距离:${Math.round(
|
Math.ceil(distance),
|
)}m`,
|
font: '13px monospace',
|
showBackground: true,
|
horizontalOrigin: globalCesium.HorizontalOrigin.CENTER,
|
verticalOrigin: globalCesium.VerticalOrigin.BOTTOM,
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
pixelOffset: new globalCesium.Cartesian2(0, -40),
|
show: true,
|
})
|
})
|
}
|
|
const meMapSrc = new URL('@/assets/images/me.png', import.meta.url).href
|
// 获取手机设备定位
|
function getPhoneLocation(value:Boolean, workspaceId:String) {
|
if (window.cesiumViewer == null) return
|
// 创建一个箭头实体
|
removeById('me_dw')
|
myAppEntity = window.cesiumViewer.entities.add({
|
id: 'me_dw',
|
position: globalCesium.Cartesian3.fromDegrees(0, 0, 0), // 初始位置
|
billboard: {
|
image: meMapSrc, // 箭头图片路径
|
width: 30,
|
height: 30,
|
alignedAxis: globalCesium.Cartesian3.UNIT_Z, // 对齐轴
|
},
|
// orientation: new globalCesium.CallbackProperty(() => {
|
// return globalCesium.Transforms.headingPitchRollQuaternion(
|
// myAppEntity.position.getValue(window.cesiumViewer.clock.currentTime),
|
// new globalCesium.HeadingPitchRoll(heading, 0, 0) // 设置朝向
|
// );
|
// }, false),
|
});
|
|
let heading = 0; // 初始朝向
|
// 获取设备朝向
|
// if (window.DeviceOrientationEvent) {
|
// window.addEventListener('deviceorientation', (event) => {
|
// if (event.alpha !== null) {
|
// heading = globalCesium.Math.toRadians(event.alpha); // 将 alpha 转换为弧度
|
// }
|
// });
|
// } else {
|
// console.log('手机不支持.');
|
// }
|
|
// 获取设备位置
|
if (navigator.geolocation) {
|
navigator.geolocation.watchPosition((position) => {
|
me_longitude = position.coords.longitude;
|
me_latitude = position.coords.latitude;
|
me_altitude = position.coords.altitude || 0;
|
|
// 更新箭头实体的位置
|
myAppEntity.position = globalCesium.Cartesian3.fromDegrees(me_longitude, me_latitude, me_altitude);
|
if (value) {
|
// 将相机定位到设备位置 只有点击图标才可以执行这里
|
window.cesiumViewer.camera.setView({
|
destination: globalCesium.Cartesian3.fromDegrees(me_longitude, me_latitude, me_altitude + 1000), // 相机高度
|
// orientation: {
|
// heading: heading, // 相机朝向
|
// pitch: globalCesium.Math.toRadians(-90), // 俯视角度
|
// roll: 0,
|
// },
|
});
|
}
|
// 查看两条线直接距离和高度
|
getTwoHeightWidth(workspaceId)
|
}, (error) => {
|
console.error('定位有误:', error);
|
});
|
} else {
|
console.log('手机不支持.');
|
}
|
}
|
|
|
return {
|
initDock,
|
getPhoneLocation,
|
}
|
}
|