管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-05-27 0af4ecb9b2047b8ba6d00e891050cf2d68b829a6
src/views/Tools/LayerTree.vue
@@ -115,7 +115,7 @@
      <div
        class="edit"
        @click="pellucidity()"
        v-if="showlocal"
        v-if="showopaque"
      >
        <i class="el-icon-tickets"></i>&nbsp;&nbsp;透明度
      </div>
@@ -227,6 +227,7 @@
    return {
      shwoHistogram: false,
      showlocal: false,
      showopaque: false,
      eleId: "",
      isShow: false,
      currentData: "",
@@ -323,11 +324,18 @@
      this.currentNode = Node;
      this.$store.state.propertiesName = this.currentData;
      if (this.currentData.serveType == "Tileset" || this.currentData.serveType == "3DML") {
      this.showModelAttach = false;
      this.shwoTitle = false;
      this.menuVisible = true;
      if (this.currentData.serveType == 'TMS') {
        this.shwoTitle = true
      } else if (this.currentData.serveType == "Tileset" || this.currentData.serveType == "3DML") {
        this.showModelAttach = true;
      } else {
        this.showModelAttach = false;
      } else if (this.currentData.serveType == "DOM" || this.currentData.serveType == "Mpt") {
        this.menuVisible = false;
      }
      if (this.currentData.enName == "s_explorationpoint") {
        this.shwoHistogram = true;
      } else {
@@ -341,10 +349,18 @@
      }
      if (Node.data.children == null && Node.data.serveType == "Tileset" || Node.data.serveType == "3DML") {
        this.showlocal = true;
      } else if (Node.data.children == null && Node.data.serveType != "Tileset" || Node.data.serveType == "3DML") {
        this.showopaque = true;
      } else if (Node.data.children == null && Node.data.serveType == "TMS") {
        this.showlocal = true;
        this.showopaque = false;
      } else if (Node.data.children == null && Node.data.serveType != "Tileset") {
        this.showlocal = false;
        this.showopaque = false;
      }
      this.menuVisible = true;
      if (this.currentData.serveType == "DEM") {
        this.showlocal = true;
        this.showopaque = false;
      }
      this.$refs.card.$el.style.left = event.pageX + 20 + "px";
      this.$refs.card.$el.style.top = event.pageY + "px";
@@ -484,13 +500,23 @@
    //模型定位
    positioning() {
    async positioning() {
      this.menuVisible = false
      for (var i in Viewer.scene.primitives._primitives) {
        if (
          Viewer.scene.primitives._primitives[i].id == this.currentData.cnName
        ) {
          Viewer.flyTo(Viewer.scene.primitives._primitives[i]);
      if (this.currentData.serveType == 'Tileset' || this.currentData.serveType == '3DML') {
        for (var i in Viewer.scene.primitives._primitives) {
          if (
            Viewer.scene.primitives._primitives[i].id == this.currentData.cnName
          ) {
            Viewer.flyTo(Viewer.scene.primitives._primitives[i]);
          }
        }
      } else if (this.currentData.pubid && this.currentData.serveType == 'TMS' || this.currentData.serveType == "DEM") {
        const data = await comprehensive_selectPubById({ id: this.currentData.pubid })
        if (data.result.geom) {
          var wkt = this.$wkt.parse(data.result.geom);
          Viewer.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000),
          });
        }
      }
    },
@@ -574,6 +600,7 @@
        var listTileset = [];
        var listTMS = [];
        var listMpt = [];
        var listDEM = [];
        for (var i in this.childOption) {
          switch (this.childOption[i].serveType) {
            case 'WMS':
@@ -594,6 +621,9 @@
            case 'TMS':
              listTMS.push(this.childOption[i])
              break;
            case 'DEM':
              this.setChangeDEM([data], checked);
              break;
          }
        }
        this.setChangeWMS(listWMS, checked);
@@ -610,6 +640,8 @@
          this.setChangeTMS([data], checked);
        } else if (data.serveType == "Mpt") {
          this.setChangeMpt([data], checked);
        } else if (data.serveType == "DEM") {
          this.setChangeDEM([data], checked);
        }
      }
      // if (data.type != 2) return;
@@ -749,6 +781,53 @@
      //   }
      // }
    },
    setChangeDEM(result, checked) {
      var value = this.$refs.tree.getCheckedNodes();
      var std = [];
      var val = [];
      for (var i in value) {
        if (value[i].serveType != 'DEM') {
          val.push(value[i].id)
        }
        std.push(value[i].id)
      }
      if (window.terrainFlag == 'MPT') {
        window.terrainLayer.deleteObject();
      } else if (window.terrainFlag == 'DEM') {
        Viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider();
        window.terrainLayer = null;
      }
      var tile = result[0]
      if (std.indexOf(tile.id) != -1) {
        val.push(tile.id);
        this.$refs.tree.setCheckedKeys(val);
        window.terrainLayer = new Cesium.CesiumTerrainProvider({
          url: tile.url.replace("{host}", iisHost)
        });
        Viewer.terrainProvider = window.terrainLayer
        window.terrainFlag = 'DEM'
      } else {
        var option = {
          url: window.sceneConfig.SGUrl,
          layerName: window.sceneConfig.mptName,
          requestVertexNormals: true,
        };
        window.terrainLayer = sgworld.Creator.sfsterrainprovider("", option, "", true, "");
        Viewer.camera.flyTo({
          destination: Cesium.Cartesian3.fromDegrees(110, 33, 8000000),
        });
        window.terrainFlag = 'MPT'
      }
    },
    setChangeMpt(result, checked) {
      var value = this.$refs.tree.getCheckedNodes();
      var std = [];
@@ -1035,10 +1114,10 @@
        layer.name = res.cnName;
        if (data.result.geom) {
          var wkt = this.$wkt.parse(data.result.geom);
          Viewer.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000),
          });
          // var wkt = this.$wkt.parse(data.result.geom);
          // Viewer.camera.flyTo({
          //   destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], 2000),
          // });
        }
        this.setChangeWMS();
      }