From e0a68e0426c7d883f720831ebfeb843c70df697c Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 03 四月 2023 09:05:13 +0800
Subject: [PATCH] 1

---
 src/components/MapView/mapMenuTop.vue |   69 ++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/src/components/MapView/mapMenuTop.vue b/src/components/MapView/mapMenuTop.vue
index 57d4a24..945beab 100644
--- a/src/components/MapView/mapMenuTop.vue
+++ b/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("鏁版嵁瑙f瀽澶辫触")
           }
 
-          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 = []

--
Gitblit v1.9.3