From 0600d7f44c6f4488fbdd327988d3783d7401af9d Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Sun, 07 May 2023 10:23:31 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/srs-police-affairs

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

diff --git a/src/utils/turfPolygon.js b/src/utils/turfPolygon.js
index 1ccc6ee..3ec9461 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-04-18 20:13:04
+ * @LastEditTime: 2023-05-06 16:52:41
  * @FilePath: \srs-police-affairs\src\utils\turfPolygon.js
  * @Description: 
  * 
@@ -53,8 +53,6 @@
         return turf.centroid(turf.polygon([arr])).geometry.coordinates
     }
 }
-
-
 
 export const computerCapacity = (data, type = '') => {
 
@@ -119,4 +117,28 @@
             3
         )
     }
+}
+
+export const getMapBounds = (data, type = '') => {
+    let pointArr = []
+
+    data.forEach(item => {
+        pointArr.push(turf.point([item.x, item.y]))
+        return
+    })
+
+    const features = turf.featureCollection(pointArr)
+
+    const scope = turf.envelope(features).bbox
+
+    // const poly = turf.polygon([[[0, 29], [3.5, 29], [2.5, 32], [0, 29]]])
+
+    return scope
+}
+
+export const getLineSpeed = (data) => {
+    var line = turf.lineString(data)
+    var length = turf.length(line, { units: 'miles' })
+
+    return length * 1000 / 50
 }
\ No newline at end of file

--
Gitblit v1.9.3