This commit is contained in:
zh
2025-09-11 20:51:39 +08:00
parent 3474759fdc
commit a0499b9b35
8 changed files with 76 additions and 55 deletions

View File

@ -91,7 +91,7 @@ export default {
cutFill: "土方分析",
globalContour: "全局等高线",
contour: "等高线",
clear: "清除",
clearAnalysis: "清除",
},
measure: {
projectionArea: "投影面积",

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

View File

@ -10,14 +10,15 @@ import type {
const pendingRequests = new Map<string, AbortController>()
let baseURL: any
if (window && window.process && window.process.type === 'renderer') {
baseURL = localStorage.getItem('ip') || 'http://192.168.110.25:8848' || 'http://127.0.0.1:8808'
// baseURL = localStorage.getItem('ip') ||'http://192.168.110.25:8848'|| 'http://127.0.0.1:8808'
baseURL = 'http://127.0.0.1:8848'
} else {
baseURL = 'http://192.168.110.25:8848'
}
// 创建自定义配置的axios实例
const service: AxiosInstance = axios.create({
baseURL: 'http://192.168.110.25:8848',
baseURL: baseURL,
timeout: 10000,
headers: {
'Content-Type': 'application/json',

View File

@ -1,6 +1,13 @@
export const initMapData = async (type, data) => {
let entityObject
let options
let baseURL
if (window && window.process && window.process.type === 'renderer') {
// baseURL = localStorage.getItem('ip') ||'http://192.168.110.25:8848'|| 'http://127.0.0.1:8808'
baseURL = 'http://127.0.0.1:8848'
} else {
baseURL = 'http://192.168.110.25:8848'
}
switch (type) {
case 'groundText':
entityObject = new YJ.Obj.GroundText(window.earth, data)
@ -40,15 +47,16 @@ export const initMapData = async (type, data) => {
entityObject = new YJ.Obj.ModelObject(window.earth, data)
break
case 'terrain':
data.host = 'http://192.168.110.25:8848'
data.host = baseURL
entityObject = new YJ.Obj.Terrain(window.earth, data)
break
case 'layer':
data.host = 'http://192.168.110.25:8848'
data.host = baseURL
console.log('data',data)
entityObject = new YJ.Obj.Layer(window.earth, data)
break
case 'tileset':
data.host = 'http://192.168.110.25:8848'
data.host = baseURL
entityObject = new YJ.Obj.Tileset(window.earth, data)
entityObject.load((res) => {

View File

@ -97,7 +97,7 @@ const menuList: any = ref([
'cutFill',
'contour',
'globalContour',
'clear'
'clearAnalysis'
]
},
// 测量

View File

@ -245,7 +245,7 @@ const methodMap = {
})
},
//分析清除
clear() {
clearAnalysis() {
YJ.Analysis.Clear()
},
//----------------工具------------------

View File

@ -36,14 +36,40 @@ export const useRightOperate = () => {
}
ipcRenderer.send('open-directory-dialog', options);
// 监听主进程返回的结果
//@ts-ignore
ipcRenderer.once('selectedItem', async (event, filePaths) => {
if (filePaths.length > 0) {
let id = new YJ.Tools().randomString()
// 检查文件名是否有效
if (typeof filePaths[0] !== 'string' || filePaths[0].trim() === '') {
return false;
}
// 获取最后一个点的位置
const lastDotIndex = filePaths[0].lastIndexOf('.');
// 如果没有点或者点是最后一个字符,则不是有效的文件后缀
if (lastDotIndex === -1 || lastDotIndex === filePaths[0].length - 1) {
return false;
}
// 提取后缀并转换为小写进行比较
const extension = filePaths[0].slice(lastDotIndex + 1).toLowerCase();
let params2:any = {}
if(extension === 'mbtiles') {
params2.alpha = 1
params2.brightness = 1
}
let params: any = {
id: id,
sourcePath: filePaths[0],
parentId: parentId,
params: '',
params: JSON.stringify(params2),
}
// filePaths[0].split('\\').pop()
let res = await TreeApi.addModelSource(params)
@ -54,25 +80,16 @@ export const useRightOperate = () => {
type: 'success'
})
res.data.id = id
if (res.data.params) {
let params = JSON.parse(res.data.params)
let detail = JSON.parse(res.data.detail)
if (!params.id) {
params.id = res.data.id
}
initMapData(res.data.sourceType, params)
if (!params.name) {
params.name = res.data.sourceName
}
else {
//@ts-ignore
if (res.data.detail) {
//@ts-ignore
let detail = JSON.parse(res.data.detail)
if (!detail.id) {
detail.id = res.data.id
}
initMapData(res.data.sourceType, detail)
}
}
cusAddNodes(window.treeObj, params.parentId, [res.data])
initMapData(res.data.sourceType, {...detail, ...params})
cusAddNodes(window.treeObj, params.parentId, [{...detail, ...params}])
}
}
});

View File

@ -489,25 +489,20 @@ export const useTree = () => {
const initTreeCallBack = () => {
if (window.earth) {
for (let i = 0; i < zNodes.value.length; i++) {
if (zNodes.value[i].params) {
let params = JSON.parse(zNodes.value[i].params)
if(zNodes.value[i].sourceType === 'directory') {
continue
}
//@ts-ignore
let params = JSON.parse(zNodes.value[i].params||'{}')
//@ts-ignore
let detail = JSON.parse(zNodes.value[i].detail||'{}')
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)
}
if (!params.name) {
params.name = zNodes.value[i].sourceName
}
initMapData(zNodes.value[i].sourceType, { ...detail, ...params })
}
}
}