From eb6cfd90fd89f11263146dc4c38069c8a4845fab Mon Sep 17 00:00:00 2001
From: 584911253@qq.com <584911253@qq.com>
Date: 星期五, 10 三月 2023 15:36:37 +0800
Subject: [PATCH] bug修改

---
 src/components/mapsdk.vue |  140 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 102 insertions(+), 38 deletions(-)

diff --git a/src/components/mapsdk.vue b/src/components/mapsdk.vue
index 8999209..f4dc56b 100644
--- a/src/components/mapsdk.vue
+++ b/src/components/mapsdk.vue
@@ -56,6 +56,7 @@
           </div>
         </el-card>
       </div>
+      <!--鍧愭爣鐐逛綅-->
       <div
         class="coordLocalBox"
         v-if="showCoordLocalBoxDialog"
@@ -95,6 +96,7 @@
           </div>
         </el-card>
       </div>
+      <!--鍦板舰骞虫暣-->
       <div
         class="terrainLevelBox"
         v-if="showTerrainLevelDialog"
@@ -230,6 +232,7 @@
           </div>
         </el-card>
       </div>
+      <!-- 璺緞鍒嗘瀽寮圭獥-->
       <div
         class="pathAnalysisBox"
         v-if="showPathAnalysisBoxDialog"
@@ -315,6 +318,7 @@
           ></div>
         </div>
       </div>
+      <!-- 鍧″害鍒嗘瀽寮圭獥-->
       <div
         class="lengend"
         v-show="showLengendDialog"
@@ -665,6 +669,20 @@
     this.$bus.$on('changemapType', (e) => {
       this.show2DMap = e;
     });
+    this.$bus.$on('closeMenuPop', (e) => {
+      //闈炶矾寰勫垎鏋�
+      if (e != 'd3'){
+        this.showPathAnalysisBoxDialog = false;
+      }
+      //闈炲潯搴﹀垎鏋�
+      if (e != 'd2'){
+        this.showLengendDialog = false;
+      }
+      //闈炲湴褰㈠钩鏁�
+      if (e != 'd10'){
+        this.showTerrainLevelDialog = false;
+      }
+    });
     //妯″瀷鎹曟崏
     this.catchmodel()
   },
@@ -850,7 +868,8 @@
         } else {
           this.showBufferBoxDialog = true;
         }
-      } else if (res.name == "Coord") {
+      }
+      else if (res.name == "Coord") {
         if (res.id == "1") {
           this.showCoordLocalBoxDialog = true;
           this.showToponymicLocalBoxDialog = false;
@@ -859,7 +878,8 @@
           this.showCoordLocalBoxDialog = false;
           this.getToponymicData();
         }
-      } else if (res.name == "Analysis") {
+      }
+      else if (res.name == "Analysis") {
         if (res.id == "3") {
           if (res.show == true) {
             this.showPathAnalysisBoxDialog = true;
@@ -868,23 +888,21 @@
             this.closeBufferBox(4);
           }
         }
-      } else if (res.name == "Trrain") {
+      }
+      else if (res.name == "Trrain") {
         switch (res.id) {
           case "d10":
             this.showTerrainLevelDialog = !this.showTerrainLevelDialog;
             this.clearTerrainLevel();
             break;
         }
-
-      } else if (res.name == "Lengend") {
+      }
+      else if (res.name == "Lengend") {
         switch (res.id) {
           case "d2":
-
             this.showLengendDialog = res.vshow;
-
             break;
         }
-
       }
     },
     handleSizeChange(val) {
@@ -958,6 +976,7 @@
           break;
         case 2:
           this.showCoordLocalBoxDialog = false;
+          sgworld.Creator.DeleteObject(this.imagePoint);
           break;
         case 3:
           this.showToponymicLocalBoxDialog = false;
@@ -990,6 +1009,10 @@
         Y: lat,
         Altitude: 2000,
       };
+      if (this.imagePoint != null) {
+        sgworld.Creator.DeleteObject(this.imagePoint);
+        this.imagePoint = null;
+      }
       this.imagePoint = sgworld.Creator.CreateLabel(
         position,
         "",
@@ -1068,36 +1091,64 @@
     },
     async showMouseLeftClick(res) {
       if (res == 3) {
-        this.$refs.form.validate((valid) => {
-          if (!valid) {
-            return false;
+        this.$refs.form.validate(async (valid) => {
+          if (valid) {
+            this.clearPathAll(5);
+            var start = this.pathFrom.lon.split(",");
+            var end = this.pathFrom.lat.split(",");
+            var startData = {
+              x1: parseFloat(start[0]),
+              y1: parseFloat(start[1]),
+              x2: parseFloat(end[0]),
+              y2: parseFloat(end[1]),
+            };
+            const data = await comprehensive_selectRoute(startData);
+            if (data.code != 200) {
+              return this.$message.error("鏁版嵁璇锋眰澶辫触");
+            }
+            if (!data.result) {
+              return this.$message.error("鏆傛棤鏁版嵁");
+            }
+            var wkt = this.$wkt.parse(data.result);
+            var bufferSource = Cesium.GeoJsonDataSource.load(wkt, {
+              stroke: new Cesium.Color(82 / 255, 152 / 255, 255 / 255, 1),
+              strokeWidth: 5,
+              clampToGround: true,
+            });
+            bufferSource.then((bufferSource) => {
+              sgworld.Navigate.flyToObj(bufferSource);
+              Viewer.dataSources.add(bufferSource);
+            });
           }
         });
-        this.clearPathAll(3);
-        var start = this.pathFrom.lon.split(",");
-        var end = this.pathFrom.lat.split(",");
-        var startData = {
-          x1: parseFloat(start[0]),
-          y1: parseFloat(start[1]),
-          x2: parseFloat(end[0]),
-          y2: parseFloat(end[1]),
-        };
-
-        const data = await comprehensive_selectRoute(startData);
-        if (data.code != 200) {
-          return this.$message.error("鏁版嵁璇锋眰澶辫触");
-        }
-        var wkt = this.$wkt.parse(data.result);
-        var bufferSource = Cesium.GeoJsonDataSource.load(wkt, {
-          stroke: new Cesium.Color(82 / 255, 152 / 255, 255 / 255, 1),
-
-          strokeWidth: 5,
-          clampToGround: true,
-        });
-        bufferSource.then((bufferSource) => {
-          sgworld.Navigate.flyToObj(bufferSource);
-          Viewer.dataSources.add(bufferSource);
-        });
+        // this.clearPathAll(3);
+        // var start = this.pathFrom.lon.split(",");
+        // var end = this.pathFrom.lat.split(",");
+        // var startData = {
+        //   x1: parseFloat(start[0]),
+        //   y1: parseFloat(start[1]),
+        //   x2: parseFloat(end[0]),
+        //   y2: parseFloat(end[1]),
+        // };
+        //
+        // const data = await comprehensive_selectRoute(startData);
+        // if (data.code != 200) {
+        //   return this.$message.error("鏁版嵁璇锋眰澶辫触");
+        // }
+        // if (!data.result) {
+        //   return this.$message.error("鏆傛棤鏁版嵁");
+        // }
+        // var wkt = this.$wkt.parse(data.result);
+        // var bufferSource = Cesium.GeoJsonDataSource.load(wkt, {
+        //   stroke: new Cesium.Color(82 / 255, 152 / 255, 255 / 255, 1),
+        //
+        //   strokeWidth: 5,
+        //   clampToGround: true,
+        // });
+        // bufferSource.then((bufferSource) => {
+        //   sgworld.Navigate.flyToObj(bufferSource);
+        //   Viewer.dataSources.add(bufferSource);
+        // });
         // var jsonurl =
         //   wnsUrl +
         //   '?start=' +
@@ -1223,6 +1274,13 @@
             sgworld.Creator.DeleteObject(this.linePath);
             this.linePath = null;
           }
+        case 5:
+          if (this.linePath != null) {
+            sgworld.Creator.DeleteObject(this.linePath);
+            this.linePath = null;
+          }
+
+          Viewer.dataSources.removeAll();
           break;
       }
     },
@@ -1448,7 +1506,6 @@
 .mapBox {
   width: 100%;
   height: 100%;
-
   position: relative;
   #mapdiv {
     width: 100%;
@@ -1494,6 +1551,14 @@
         padding: 10px 20px;
       }
     }
+    .pathAnalysisBox{
+      width: 412px;
+      height: 370px;
+      z-index: 40;
+      position: absolute;
+      right: 8%;
+      bottom: 1%;
+    }
     .attributionPop{
       width: 350px;
       height: 370px;
@@ -1508,7 +1573,6 @@
         padding: 10px 20px;
       }
     }
-
     .terrainLevelBox {
       width: 350px;
       height: 370px;

--
Gitblit v1.9.3