|
|
|
@ -14,9 +14,10 @@ |
|
|
|
@click="state.view3DMode = Constract.Mode3D">3D |
|
|
|
</el-button> |
|
|
|
</el-button-group> |
|
|
|
<el-button :icon="renderIcon('element Files')" link @click="showBulkCopy" :disabled="!selectedObject"> |
|
|
|
<el-upload :on-change="addAmrMap" |
|
|
|
:show-file-list="false" accept=".json" action="" :auto-upload="false"> |
|
|
|
导入AMR地图 |
|
|
|
</el-button> |
|
|
|
</el-upload> |
|
|
|
<!-- |
|
|
|
<el-button :icon="renderIcon('element Files')" link @click="showBulkCopy" :disabled="!selectedObject"> |
|
|
|
批量复制 |
|
|
|
@ -119,6 +120,7 @@ import cadFont from '@/assets/fonts/helvetiker_regular.typeface.json?url' |
|
|
|
import StateManager from '@/core/manager/StateManager.js' |
|
|
|
import gsap from 'gsap' |
|
|
|
import TaskManager from '@/core/manager/TaskManager.js' |
|
|
|
import { AmrMapConvert } from '@/utils/AmrMapConvert.js' |
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
@ -303,6 +305,40 @@ export default defineComponent({ |
|
|
|
taskManager.addTravelTask('5iKoIUBhnU08EM0IsoyOSW') |
|
|
|
taskManager.runTask() |
|
|
|
}, |
|
|
|
addAmrMap(file) { |
|
|
|
if (!file) return |
|
|
|
file = file.raw |
|
|
|
if (!file) { |
|
|
|
system.showErrorDialog('请上传有效的AMR地图文件') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const reader = new FileReader() |
|
|
|
system.showLoading('正在导入地图...') |
|
|
|
reader.onerror = (error) => { |
|
|
|
console.error('读取AMR地图文件失败:', error) |
|
|
|
system.showErrorDialog('读取AMR地图文件失败,请检查文件格式') |
|
|
|
system.clearLoading() |
|
|
|
} |
|
|
|
reader.onload = () => { |
|
|
|
try { |
|
|
|
const jsonData = JSON.parse(reader.result) |
|
|
|
if (!jsonData || !jsonData.businessMap) { |
|
|
|
system.showErrorDialog('无效的AMR地图文件') |
|
|
|
return |
|
|
|
} |
|
|
|
AmrMapConvert(this.viewport, jsonData) |
|
|
|
system.showInfoDialog('AMR地图加载完毕') |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('解析AMR地图文件失败:', error) |
|
|
|
system.showErrorDialog('解析AMR地图文件失败,请检查文件格式') |
|
|
|
} finally { |
|
|
|
system.clearLoading() |
|
|
|
} |
|
|
|
} |
|
|
|
reader.readAsText(file) |
|
|
|
}, |
|
|
|
async addCADDxf(file) { |
|
|
|
|
|
|
|
// 创建一个边长为 1 的红色立方体 |
|
|
|
|