From 577beb1a767da2c4a77409a019da85ac0aa473bb Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 27 Apr 2023 20:05:10 +0800
Subject: [PATCH] eventbus处理
---
src/components/map/index.vue | 39 +++++++++++++++++++++++++++++++++++----
1 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 1342cd9..92d8ba4 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2022-08-18 17:00:30
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-04-25 16:39:34
+ * @LastEditTime: 2023-04-27 20:00:20
* @FilePath: \srs-police-affairs\src\components\map\index.vue
* @Description: 公用地图组件
*
@@ -297,8 +297,7 @@
// 地形数据添加
that.addTerrain()
- // 外网
- // global.viewer.imageryLayers.addImageryProvider(
+ // 外网 // global.viewer.imageryLayers.addImageryProvider(
// new global.DC.Namespace.Cesium.UrlTemplateImageryProvider({
// url: 'http://t{s}.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=d083e4cf30bfc438ef93436c10c2c20a',
// subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
@@ -307,6 +306,7 @@
// maximumLevel: 18
// })
// )
+
// 设置地图初始位置,角度等
global.viewer.camera.setView({
@@ -872,7 +872,11 @@
layersObjcect[layerName].addTo(global.viewer)
} else if (type == 'ClusterLayer') {
- if (!layersObjcect[layerName]) layersObjcect[layerName] = null
+ if (!layersObjcect[layerName]) {
+ this.mapRemoveLayer(layerName, type)
+ layersObjcect[layerName] = null
+ }
+
layersObjcect[layerName] = new global.DC.ClusterLayer(layerName, {
pixelRange: 40, style: ClusterLayerType
})
@@ -1314,6 +1318,33 @@
}
})
}
+ },
+
+ destroyed () {
+ this.$EventBus.$off('mapAddLayer')
+ this.$EventBus.$off('mapRemoveLayer')
+ this.$EventBus.$off('mapRemovePolygonLayer')
+ this.$EventBus.$off('mapRemovePolygon')
+ this.$EventBus.$off('mapClearLayer')
+ this.$EventBus.$off('layerPointAdd')
+ this.$EventBus.$off('layerPolygonAdd')
+ this.$EventBus.$off('layerPolylineAdd')
+ this.$EventBus.$off('layerWallAdd')
+ this.$EventBus.$off('rowLayerWallAdd')
+ this.$EventBus.$off('getOverLayerID')
+ this.$EventBus.$off('layerShow')
+ this.$EventBus.$off('toPosition')
+ this.$EventBus.$off('highOrLightChange')
+ this.$EventBus.$off('addMxTileset')
+ this.$EventBus.$off('closeMxTileset')
+ this.$EventBus.$off('tilesetLayerFlag')
+ this.$EventBus.$off('removeMxTileset')
+ this.$EventBus.$off('flytoLayer')
+ this.$EventBus.$off('showThreeDimensions')
+ this.$EventBus.$off('switchThreeDimensions')
+ this.$EventBus.$off('clearHouse3D')
+ this.$EventBus.$off('registerMxClick')
+ this.$EventBus.$off('unbindMxClick')
}
}
</script>
--
Gitblit v1.9.3