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 icon from '../../resources/earth.png?asset'
import fs from 'fs' import fs from 'fs'
const { exec } = require('child_process');
// 开发环境路径处理 - 确保添加正确的file协议 // 开发环境路径处理 - 确保添加正确的file协议
const devSplashPath = path.resolve( const devSplashPath = path.resolve(
app.getAppPath(), app.getAppPath(),

View File

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

View File

@ -32,10 +32,15 @@
@font-face { @font-face {
font-family: 'sy-boldface'; font-family: 'sy-boldface';
src: url('../fonts/sy-boldface.otf') format('opentype'); src: url('../iconfont/sy-boldface.otf') format('opentype');
} }
@font-face { @font-face {
font-family: 'Ali-mother-counts-bold'; 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' import { renderMethods } from '../tree/hooks/renderTreeNode'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { t } = useI18n() const { t } = useI18n()
const { findParentId, findTreeIndex } = useTreeNode() const { findParentId, findTreeIndex, cusAddNodes } = useTreeNode()
const obj = ref(null) const obj = ref(null)
const isclick = ref(false) const isclick = ref(false)
const eventBus = inject('bus') const eventBus = inject('bus')
@ -42,6 +42,13 @@ eventBus.on('graffitiObj', (data) => {
graffitiObjArr.push(data) graffitiObjArr.push(data)
}) })
const methodMap = { const methodMap = {
// 轨迹运动
trajectoryMotion: ()=>{
// let draw = new YJ.Draw.DrawPolyline(window.earth)
// draw.start((err, positions) => {
// if (positions.length > 1) {}
// })
},
// 电子围墙 // 电子围墙
electronicFence: () => { electronicFence: () => {
let draw = new YJ.Draw.DrawPolyline(window.earth) let draw = new YJ.Draw.DrawPolyline(window.earth)
@ -51,7 +58,8 @@ const methodMap = {
positions.forEach((item) => { positions.forEach((item) => {
if (item.alt < alt) alt = item.alt 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 = { let params = {
sourceName: '电子围墙', sourceName: '电子围墙',
id, id,
@ -71,10 +79,11 @@ const methodMap = {
// 渲染电子围墙 // 渲染电子围墙
renderMethods.renderWallStereoscopic(params) renderMethods.renderWallStereoscopic(params)
// 存入数据库 // 存入数据库
let res = TreeApi.addOtherSource(params) // let res = TreeApi.addOtherSource(params)
console.log('addOtherSource', res) // console.log('addOtherSource', res)
// 上树 // 上树
cusAddNodes(window.treeObj, params.parentId, [params]) cusAddNodes(window.treeObj, params.parentId, [params])
eventBus.emit("openDialog", 'wallStereoscopic');
} }
}) })
}, },

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -435,8 +435,22 @@ export const useTree = () => {
for (let i = 0; i < zNodes.value.length; i++) { for (let i = 0; i < zNodes.value.length; i++) {
if (zNodes.value[i].params) { if (zNodes.value[i].params) {
let params = JSON.parse(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) 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) => { export const initMapData = async (type, data) => {
let entityObject let entityObject
let options let options
console.log('data', type, data)
switch (type) { switch (type) {
case 'groundText': case 'groundText':
entityObject = new YJ.Obj.GroundText(window.earth, data) entityObject = new YJ.Obj.GroundText(window.earth, data)
@ -39,6 +40,18 @@ export const initMapData = async (type, data) => {
case 'model': case 'model':
entityObject = new YJ.Obj.ModelObject(window.earth, data) entityObject = new YJ.Obj.ModelObject(window.earth, data)
break 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: default:
return return
break break

View File

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