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
|
}
|
}
|