From 016de324c0145632532fcd5450b96a2d1291dac6 Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Fri, 08 Mar 2024 17:41:24 +0800
Subject: [PATCH] update: 右键添加航点完成、kmz文件编辑等
---
src/utils/cesium/use-map-draw.ts | 42 +++++++++++++++++++++++++++++++++++-------
1 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/src/utils/cesium/use-map-draw.ts b/src/utils/cesium/use-map-draw.ts
index c088045..96fb23c 100644
--- a/src/utils/cesium/use-map-draw.ts
+++ b/src/utils/cesium/use-map-draw.ts
@@ -22,6 +22,7 @@
}
interface tragetPoint {
position: Cesium.Cartesian3
+ isUseGlobalHeight: boolean,
eventList: eventParmas[]
}
@@ -122,9 +123,10 @@
// 记录点位信息
let cartesianArr: Cesium.Cartesian3[] = []
- // 绘制路线
+ // 绘制路线
+ // 起飞点
+ // let btmStartPoint: Cesium.Cartesian3 | null = null
const drawWayline = async (entities?: Cesium.Entity[], kmlStr?: string) => {
- console.log(kmlStr)
if (!entities && !kmlStr) {
dataSource.show = false
}
@@ -149,6 +151,23 @@
})
// 起飞点
let btmStartPoint = null
+ // 获取文件中的起飞点
+ const startPointRegStr = getKmlParams(kmlRes, true, {
+ name: 'takeOffRefPoint',
+ findRegx: '([\\s\\S]*?)',
+ }) || ['', '0.00000,0.00000,0.00000']
+ const startPointPosition = startPointRegStr[1].split(',')
+ btmStartPoint = Cesium.Cartesian3.fromDegrees(
+ Number(startPointPosition[1]),
+ Number(startPointPosition[0]),
+ Number(startPointPosition[2])
+ )
+ // 参考起飞点“海拔高度,与“参考起飞点”中的椭球高度对应
+ // const posterHeightRegStr = getKmlParams(kmlRes, true, {
+ // name: 'takeOffRefPointAGLHeight',
+ // findRegx: '([\\s\\S]*?)',
+ // }) || ['', 0]
+ // const posterHeight = Number(posterHeightRegStr[1])
// 判断是否存在实体集
if (entities) {
cartesianArr = []
@@ -172,15 +191,23 @@
name: 'height',
findRegx: '([\\s\\S]*?)',
})
+ // 获取是否使用全局高度
+ const useGlobalHeightRegStr = getKmlParams(point, true, {
+ name: 'useGlobalHeight',
+ findRegx: '([\\s\\S]*?)',
+ }) || ['', '0']
+ const isUseGlobalHeight = Boolean(Number(useGlobalHeightRegStr[1]))
const AslHeight = Number(getPointHeight[1])
const HeaHeight = Number(getHaeHeight[1])
entity.position = Cesium.Cartesian3.fromDegrees(longitude, latitude, AslHeight)
- if (i === 0) {
- btmStartPoint = Cesium.Cartesian3.fromDegrees(longitude, latitude, 0)
- }
// 创建广告牌信息
- const title = Number(i + 1) === 1 ? 'S' : i
- const billboard = createTriangleMarker(title, '#61d396')
+ const title = Number(i + 1) === 1 ? 'S' : i + 1
+ let billboard = null
+ if (isUseGlobalHeight) {
+ billboard = createTriangleMarker(title, '#61d396')
+ } else {
+ billboard = createTriangleMarker(title, '#409eff')
+ }
// 修改id
entity._id = 'tragetPoint' + i
// 修改广告牌样式
@@ -228,6 +255,7 @@
// 当前航线点位事件信息等
waylinePointsEvent.value.push({
position: entity.position._value,
+ isUseGlobalHeight,
eventList: [],
})
}
--
Gitblit v1.9.3