yxl
2025-01-10 ed837798421340859efca21e46adc17575bdfef8
最新修改
已添加1个文件
已修改6个文件
311 ■■■■ 文件已修改
public/config/config.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/gltf/ddc.glb 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/map/mapServer.js 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/map/mapView.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/mapSetFunc.js 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/chartView/index.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/config/config.js
@@ -21,7 +21,8 @@
  imgUrl: webHost + "/image/",
  reportMd: "/Data/Report.md",
  reportDocx: "/Data/Report.docx",
  modelLayer:"军事设施",//"FW21",
  modelLayer:"MilitaryFacilities",//"FW21",
  terrainUrl:"https://tiles1.geovisearth.com/base/v1/terrain?token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405",
  modelBase: {
    url: "http://106.120.22.26:8013",
    account: "/account-service",
public/gltf/ddc.glb
Binary files differ
src/assets/js/map/mapServer.js
@@ -4,7 +4,7 @@
  listData: [],
  sourceType: null,
  tileContent: null,
  init() {},
  init() { },
  addServer(res) {
    this.sourceType = res.sourceType;
    switch (this.sourceType) {
@@ -108,6 +108,10 @@
    //   const tileset =  earthCtrl.factory.create3DTilesets({
    //     url: res.url
    // });
    // const model = await earthCtrl.factory.create3DTilesets({
    //   url: res.url,
    //   success: this.flyTo(),
    // });
    var tileset = await Viewer.scene.primitives.add(
      new Cesium.Cesium3DTileset({
        url: res.url
@@ -125,13 +129,21 @@
      layerId: res.id,
      name: res.name
    });
    console.log(" this.listData",  this.listData);
    console.log(" this.listData", this.listData);
    // console.log('tileset',tileset);
    // earthCtrl.userScene.flyTo(tileset);
  },
  flyTo(model) {
    debugger
    // const options = {
    //   duration: 2,
    //   offset: new SmartEarth.Cesium.HeadingPitchRange(1.0, -0.3, 1000)
    // };
    // earthCtrl.userScene.flyTo(model.item, options);
  },
  traverseVisibleTiles() {
    tileset.readyPromise.then((tileset) => {
      tileset.tileVisibility.forEachTile(function (tile) {});
      tileset.tileVisibility.forEachTile(function (tile) { });
    });
  },
  addWfsLayer(res) {
src/assets/js/map/mapView.js
@@ -36,10 +36,8 @@
        console.log("点击的对象:", pickedObject);
      }
    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    // earthCtrl.factory.createTerrainLayer({
    //   sourceType: "ctb",
    //   url: "https://tiles1.geovisearth.com/base/v1/terrain?token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405"
    // });
    //加载全球地形
    this.addTerrain();
    this.addImageLayer();
    // this.addqqmap();
    let now2 = new Date();
@@ -116,6 +114,9 @@
    //   lat: 23.990136825668284,
    //   alt: 150
    // })
    earthCtrl.measure.pickPosition({}, function (e) {
      console.info(e);
    });
  },
  addTetrahedron(res) {
    earthCtrl.factory.addTetrahedron({
@@ -250,14 +251,14 @@
      width: 1.5,
      color: '#87CEFA',
    })
    earthCtrl.factory.createWfsLayer('polyline', {
    const layer1 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarM',
      width: 1.5,
      color: '#de3',
    })
    earthCtrl.factory.createWfsLayer('polyline', {
    const layer2 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarS',
      width: 1.5,
@@ -286,30 +287,36 @@
  },
  addModel() {
    const entity = earthCtrl.viewer.entities.add({
      position: SmartEarth.Cesium.Cartesian3.fromDegrees(
        121.614202387521061,
        23.990136825668284,
        0
      position: Cesium.Cartesian3.fromDegrees(
        121.576830,
        24.006230,
      ),
      model: {
        uri: '/gltf/tank.glb',
        scale: 15,
        heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND,
        disableDepthTestDistance: Number.POSITIVE_INFINITY // 禁用深度测试
        uri: '/gltf/ddc.glb',
        scale: 20,
        heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
        // disableDepthTestDistance: Number.POSITIVE_INFINITY // 禁用深度测试
      },
      label: {
        show: true,
        text: '经度:121.6142023,纬度:23.9901368',
        color: SmartEarth.Cesium.Color.fromCssColorString("#fff"),
        text: '经度:121.576830,纬度:24.006230',
        color: Cesium.Color.fromCssColorString("#fff"),
        font: "normal 14px MicroSoft YaHei",
        showBackground: true,
        outlineColor: SmartEarth.Cesium.Color.WHITE,
        pixelOffset: new SmartEarth.Cesium.Cartesian2(10, -30),
        horizontalOrigin: SmartEarth.Cesium.HorizontalOrigin.CENTER,
        verticalOrigin: SmartEarth.Cesium.VerticalOrigin.BOTTOM,
        heightReference: SmartEarth.Cesium.HeightReference.CLAMP_TO_GROUND,
        outlineColor: Cesium.Color.WHITE,
        pixelOffset: new Cesium.Cartesian2(10, -30),
        horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
        heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
      },
    });
  },
  //加载全球地形
  addTerrain() {
    window.terrain = earthCtrl.factory.createTerrainLayer({
      sourceType: "ctb",
      url:config.terrainUrl
    });
  }
};
export default mapViewer;
src/assets/js/mapSetFunc.js
@@ -19,6 +19,12 @@
      case "queryMeta":
        this.creatQueryMeta(res);
        break;
      case "aroundPoi_2":
        this.addWfsLayer(res);
        break;
      case "getParam":
        this.addTetrahedron(res);
        break;
    }
  },
  creatQueryMeta(res) {
@@ -37,7 +43,7 @@
    this.setModelChangeColor(colors);
  },
  setModelChangeColor(res) {
    console.log('mapServer.listData',mapServer.listData,config.modelLayer);
    console.log('mapServer.listData', mapServer.listData, config.modelLayer);
    const modelLayer = mapServer.listData.filter((obj) => {
      if (obj.name == config.modelLayer) {
        return obj;
@@ -156,7 +162,7 @@
  },
  creatPoiMap(res) {
    res.data.forEach((poi,index) => {
    res.data.forEach((poi, index) => {
      // const poi = res.data[0];
      console.log('poi------', poi)
      const label = earthCtrl.factory.createLabel({
@@ -236,7 +242,7 @@
        ids: element.list
      });
    })
    console.log('colors----',colors);
    console.log('colors----', colors);
    store.state.setListColor = colors;
    store.state.showLenged = true;
    this.setModelChangeColor(colors);
@@ -323,6 +329,160 @@
      }
    });
  },
  // 添加wfs
  addWfsLayer(res) {
    if (window.terrain) {
      window.terrain.removeFromMap();
      window.terrain = null;
    }
    // earthCtrl.viewer.scene.globe.show = false;
    earthCtrl.viewer.camera.flyTo({
      destination: {
        x: -3475710.5684351875,
        y: 5625834.799523204,
        z: 2729961.751894543,
      },
      orientation: {
        heading: 5.73978482494632,
        pitch: -1.2817819264676036,
        roll: 6.282989918773924,
      },
    });
    const layer1 = earthCtrl.factory.createWfsLayer('point', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarSpot',
      text: '[JiaShanBase:Type]',
      color: '#de3',
      disableDepthTestDistance: Infinity
    })
    this.layerList.push({
      layer: layer1,
      func: res.func
    });
    const layer2 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarL',
      width: 1.5,
      color: '#87CEFA',
      disableDepthTestDistance: Number.POSITIVE_INFINITY,
    })
    this.layerList.push({
      layer: layer2,
      func: res.func
    });
    const layer3 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarM',
      width: 1.5,
      color: '#de3',
      disableDepthTestDistance: Number.POSITIVE_INFINITY,
    })
    this.layerList.push({
      layer: layer3,
      func: res.func
    });
    const layer4 = earthCtrl.factory.createWfsLayer('polyline', {
      urls: 'https://cim.smartearth.cn/geoserver/JiaShanBase/ows',
      layer: 'JiaShanBase:RadarS',
      width: 1.5,
      color: '#FF0000',
      disableDepthTestDistance: Number.POSITIVE_INFINITY,
    })
    this.layerList.push({
      layer: layer4,
      func: res.func
    });
    this.addRaderLayer(res);
  },
  addRaderLayer(res) {
    //雷达遮罩扫描(自定义)
    const option = {
      radius: 150000,  //半径
      yaw: 0,  //雷达方向(可选)
      angle: 120,  //雷达夹角(可选)
      scanAngle: 30,  //扫描夹角(可选)
      speed: 5,  //倍速(可选)
      maxLat: 90,  //下维度(可选)
      minLat: 45,  //上维度(可选)
      stackPartitions: 40,  //横向网格数(可选)
      slicePartitions: 80,  //纵向网格数(可选)
      //color: 'rgba(255,255,255,0.5)',  //雷达遮罩颜色(可选)
      //outlineColor: 'rgba(255,255,255,0.5)',  //雷达遮罩边框线颜色(可选)
      //scanColor: 'rgba(255,0,0,0.5)',   //扫描颜色(可选)
    };
    const position1 = [121.614202387521061, 23.990136825668284, 0];
    // 雷达遮罩
    const layer = earthCtrl.factory.createRadarMaskScan('雷达遮罩扫描1', position1, option)
    this.layerList.push({
      layer: layer,
      func: 'radarMaskScan'
    });
  },
  //视锥
  addTetrahedron(res) {
    res.data.forEach((item,index) => {
      const tetrahedron = earthCtrl.factory.addTetrahedron({
        position: {
          lon: item.lontitude,
          lat: item.lattitude,
          height: item.height
        },
        multiple: 0.05,
        scale: new SmartEarth.Cesium.Cartesian3(100, 100, 100),
        color: "#FF0000",
        outlineColor: "#FF0000"
      });
      if (index == 0) {
        earthCtrl.camera.flyTo(item.lontitude, item.lattitude, 5000, 0, -90, 0, 2);
        const modelLayer = mapServer.listData.filter((obj) => {
          if (obj.name == config.modelLayer) {
            return obj;
          }
        });
        // debugger
        if (modelLayer.length <= 0) return;
        // earthCtrl.userScene.flyTo(modelLayer[0].layer);
        // modelLayer[0].layer.style = new Cesium.Cesium3DTileStyle({
        //   color: {
        //     evaluateColor: (feature) => {
        //       const id = feature.getProperty("id");
        //       // if (id === 'de9b9f1f-bea5-11ef-bbd1-ac82473c08a6') {
        //       //   debugger
        //       //   // const boundingVolume = feature.tileset.root.boundingVolume
        //       //   // const center = Cesium.BoundingVolume.computeBoundingVolume(boundingVolume, feature.tileset.root.transform);
        //       //   // debugger
        //       //   earthCtrl.viewer.camera.flyTo({
        //       //     destination: center,
        //       //     duration: 2.0
        //       //   });
        //       //   // earthCtrl.userScene.flyTo(feature);
        //       //   // return new SmartEarth.Cesium.Color.fromCssColorString(
        //       //   //   '#FF0000'
        //       //   // );
        //       // }
        //       // console.log("id**********", id);
        //       // const color = res.filter((item) => {
        //       //   if (item.ids.indexOf(id) > -1) {
        //       //     return item;
        //       //   }
        //       // });
        //       // if (color.length > 0) {
        //         // return new SmartEarth.Cesium.Color.fromCssColorString(
        //         //   color[0].color
        //         // );
        //       // }
        //     }
        //   }
        // });
      }
      this.layerList.push({
        layer: tetrahedron,
        func: 'tetrahedron'
      });
    })
  },
  removeAll() {
    store.state.setListColor = [];
    store.state.showLenged = false;
@@ -360,6 +520,27 @@
        this.layerList.splice(i, 1);
        i--;
      }
      else if (obj.func == "aroundPoi_2") {
        this.layerList[i].layer.destroy();
        this.layerList.splice(i, 1);
        i--;
      }
      else if (obj.func == "radarMaskScan") {
        this.layerList[i].layer.deleteObject();
        this.layerList.splice(i, 1);
        i--;
      }
      else if (obj.func == "tetrahedron") {
        this.layerList[i].layer.deleteObject();
        this.layerList.splice(i, 1);
        i--;
      }
    }
    if (!window.terrain) {
      window.terrain = earthCtrl.factory.createTerrainLayer({
        sourceType: "ctb",
        url: config.terrainUrl
      });
    }
  }
};
src/views/chartView/index.vue
@@ -140,6 +140,15 @@
      };
    },
    async getQueryLayerList() {
      const item = {
        sourceType: "Tileset",
        name: "MilitaryFacilities",
        url: "/data-api/gisserver/c3dserver/sedb_DESKTOP-15DOTHJ_SEM4550/tileset.json",
      };
      setTimeout(() => {
        mapServer.addServer(item);
      }, 1000);
      return;
      getAgentLayerList().then((response) => {
        if (response.code != 200) return;
        const items = response.data;
@@ -320,33 +329,33 @@
          let dataList = [
            {
              type: "可打击目标",
              color:'#FF3366',
              color: "#FF3366",
              list: [],
            },
            {
              type: "不可打击目标",
              color:'#33FF66',
              color: "#33FF66",
              list: [],
            },
            {
              type: "其他",
              color:'#3366FF',
              color: "#3366FF",
              list: [],
            },
          ];
          res.data.forEach((item) => {
            if (item.ifstrike === "1") {
              dataList[0].list.push(item.seid);
              dataList[0].list.push(item.uuid);
            } else if (item.ifstrike === "2") {
              dataList[1].list.push(item.seid);
              dataList[1].list.push(item.uuid);
            } else {
              dataList[2].list.push(item.seid);
              dataList[2].list.push(item.uuid);
            }
          });
          const resultData = dataList
            .map((item) => `| ${item.type} | ${item.list.length} |`)
            .join("\n");
          var a = `| 数据类型 | 数据量 |\n|------|------|\n`+resultData;
          var a = `| 数据类型 | 数据量 |\n|------|------|\n` + resultData;
          console.log("aaa", a);
          this.setUpdateHistoryInFor(obj, a);
          var roleMsg = msgData.getMdData("markdown", a);
@@ -354,16 +363,37 @@
          const finalData = {
            func: "aroundPoi",
            data: dataList,
          }
          };
          mapSetFunc.init(finalData);
          break;
        case "getParam":
          mapSetFunc.init(res);
          console.log("res.data.targetinfo", res);
          this.setUpdateHistoryInFor(obj, res.msg);
          var roleMsg = msgData.getAffairsData([
            { type: "text", val: res.data[0].targetinfo },
          ]);
          if (res.data.length === 1) {
            var roleMsg = msgData.getAffairsData([
              { type: "text", val: res.data[0].targetinfo },
            ]);
            this.refashMsg(roleMsg.list);
          } else {
            const markData = res.data
              .map((item) => `| ${item.name} | ${item.targetinfo} |`)
              .join("\n");
            let markAttr = `| 名称 | 属性信息 |\n|------|------|\n` + markData;
            var roleMsg = msgData.getMdData("markdown", markAttr);
            this.refashMsg(roleMsg.list);
          }
          break;
        case "aroundPoi_2":
          mapSetFunc.init(res);
          console.log("res.data.targetinfo", res);
          const resData = res.data
            .map((item) => `| ${item.name} | ${item.targetinfo} |`)
            .join("\n");
          var attr = `| 名称 | 属性信息 |\n|------|------|\n` + resData;
          console.log("aaa", attr);
          var roleMsg = msgData.getMdData("markdown", attr);
          this.setUpdateHistoryInFor(obj, res.msg);
          this.refashMsg(roleMsg.list);
          break;
        default:
vue.config.js
@@ -18,7 +18,7 @@
        }
      },
      "/data-api": {
        target: 'https://cim.smartearth.cn',
        target: 'http://103.135.160.14:9038/',
        changeOrigin: true,
        pathRewrite: {
          '^/data-api': ''