This commit is contained in:
2025-10-11 16:09:15 +08:00
13 changed files with 507 additions and 94 deletions

View File

@ -33,6 +33,7 @@
"electron-updater": "^6.3.9",
"element-plus": "^2.10.4",
"express": "^5.1.0",
"file-saver": "^2.0.5",
"mitt": "^3.0.1",
"moment": "^2.30.1",
"pinia": "^3.0.3",
@ -43,7 +44,8 @@
"vue-clipboard3": "^2.0.0",
"vue-i18n": "^9.14.5",
"vue-router": "^4.5.1",
"vuedraggable": "^2.24.3"
"vuedraggable": "^2.24.3",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@electron-toolkit/eslint-config-prettier": "3.0.0",

View File

@ -1,4 +1,5 @@
import { leftClick, rightClick } from '../../src/views/components/tree/entityClick'
import { renderVector } from '../views/components/tree/components/hooks/renderVector'
export const initMapData = async (type, data, cd) => {
let entityObject
let options
@ -133,6 +134,14 @@ export const initMapData = async (type, data, cd) => {
case 'explosion':
entityObject = new YJ.Obj.Explosion(window.earth, data)
break
case 'geojson':
entityObject = new YJ.Obj.GeoJson(window.earth, data)
entityObject.on()
break
case 'vector':
let node = window.treeObj.getNodeByParam("id", data.id, null);
entityObject = renderVector(node, false)
break
default:
break
}
@ -168,6 +177,9 @@ export const initMapData = async (type, data, cd) => {
rightClick(getOptions());
};
if (entityObject.options.id) {
(window as any)._entityMap.set(entityObject.options.id, entityObject)
}
}
// options = entityObject

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12" fill="none"><g clip-path="url(#clip-path-2256_179)"><path d="M1.19473 4.35725L1.19473 1.80615C1.19473 1.46881 1.46881 1.19473 1.80615 1.19473L10.1939 1.19473C10.5312 1.19473 10.8053 1.46881 10.8053 1.80615L10.8053 10.1939C10.8053 10.5312 10.5312 10.8053 10.1939 10.8053L7.64275 10.8053C7.31245 10.8053 7.04539 11.0723 7.04539 11.4026C7.04539 11.7329 7.31245 12 7.64275 12L10.7859 12C11.4571 12 12 11.4554 12 10.786L12 1.21406C12 0.542899 11.4553 0 10.7859 0L1.21406 0C0.542899 0 0 0.544656 0 1.21406L0 4.35725C0 4.68756 0.267057 4.95461 0.597365 4.95461C0.927672 4.95461 1.19473 4.68756 1.19473 4.35725Z" fill="#FFFFFF" ></path><path d="M6.20029 8.62311L6.19854 8.62135L3.84949 6.2723C3.61581 6.03863 3.23807 6.03863 3.00439 6.2723C2.77072 6.50598 2.77072 6.88372 3.00439 7.1174L4.33792 8.45093L0.597365 8.45093C0.267057 8.45093 0 8.71799 0 9.04829C0 9.3786 0.267057 9.64566 0.597365 9.64566L4.33441 9.64566L3.00439 10.9757C2.77072 11.2093 2.77072 11.5871 3.00439 11.8208C3.23807 12.0544 3.61581 12.0544 3.84949 11.8208L6.16164 9.50861C6.29341 9.39968 6.37775 9.23453 6.37775 9.05005C6.37775 8.88138 6.30923 8.73204 6.20029 8.62311Z" fill="#FFFFFF" ></path></g><defs><clipPath id="clip-path-2256_179"><path d="M0 12L12 12L12 0L0 0L0 12Z" fill="white"/></clipPath></defs></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12" fill="none"><path d="M5.99995 0C2.68626 0 0 2.6863 0 6.00001C0 9.31371 2.68628 12 5.99995 12C9.31363 12 11.9999 9.31371 11.9999 6.00001C11.9999 2.6863 9.31363 0 5.99995 0ZM5.99995 10.8988C3.29444 10.8988 1.10121 8.70557 1.10121 6.00002C1.10121 3.29447 3.29443 1.10124 5.99995 1.10124C8.70548 1.10124 10.8987 3.29447 10.8987 6.00002C10.8987 8.70557 8.70548 10.8988 5.99995 10.8988Z" fill="#FFFFFF" ></path><path d="M5.72705 3.17093C5.72705 3.56116 6.04337 3.8775 6.43361 3.8775C6.82384 3.8775 7.14017 3.56116 7.14017 3.17093C7.14017 2.78069 6.82384 2.46436 6.43361 2.46436C6.04337 2.46444 5.72705 2.78075 5.72705 3.17093ZM6.2303 9.67696C5.70904 9.80738 4.98747 9.7957 4.62688 9.6509C4.26623 9.50617 4.13495 8.97968 4.33516 8.48104L5.23442 6.24068C5.43461 5.742 5.17471 5.21648 4.65696 5.07279L4.48511 5.02508C3.96734 4.8814 3.97761 4.69316 4.50797 4.60682L5.02267 4.523C5.55304 4.4366 6.28202 4.48439 6.64266 4.62917C7.00331 4.7739 7.13372 5.30002 6.93249 5.79829L6.09405 7.87443C5.89281 8.3727 6.14467 8.90614 6.6536 9.0599C7.16253 9.21366 7.15254 9.44619 6.63128 9.57661L6.23033 9.67696L6.2303 9.67696Z" fill="#FFFFFF" ></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -71,6 +71,7 @@ if (!localStorage.getItem("AMapKey")) {
// 注册全局指令
(window as any)._winMap = new Map();
(window as any)._entityMap = new Map();
const setApp = createApp(App)
// 定义全局方法

View File

@ -42,3 +42,26 @@ export const setIP = (url: string) => {
export const getIP = () => {
return localStorage.getItem('ip') || undefined
}
/**
* 切割路径返回名称
* @param path
* @returns {*}
*/
export function getNamefromPath(path) {
let index = 1;
if (path.endsWith(".json")) {
index = 2;
}
let arr = path.split("/");
let str = arr[arr.length - index];
let name = str;
if (!path.endsWith(".json")) {
let arr1 = str.split(".");
arr1.pop();
name = arr1.join(".");
}
return name;
}

View File

@ -13,7 +13,7 @@
<div class="col">
<span class="label">名称字段选择</span>
<el-select v-model="entityOptions.field">
<el-option v-for="item in keyData" :label="item.name" :value="item.key"></el-option>
<el-option v-for="item in keyData" :label="item.label" :value="item.key"></el-option>
</el-select>
</div>
</div>
@ -57,8 +57,7 @@ const getKeys = () => {
}
}
keyData.value.push({
name: label,
value: label,
label: label,
key: key
})
}
@ -80,6 +79,11 @@ const confirm = () => {
name: entityOptions.value.name,
show: entityOptions.value.show,
id: entityOptions.value.options.id,
path: entityOptions.value.options.path,
field: entityOptions.value.field,
headTables: entityOptions.value.options.headTables,
opacity: entityOptions.value.opacity,
color: entityOptions.value.color,
}
let params2 = {
"id": params.id,

View File

@ -0,0 +1,266 @@
<template>
<Dialog ref="baseDialog" :title="title" width="900px" left="calc(50% - 450px)" top="calc(50% - 360px)"
:closeCallback="closeCallback">
<template #content>
<span class="custom-divider"></span>
<div class="div-item">
<div class="row">
<div class="col">
<input type="text" placeholder="输入关键字搜索" v-model="keyword" @input="search">
<button class="btn" style="margin-left: 10px;" @click="exportExcel">导出</button>
</div>
<div class="col">
<span class="label">名称字段选择</span>
<el-select v-model="entityOptions.field" @change="changeFieId">
<el-option v-for="item in keyData" :label="item.label" :value="item.key"></el-option>
</el-select>
</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col table-box">
<div class="table">
<div class="table-head">
<div class="tr">
<div class="th" v-for="field in keyData" :title="field.label">
<p>{{ field.label }}</p>
</div>
</div>
</div>
<div class="table-body">
<div class="tr" v-for="item in tableData">
<div class="td" v-for="td in keyData" :title="item.properties[td.key]">
<p>{{ item.properties[td.key] }}</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<Pagination :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" />
</div>
</div>
</template>
<template #footer>
<button @click="close">关闭</button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { inject } from 'vue'
import { TreeApi } from '@/api/tree'
import { ElMessage, ElMessageBox } from 'element-plus'
import Dialog from '@/components/dialog/baseDialog.vue'
import { useTreeNode } from '../tree/hooks/treeNode'
const FileSaver = require('file-saver')
const XLSX = require('xlsx')
const { cusUpdateNode, getSelectedNodes, cusRemoveNode } = useTreeNode()
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
const keyData: any = ref([])
const keyword: any = ref('')
const entityOptions: any = ref({});
let originalOptions: any
let that: any
const tableData: any = ref([])
const total: any = ref(0)
const pageSize: any = ref(20)
const pageNum: any = ref(1)
const maxPageNum: any = ref(0)
const filterData: any = ref([])
const title = ref('')
const closeCallback = () => {
entityOptions.value.originalOptions = structuredClone(originalOptions)
entityOptions.value.reset()
eventBus.emit("destroyComponent")
}
const getKeys = () => {
for (let key in that.geojson.features[0].properties) {
let label = key
for (let index = 0; index < that.options.headTables.length; index++) {
if (that.options.headTables[index].key === key) {
label = that.options.headTables[index].label
break
}
}
keyData.value.push({
label: label,
key: key
})
}
}
let node
let parentNode
let features
const open = async (id: any) => {
// that = window.earth.entityMap.get(id)
node = window.treeObj.getNodeByParam("id", id, null);
that = getThat(node)
if (that.options.id === id) {
features = that.geojson.features
}
else {
features = [node.params]
}
console.log(features, that, id)
let arr = JSON.parse(JSON.stringify(features))
filterData.value = JSON.parse(JSON.stringify(arr))
total.value = filterData.value.length
let spliceData = arrSplice(arr, pageSize.value)
maxPageNum.value = spliceData.length
tableData.value = spliceData[pageNum.value - 1]
title.value = node.sourceName
getKeys()
originalOptions = structuredClone(that.options)
entityOptions.value = that
baseDialog.value?.open()
await nextTick()
}
const getThat = (n) => {
if (n) {
let t = window.earth.entityMap.get(n.id)
if (t) {
parentNode = n
return t
}
else {
if (n.parentId) {
return getThat(window.treeObj.getNodeByParam("id", n.parentId, null))
}
}
}
}
const search = () => {
let val = keyword.value
let fuzzySearch = (list, keyWord, attribute: any = []) => {
const reg = new RegExp(keyWord) // 创建正则表达式
const arr: any = []
for (let i = 0; i < list.length; i++) {
let isFind = false
for (let j = 0; j < attribute.length; j++) {
if (list[i].properties[attribute[j].key]) {
isFind = reg.test(list[i].properties[attribute[j].key])
if (isFind) {
arr.push(list[i])
break
}
}
}
}
console.log(arr)
return arr
}
let arr = fuzzySearch(features, val, keyData.value)
filterData.value = JSON.parse(JSON.stringify(arr))
total.value = filterData.value.length
let spliceData = arrSplice(arr, pageSize.value)
maxPageNum.value = spliceData.length
tableData.value = spliceData[pageNum.value - 1]
}
const arrSplice = (arr, chunkSize) => {
//定义一个空数组来接收返回值
const resSplice: any = []
while (arr.length > 0) {
//注意splice方法的返回值为删除的值在这边即为原数组中切割掉的index为0-chunkSize的值
const chunk = arr.splice(0, chunkSize)
//将返回值添加到resSplice数组
resSplice.push(chunk)
}
//return出去
return resSplice
}
const getTableList = ({ page, limit }) => {
pageNum.value = page
pageSize.value = limit
let arr = JSON.parse(JSON.stringify(filterData.value))
let spliceData = arrSplice(arr, pageSize.value)
maxPageNum.value = spliceData.length
tableData.value = spliceData[pageNum.value - 1]
}
const changeFieId = () => {
updateNode(parentNode.children, entityOptions.value.field)
}
const updateNode = (children, field) => {
for (let i = 0; i < children.length; i++) {
if (children[i].children) {
updateNode(children[i].children, field)
}
else {
if (children[i].params) {
cusUpdateNode({ "id": children[i].id, "sourceName": children[i].params.properties[field], "params": children[i].params })
}
}
}
}
const exportExcel = () => {
let prepareData: any = [[]]
for (let m = 0; m < keyData.value.length; m++) {
prepareData[0].push(keyData.value[m].label)
}
for (let i = 0; i < tableData.value.length; i++) {
let array: any = []
for (let m = 0; m < keyData.value.length; m++) {
array.push(tableData.value[i].properties[keyData.value[m].key])
}
prepareData.push(array)
}
const worksheet = XLSX.utils.aoa_to_sheet(prepareData)
const workbook = XLSX.utils.book_new()
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1')
const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' })
const data = new Blob([excelBuffer], { type: 'application/octet-stream' })
FileSaver.saveAs(data, title.value + '.xlsx')
}
const close = () => {
baseDialog.value?.close()
}
defineExpose({
open,
close
})
</script>
<style scoped lang="scss">
.table-box {
width: 100%;
overflow: auto;
border: 1px solid rgba(var(--color-sdk-base-rgb), 0.5);
.table {
flex: 0 0 auto;
min-width: 100%;
.table-body {
height: 420px;
}
.tr {
display: inline-flex;
}
.tr:last-child {
border-bottom: 1px solid rgba(var(--color-sdk-base-rgb), 0.5) !important;
}
.th,
.td {
white-space: nowrap;
flex: 1;
min-width: 0px;
p {
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
</style>

View File

@ -0,0 +1,65 @@
import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
const { cusAddNodes } = useTreeNode()
export function renderVector(node, ifFly = true) {
// if (node.detail != "") node.detail.field = node.detail.fieldName || "id";
let params = JSON.parse(node.params)
let vectorParams = {
id: node.id,
path: params.path,
fileName: node.sourceName,
...params,
};
console.log("node", node);
console.log("vectorParams", vectorParams);
let Vector = new YJ.Obj.Vector(window.earth, vectorParams);
console.log("Vector", Vector);
Vector.on().then((res) => {
Vector.load(() => {
let newnodes = Vector.getAllNode();
console.log("newnodes1111", newnodes);
if (newnodes) {
if (newnodes.list.length) {
newnodes.list.forEach((it) => {
let childNode = {
id: new YJ.Tools().randomString(),
sourceType: 'FeatureCollection',
sourceName: it.name,
isShow: true
}
cusAddNodes(window.treeObj, node.id, [childNode])
let zijiNodes: any = [];
if (it.features && it.features.length) {
it.features.forEach((item) => {
let ziNode = {
id: item.id,
sourceType: item.type,
sourcePath: params.path,
sourceName:
item.properties[Vector.field] || Object.keys(item.properties)[0] || '未知',
params: {
...item,
},
isShow: true
};
zijiNodes.push(ziNode);
});
}
cusAddNodes(window.treeObj, childNode.id, zijiNodes)
});
}
}
if (ifFly) Vector.flyTo();
// Vector.onClick = shpTotal;
Vector.onClick = () => {
alert('left')
};
//鼠标右键点击事件
// Vector.onRightClick = shpSelect;
Vector.onRightClick = () => {
alert('right')
};
});
});
return Vector
}

View File

@ -5,6 +5,8 @@ import { useTreeNode } from '@/views/components/tree/hooks/treeNode'
import { initMapData } from '@/common/initMapData'
import { GisApi } from '@/api/gisApi'
import { addMapSource } from '@/common/addMapSource'
import { getNamefromPath } from '@/utils/index'
import { renderVector } from './renderVector'
const { cusAddNodes } = useTreeNode()
export const useRightOperate = () => {
@ -83,12 +85,16 @@ export const useRightOperate = () => {
parentId: parentId,
sourceName: name,
sourceType: 'vector',
sourcePath: filePaths[0],
// sourcePath: filePaths[0],
params: {
id: id,
path: filePaths[0],
field: 'id',
name: name,
headTables: [],
opacity: 1,
color: 'rgba(0,255,184,0.5)',
show: true
},
}
TreeApi.addOtherSource(params)
@ -97,6 +103,22 @@ export const useRightOperate = () => {
cusAddNodes(window.treeObj, params.parentId, [params])
renderVector(params, true)
}
else if (["geojson"].includes(sourceType)) {
let baseURL = localStorage.getItem('service')
await addMapSource({
type: 'geojson',
id: id,
sourceName: name,
opt: {
host: baseURL,
id: id,
url: filePaths[0],
show: true,
width: 1,
color: "rgb(239, 6, 6, 1)",
}
})
}
else {
// 获取最后一个点的位置
const lastDotIndex = filePaths[0].lastIndexOf('.');
@ -246,11 +268,54 @@ export const useRightOperate = () => {
}
}
//属性
const showAttr = (eventBus, node) => {
console.log(eventBus, node)
const showAttr = (eventBus) => {
let node
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
node = selectNodes[selectNodes.length - 1]
}
if (node && (node.sourceType == 'Feature' || node.sourceType == 'vector')) {
eventBus.emit("openDialog", 'vectorAttr', node.id);
}
}
//导入表头
const importHeader = () => {
let node
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
node = selectNodes[selectNodes.length - 1]
}
const dialogParams = {
properties: ["openFile", "multiSelections"],
filters: [
{
name: "excel",
extensions: ["csv"],
},
],
};
openDirectoryDialog(dialogParams, (paths) => {
if (!paths.length) {
return;
}
let name = getNamefromPath(paths[0]);
let formData = new FormData();
formData.append("file", paths[0]);
formData.append("id", node.id);
console.log(paths[0], node.id)
// importTablehead(formData).then((res) => {
// if (res.code == 0) {
// this.rightClickTreeNode.head_tables = JSON.stringify(
// res.data.list
// );
// this.$message.success("导入成功");
// } else {
// this.$message.error("导入失败");
// }
// });
});
}
//导入模型
const importHeader = () => { }
//导入模型
const addXlsxs = () => { }
//导入模型
@ -288,7 +353,7 @@ export const useRightOperate = () => {
type: 'success'
})
source_ids.forEach(item => {
let entity = window.earth.entityMap.get(item)
let entity = (window as any)._entityMap.get(item)
entity?.remove?.();
// let node = window.treeObj.getNodeByParam("id", item, null);
eventBus.emit("destroyComponent", item);
@ -325,7 +390,7 @@ export const useRightOperate = () => {
id: node.id,
}
}
let entityObject = window.earth.entityMap.get(params.id)
let entityObject = (window as any)._entityMap.get(params.id)
entityObject.setCustomView()
params.customView = entityObject.customView
let params2 = {
@ -346,7 +411,7 @@ export const useRightOperate = () => {
if (selectNodes && selectNodes[selectNodes.length - 1]) {
let node = selectNodes[selectNodes.length - 1]
let params = JSON.parse(node.params)
let entityObject = window.earth.entityMap.get(params.id)
let entityObject = (window as any)._entityMap.get(params.id)
entityObject.resetCustomView()
params.customView = entityObject.customView
let params2 = {
@ -475,7 +540,7 @@ export const useRightOperate = () => {
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
let node = selectNodes[selectNodes.length - 1]
let layer = window.earth.entityMap.get(node.id);
let layer = (window as any)._entityMap.get(node.id);
layer[key]();
_updateLayerIndex();
}
@ -497,7 +562,7 @@ export const useRightOperate = () => {
];
nodes.forEach((item) => {
if (arr.includes(item.sourceType) && item.isShow) {
let entityOptions = window.earth.entityMap.get(item.id)
let entityOptions = (window as any)._entityMap.get(item.id)
let layerIndex = entityOptions.layerIndex;
layers.push({ id: item.id, layerIndex });
// let params = {
@ -601,71 +666,7 @@ export const useRightOperate = () => {
}
}
function renderVector(node, ifFly = true) {
// if (node.detail != "") node.detail.field = node.detail.fieldName || "id";
let headTables;
if (node.headTables) {
headTables == "" ? node.headTables : JSON.parse(node.headTables);
}
let vectorParams = {
id: node.id,
path: node.sourcePath,
fileName: node.sourceName,
headTables,
...node.params,
};
console.log("node", node);
console.log("vectorParams", vectorParams);
let Vector = new YJ.Obj.Vector(window.earth, vectorParams);
console.log("Vector", Vector);
Vector.on().then((res) => {
Vector.load(() => {
let childNode = {
id: new YJ.Tools().randomString(),
sourceType: 'FeatureCollection',
sourceName: node.sourceName,
isShow: true
}
cusAddNodes(window.treeObj, node.id, [childNode])
let newnodes = Vector.getAllNode();
console.log("newnodes1111", newnodes);
if (newnodes) {
if (newnodes.list.length) {
newnodes.list.forEach((it) => {
let zijiNodes: any = [];
if (it.features && it.features.length) {
it.features.forEach((item) => {
let ziNode = {
id: item.id,
sourceType: item.type,
sourceName:
item.properties[Vector.field] || Object.keys(item.properties)[0] || '未知',
params: {
...item,
},
isShow: true
};
zijiNodes.push(ziNode);
});
}
cusAddNodes(window.treeObj, childNode.id, zijiNodes)
});
}
}
if (ifFly) Vector.flyTo();
// Vector.onClick = shpTotal;
Vector.onClick = () => {
alert('left')
};
//鼠标右键点击事件
// Vector.onRightClick = shpSelect;
Vector.onRightClick = () => {
alert('right')
};
});
});
}
function getLastPathComponent(path, extensionsToRemove = []) {
// 处理路径分隔符
@ -677,6 +678,7 @@ export const useRightOperate = () => {
// 检查是否匹配任何需要移除的后缀
for (const ext of extensionsToRemove) {
//@ts-ignore
const extWithDot = ext.startsWith('.') ? ext : `.${ext}`;
if (lastComponent.endsWith(extWithDot)) {
return lastComponent.slice(0, -extWithDot.length);
@ -686,6 +688,14 @@ export const useRightOperate = () => {
return lastComponent;
}
function openDirectoryDialog(option, cb) {
const { ipcRenderer } = require('electron')
ipcRenderer.send("open-directory-dialog", option);
ipcRenderer.once("selectedItem", (e, paths) => {
cb(paths);
});
}
return {
rightMenus
}

View File

@ -56,7 +56,7 @@ export const useTree = () => {
const menus = showRightMenu(event, treeObj.value)
console.log('menus', menus)
if (menus.length == 0) {
$changeComponentShow('.rightMenu', false)
// $changeComponentShow('.rightMenu', false)
return
}
nextTick(() => {
@ -71,13 +71,34 @@ export const useTree = () => {
*/
const onDblClick = (event: MouseEvent, treeId: string, treeNode: any) => {
let entityObject
if (treeNode.sourceType == 'pressModel') {
entityObject = (window as any).pressModelEntities.get(treeNode.id)
} else {
entityObject = window.earth.entityMap.get(treeNode.id)
if(treeNode.sourceType == 'Feature') {
const getEntityObject = (n) => {
if (n) {
let t = window.earth.entityMap.get(n.id)
if (t) {
return t
}
else {
if (n.parentId) {
return getEntityObject(window.treeObj.getNodeByParam("id", n.parentId, null))
}
}
}
}
entityObject = getEntityObject(treeNode)
entityObject.flyTo(treeNode.id)
}
else {
if (treeNode.sourceType == 'pressModel') {
entityObject = (window as any).pressModelEntities.get(treeNode.id)
} else {
entityObject = (window as any)._entityMap.get(treeNode.id)
}
entityObject.flyTo()
}
console.log('entityObject', entityObject)
entityObject.flyTo()
}
/**
* 用于捕获节点拖拽操作结束的事件回调函数
@ -235,7 +256,7 @@ export const useTree = () => {
entityObject = (window as any).pressModelEntities.get(treeNode.id)
if (!entityObject && treeNode.isShow) {
const entity = window.earth.entityMap.get(params.modelId).entity
const entity = (window as any)._entityMap.get(params.modelId).entity
entityObject = new YJ.Analysis.Flat(window.earth, entity, {
positions: params.positions,
height: params.height,
@ -245,7 +266,7 @@ export const useTree = () => {
}
} else if (treeNode.sourceType != 'directory') {
entityObject = window.earth.entityMap.get(params.id)
entityObject = (window as any)._entityMap.get(params.id)
}
if (entityObject) {
entityObject.show = treeNode.isShow;

View File

@ -446,17 +446,16 @@ export const useTreeNode = () => {
const cusNodeIcon = async (node) => {
let availablePort = await ipcRenderer.invoke('get-available-port');
let type
if(node.sourcePath) {
if(node.sourcePath || node.sourceType === 'vector') {
let path = node.sourcePath ? node.sourcePath : JSON.parse(node.params).path
// 获取最后一个点的位置
const lastDotIndex = node.sourcePath.lastIndexOf('.');
const lastDotIndex = path.lastIndexOf('.');
// 如果没有点或者点是最后一个字符,则不是有效的文件后缀
if (lastDotIndex === -1 || lastDotIndex === node.sourcePath.length - 1) {
if (lastDotIndex === -1 || lastDotIndex === path.length - 1) {
return false;
}
// 提取后缀并转换为小写进行比较
const extension = node.sourcePath.slice(lastDotIndex + 1).toLowerCase();
const extension = path.slice(lastDotIndex + 1).toLowerCase();
type = extension
}
else {
@ -534,7 +533,9 @@ export const useTreeNode = () => {
allNodes = allNodes.concat(treeObj.transformToArray(node))
})
allNodes.forEach((node: any) => {
_idSet.add(node.id)
if(node.sourceType !== 'FeatureCollection' && node.sourceType !== 'Feature') {
_idSet.add(node.id)
}
treeObj.removeNode(node)
})
YJ.Global.splitScreen.setActiveId();

View File

@ -119,6 +119,7 @@ import particleEffects from '../components/propertyBox/particleEffects.vue'
import flyLine from '../components/propertyBox/flyLine.vue'
import explosion from '../components/propertyBox/explosion.vue'
import vector from '../components/propertyBox/vector.vue'
import vectorAttr from '../components/propertyBox/vectorAttr.vue'
import graphObject from '../components/propertyBox/graphObject.vue'
import graph from '../components/propertyBox/graph.vue'
@ -306,6 +307,11 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
await nextTick()
dynamicComponentRef.value?.open(id)
break
case 'vectorAttr':
currentComponent.value = vectorAttr
await nextTick()
dynamicComponentRef.value?.open(id)
break
default:
break
}