管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2023-04-03 e0a68e0426c7d883f720831ebfeb843c70df697c
src/components/MapView/mapMenuTop.vue
@@ -170,6 +170,7 @@
        >确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
@@ -179,6 +180,7 @@
import {
  inquiry_SelectTabs,
  inquiry_uploadShp,
  decr,
  encr,
  dataLib_selectTabs,
  pipelines_selectSegNames,
@@ -260,6 +262,9 @@
      analyGid: null,
      dialogFormVisible: false,
      bufferLinePosition: [],
      dialogExtentVisible: false,
      setExtent: 10,
      wktExtent: null,
    }
  },
@@ -267,6 +272,9 @@
    this.menuTopFrom.queryType = "rectangle"
    this.getAllTable()
    this.getPipelineData()
    this.$bus.$on("setExtentBUff", res => {
      this.setExtentBuffer(res);
    })
  },
  watch: {
    analyGid(newVal, oldVal) {
@@ -276,6 +284,55 @@
    },
  },
  methods: {
    setExtentBuffer(res) {
      // var wkt = this.$wkt.parse(this.wktExtent)
      // var wkt = encr(this.wktExtent)
      var wkt1 = decr(this.wktExtent)
      var wkt = this.$wkt.parse(wkt1)
      var restVal = turf.buffer(wkt, res, { units: "meters", steps: 64 })
      var options = { precision: 6, coordinates: 2 };
      var truncated = turf.truncate(restVal, options);
      var options1 = { tolerance: 0.01, highQuality: false };
      var simplified = turf.simplify(truncated, options1);
      var wkt2 = this.$wkt.convert(simplified.geometry)
      var wkt3 = encr(wkt2)
      this.$store.state.mapMenuShpFile = wkt3
      var points = simplified.geometry.coordinates[0]
      var degreesArray = this.pointsToDegreesArray(points)
      let array = Cesium.Cartesian3.fromDegreesArray(degreesArray)
      const hierarchy = new Cesium.PolygonHierarchy(array)
      const bufferPolygon = sgworld.Viewer.entities.add({
        polygon: {
          hierarchy: hierarchy,
          material: Cesium.Color.RED.withAlpha(0.5),
          classificationType: Cesium.ClassificationType.BOTH,
        },
      })
      this.bufferEntities.push(bufferPolygon)
      sgworld.Navigate.flyToObj(bufferPolygon)
      this.showMapMenuPop()
    },
    getDownLoadExtent(res) {
      this.wktExtent = res.result.wkt
      this.$bus.$emit('showExtentLayer', true);
      // this.dialogExtentVisible = true
      //           this.$store.state.mapMenuShpFile = rs.result.wkt
      //
    },
    changeValue(value) {
      var obj = {}
      obj = this.queryOption.find(function (item) {
@@ -346,7 +403,8 @@
    },
    //清空树选中的节点
    resetCheckedNodes() {
      this.layerData = []
      this.getAllTable()
      this.$refs.tree.setCheckedKeys([]);
      this.treeChange = []
      this.menuTopFrom.queryLayer = null
@@ -375,6 +433,7 @@
        })
        return
      }
      var that = this;
      $.ajax(BASE_URL + "/inquiry/uploadShp?token=" + getToken(), {
        type: "post",
        data: formData,
@@ -384,11 +443,11 @@
        contentType: false,
        success: rs => {
          if (rs.code !== 200) {
            return this.$message.error("用户角色请求错误")
            return this.$message.error("数据解析失败")
          }
          this.$store.state.mapMenuShpFile = rs.result.wkt
          this.showMapMenuPop()
          that.getDownLoadExtent(rs);
        },
        error: e => {
          console.log(e)
@@ -548,6 +607,8 @@
    },
    clearQuery() {
      // 清楚buffer
      this.layerData = [];
      this.getAllTable();
      this.clearBufferEntities()
      this.$refs.pathClear.value = ""
      this.treeChange = []