4 files modified
1 files added
| | |
| | | const result = await request.get(url) |
| | | return result.data |
| | | } |
| | | |
| | | export interface Point{ |
| | | lon:number, |
| | | lat:number, |
| | | height?:number, |
| | | distance?:number |
| | | } |
| | | |
| | | export const flyByArea = async function (sn:string,dockPoint:Point,areaList:any[],radius:number): Promise<IWorkspaceResponse<any>> { |
| | | const url = `${HTTP_PREFIX}/workspaces/${sn}/jobs/flyByArea` |
| | | const result = await request.post(url,{dockPoint:dockPoint,areaList:areaList,radius:radius}) |
| | | return result.data |
| | | } |
| | | |
| | |
| | | <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) { |
| | |
| | | } |
| | | } |
| | | |
| | | function removeAllDataSource() { |
| | | viewer.dataSources.removeAll(); |
| | | function removeAllDataSource () { |
| | | viewer.dataSources.removeAll() |
| | | } |
| | | |
| | | // 清除所有标记点 |
| | |
| | | } |
| | | } |
| | | |
| | | //加载json文件 |
| | | const loadGeoJson = (url:string)=>{ |
| | | // 加载json文件 |
| | | const loadGeoJson = (url:string) => { |
| | | const option = { |
| | | stroke: Cesium.Color.HOTPINK, |
| | | fill: Cesium.Color.PINK, |
| | | strokeWidth: 3, |
| | | } |
| | | const promise = Cesium.GeoJsonDataSource.load(url,option) |
| | | const promise = Cesium.GeoJsonDataSource.load(url, option) |
| | | |
| | | promise.then(dataSource=>{ |
| | | promise.then(dataSource => { |
| | | console.log(dataSource) |
| | | viewer.dataSources.add(dataSource); |
| | | viewer.dataSources.add(dataSource) |
| | | }) |
| | | } |
| | | |
| | |
| | | import { EHmsLevel } from '/@/types/enums' |
| | | import { cesiumOperation } from '/@/hooks/use-cesium-tsa' |
| | | import { convertTimestampToDate, getDateFromTimestamp, isToday, setTodayTime } from '/@/utils/time' |
| | | import { parseJsonFile } from '/@/utils/geo-utils' |
| | | let droneEntity: any |
| | | |
| | | const { appContext } = getCurrentInstance() |
| New file |
| | |
| | | import axios from 'axios' |
| | | |
| | | export function parseJsonFile(url: string) { |
| | | |
| | | return new Promise((resolve,reject)=>{ |
| | | axios.get(url) |
| | | .then(function (response) { |
| | | console.log(response.data); |
| | | resolve(response.data) |
| | | }) |
| | | }) |
| | | |
| | | } |