This commit is contained in:
zh
2025-09-09 10:06:18 +08:00
parent 47fa66ce6b
commit a1f5a61252
14 changed files with 86 additions and 27 deletions

View File

@ -4,6 +4,8 @@ import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/earth.png?asset'
import fs from 'fs'
const { exec } = require('child_process');
// 开发环境路径处理 - 确保添加正确的file协议
const devSplashPath = path.resolve(
app.getAppPath(),

View File

@ -49,7 +49,7 @@ body {
background: var(--color-background);
line-height: 1.6;
font-family:
Inter,
SourceHanSans,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',

View File

@ -32,10 +32,15 @@
@font-face {
font-family: 'sy-boldface';
src: url('../fonts/sy-boldface.otf') format('opentype');
src: url('../iconfont/sy-boldface.otf') format('opentype');
}
@font-face {
font-family: 'Ali-mother-counts-bold';
src: url('../fonts/Ali-mother-counts-bold.ttf') format('truetype');
src: url('../iconfont/Ali-mother-counts-bold.ttf') format('truetype');
}
@font-face {
font-family: 'SourceHanSans';
src: url('../iconfont/SourceHanSansCN-Medium.otf') format('opentype');
}

View File

@ -24,7 +24,7 @@ import { TreeApi } from '@/api/tree'
import { renderMethods } from '../tree/hooks/renderTreeNode'
const { proxy } = getCurrentInstance()
const { t } = useI18n()
const { findParentId, findTreeIndex } = useTreeNode()
const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
const obj = ref(null)
const isclick = ref(false)
const eventBus = inject('bus')
@ -42,6 +42,13 @@ eventBus.on('graffitiObj', (data) => {
graffitiObjArr.push(data)
})
const methodMap = {
// 轨迹运动
trajectoryMotion: ()=>{
// let draw = new YJ.Draw.DrawPolyline(window.earth)
// draw.start((err, positions) => {
// if (positions.length > 1) {}
// })
},
// 电子围墙
electronicFence: () => {
let draw = new YJ.Draw.DrawPolyline(window.earth)
@ -51,7 +58,8 @@ const methodMap = {
positions.forEach((item) => {
if (item.alt < alt) alt = item.alt
})
let id = proxy.$md5(new Date().getTime() + '围墙')
// let id = new YJ.Tools().randomString()
let id = 'aaa'
let params = {
sourceName: '电子围墙',
id,
@ -71,10 +79,11 @@ const methodMap = {
// 渲染电子围墙
renderMethods.renderWallStereoscopic(params)
// 存入数据库
let res = TreeApi.addOtherSource(params)
console.log('addOtherSource', res)
// let res = TreeApi.addOtherSource(params)
// console.log('addOtherSource', res)
// 上树
cusAddNodes(window.treeObj, params.parentId, [params])
eventBus.emit("openDialog", 'wallStereoscopic');
}
})
},

View File

@ -182,7 +182,7 @@ let originalOptions: any
let that: any
const open = async (id: any, type: any) => {
that = window.earth.entityMap.get('aaa')
that = window.earth.entityMap.get(id)
originalOptions = structuredClone(that.options)
entityOptions.value = that
heightMode.value = entityOptions.value.heightMode

View File

@ -15,6 +15,9 @@ import { inject } from 'vue'
import { TreeApi } from '@/api/tree'
import Dialog from '@/components/dialog/baseDialog.vue'
import { initMapData } from '../tree/initMapData'
import { useTreeNode } from '../tree/hooks/treeNode'
const { cusAddNodes } = useTreeNode()
const baseDialog: any = ref(null)
const eventBus: any = inject('bus')
@ -37,10 +40,12 @@ const confirm = () => {
let id = new YJ.Tools().randomString()
let options: any = await initMapData('groundText', {
id: id,
name: name,
text: name,
positions: positions
})
delete options.host
delete options.positions
console.log('options', options)
let selectedNodes = window.treeObj.getSelectedNodes()
let params = {
id: id,
@ -54,6 +59,7 @@ const confirm = () => {
params: options
}
TreeApi.addOtherSource(params)
cusAddNodes(window.treeObj, params.parentId, [params])
})
}
defineExpose({

View File

@ -41,19 +41,20 @@ const confirm = () => {
positions: positions
})
delete options.host
let selectedNodes = window.treeObj.getSelectedNodes()
let params = {
id: id,
sourceName: name,
sourceType: 'standText',
parentId:
selectedNodes && selectedNodes[selectedNodes.length - 1]
? selectedNodes[selectedNodes.length - 1].id
: undefined,
// "treeIndex": 0,
params: options
}
TreeApi.addOtherSource(params)
console.log('options', options)
// let selectedNodes = window.treeObj.getSelectedNodes()
// let params = {
// id: id,
// sourceName: name,
// sourceType: 'standText',
// parentId:
// selectedNodes && selectedNodes[selectedNodes.length - 1]
// ? selectedNodes[selectedNodes.length - 1].id
// : undefined,
// // "treeIndex": 0,
// params: options
// }
// TreeApi.addOtherSource(params)
})
}
defineExpose({

View File

@ -102,6 +102,7 @@ let originalOptions: any
let that: any
const colorRef = ref(null)
const open = async (id: any) => {
console.log('id', id)
that = window.earth.entityMap.get(id)
originalOptions = structuredClone(that.options)
entityOptions.value = that
@ -131,12 +132,12 @@ const confirm = () => {
delete params.name
let params2 = {
"id": params.id,
"sourceName": params.name,
"sourceName": params.text,
"params": params,
"isShow": params.show ? 1 : 0,
}
TreeApi.updateDirectoryInfo(params2)
cusUpdateNode({ "id": params.id, "sourceName": params.name, "params": JSON.stringify(params) })
cusUpdateNode({ "id": params.id, "sourceName": params.text, "params": JSON.stringify(params) })
}
const close = () => {
baseDialog.value?.close()

View File

@ -28,6 +28,7 @@ export const useRightOperate = () => {
const editNode = (eventBus) => {
let selectNodes = getSelectedNodes(window.treeObj);
if (selectNodes && selectNodes[selectNodes.length - 1]) {
console.log('------------------',selectNodes[selectNodes.length - 1].params)
let params = JSON.parse(selectNodes[selectNodes.length - 1].params)
eventBus.emit("openDialog", selectNodes[selectNodes.length - 1].sourceType, params.id);
}
@ -73,6 +74,13 @@ export const useRightOperate = () => {
if (selectNodes && selectNodes[selectNodes.length - 1]) {
let node = selectNodes[selectNodes.length - 1]
let params = JSON.parse(node.params)
if(!params) {
params = {
name: node.sourceName,
show: node.isShow,
id: node.id,
}
}
let entityObject = window.earth.entityMap.get(params.id)
entityObject.setCustomView()
params.customView = entityObject.customView
@ -83,7 +91,7 @@ export const useRightOperate = () => {
"parentId": node.parentId,
"treeIndex": node.treeIndex,
"params": params,
"isShow": node.isShow ? 1 : 0,
"isShow": node.isShow ? 1 : 0 ? 1 : 0,
}
TreeApi.updateDirectoryInfo(params2)
}

View File

@ -435,8 +435,22 @@ export const useTree = () => {
for (let i = 0; i < zNodes.value.length; i++) {
if (zNodes.value[i].params) {
let params = JSON.parse(zNodes.value[i].params)
if (!params.id) {
params.id = zNodes.value[i].id
}
initMapData(zNodes.value[i].sourceType, params)
}
else {
//@ts-ignore
if (zNodes.value[i].detail) {
//@ts-ignore
let detail = JSON.parse(zNodes.value[i].detail)
if (!detail.id) {
detail.id = zNodes.value[i].id
}
initMapData(zNodes.value[i].sourceType, detail)
}
}
}
}
}

View File

@ -1,6 +1,7 @@
export const initMapData = async (type, data) => {
let entityObject
let options
console.log('data', type, data)
switch (type) {
case 'groundText':
entityObject = new YJ.Obj.GroundText(window.earth, data)
@ -39,6 +40,18 @@ export const initMapData = async (type, data) => {
case 'model':
entityObject = new YJ.Obj.ModelObject(window.earth, data)
break
case 'terrain':
data.host = 'http://192.168.110.25:8848'
entityObject = new YJ.Obj.Terrain(window.earth, data)
break
case 'layer':
data.host = 'http://192.168.110.25:8848'
entityObject = new YJ.Obj.Layer(window.earth, data)
break
case 'tileset':
data.host = 'http://192.168.110.25:8848'
entityObject = new YJ.Obj.Tileset(window.earth, data)
break
default:
return
break

View File

@ -86,7 +86,7 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
case 'groundText':
currentComponent.value = groundText
await nextTick()
dynamicComponentRef.value?.open()
dynamicComponentRef.value?.open(id)
break
case 'addStandText':
currentComponent.value = addStandText
@ -96,7 +96,7 @@ eventBus.on('openDialog', async (sourceType: any, id: any) => {
case 'standText':
currentComponent.value = standText
await nextTick()
dynamicComponentRef.value?.open()
dynamicComponentRef.value?.open(id)
break
case 'point':
currentComponent.value = billboardObject