From 17f526f1c9f4bf78aa4cd7399785d0bc8ade8b6a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 05 Apr 2023 00:57:04 +0800
Subject: [PATCH] 社区感知的更改

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

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index 648000e..03e1320 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-04 18:18:42
+ * @LastEditTime: 2023-04-05 00:50:03
  * @FilePath: \srs-police-affairs\src\components\map\index.vue
  * @Description: 公用地图组件
  * 
@@ -249,6 +249,9 @@
             global.viewer.addLayer(layersObjcect.monitoringLayer)
             layersObjcect.panoramaLayer = new global.DC.VectorLayer('panoramaLayer')
             global.viewer.addLayer(layersObjcect.panoramaLayer)
+
+            floorEntitysLayers = new global.DC.VectorLayer('floorEntitysLayers')
+            global.viewer.addLayer(floorEntitysLayers)
 
             // 模型图层添加
             tilesetLayer = new global.DC.TilesetLayer('tilesetLayer')
@@ -608,7 +611,7 @@
             })
 
             // this.addMxTileset('sdTilesetLayer', `${tile3DUrl}/sf3d/361102/model/wanda/tileset.json`)
-            // this.addMxTileset('sdTilesetLayer', `https://tuan-gis.sit.fengtu.com.cn/361102/wanda/tileset.json`)
+            // this.addMxTileset('sdTilesetLayer02', `https://tuan-gis.sit.fengtu.com.cn/361102/wanda/tileset.json`)
             // this.addMxTileset('sdTilesetLayer', `/mx/01/tileset.json`)
 
             if (this.tilesetLayerType == type && status == '') {
@@ -1116,43 +1119,42 @@
         * @param {*} 
         */
         showThreeDimensions (positions, minHeight, maxHeight) {
-            if (flootEntitysEntites == null) {
-                floorEntitysLayers = new global.DC.Namespace.Cesium.CustomDataSource("floorEntitysLayers")
-                global.viewer.dataSources.add(floorEntitysLayers)
-                flootEntitysEntites = floorEntitysLayers.entities
-            } else {
-                flootEntitysEntites.removeAll()
+            if (floorEntitysLayers != null) {
+                floorEntitysLayers.remove()
+                floorEntitysLayers = new global.DC.VectorLayer('floorEntitysLayers')
+                global.viewer.addLayer(floorEntitysLayers)
             }
+
+            floorEntitysLayers.clear()
+
             let housePositions = JSON.parse(positions).coordinates[0]
 
             let floorPositions = housePositions.reduce((prev, curr) => {
-                curr.forEach(item => {
-                    prev.push(item)
-                })
+                prev.push([curr[0], curr[1]])
+
                 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),
-                }
+            let polygonStr = floorPositions.join(';')
+
+            let polygon = new global.DC.Polygon(polygonStr)
+
+            polygon.setStyle({
+                material: global.DC.Namespace.Cesium.Color.RED.withAlpha(0.5),
+                extrudedHeight: maxHeight,
+                height: minHeight,
+                extrudedHeightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND,
+                heightReference: global.DC.Namespace.Cesium.HeightReference.RELATIVE_TO_GROUND
             })
+
+            floorEntitysLayers.addOverlay(polygon)
+
+            floorEntitysLayers.show = true
         },
 
         // 清除建筑3D
         clearHouse3D () {
-            if (flootEntitysEntites == null) {
-                floorEntitysLayers = new global.DC.Namespace.Cesium.CustomDataSource("floorEntitysLayers")
-                global.viewer.dataSources.add(floorEntitysLayers)
-                flootEntitysEntites = floorEntitysLayers.entities
-            } else {
-                flootEntitysEntites.removeAll()
-            }
+            floorEntitysLayers.clear()
         },
     },
 

--
Gitblit v1.9.3