From 646cf1272bc67313dc50ccc765cfd16fea5ff773 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Mon, 08 May 2023 18:30:00 +0800
Subject: [PATCH] 模型高层去除、电子沙盘更改、警情信息更改

---
 src/utils/turfPolygon.js |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/utils/turfPolygon.js b/src/utils/turfPolygon.js
index 3ec9461..4952bb1 100644
--- a/src/utils/turfPolygon.js
+++ b/src/utils/turfPolygon.js
@@ -2,7 +2,7 @@
  * @Author: shuishen 1109946754@qq.com
  * @Date: 2023-03-31 10:52:25
  * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2023-05-06 16:52:41
+ * @LastEditTime: 2023-05-08 18:21:01
  * @FilePath: \srs-police-affairs\src\utils\turfPolygon.js
  * @Description: 
  * 
@@ -92,6 +92,7 @@
 
         }
     } else {
+        console.log(data, 564)
         let pointArr = []
         data.forEach(item => {
             if (item.longitude && item.latitude) {
@@ -111,8 +112,22 @@
 
         // const poly = turf.polygon([[[0, 29], [3.5, 29], [2.5, 32], [0, 29]]])
 
-        global.viewer.flyToBounds(scope,
-            { heading: 0, pitch: -45, roll: 0 },
+        console.log([[scope[0], scope[1]], [scope[2], scope[1]], [scope[2], scope[3]], [scope[0], scope[3]]])
+
+        var poly = turf.polygon([[[scope[0], scope[1]], [scope[2], scope[1]], [scope[2], scope[3]], [scope[0], scope[3]], [scope[0], scope[1]]]])
+        var scaledPoly = turf.transformScale(poly, 4)
+
+        let boxPoint = []
+        scaledPoly.geometry.coordinates[0].forEach(item => {
+            boxPoint.push(turf.point(item))
+        })
+
+        const boxFeatures = turf.featureCollection(boxPoint)
+
+        const boxScope = turf.envelope(boxFeatures).bbox
+
+        global.viewer.flyToBounds(boxScope,
+            { heading: 0, pitch: -90, roll: 0 },
             (e) => { },
             3
         )

--
Gitblit v1.9.3