提交
This commit is contained in:
		@ -91,7 +91,7 @@ export default {
 | 
			
		||||
    cutFill: "土方分析",
 | 
			
		||||
    globalContour: "全局等高线",
 | 
			
		||||
    contour: "等高线",
 | 
			
		||||
    clear: "清除",
 | 
			
		||||
    clearAnalysis: "清除",
 | 
			
		||||
  },
 | 
			
		||||
  measure: {
 | 
			
		||||
    projectionArea: "投影面积",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								src/renderer/src/assets/images/second/clearAnalysis.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/renderer/src/assets/images/second/clearAnalysis.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 844 B  | 
@ -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',
 | 
			
		||||
 | 
			
		||||
@ -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,20 +47,21 @@ 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) => {
 | 
			
		||||
        // 等模型加载完后再加载压平模型
 | 
			
		||||
        Array.from((window as any).pressModelMap.keys()).forEach((key:any) => {
 | 
			
		||||
        Array.from((window as any).pressModelMap.keys()).forEach((key: any) => {
 | 
			
		||||
          if (key.indexOf("_" + data.id) > -1) {
 | 
			
		||||
            const nodes = (window as any).pressModelMap.get(key);
 | 
			
		||||
            if (nodes) {
 | 
			
		||||
@ -61,7 +69,7 @@ export const initMapData = async (type, data) => {
 | 
			
		||||
                // nodeType[nodes.source_type].render(nodes);
 | 
			
		||||
                const flatData = JSON.parse(nodes.params)
 | 
			
		||||
                const entity = window.earth.entityMap.get(flatData.modelId).entity
 | 
			
		||||
                let flat:any = new YJ.Analysis.Flat(window.earth, entity, {
 | 
			
		||||
                let flat: any = new YJ.Analysis.Flat(window.earth, entity, {
 | 
			
		||||
                  positions: flatData.positions,
 | 
			
		||||
                  height: flatData.height,
 | 
			
		||||
                  name: nodes.sourceName
 | 
			
		||||
@ -74,16 +82,16 @@ export const initMapData = async (type, data) => {
 | 
			
		||||
 | 
			
		||||
      })
 | 
			
		||||
      break
 | 
			
		||||
      case 'path':
 | 
			
		||||
    case 'path':
 | 
			
		||||
      entityObject = new YJ.Obj.TrajectoryMotion(window.earth, data)
 | 
			
		||||
      break
 | 
			
		||||
      case 'wallStereoscopic':
 | 
			
		||||
    case 'wallStereoscopic':
 | 
			
		||||
      entityObject = new YJ.Obj.WallStereoscopic(window.earth, data)
 | 
			
		||||
      break
 | 
			
		||||
      case 'diffuseScan':
 | 
			
		||||
    case 'diffuseScan':
 | 
			
		||||
      entityObject = new YJ.Obj.CircleDiffuse(window.earth, data)
 | 
			
		||||
      break
 | 
			
		||||
      case 'radarScan':
 | 
			
		||||
    case 'radarScan':
 | 
			
		||||
      entityObject = new YJ.Obj.RadarScan(window.earth, data)
 | 
			
		||||
      break
 | 
			
		||||
    default:
 | 
			
		||||
 | 
			
		||||
@ -97,7 +97,7 @@ const menuList: any = ref([
 | 
			
		||||
      'cutFill',
 | 
			
		||||
      'contour',
 | 
			
		||||
      'globalContour',
 | 
			
		||||
      'clear'
 | 
			
		||||
      'clearAnalysis'
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  // 测量
 | 
			
		||||
 | 
			
		||||
@ -245,7 +245,7 @@ const methodMap = {
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  //分析清除
 | 
			
		||||
  clear() {
 | 
			
		||||
  clearAnalysis() {
 | 
			
		||||
    YJ.Analysis.Clear()
 | 
			
		||||
  },
 | 
			
		||||
  //----------------工具------------------
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
            if (!params.id) {
 | 
			
		||||
              params.id = res.data.id
 | 
			
		||||
            }
 | 
			
		||||
            initMapData(res.data.sourceType, params)
 | 
			
		||||
          let params = JSON.parse(res.data.params)
 | 
			
		||||
          let detail = JSON.parse(res.data.detail)
 | 
			
		||||
          if (!params.id) {
 | 
			
		||||
            params.id = res.data.id
 | 
			
		||||
          }
 | 
			
		||||
          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)
 | 
			
		||||
            }
 | 
			
		||||
          if (!params.name) {
 | 
			
		||||
            params.name = res.data.sourceName
 | 
			
		||||
          }
 | 
			
		||||
          cusAddNodes(window.treeObj, params.parentId, [res.data])
 | 
			
		||||
          initMapData(res.data.sourceType, {...detail, ...params})
 | 
			
		||||
          cusAddNodes(window.treeObj, params.parentId, [{...detail, ...params}])
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
@ -196,7 +213,7 @@ export const useRightOperate = () => {
 | 
			
		||||
      .then(async () => {
 | 
			
		||||
        let selectNodes = getSelectedNodes(window.treeObj)
 | 
			
		||||
        let source_ids = cusRemoveNode(window.treeObj, selectNodes)
 | 
			
		||||
        const res = await TreeApi.removeDirectory({ ids:source_ids })
 | 
			
		||||
        const res = await TreeApi.removeDirectory({ ids: source_ids })
 | 
			
		||||
        if (res.code == 0 || res.code == 200) {
 | 
			
		||||
          ElMessage({
 | 
			
		||||
            message: '删除成功',
 | 
			
		||||
 | 
			
		||||
@ -238,7 +238,7 @@ export const useTree = () => {
 | 
			
		||||
          height: params.height,
 | 
			
		||||
          name: treeNode.sourceName
 | 
			
		||||
        })
 | 
			
		||||
        (window as any).pressModelEntities.set(treeNode.id, entityObject)
 | 
			
		||||
          (window as any).pressModelEntities.set(treeNode.id, entityObject)
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
@ -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 (!params.id) {
 | 
			
		||||
            params.id = zNodes.value[i].id
 | 
			
		||||
          }
 | 
			
		||||
          initMapData(zNodes.value[i].sourceType, params)
 | 
			
		||||
 | 
			
		||||
        if(zNodes.value[i].sourceType === 'directory') {
 | 
			
		||||
          continue
 | 
			
		||||
        }
 | 
			
		||||
        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)
 | 
			
		||||
          }
 | 
			
		||||
        //@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
 | 
			
		||||
        }
 | 
			
		||||
        if (!params.name) {
 | 
			
		||||
          params.name = zNodes.value[i].sourceName
 | 
			
		||||
        }
 | 
			
		||||
        initMapData(zNodes.value[i].sourceType, { ...detail, ...params })
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user