From a3fadb577e4d18c1d7ff60e23be4f3d27f63b9a3 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 17 Jan 2022 17:07:52 +0800
Subject: [PATCH] +

---
 src/store/modules/mobile.js |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 979e095..d747e5a 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -56,6 +56,7 @@
     navigationStartLngLat: "", //导航起点
     navigationEndLngLat: "", //导航终点
     drawALineLayer: null, //导航路径图层
+    drawALineLayerIcon: null, //导航路径图层图标
     isOpenDrawALine: false, //是否开启路径
     endPosition: "", //传送终点经纬度--
     isendPosition: false, //传送终点经纬度--感应数据
@@ -270,6 +271,12 @@
         state.isOpenDrawALine = false;
       }
     },
+    removerPolyLineIcon(state) {
+      if (state.drawALineLayerIcon) {
+        state.drawALineLayerIcon.remove();
+        state.drawALineLayerIcon = null;
+      }
+    },
     removePolylineMany(state) {
       if (state.drawALineLayerMany) {
         state.drawALineLayerMany.remove();
@@ -302,7 +309,7 @@
       const nowHeight = Math.ceil(
         state.mviewer.camera.positionCartographic.height
       );
-      console.log(data);
+      // console.log(data);
       if (state.dimension == "3D") {
         Flys = [
           +data.lntLat[0] + 0.01197,
@@ -744,22 +751,19 @@
         color: color,
         speed: 10,
       });
-      let drawALineLayer = new global.DC.VectorLayer("layer");
-      state.mviewer.addLayer(drawALineLayer);
-      let polyline = new global.DC.Polyline(Str); //加入绘画点
-      polyline.setStyle({
-        width: 3,
-        material: material,
-        clampToGround: true,
-      });
-      drawALineLayer.addOverlay(polyline);
+      state.drawALineLayer = new global.DC.VectorLayer("lineLayer");
+      state.mviewer.addLayer(state.drawALineLayer);
+
       //如果是添加  给第一个点加入图标 和事件
       if (value[1]) {
+        commit("removerPolyLineIcon");
+        state.drawALineLayerIcon = new global.DC.VectorLayer("pointLayer");
+        state.mviewer.addLayer(state.drawALineLayerIcon);
         let post = Str.split(";")[0].split(",");
         let position = new global.DC.Position(post[0], post[1]);
         let billboard = new global.DC.Billboard(
           position,
-          "img/dingwei/dingwei4.png"
+          "img/dingwei/dingwei1.png"
         ); //加入绘画点
         billboard.setStyle({
           pixelOffset: { x: 0, y: -17 }, //偏移像素
@@ -779,10 +783,16 @@
           };
           dispatch("setMobileWindows", windowData);
         });
-        drawALineLayer.addOverlay(billboard);
+        state.drawALineLayerIcon.addOverlay(billboard);
       }
+      let polyline = new global.DC.Polyline(Str); //加入线
+      polyline.setStyle({
+        width: 3,
+        material: material,
+        clampToGround: true,
+      });
+      state.drawALineLayer.addOverlay(polyline);
 
-      state.drawALineLayer = drawALineLayer;
       state.isOpenDrawALine = true;
       // commit("cameraSetView", state.navigationStartLngLat); //移动
     },
@@ -805,7 +815,7 @@
         image: "img/icon/right.png",
         repeat: { x: 320, y: 1 },
       });
-      let drawALineLayerMany = new global.DC.VectorLayer("layer");
+      let drawALineLayerMany = new global.DC.VectorLayer("manyLinePointLayer");
       state.mviewer.addLayer(drawALineLayerMany);
       //多条线
       for (let k in Strs) {
@@ -888,9 +898,8 @@
         drawALineLayerMany.addOverlay(Labels);
         // console.log(point[k]);
       }
-
       state.drawALineLayerMany = drawALineLayerMany;
-      state.isOpenDrawALineMany = true;
+      state.isOpenDrawALineMany = value[2].name ? value[2].name : true;
       // commit("cameraSetView", state.navigationStartLngLat); //移动
     },
   },

--
Gitblit v1.9.3