| | |
| | | <Button :ghost="!flightController" size="small" @click="onClickFightControl"> |
| | | {{ flightController ? '退出控制' : '进入控制' }} |
| | | </Button> |
| | | |
| | | <Button size="small" @click="flyByPoints"> |
| | | 图斑飞行 |
| | | </Button> |
| | | </div> |
| | | </div> |
| | | <div class="row"> |
| | |
| | | import DroneControlInfoPanel from './DroneControlInfoPanel.vue' |
| | | import { noDebugCmdList as baseCmdList, DeviceCmdItem, DeviceCmd } from '/@/types/device-cmd' |
| | | import { useDockControl } from './use-dock-control' |
| | | import { flyByArea, Point } from '/@/api/wayline' |
| | | import { parseJsonFile } from '/@/utils/geo-utils' |
| | | |
| | | const props = defineProps<{ |
| | | sn: string, |
| | |
| | | enterFlightControl() |
| | | } |
| | | |
| | | // 根据图斑飞行 |
| | | async function flyByPoints () { |
| | | // 半径m |
| | | const radius = 7000 |
| | | const dockPoint:Point = reactive({ |
| | | lon: props.deviceInfo.dock.basic_osd.longitude, |
| | | lat: props.deviceInfo.dock.basic_osd.latitude |
| | | }) |
| | | const jsonData = await parseJsonFile('../src/assets/jsonData/图斑_FeaturesToJSON(1).json') |
| | | const sn = props.sn |
| | | const features = jsonData.features |
| | | const list = [] |
| | | |
| | | features.forEach(feature => { |
| | | const areaList = [] |
| | | feature.geometry.coordinates[0].forEach(areaPoint => { |
| | | console.log('areaPoint:', areaPoint) |
| | | const point = { |
| | | lon: areaPoint[0], |
| | | lat: areaPoint[1] |
| | | } |
| | | areaList.push(point) |
| | | }) |
| | | list.push(areaList) |
| | | }) |
| | | |
| | | flyByArea(sn, dockPoint, list, radius).then(res => { |
| | | console.log(res, '----------------') |
| | | }) |
| | | } |
| | | |
| | | // 进入飞行控制 |
| | | async function enterFlightControl () { |
| | | if (!clientId.value) { |