From dcfbb07dc9cadb6d960081d1a02658bde734e97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=A6=8D?= <1455167345@qq.com> Date: Tue, 12 Aug 2025 17:35:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9E=E8=A1=8C=E4=BD=9C=E4=B8=9A=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E5=B7=A1=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workmanagement/flightoperation/index.ts | 1 + .../workmanagement/flightoperation/index.vue | 64 +++- .../flightoperation/src/Patrol.vue | 335 ++++++++++++++++++ .../workplan/components/map.vue | 84 ++++- 4 files changed, 465 insertions(+), 19 deletions(-) create mode 100644 src/views/demo/workmanagement/flightoperation/src/Patrol.vue diff --git a/src/views/demo/workmanagement/flightoperation/index.ts b/src/views/demo/workmanagement/flightoperation/index.ts index 4ef6682..36f4b37 100644 --- a/src/views/demo/workmanagement/flightoperation/index.ts +++ b/src/views/demo/workmanagement/flightoperation/index.ts @@ -8,4 +8,5 @@ export { default as LoadControl } from './src/LoadControl.vue'; export { default as FlightControl } from './src/FlightControl.vue'; export { default as TakeOffForm } from './src/TakeOffForm.vue'; export { default as FlyToForm } from './src/FlyToForm.vue'; +export { default as Patrol } from './src/Patrol.vue'; export { default as Map } from '../workplan/components/map.vue'; diff --git a/src/views/demo/workmanagement/flightoperation/index.vue b/src/views/demo/workmanagement/flightoperation/index.vue index f3d1318..9681cf5 100644 --- a/src/views/demo/workmanagement/flightoperation/index.vue +++ b/src/views/demo/workmanagement/flightoperation/index.vue @@ -2,14 +2,10 @@
- +
+ +
+
+ + 智能巡检 +
+
+ + 上报事件 +
+
+
diff --git a/src/views/demo/workmanagement/flightoperation/src/Patrol.vue b/src/views/demo/workmanagement/flightoperation/src/Patrol.vue new file mode 100644 index 0000000..9179ad3 --- /dev/null +++ b/src/views/demo/workmanagement/flightoperation/src/Patrol.vue @@ -0,0 +1,335 @@ + + + diff --git a/src/views/demo/workmanagement/workplan/components/map.vue b/src/views/demo/workmanagement/workplan/components/map.vue index f167946..846acd4 100644 --- a/src/views/demo/workmanagement/workplan/components/map.vue +++ b/src/views/demo/workmanagement/workplan/components/map.vue @@ -222,6 +222,10 @@ }, "waylineWpmlConfig":{ type:Object + }, + "drawArea":{ + type:Boolean, + default:false } }) @@ -347,7 +351,7 @@ const generatePreviewPoint = (placemark)=>{ } }; - const emits = defineEmits(['exitDraw', 'flyToThere', 'mapOnLoad', 'clickAirPort', 'changeAirportLive', 'changeUAVLive']); + const emits = defineEmits(['exitDraw', 'flyToThere', 'mapOnLoad', 'clickAirPort', 'changeAirportLive', 'changeUAVLive','areaData']); const airPoints = ref([]); const currentAirPoint = ref({}); @@ -401,6 +405,8 @@ const generatePreviewPoint = (placemark)=>{ // 测区面图层 let polygonGraphicLayer: mars3d.layer.GraphicLayer; + // 监测区域面图层 + let patrolPolygonGraphicLayer: mars3d.layer.GraphicLayer; // 面航线图层 let polygonLineGraphicLayer: mars3d.layer.GeoJsonLayer; @@ -436,6 +442,8 @@ const generatePreviewPoint = (placemark)=>{ polygonGraphicLayer ? polygonGraphicLayer.clear() : null; + patrolPolygonGraphicLayer ? patrolPolygonGraphicLayer.clear() : null; + polygonLineGraphicLayer ? polygonLineGraphicLayer.clear() : null; airPoints.value = []; @@ -699,6 +707,10 @@ const initMap = () => { polygonGraphicLayer = new mars3d.layer.GraphicLayer({ isAutoEditing: true, // 是否自动激活编辑 }); + // 监测面区域 + patrolPolygonGraphicLayer = new mars3d.layer.GraphicLayer({ + isAutoEditing: true, // 是否自动激活编辑 + }) polygonGraphicLayer.bindContextMenu([ { @@ -709,12 +721,26 @@ const initMap = () => { }, }, ]); + patrolPolygonGraphicLayer.bindContextMenu([ + { + text: '删除测区', + icon: 'fa fa-camera-retro', // 支持 font-class 的字体方式图标 + callback: (e) => { + handlerClearPolygonGraphicLayer(e); + }, + }, + ]); polygonGraphicLayer.on(mars3d.EventType.editMovePoint,(event)=>{ onPolygonGraphicLayerEdit(event); }) + patrolPolygonGraphicLayer.on(mars3d.EventType.editMovePoint,(event)=>{ + console.log(event) + onPatrolPolygonGraphicLayerEdit(event); + }) map.addLayer(polygonGraphicLayer); + map.addLayer(patrolPolygonGraphicLayer); // 绘制起点 @@ -799,6 +825,17 @@ const handlerBindMapMenus = () => { }, ]; } + if(props.drawArea){ + mapContextmenuItems = [ + { + text: '添加面区域', + icon: 'fa fa-camera-retro', // 支持 font-class 的字体方式图标 + callback: (e) => { + handlerDrawPolygonPatrol(); + }, + }, + ]; + } map.bindContextMenu(mapContextmenuItems); }; @@ -962,6 +999,26 @@ const handlerDrawPolygon = async () => { // 计算边长等信息 handlerGetPolygonBorderInfo(polygonGeoJson.value); }; +// 绘制监测区域 +const handlerDrawPolygonPatrol= async () => { + + const graphic = await patrolPolygonGraphicLayer.startDraw({ + type: 'polygon', + style: { + color: '#408eff', + opacity: 0.3, + outline: true, + outlineColor: '#408eff', + outlineWidth: 3.0, + clampToGround: true, + }, + }); + + let coordinates = graphic.toJSON().positions; + coordinates.push(coordinates[0]); + polygonGeoJson.value = coordinates; + emits('areaData',polygonGeoJson.value); +}; // 测区编辑后重新计算航线 const onPolygonGraphicLayerEdit = (e)=>{ @@ -991,6 +1048,15 @@ const onPolygonGraphicLayerEdit = (e)=>{ } +// 监测区域编辑后重新赋值 +const onPatrolPolygonGraphicLayerEdit = (e)=>{ + let coordinates = e.graphic.toJSON().positions; + if(props.editMode == 'add'){ + coordinates.push(coordinates[0]); + } + polygonGeoJson.value = coordinates; + emits('areaData',polygonGeoJson.value); +} // 绘制面航线 const handlerDrawPolygonLine = (lines) => { // 设置首航点 @@ -1254,6 +1320,8 @@ const handlerClearPolygonGraphicLayer = () => { polygonLineGraphicLayer ? polygonLineGraphicLayer.clear() : null; + patrolPolygonGraphicLayer ? patrolPolygonGraphicLayer.clear() : null; + textLabelGraphicLayer ? textLabelGraphicLayer.clear() : null; polygonGeoJson.value = null; @@ -2487,12 +2555,14 @@ const setUAVPosition = () => { const airPortStoreVal = airPortStore(); const uav = airPortStoreVal.getUAV; const type_subtype_gimbalindex = props.uavTrack[uav.camera_index]; - const rectSensor = graphicLayer.getGraphicById("uav-route-rectSensor") - rectSensor.heading = type_subtype_gimbalindex.gimbal_yaw //四周方向角,0至360度角度值 - rectSensor.pitch = type_subtype_gimbalindex.gimbal_pitch //俯仰角,上下摇摆的角度,0至360度角度值 - rectSensor.roll = type_subtype_gimbalindex.gimbal_roll + 90 //滚转角,左右摆动的角度,0至360度角度值 - rectSensor.angle1 = 10 //夹角1,半场角度,取值范围 0.1-89.9 - rectSensor.angle2 = 10 //夹角2,半场角度,取值范围 0.1-89.9 + if(type_subtype_gimbalindex){ + const rectSensor = graphicLayer.getGraphicById("uav-route-rectSensor") + rectSensor.heading = type_subtype_gimbalindex.gimbal_yaw //四周方向角,0至360度角度值 + rectSensor.pitch = type_subtype_gimbalindex.gimbal_pitch //俯仰角,上下摇摆的角度,0至360度角度值 + rectSensor.roll = type_subtype_gimbalindex.gimbal_roll + 90 //滚转角,左右摆动的角度,0至360度角度值 + rectSensor.angle1 = 10 //夹角1,半场角度,取值范围 0.1-89.9 + rectSensor.angle2 = 10 //夹角2,半场角度,取值范围 0.1-89.9 + } } }; // 绘制连接地面线