chc 1 week ago
parent
commit
fa258c22dd
2 changed files with 13 additions and 8 deletions
  1. 9 7
      src/views/map/Map.vue
  2. 4 1
      src/views/map/layerControl/TailBaseLine.vue

+ 9 - 7
src/views/map/Map.vue

@@ -1658,13 +1658,13 @@ export default defineComponent({
       //   }
 
       //控制河流和河流尾迹线
-      if (type && level > 9) {
-      // map.showOverlay('geojson_line_dxh', false);
-      // eventBus.emit('TailBaseLine', false);
-      } else if (type) {
-      map.showOverlay('geojson_line_dxh', true);
-      eventBus.emit('TailBaseLine', true);
-      }
+      // if (type && level > 9) {
+      // // map.showOverlay('geojson_line_dxh', false);
+      // // eventBus.emit('TailBaseLine', false);
+      // } else if (type) {
+      // map.showOverlay('geojson_line_dxh', true);
+      // eventBus.emit('TailBaseLine', true);
+      // }
 
       // //地灾工程文字控制
       // if (level > 13) {
@@ -1772,6 +1772,8 @@ export default defineComponent({
     },
 
     addHL() {
+      map.showOverlay('geojson_line_dxh', true);
+      eventBus.emit('TailBaseLine', true);
       // const geo = new TFMap.GeoPolyline([dxh], 5, 'rgba(11,161,236,1)');
       // geo.setClassify('geojson_line_dxh');
       // map.addOverlay(geo);

+ 4 - 1
src/views/map/layerControl/TailBaseLine.vue

@@ -21,6 +21,7 @@ export default {
     let map = null;
     let roloadData = null;
     let trailData = null;
+    let trailData2 = null;
     let checkValue = ref(true);
     // getData();
     // const ybjJsonTemp=ybjJson;
@@ -65,7 +66,9 @@ export default {
       }
       if (trailData) {
         map.viewer.dataSources.remove(trailData);
+        map.viewer.dataSources.remove(trailData2);
         trailData = null;
+        trailData2 = null;
       }
     }
 
@@ -115,7 +118,7 @@ export default {
         clampToGround: true, //贴地设置
       }); //geojson面数据
       promise3.then(function (dataSource) {
-        trailData = dataSource;
+        trailData2 = dataSource;
         viewer.dataSources.add(dataSource);
         var entities = dataSource.entities.values;
         for (var o = 0; o < entities.length; o++) {