管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-09-21 c2a6c53657baaf0830cd881e1a23a15af23ac6fa
src/views/Tools/LayerTree.vue
@@ -40,7 +40,6 @@
      :default-checked-keys="handleTreeCheck"
      :expand-on-click-node="false"
      :filter-node-method="filterNode"
      draggable
    >
      <span
        class="slot-t-node"
@@ -48,8 +47,8 @@
      >
        <span v-show="!data.isEdit">
          <span :class="[data.id >= 99 ? 'slot-t-node--label' : '']">{{
              node.label
            }}</span>
                              node.label
                            }}</span>
        </span>
        <span v-show="data.isEdit">
          <el-input
@@ -105,6 +104,13 @@
      >
        <i class="el-icon-download"></i>&nbsp;&nbsp;瓦片下载
      </div>
      <div
        class="edit"
        v-show="shwoAnnex"
        @click="annexDownload()"
      >
        <i class="el-icon-tickets"></i>&nbsp;&nbsp;附件
      </div>
    </el-card>
  </div>
</template>
@@ -129,6 +135,7 @@
      showOpacity: false, // 不透明度
      shwoTileDown: false, // 瓦片下载
      menuVisible: false, // 菜单
      shwoAnnex: false,//附件
      levelArray: [ // 高程数组
        0, 40000000, 20000000, 10000000, 5000000, 2000000, 1000000, 500000,
        250000, 200000, 100000, 50000, 17000, 9000, 5000, 2000, 1000, 500, 200,
@@ -279,7 +286,7 @@
      this.showOpacity = ["Tileset", "3DML"].indexOf(object.serveType) > -1; // 不透明度
      this.shwoTileDown = ["TMS", "DOM"].indexOf(object.serveType) > -1 && object.pubid; // 瓦片下载
      this.menuVisible = this.showProp || this.shwoHistogram || this.showLocal || this.showOpacity || this.shwoTileDown; // 菜单
      this.shwoAnnex = ['DEM', 'TMS'].indexOf(object.serveType) > -1;//附件
      this.$refs.card.$el.style.left = event.pageX + 20 + "px";
      this.$refs.card.$el.style.top = event.pageY + "px";
    },
@@ -295,6 +302,7 @@
    // 定位
    async positioning() {
      this.rmListener();
      if (["Tileset", "3DML"].indexOf(this.currentData.serveType) > -1) {
        for (let i in Viewer.scene.primitives._primitives) {
          if (Viewer.scene.primitives._primitives[i].id == this.currentData.cnName) {
@@ -311,14 +319,25 @@
          let wkt = this.$wkt.parse(data.result.geom);
          let height = this.getHeight(wkt.coordinates[2]);
          Viewer.camera.flyTo({
            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], height), // 2000
            destination: Cesium.Cartesian3.fromDegrees(wkt.coordinates[1], wkt.coordinates[0], sceneConfig.extureHeight), // 2000
          });
        }
        return;
      }
      if ("Mpt" == this.currentData.serveType) {
        viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(101.8, 37.9, 10000000.0) }); // 中国
        if (this.currentData.json) {
          var json = JSON.parse(this.currentData.json);
          if (json.west) {
            Viewer.camera.flyTo({
              destination: Cesium.Rectangle.fromDegrees(json.west, json.south, json.east, json.north)
            })
          }
        } else {
          Viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(101.8, 37.9, 10000000.0) }); // 中国
        }
      }
    },
    // 钻孔柱状图
@@ -343,9 +362,14 @@
    // 获取高度
    getHeight(level) {
      if (level > -1 && level < 23) return this.levelArray[level];
      return this.levelArray[this.levelArray.length - 1];
      var res = 7
      return this.levelArray[res];
    },
    //附件下载
    annexDownload() {
      this.$bus.$emit('annexDownload', this.currentData)
    },
    // 瓦片下载
    tileDownload() {
      this.rmListener();
@@ -403,7 +427,7 @@
        }
      }
      if (obj.TMS.length) this.setChangeDEM(obj.DEM, checked);
      if (obj.DEM.length) this.setChangeDEM(obj.DEM, checked);
      if (obj.TMS.length) this.setChangeTMS(obj.TMS, checked);
      if (obj.Mpt.length) this.setChangeMpt(obj.Mpt, checked);
      if (obj.Tileset.length) this.setChangeTileset(obj.Tileset, checked);
@@ -542,6 +566,7 @@
    },
    // 添加TMS图层
    addTMSLayers(layers) {
      for (let i in layers) {
        let res = layers[i];
        res.url = res.url.indexOf("{host}") > -1 ? res.url.replace("{host}", iisHost) : res.url;
@@ -556,8 +581,14 @@
          maximumLevel: 22,
          enablePickFeatures: false
        }), 1);
        layer.id = res.id;
        layer.name = res.cnName;
        if (is_production) {
          Viewer.imageryLayers.raiseToTop(layer);//将图层上移一层
          Viewer.imageryLayers.lower(layer);//将图层上移一层
        }
      }
    },
    // 切换Mpt
@@ -585,12 +616,18 @@
      for (let i in layers) {
        let res = layers[i];
        if (res.url.indexOf("{host}") > -1) res.url = res.url.replace("{host}", iisHost);
        let urls = res.url.split(';')
        let layer = sgworld.Creator.createImageryProvider(res.cnName, "wms", {
        let urls = res.url.split(';');
        var ops = {
          url: urls[0],
          layers: urls[1]
        }, "0", undefined, true, "");
        };
        if (res && res.json) {
          var rs = JSON.parse(res.json);
          ops.rectangle = Cesium.Rectangle.fromDegrees(rs.west, rs.south, rs.east, rs.north);
        }
        let layer = sgworld.Creator.createImageryProvider(res.cnName, "wms", ops, "0", undefined, true, "");
        this.mptLayer.push(layer);
      }
    },
@@ -684,6 +721,10 @@
      let layer = Viewer.imageryLayers.addImageryProvider(provider, 1);
      layer.name = res.cnName;
      if (is_production) {
        Viewer.imageryLayers.raiseToTop(layer);//将图层上移一层
        Viewer.imageryLayers.lower(layer);//将图层上移一层
      }
      // if (data.result.geom) {
      //   let wkt = this.$wkt.parse(data.result.geom);
      //   Viewer.camera.flyTo({