彭宇 2 лет назад
Родитель
Сommit
91daca0422
3 измененных файлов с 17 добавлено и 4 удалено
  1. 13 2
      src/components/supermap.vue
  2. 1 1
      src/components/vBottomMenu.vue
  3. 3 1
      src/views/forest.vue

+ 13 - 2
src/components/supermap.vue

@@ -34,8 +34,9 @@
         graphicsLayer: [],
         latLngLayers: [],
         latLngGroup: [],
-        isEditableLayers: false,
-        drawControl: null,
+        isEditableLayers: false,//绘图控件
+        drawControl: null,//绘图控件
+        deckglLayer : null,//图层Layer
       }
     },
     watch: {
@@ -586,6 +587,16 @@
       controlLevel: function (level) {//控制地图缩放级别
         this.map.setZoom(level)
       },
+      layerSwitching: function (url,isClear) {//图层切换  url 图层地址   isClear  是否清除图层
+        if(isClear){
+          if(this.deckglLayer!=null){
+            this.deckglLayer.remove()
+          }
+        }
+        this.deckglLayer = window.L.supermap.tiledMapLayer(url,{
+        });
+        this.map.addLayer(this.deckglLayer);
+      },
     }
   }
 </script>

+ 1 - 1
src/components/vBottomMenu.vue

@@ -20,7 +20,7 @@
           {
             name: '图层切换',
             icon: 'sj-icon-tcqh',
-            click: ''
+            click: 'layerSwitching'
           },
           {
             name: '测量工具',

+ 3 - 1
src/views/forest.vue

@@ -479,7 +479,7 @@
       supermapProcessed,
 			vheader,
 			vBottomMenu,
-      eventLocation
+      eventLocation,
 		},
 		created() {
       /** ----------------------------------摄像头预览开始------------------------------------- */
@@ -711,6 +711,8 @@
           }else{
             this.$refs.supermap.isEditableLayers=false
           }
+        }else if(click=="layerSwitching"){
+          this.$refs.supermap.layerSwitching('http://218.27.1.154:8090/iserver/services/map-SiPingLinYe4326/rest/maps/二龙湖林场轮廓',true);
         }
       },
 			//态势感知chart