GuLiMmo
2024-03-04 d20068f8f1c0d1f7f4077c2fdd7d46e0f5216285
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
40
41
42
43
44
45
46
47
48
49
50
import { ref } from 'vue'
import { analyzeKmzFile, getKmlParams } from '/@/utils/cesium/kmz'
 
const useKMLTsa = () => {
  const kmzStr = ref('')
 
  const init = async (fileUrl: string, fileContent ?: string) => {
    const kmzRes: string = await analyzeKmzFile(fileUrl)
    if (fileContent) {
      kmzStr.value = fileContent
      return false
    }
    kmzStr.value = kmzRes
  }
 
  const create = () => {
    const nowTime = new Date().getTime()
    const str = `
    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:wpml="http://www.dji.com/wpmz/1.0.5">
      <Document>
        <wpml:author>17304076412</wpml:author>
        <wpml:createTime>${nowTime}</wpml:createTime>
        <wpml:updateTime>${nowTime}</wpml:updateTime>
        <wpml:missionConfig>
        </wpml:missionConfig>
        <Folder>
        </Folder>
      </Document>
    </kml>
    `
    kmzStr.value = str
  }
 
  const write = () => {}
 
  const del = () => {}
 
  const edit = () => {}
 
  const save = () => {}
 
  return {
    create,
    write,
    del,
    edit,
    save
  }
}