From b44a65178e05b426f090caad0a0a06d8c0adfa4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98=E5=A6=8D?= <1455167345@qq.com>
Date: Wed, 23 Jul 2025 10:39:22 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E9=A3=9E=E8=A1=8C=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/demo/workmanagement/flightoperation/index.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/demo/workmanagement/flightoperation/index.vue b/src/views/demo/workmanagement/flightoperation/index.vue
index d8abf4c..e00718d 100644
--- a/src/views/demo/workmanagement/flightoperation/index.vue
+++ b/src/views/demo/workmanagement/flightoperation/index.vue
@@ -257,7 +257,7 @@
diff --git a/src/views/demo/workmanagement/flightannotation/pathMap.vue b/src/views/demo/workmanagement/flightannotation/pathMap.vue
index 67c1223..c7222f2 100644
--- a/src/views/demo/workmanagement/flightannotation/pathMap.vue
+++ b/src/views/demo/workmanagement/flightannotation/pathMap.vue
@@ -5,7 +5,7 @@
+
+
+
+
+
+
+ {{ workspace.WorkspaceName }}
+
+
+
+
@@ -135,10 +165,16 @@
closeIcon,
} from './svg';
import * as turf from '@turf/turf';
- import { GeojsonToWkt } from '@/components/MapboxMaps/src/WktGeojsonTransform';
+ import { WktToGeojson, GeojsonToWkt } from '@/components/MapboxMaps/src/WktGeojsonTransform';
import dayjs from 'dayjs';
+ import { useMessage } from '@/hooks/web/useMessage';
+ const { createMessage } = useMessage();
- const props = defineProps(['allAnnotationDataList', 'nowShowAnnotationData']);
+ const props = defineProps([
+ 'allAnnotationDataList',
+ 'allWorkspaceDataList',
+ 'nowShowAnnotationData',
+ ]);
const emits = defineEmits(['setNowShowAnnotationData', 'setAllAnnotationData']);
const vChartRef: any = ref();
@@ -478,7 +514,6 @@
parseFloat(props.nowShowAnnotationData.coordinates[2]),
];
graphicLayer.setStyle({
- // 图标(待修改)
image: dataURL2,
iconname: props.nowShowAnnotationData.properties.iconname,
label: {
@@ -690,6 +725,24 @@
});
emits('setNowShowAnnotationData', item);
});
+ // 监听点编辑移动事件
+ pointGraphic.on(mars3d.EventType.editMovePoint, (event) => {
+ let point = event.target.point;
+ let coordinates = [point.lng, point.lat, point.alt];
+ let geom = GeojsonToWkt(turf.point(coordinates).geometry);
+ let properties = {
+ ...item.properties,
+ centerPoint: coordinates,
+ };
+ let params = {
+ ...item,
+ properties: JSON.stringify(properties),
+ geom: geom,
+ };
+ UpdateAnnotation(params).then((result) => {
+ emits('setAllAnnotationData');
+ });
+ });
// 将点对象 添加到图层中
graphicLayers.addGraphic(pointGraphic);
// 数据
@@ -752,6 +805,66 @@
});
emits('setNowShowAnnotationData', item);
});
+ // 监听点编辑移动事件
+ lineGraphic.on(mars3d.EventType.editMovePoint, (event) => {
+ let positions = event.target._positions_draw;
+ let coordinates = positions.map((position) => {
+ const cartographic = Cesium.Cartographic.fromCartesian(position);
+ const lng = Cesium.Math.toDegrees(cartographic.longitude);
+ const lat = Cesium.Math.toDegrees(cartographic.latitude);
+ const height = cartographic.height;
+ return [lng, lat, height];
+ });
+ let geom = GeojsonToWkt(turf.lineString(coordinates).geometry);
+ let properties = {
+ ...item.properties,
+ centerPoint: coordinates[0],
+ };
+ let params = {
+ ...item,
+ properties: JSON.stringify(properties),
+ geom: geom,
+ };
+ UpdateAnnotation(params).then((result) => {
+ emits('setAllAnnotationData');
+ emits('setNowShowAnnotationData', {
+ ...item,
+ properties: properties,
+ geom: geom,
+ coordinates: coordinates,
+ });
+ });
+ });
+ // 监听点删除事件
+ lineGraphic.on(mars3d.EventType.editRemovePoint, (event) => {
+ let positions = event.target._positions_draw;
+ let coordinates = positions.map((position) => {
+ const cartographic = Cesium.Cartographic.fromCartesian(position);
+ const lng = Cesium.Math.toDegrees(cartographic.longitude);
+ const lat = Cesium.Math.toDegrees(cartographic.latitude);
+ const height = cartographic.height;
+ return [lng, lat, height];
+ });
+ let geom = GeojsonToWkt(turf.lineString(coordinates).geometry);
+ let properties = {
+ ...item.properties,
+ centerPoint: coordinates[0],
+ };
+ let params = {
+ ...item,
+ properties: JSON.stringify(properties),
+ geom: geom,
+ };
+ UpdateAnnotation(params).then((result) => {
+ emits('setAllAnnotationData');
+ emits('setNowShowAnnotationData', {
+ ...item,
+ properties: properties,
+ geom: geom,
+ coordinates: coordinates,
+ });
+ });
+ });
// 将线对象 添加到图层中
graphicLayers.addGraphic(lineGraphic);
// 数据
@@ -817,6 +930,70 @@
});
emits('setNowShowAnnotationData', item);
});
+ // 监听点编辑移动事件
+ polygonGraphic.on(mars3d.EventType.editMovePoint, (event) => {
+ let positions = event.target._positions_draw;
+ let coordinates = positions.map((position) => {
+ const cartographic = Cesium.Cartographic.fromCartesian(position);
+ const lng = Cesium.Math.toDegrees(cartographic.longitude);
+ const lat = Cesium.Math.toDegrees(cartographic.latitude);
+ const height = cartographic.height;
+ return [lng, lat, height];
+ });
+ let polygonData: any = [];
+ polygonData.push(coordinates);
+ let geom = GeojsonToWkt(turf.polygon(polygonData).geometry);
+ let properties = {
+ ...item.properties,
+ centerPoint: coordinates[0],
+ };
+ let params = {
+ ...item,
+ properties: JSON.stringify(properties),
+ geom: geom,
+ };
+ UpdateAnnotation(params).then((result) => {
+ emits('setAllAnnotationData');
+ emits('setNowShowAnnotationData', {
+ ...item,
+ properties: properties,
+ geom: geom,
+ coordinates: polygonData,
+ });
+ });
+ });
+ // 监听点删除事件
+ polygonGraphic.on(mars3d.EventType.editRemovePoint, (event) => {
+ let positions = event.target._positions_draw;
+ let coordinates = positions.map((position) => {
+ const cartographic = Cesium.Cartographic.fromCartesian(position);
+ const lng = Cesium.Math.toDegrees(cartographic.longitude);
+ const lat = Cesium.Math.toDegrees(cartographic.latitude);
+ const height = cartographic.height;
+ return [lng, lat, height];
+ });
+ let polygonData: any = [];
+ polygonData.push(coordinates);
+ let geom = GeojsonToWkt(turf.polygon(polygonData).geometry);
+ let properties = {
+ ...item.properties,
+ centerPoint: coordinates[0],
+ };
+ let params = {
+ ...item,
+ properties: JSON.stringify(properties),
+ geom: geom,
+ };
+ UpdateAnnotation(params).then((result) => {
+ emits('setAllAnnotationData');
+ emits('setNowShowAnnotationData', {
+ ...item,
+ properties: properties,
+ geom: geom,
+ coordinates: polygonData,
+ });
+ });
+ });
// 将形状对象 添加到图层中
graphicLayers.addGraphic(polygonGraphic);
// 数据
@@ -880,6 +1057,30 @@
});
emits('setNowShowAnnotationData', item);
});
+ // 监听点编辑移动事件
+ circleGraphic.on(mars3d.EventType.editMovePoint, (event) => {
+ let coordinates = event.graphic.options.position;
+ let radius = event.graphic.options.style.radius;
+ let geom = GeojsonToWkt(turf.point(coordinates).geometry);
+ let properties = {
+ ...item.properties,
+ centerPoint: coordinates,
+ radius: radius,
+ };
+ let params = {
+ ...item,
+ properties: JSON.stringify(properties),
+ geom: geom,
+ };
+ UpdateAnnotation(params).then((result) => {
+ emits('setAllAnnotationData');
+ emits('setNowShowAnnotationData', {
+ ...item,
+ properties: properties,
+ geom: geom,
+ });
+ });
+ });
// 将圆对象 添加到图层中
graphicLayers.addGraphic(circleGraphic);
// 数据
@@ -938,13 +1139,50 @@
const drawColorPolygon = ref('#2D8CF0');
const drawColorCricle = ref('#2D8CF0');
- // 地图标注-绘制-点
- async function drawPoint() {
- if (mapDrawType.value == 'drawPoint') {
- mapDrawType.value = '';
+ // 项目弹窗
+ const chooseWorkSpaceOpen = ref(false);
+ const chooseWorkSpaceId = ref('');
+
+ // 选择项目
+ function fun_chooseWorkSpaceType(type) {
+ chooseWorkSpaceOpen.value = true;
+ mapDrawType.value = type;
+ }
+ // 确认-选择绘制类型
+ function fun_workSpaceOk() {
+ if (chooseWorkSpaceId.value == '') {
+ createMessage.warning('先选择要标注的项目!');
return;
}
- mapDrawType.value = 'drawPoint';
+ chooseWorkSpaceOpen.value = false;
+ switch (mapDrawType.value) {
+ // 地图标注-绘制-点
+ case 'drawPoint':
+ drawPoint();
+ break;
+ // 地图标注-绘制-线
+ case 'drawPolyline':
+ drawPolyline();
+ break;
+ // 地图标注-绘制-形状
+ case 'drawPolygon':
+ drawPolygon();
+ break;
+ // 地图标注-绘制-圆
+ case 'drawCricle':
+ drawCricle();
+ break;
+ }
+ }
+ // 取消
+ function fun_workSpaceCancel() {
+ chooseWorkSpaceOpen.value = false;
+ mapDrawType.value = '';
+ chooseWorkSpaceId.value == '';
+ }
+
+ // 地图标注-绘制-点
+ async function drawPoint() {
let time = dayjs().format('YYYY-MM-DD HH:mm:ss');
const image = new Image();
image.crossOrigin = 'Anonymous';
@@ -987,11 +1225,6 @@
}
// 地图标注-绘制-线
async function drawPolyline() {
- if (mapDrawType.value == 'drawPolyline') {
- mapDrawType.value = '';
- return;
- }
- mapDrawType.value = 'drawPolyline';
let time = dayjs().format('YYYY-MM-DD HH:mm:ss');
const graphic = await graphicLayers.startDraw({
type: 'polyline',
@@ -1018,11 +1251,6 @@
}
// 地图标注-绘制-形状
async function drawPolygon() {
- if (mapDrawType.value == 'drawPolygon') {
- mapDrawType.value = '';
- return;
- }
- mapDrawType.value = 'drawPolygon';
let time = dayjs().format('YYYY-MM-DD HH:mm:ss');
const graphic = await graphicLayers.startDraw({
type: 'polygon',
@@ -1047,11 +1275,6 @@
}
// 地图标注-绘制-圆
async function drawCricle() {
- if (mapDrawType.value == 'drawCricle') {
- mapDrawType.value = '';
- return;
- }
- mapDrawType.value = 'drawCricle';
let time = dayjs().format('YYYY-MM-DD HH:mm:ss');
const graphic = await graphicLayers.startDraw({
type: 'circle',
@@ -1091,8 +1314,7 @@
geom = GeojsonToWkt(turf.point(coordinates).geometry);
properties = {
iconname: addOrUpdate == 'add' ? 'defaultIcon' : graphicJson.style.iconname,
- font_size: 16,
- iconnum: 0,
+ font_size: addOrUpdate == 'add' ? 16 : graphicJson.style.label.font_size,
clampToGround: false,
color: addOrUpdate == 'add' ? drawColorPoint.value : graphicJson.style.label.color,
centerPoint: coordinates,
@@ -1102,10 +1324,10 @@
type = 1;
geom = GeojsonToWkt(turf.lineString(coordinates).geometry);
properties = {
- font_size: 16,
+ font_size: addOrUpdate == 'add' ? 16 : graphicJson.style.label.font_size,
line_width: 5,
clampToGround: false,
- color: drawColorPolyline.value,
+ color: addOrUpdate == 'add' ? drawColorPolyline.value : graphicJson.style.label.color,
centerPoint: coordinates[0],
line_start_cap: 0,
line_end_cap: 0,
@@ -1113,27 +1335,27 @@
break;
case 'polygon':
type = 2;
- coordinates.push(coordinates[0]);
if (addOrUpdate == 'add') {
+ coordinates.push(coordinates[0]);
polygonData.push(coordinates);
} else {
- polygonData = coordinates;
+ polygonData.push(coordinates);
}
geom = GeojsonToWkt(turf.polygon(polygonData).geometry);
properties = {
- font_size: 16,
+ font_size: addOrUpdate == 'add' ? 16 : graphicJson.style.label.font_size,
clampToGround: false,
- color: drawColorPolygon.value,
+ color: addOrUpdate == 'add' ? drawColorPolygon.value : graphicJson.style.label.color,
centerPoint: coordinates[0],
};
break;
case 'circle':
type = 3;
- geom = GeojsonToWkt(turf.circle(coordinates, graphicJson.style.radius).geometry);
+ geom = GeojsonToWkt(turf.point(coordinates).geometry);
properties = {
- font_size: 16,
+ font_size: addOrUpdate == 'add' ? 16 : graphicJson.style.label.font_size,
clampToGround: true,
- color: drawColorCricle.value,
+ color: addOrUpdate == 'add' ? drawColorCricle.value : graphicJson.style.label.color,
radius: graphicJson.style.radius,
centerPoint: coordinates,
};
@@ -1146,29 +1368,26 @@
properties: JSON.stringify(properties),
createTime: time,
createUser: '',
+ createUserName: '',
geom: geom,
- workSpaceId: '1',
+ workSpaceId: chooseWorkSpaceId.value,
state: 0,
- createUserName: '',
};
AddAnnotation(params).then((result) => {
// 刷新区域信息
emits('setAllAnnotationData');
mapDrawType.value = '';
+ chooseWorkSpaceId.value = '';
});
} else {
params = {
- id: graphicJson.id,
- name: graphicJson.style.label.text,
- type: type,
+ ...props.nowShowAnnotationData,
properties: JSON.stringify(properties),
geom: geom,
- workSpaceId: '1',
- state: props.nowShowAnnotationData.state,
};
UpdateAnnotation(params).then((result) => {
// 刷新区域信息
- // emits('setAllAreaData');
+ // emits('setAllAnnotationData');
// mapAreaDrawFlag.value = false;
});
}
diff --git a/types/config.d.ts b/types/config.d.ts
index 6aa4796..b32b0bb 100644
--- a/types/config.d.ts
+++ b/types/config.d.ts
@@ -164,6 +164,7 @@ export interface GlobEnvConfig {
VITE_GLOB_APP_LOGO?: string;
// info image video
VITE_GLOB_INFO_IMAGE_URL?: string;
+ VITE_MEDIALIBRARY_IMAGE_URL?: string;
VITE_GLOB_APP_MANAGEMENT_UNIT?: string;
VITE_GLOB_APP_TECHINICAL_SUPPORT?: string;
VITE_GLOB_APP_VERSIONS?: string;
From ca4c0443a057f95d59731c045b675ab94b80d588 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98=E5=A6=8D?= <1455167345@qq.com>
Date: Thu, 24 Jul 2025 16:49:26 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E9=A3=9E=E8=A1=8C=E4=BD=9C=E4=B8=9A?=
=?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=8C=BA=E5=9F=9F=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/demo/workmanagement/flightoperation/index.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/views/demo/workmanagement/flightoperation/index.vue b/src/views/demo/workmanagement/flightoperation/index.vue
index e00718d..1074449 100644
--- a/src/views/demo/workmanagement/flightoperation/index.vue
+++ b/src/views/demo/workmanagement/flightoperation/index.vue
@@ -258,7 +258,7 @@
diff --git a/src/views/demo/workmanagement/flightannotation/pathMap.vue b/src/views/demo/workmanagement/flightannotation/pathMap.vue
index c7222f2..cbf866c 100644
--- a/src/views/demo/workmanagement/flightannotation/pathMap.vue
+++ b/src/views/demo/workmanagement/flightannotation/pathMap.vue
@@ -174,6 +174,7 @@
'allAnnotationDataList',
'allWorkspaceDataList',
'nowShowAnnotationData',
+ 'treeDataShowOrHideList',
]);
const emits = defineEmits(['setNowShowAnnotationData', 'setAllAnnotationData']);
@@ -591,6 +592,41 @@
deep: true,
},
);
+ watch(
+ () => props.treeDataShowOrHideList,
+ () => {
+ let tempGraphicLayerList = [
+ // 点
+ ...annotation_PointGraphicData,
+ // 线
+ ...annotation_LineStringGraphicData,
+ // 多边形
+ ...annotation_PolygonGraphicData,
+ // 圆
+ ...annotation_CircleGraphicData,
+ ];
+ tempGraphicLayerList?.forEach((graphicLayer) => {
+ if (props.treeDataShowOrHideList.includes(graphicLayer.options.workSpaceId)) {
+ graphicLayer.setStyle({
+ show: graphicLayer.options.state == 0 ? true : false,
+ outline: graphicLayer.options.state == 0 ? true : false,
+ label: {
+ show: graphicLayer.options.state == 0 ? true : false,
+ },
+ });
+ } else {
+ graphicLayer.setStyle({
+ show: false,
+ outline: false,
+ label: {
+ show: false,
+ },
+ });
+ }
+ });
+ },
+ );
+
// 地图标注-初始化-遍历展示
const showAllAnnotationDataList = async () => {
// 删除旧数据
@@ -693,6 +729,8 @@
},
show: item.state == 0 ? true : false,
hasEdit: true,
+ state: item.state,
+ workSpaceId: item.workSpaceId,
});
// 监听mouseover事件
pointGraphic.on(mars3d.EventType.mouseOver, function () {
@@ -773,6 +811,8 @@
show: item.state == 0 ? true : false,
hasEdit: true,
drawShowMeasure: true,
+ state: item.state,
+ workSpaceId: item.workSpaceId,
});
// 监听mouseover事件
lineGraphic.on(mars3d.EventType.mouseOver, function () {
@@ -897,6 +937,8 @@
show: item.state == 0 ? true : false,
hasEdit: true,
drawShowMeasure: true,
+ state: item.state,
+ workSpaceId: item.workSpaceId,
});
// 监听mouseover事件
polygonGraphic.on(mars3d.EventType.mouseOver, function () {
@@ -1025,6 +1067,8 @@
show: item.state == 0 ? true : false,
hasEdit: true,
drawShowMeasure: true,
+ state: item.state,
+ workSpaceId: item.workSpaceId,
});
// 监听mouseover事件
circleGraphic.on(mars3d.EventType.mouseOver, function () {