增加app设备定位和激光扫射定位以及目标高度和测距距离
5 files modified
2 files added
| | |
| | | loadLAYER, |
| | | } = cesiumOperation() |
| | | |
| | | // const vConsole = new VConsole(); |
| | | const vConsole = new VConsole(); |
| | | |
| | | let globalViewer = null |
| | | |
| | |
| | | const imageUrl = new URL('@/assets/images/norecord.png', import.meta.url).href |
| | | |
| | | const imageMapSrc = new URL('@/assets/images/mapdock.png', import.meta.url).href |
| | | |
| | | const meMapSrc = new URL('@/assets/images/me.png', import.meta.url).href |
| | | |
| | | const jgbMapSrc = new URL('@/assets/images/jgb.png', import.meta.url).href |
| | | |
| | | const mapswitching = new URL('@/assets/images/mapswitching.png', import.meta.url).href |
| | | |
| | |
| | | break |
| | | } |
| | | case EBizCode.DeviceOsd: { |
| | | // console.log('低调点',payload) |
| | | store.commit('SET_DEVICE_INFO', payload.data) |
| | | store.commit('SET_WS_MESSAGE', payload) |
| | | break |
| | |
| | | // await _init('cesiumContainerBigMap'); |
| | | // await getWrjSsLx(); |
| | | } else { |
| | | console.log('是否进来',landscapeBox) |
| | | isLandscape.value = false; |
| | | updateScreenSize() |
| | | landscapeBox.style.display = 'inherit'; |
| | |
| | | const getWrjSsLx = () => { |
| | | getWaylineFile(sbInfo.sn).then((res:any) => { |
| | | if (res.code != 200) return |
| | | console.log('草草草草', res.data) |
| | | ssLinePath.value = res.data |
| | | globalViewer = window.cesiumViewer |
| | | // 先有航线,再飞行 |
| | |
| | | }) |
| | | } else { |
| | | // 当机场坐标存在时,判断获取的位置与机场坐标位置是否一致,若不是,重新更新位置 |
| | | let dornePoint = cartesian3Convert( |
| | | getEntityById('drone_dock')._position._value, |
| | | window.cesiumViewer, |
| | | ) |
| | | let dornePoint = cartesian3Convert(getEntityById('drone_dock')._position._value, window.cesiumViewer,) |
| | | getLongOk = getLnglatDist( |
| | | dornePoint.longitude, |
| | | dornePoint.latitude, |
| | |
| | | }, {deep: true}) |
| | | |
| | | watch(() => store.state.wsMessage, (newValue, oldValue) => { |
| | | // 控制台报 Expected longitude to be typeof number, actual typeof was undefined 是因为这里没有及时拿到longitude数据 |
| | | viewDroneInfo.longitude = newValue?.longitude |
| | | viewDroneInfo.latitude = newValue?.latitude |
| | | viewDroneInfo.elevation = Number(newValue?.elevation.toFixed(2)) + droneHeight.value |
| | |
| | | const xmlStr = await fileInfoObj['wpmz/template.kml'] |
| | | const xmlJson = XMLToJSON(xmlStr)?.['Document'] |
| | | const placemark = xmlJson.Folder.Placemark |
| | | console.log('看看航线值', placemark.Polygon) |
| | | if (placemark?.Polygon) { |
| | | // return 'planar' |
| | | planarWayline(ssLinePath.value, sbInfo.longitude, sbInfo.latitude) |
| | |
| | | } |
| | | } |
| | | |
| | | const me_latitude = ref(0); |
| | | const me_longitude = ref(0); |
| | | // const loading = ref(true); |
| | | // const error = ref(null); |
| | | // 获取自身定位 |
| | | const getLocation = () => { |
| | | if (window.cesiumViewer == null) return |
| | | if (navigator.geolocation) { |
| | | navigator.geolocation.getCurrentPosition( |
| | | (position) => { |
| | | console.log('333',position.coords.latitude) |
| | | console.log('333',position.coords.longitude) |
| | | me_latitude.value = position.coords.latitude; |
| | | me_longitude.value = position.coords.longitude; |
| | | // loading.value = false; |
| | | // 开始给自己定位 |
| | | getLnglatAltitude(me_longitude.value, me_latitude.value, window.cesiumViewer).then(res => { |
| | | removeById('me_coordinate') |
| | | window.cesiumViewer.entities.add({ |
| | | position: globalCesium.Cartesian3.fromDegrees( |
| | | me_longitude.value, |
| | | me_latitude.value, |
| | | res.height, |
| | | ), |
| | | id: 'me_coordinate', |
| | | billboard: { |
| | | image: meMapSrc, |
| | | outlineWidth: 0, |
| | | width: 36, |
| | | height: 36, |
| | | scale: 1.0, |
| | | } |
| | | }) |
| | | // window.cesiumViewer.scene.camera.setView({ |
| | | // destination: globalCesium.Cartesian3.fromDegrees( |
| | | // Number(me_longitude), |
| | | // Number(me_latitude), |
| | | // 10000.0, |
| | | // ), |
| | | // }) |
| | | // droneHeight.value = res.height |
| | | }) |
| | | }, |
| | | (err) => { |
| | | console.log('定位有误') |
| | | } |
| | | ); |
| | | } else { |
| | | console.log('您的浏览器不支持地理定位') |
| | | } |
| | | }; |
| | | |
| | | onMounted(async () => { |
| | | window.addEventListener('orientationchange', checkOrientation); |
| | | window.addEventListener('resize', checkOrientation); // 兼容某些设备 |
| | |
| | | await nextTick(); |
| | | await _init('cesiumContainerBigMap'); |
| | | await getWrjSsLx(); |
| | | |
| | | await getLocation() |
| | | |
| | | }); |
| | | |
| | |
| | | // 存储设备值 |
| | | let osdVisible = reactive<any>({}) |
| | | |
| | | // const vConsole = new VConsole(); |
| | | const vConsole = new VConsole(); |
| | | |
| | | // 点击信息详情 |
| | | const infoClick = (data:any) => { |
| | |
| | | } |
| | | |
| | | onMounted(() => { |
| | | |
| | | // navigator.geolocation.getCurrentPosition( |
| | | // (success) => { |
| | | // console.log(success.coords.longitude, '经纬度') |
| | | // position.value = { |
| | | // latitude: success.coords.latitude, |
| | | // longitude: success.coords.longitude, |
| | | // }; |
| | | // }) |
| | | |
| | | init() |
| | | // 设置定时器,每隔 3 秒刷新一次数据 |
| | | intervalId = setInterval(init, 3000); |
| | |
| | | content: var(--before-content); |
| | | position: absolute; |
| | | top: -1rem; |
| | | left: -0.5rem; |
| | | font-size: 10px; |
| | | font-family: none; |
| | | } |
| | |
| | | height: 0; |
| | | top: 0rem; |
| | | left: 0.3rem; |
| | | border-top: solid 3px transparent; |
| | | border-left: solid 3px #1fa3f6; |
| | | border-bottom: solid 3px transparent; |
| | | border-top: solid 0.18rem transparent; |
| | | border-left: solid 0.18rem #1fa3f6; |
| | | border-bottom: solid 0.18rem transparent; |
| | | } |
| | | } |
| | | } |
| | |
| | | content: var(--right-content); |
| | | position: absolute; |
| | | top: -1rem; |
| | | left: -0.3rem; |
| | | font-size: 10px; |
| | | font-family: none; |
| | | } |
| | |
| | | &::before { |
| | | content: ''; |
| | | position: absolute; |
| | | left: -0.3rem; |
| | | right: 0.3rem; |
| | | top: 0; |
| | | border: 3px solid transparent { |
| | | right: solid 3px #1fa3f6; |
| | | border: 0.18rem solid transparent { |
| | | right: solid 0.18rem #1fa3f6; |
| | | } |
| | | } |
| | | } |
| | |
| | | // 无人机实体 |
| | | let droneEntity = null |
| | | |
| | | // 激光实体 |
| | | let laserEntity = null |
| | | export function droneFly () { |
| | | const store = useMyStore() |
| | | let deviceInfo = {} // 无人机信息 |
| | |
| | | deviceInfo = data.deviceInfo[`${sn}`] |
| | | // 机场信息 |
| | | dockInfo = data.dockInfo[`${dockSn}`] |
| | | // console.log('是吧',dockInfo) |
| | | // console.log('踩踩踩', deviceInfo) |
| | | // console.log('踩踩踩', dockInfo) |
| | | viewDroneInfo = viewDroneInfo |
| | | // console.log('1111', deviceInfo.longitude) |
| | | console.log('打印我想看的',viewDroneInfo.longitude) |
| | | // 当前飞行任务创建时间 |
| | | if (data.currentType === EDeviceTypeName.Aircraft && deviceInfo) { |
| | | const droneLngLat = { |
| | |
| | | } else { |
| | | initCreateFrustum(deviceInfo, viewDroneInfo) |
| | | } |
| | | // console.log('2222', viewDroneInfo.longitude) |
| | | addFlyGltf( |
| | | viewDroneInfo.longitude, |
| | | viewDroneInfo.latitude, |
| | |
| | | dockInfo, |
| | | ssLinePath |
| | | ) |
| | | // console.log('3333', viewDroneInfo.longitude) |
| | | addFlyLaser( |
| | | viewDroneInfo.longitude, |
| | | viewDroneInfo.latitude, |
| | | deviceInfo.height, |
| | | deviceInfo.payloads[0], |
| | | deviceInfo.attitude_head, |
| | | deviceInfo, |
| | | dockInfo, |
| | | ssLinePath |
| | | ) |
| | | setelCamera( |
| | | viewDroneInfo.longitude, |
| | | viewDroneInfo.latitude, |
| | |
| | | initCreateFrustum(deviceInfo, viewDroneInfo) |
| | | console.log('4444', viewDroneInfo.longitude) |
| | | addFlyGltf( |
| | | viewDroneInfo.longitude, |
| | | viewDroneInfo.latitude, |
| | | deviceInfo.height, |
| | | deviceInfo.payloads[0], |
| | | deviceInfo.attitude_head, |
| | | deviceInfo, |
| | | dockInfo, |
| | | ssLinePath |
| | | ) |
| | | addFlyLaser( |
| | | viewDroneInfo.longitude, |
| | | viewDroneInfo.latitude, |
| | | deviceInfo.height, |
| | |
| | | } |
| | | } |
| | | |
| | | const imgLaser = new URL('@/assets/images/laser.png', import.meta.url).href |
| | | // 增加激光扫射点 |
| | | function addFlyLaser(lng:any, lat:any, alt:any, payloads:any, attitude_head:any, deviceInfo:any, dockInfo:any, ssLinePath:any) { |
| | | console.log('哒哒哒', payloads) |
| | | const position = globalCesium.Cartesian3.fromDegrees( |
| | | payloads.measure_target_longitude, payloads.measure_target_latitude, 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, |
| | | } |
| | | }) |
| | | } |
| | | // 增加激光扫射信息 |
| | | 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( |
| | |
| | | dornePoint.longitude, |
| | | dornePoint.latitude, |
| | | ) |
| | | console.log('看看值', waylinePosition[index]) |
| | | if (getLongOk < 20) { |
| | | setting = { |
| | | id: 'route_point_' + index, |