bug fix
This commit is contained in:
16
src/App.vue
16
src/App.vue
@@ -127,6 +127,7 @@ import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { WebSocketClient, MockWebSocketDataGenerator } from './utils/websocket.js'
|
||||
import droneImage from './assets/wrj.jpg'
|
||||
import { getConfig } from ".//utils/request";
|
||||
import gcoord from 'gcoord';
|
||||
import DroneCtrl, {
|
||||
UploadAreaReq
|
||||
} from 'DroneCtrl';
|
||||
@@ -331,7 +332,7 @@ const updateDroneMarker = (lng, lat, heading = 0) => {
|
||||
}
|
||||
|
||||
// 将地图中心移动到无人机位置(可选,可以注释掉)
|
||||
// map.setCenter([lng, lat])
|
||||
map.setCenter([lng, lat])
|
||||
}
|
||||
|
||||
// 检测点是否在多边形内(射线法)
|
||||
@@ -850,7 +851,16 @@ const uploadFence = (fenceId) => {
|
||||
}
|
||||
|
||||
if (pointsData) {
|
||||
const points = pointsData.points;
|
||||
const points = pointsData.points.map(point=> {
|
||||
const wgsPoint = gcoord.transform(
|
||||
point, // 原始坐标
|
||||
gcoord.GCJ02, // 当前坐标系
|
||||
gcoord.WGS84 // 目标坐标系
|
||||
);
|
||||
return wgsPoint;
|
||||
});
|
||||
console.log(points)
|
||||
|
||||
ctrl.UploadArea(new UploadAreaReq(points.map(point=>({
|
||||
longitude: point[0],
|
||||
latitude: point[1],
|
||||
@@ -920,6 +930,7 @@ const removeFence = (fenceId) => {
|
||||
console.error('删除围栏时出错:', error)
|
||||
}
|
||||
}
|
||||
ctrl.ClearArea({});
|
||||
|
||||
// 从列表中移除
|
||||
fences.value.splice(index, 1)
|
||||
@@ -957,6 +968,7 @@ const clearAllFences = async () => {
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
await ctrl.ClearArea({});
|
||||
|
||||
// 先清除地图上的所有图形
|
||||
const fencesToRemove = [...fences.value] // 创建副本避免遍历时修改数组
|
||||
|
||||
Reference in New Issue
Block a user