forked from drone/command-center-dashboard

chenyao
2025-04-10 f6b7078aeb7a4b56ad70a6f954963fa6ea68fa2b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import * as Cesium from 'cesium';
import cesiumOperation from '@/utils/cesium-tsa';
import { analyzeKmzFile, XMLToJSON } from '@/utils/cesium/kmz.js'
import { cartesian3Convert, getCenterPoint, getLnglatDist } from '@/utils/cesium/mapUtil.js'
import { getLnglatAltitude, getPositionsHeight } from '@/utils/cesium/mapUtil'
 
const {
  addPoint,
  getEntityById,
  removeById,
  removeAllPoint,
  addLeftClickEvent,
  removeLeftClickEvent,
  addRightClickEvent,
  removeRightClickEvent,
  flyTo,
  pointInitEvent,
  pointUnInitEvent
} = cesiumOperation()
/**
 * 
 * @param { 单点航线 相关功能} url 
 */
export const initPointWayline = (url) => {
  const { viewer } = cesiumOperation();
 
  // 解析kmz文件
  const parsingFiles = async (url) => {
    const { fileInfoObj } = analyzeKmzFile(`${url}?_t=${new Date().getTime()}`);
    const xmlStr = fileInfoObj['wpmz/template.kml']
    const xmlJson = XMLToJSON(xmlStr)?.['Document']
    if (xmlJson.Folder.Placemark.length) return;
    drawWayline(xmlJson)
  };
  // 在地图上画线
  const drawWayline = (xmlJson) => {
    const { Folder } = xmlJson
  };
};