From adcdf0d9f2e37b9719d63113d2ae1a9d698ef20e Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Mon, 07 Nov 2022 16:54:18 +0800
Subject: [PATCH] 热区效果添加

---
 src/components/map/index.vue |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 6fb3f84..cc17b2f 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -244,7 +244,6 @@
 
         this.$EventBus.$on('layerPointAdd', (params) => {
             // eslint-disable-next-line no-unused-vars
-            // console.log(params.incident)
             that.layerPointAdd(params.layerName, params.type, params.layerType, params.params, params.distanceDisplayCondition, params.incident)
         })
 
@@ -291,7 +290,6 @@
             // 最新写法
             const isFullScreen = document.fullscreenElement
             if (isFullScreen) {
-                console.log('退出全屏')
                 if (document.exitFullscreen) {
                     document.exitFullscreen()
                 } else if (document.msExitFullscreen) {
@@ -304,7 +302,6 @@
                 this.isFullscreen = false
             } else {
                 var fullscreen = document.body   // 需要全屏的元素
-                console.log('进入全屏')
                 if (fullscreen.requestFullscreen) {
                     fullscreen.requestFullscreen()
                 } else if (fullscreen.mozRequestFullScreen) {
@@ -348,6 +345,12 @@
                 layersObjcect[layerName] = new global.DC.ClusterLayer(layerName)
 
                 layersObjcect[layerName].addTo(global.viewer)
+            } else if (type == 'HeatLayer') {
+                if (!layersObjcect[layerName]) layersObjcect[layerName] = null
+
+                layersObjcect[layerName] = new global.DC.HeatLayer(layerName)
+
+                layersObjcect[layerName].addTo(global.viewer)
             }
         },
 
@@ -357,7 +360,7 @@
          * @param {*} type 图层类型
          */
         mapRemoveLayer (layerName, type) {
-            if (type == 'VectorLayer' || type == 'ClusterLayer') {
+            if (type == 'VectorLayer' || type == 'ClusterLayer' || type == 'HeatLayer') {
                 if (layersObjcect[layerName] && layersObjcect[layerName] != null) {
                     layersObjcect[layerName].remove()
                     layersObjcect[layerName] = null
@@ -371,7 +374,7 @@
          * @param {*} type 图层类型
          */
         mapClearLayer (layerName, type) {
-            if (type == 'VectorLayer' || type == 'ClusterLayer') {
+            if (type == 'VectorLayer' || type == 'ClusterLayer' || type == 'HeatLayer') {
                 if (layersObjcect[layerName] && layersObjcect[layerName] != null)
                     layersObjcect[layerName].clear()
             }
@@ -397,11 +400,12 @@
 
             if (type == "billboard") {
                 pointElement = new global.DC.Billboard(new global.DC.Position(Number(params.lng), Number(params.lat), Number(params.alt)), params.url)
-
                 pointElement.size = [32, 32]
+                pointElement.attrParams = params
+                layersObjcect[layerName].addOverlay(pointElement)
+                pointElement.on(global.DC.MouseEventType.CLICK, incident)
             } else if (type == "label") {
                 pointElement = new global.DC.Label(new global.DC.Position(Number(params.lng), Number(params.lat), Number(params.alt)), params.text)
-
                 pointElement.setStyle({
                     fillColor: global.DC.Color.CRIMSON,
                     style: global.DC.Namespace.Cesium.LabelStyle.FILL_AND_OUTLINE,
@@ -411,13 +415,14 @@
                     pixelOffset: { x: 0, y: -24 },
                     distanceDisplayCondition: distanceDisplayCondition
                 })
-
+                pointElement.attrParams = params
+                layersObjcect[layerName].addOverlay(pointElement)
+                pointElement.on(global.DC.MouseEventType.CLICK, incident)
+            } else if (type == 'HeatPoint') {
+                layersObjcect[layerName].setPositions(params.positions)
             }
 
-            pointElement.attrParams = params
 
-            layersObjcect[layerName].addOverlay(pointElement)
-            pointElement.on(global.DC.MouseEventType.CLICK, incident)
         },
 
         /**

--
Gitblit v1.9.3