From 38563d52e57e2385fef5edaba3c2290198ab04b8 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 07 Feb 2023 10:24:40 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/srs-police-affairs

---
 src/components/map/index.vue |   89 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 70 insertions(+), 19 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 7f99af6..5404254 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -81,6 +81,8 @@
     sdTilesetLayer: null
 }
 
+let flootEntitysEntites = null
+
 import mapPopup from './components/mapPopup.vue'
 
 export default {
@@ -256,10 +258,10 @@
                 console.log(e, 989999)
             })
 
-            let positions = [[117.9514788, 28.4478968, 0], [117.9514698, 28.4478947, 0], [117.9513974, 28.4476981, 0], [117.9515047, 28.4476748, 0], [117.9515289, 28.4476939, 0], [117.9515508, 28.447755, 0], [117.9516278, 28.4477353, 0], [117.9516623, 28.4478497, 0], [117.9514788, 28.4478968, 0]]
+            // let positions = [[117.9514788, 28.4478968, 0], [117.9514698, 28.4478947, 0], [117.9513974, 28.4476981, 0], [117.9515047, 28.4476748, 0], [117.9515289, 28.4476939, 0], [117.9515508, 28.447755, 0], [117.9516278, 28.4477353, 0], [117.9516623, 28.4478497, 0], [117.9514788, 28.4478968, 0]]
 
             // let positions = [[117.951478782, 28.447896798, 0], [117.951469798, 28.447894686, 0], [117.951397357, 28.447698099, 0], [117.951505114, 28.447674695, 0], [117.951485465, 28.447619271, 0], [117.951706955, 28.447558541, 0], [117.951722755, 28.447611995, 0], [117.951834021, 28.447588427, 0], [117.951896863, 28.447789523, 0], [117.951478782, 28.447896798, 0]]
-
+            let positions = [[117.951478782, 28.447896798, 0], [117.951469798, 28.447894686, 0], [117.951397357, 28.447698099, 0], [117.951505114, 28.447674695, 0], [117.951485465, 28.447619271, 0], [117.951706955, 28.447558541, 0], [117.951722755, 28.447611995, 0], [117.951834021, 28.447588427, 0], [117.951896863, 28.447789523, 0], [117.951478782, 28.447896798, 0]]
             let MIN_F_H = positions.map(item => {
                 item[2] = 70
                 return item
@@ -273,25 +275,29 @@
             // 原生Cesium加载多边体
             let floorEntitysLayers = new global.DC.Namespace.Cesium.CustomDataSource("floorEntitysLayers")
             global.viewer.dataSources.add(floorEntitysLayers)
-            let flootEntitysEntites = floorEntitysLayers.entities
+            flootEntitysEntites = floorEntitysLayers.entities
 
-            let floorPositions = positions.reduce((prev, curr, index, arr) => {
-                curr.forEach(item => {
-                    prev.push(item)
-                })
-                return prev
-            }, [])
+            // let floorPositions = positions.reduce((prev, curr, index, arr) => {
+            //     curr.forEach(item => {
+            //         prev.push(item)
+            //     })
+            //     return prev
+            // }, [])
 
-            flootEntitysEntites.add({
-                polygon: {
-                    hierarchy: global.DC.Namespace.Cesium.Cartesian3.fromDegreesArrayHeights(floorPositions),
-                    heightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
-                    extrudedHeightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
-                    height: 70,
-                    extrudedHeight: 80,
-                    material: global.DC.Namespace.Cesium.Color.RED.withAlpha(0.5),
-                }
-            })
+            // flootEntitysEntites.add({
+            //     polygon: {
+            //         hierarchy: global.DC.Namespace.Cesium.Cartesian3.fromDegreesArrayHeights(floorPositions),
+            //         heightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
+            //         extrudedHeightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
+            //         height: 70,
+            //         extrudedHeight: 80,
+            //         material: global.DC.Namespace.Cesium.Color.RED.withAlpha(0.5),
+            //     }
+            // })
+
+
+
+
 
             // console.log(floorPositions)
 
@@ -419,6 +425,14 @@
             that.flytoLayer(params.polygonName, params.duration)
         })
 
+        this.$EventBus.$on('showHouse3D', (params) => {
+            that.showHouse3D(params.positions, params.minHeight, params.maxHeight)
+        })
+
+        this.$EventBus.$on('clearHouse3D', () => {
+            that.clearHouse3D()
+        })
+
         // 重写定位方法
         const homeCenter = [117.99311892441567, 28.46938164123123]
         this.$nextTick(() => {
@@ -442,6 +456,7 @@
                 this.$router.push({ path: '/layout/house', query: { searchName: 'xxx小区' } })
             }
         },
+
         switchImg () {
             // 天地图 影像
             this.imgtype = 0
@@ -457,6 +472,7 @@
             )
             this.showImgBtn = false
         },
+
         switchElec () {
             // 天地图 矢量
             this.imgtype = 1
@@ -472,6 +488,7 @@
             )
             this.showImgBtn = false
         },
+
         /**
          * @description: 全屏控制
          * @return {*} 无返回值
@@ -504,6 +521,7 @@
                 this.isFullscreen = true
             }
         },
+
         /**
          * 在图层中添加实体(点)
          * @param {*} item 图标
@@ -750,6 +768,39 @@
                 tilesetObject[titlesetName] = null
             }
         },
+
+        /**
+        * 建筑高亮显示
+        * @param {*} positions 建筑范围坐标
+        * @param {*} 
+        */
+        showHouse3D (positions, minHeight, maxHeight) {
+            flootEntitysEntites.removeAll()
+            let housePositions = JSON.parse(positions).coordinates[0]
+
+            let floorPositions = housePositions.reduce((prev, curr) => {
+                curr.forEach(item => {
+                    prev.push(item)
+                })
+                return prev
+            }, [])
+
+            flootEntitysEntites.add({
+                polygon: {
+                    hierarchy: global.DC.Namespace.Cesium.Cartesian3.fromDegreesArrayHeights(floorPositions),
+                    heightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
+                    extrudedHeightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
+                    height: minHeight,
+                    extrudedHeight: maxHeight,
+                    material: global.DC.Namespace.Cesium.Color.RED.withAlpha(0.5),
+                }
+            })
+        },
+
+        // 清除建筑3D
+        clearHouse3D () {
+            flootEntitysEntites.removeAll()
+        },
     },
 
 }

--
Gitblit v1.9.3