| | |
| | | } |
| | | } |
| | | 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 (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.deviceInfo[data.currentSn].mode_code && [3, 4, 5, 9, 10].includes(deviceInfo.mode_code)) { |
| | | if (switchSaving) return (switchSaving = false) |
| | | 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 |