From c065531c87e7dc199c7fc4d35e4f6fbedf26167d Mon Sep 17 00:00:00 2001
From: 徐旺旺 <11530253@qq.com>
Date: 星期三, 19 五月 2021 15:40:37 +0800
Subject: [PATCH] 定位、弹窗信息、排口查询BUG修复
---
src/utils/utils.js | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 31e0afa..c187b1c 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -48,23 +48,27 @@
}
export function reversePolyLine (feature) {
- const coordinates = feature.geometry.coordinates
+ const coordinates = clone(feature.geometry.coordinates)
var latlng = []
for (var j = 0; j < coordinates.length; j++) {
- const coordinate = coordinates[j]
- latlng.push(coordinate.reverse())
+ let coordinate = coordinates[j]
+ coordinate = [coordinate[1], coordinate[0]]
+ latlng.push(coordinate)
}
return latlng
}
export function reverseMultiLine (feature) {
- const coordinates = feature.geometry.coordinates
+ const coordinates = clone(feature.geometry.coordinates)
var latlng = []
for (var j = 0; j < coordinates.length; j++) {
const coordinate = coordinates[j]
var xy = []
for (var k = 0; k < coordinate.length; k++) {
- const coor = coordinate[k]
+ let coor = coordinate[k]
+ if (coor.length > 2) {
+ coor = coor.splice(2, 1)
+ }
xy.push(coor.reverse())
}
latlng.push(xy)
@@ -141,4 +145,13 @@
}
}
+/**
+ * 鍘绘帀涓ゅご绌烘牸
+ * @param str
+ * @returns {*}
+ */
+export function lrtrim (str) {
+ return str.replace(/^\s+|\s+$/g, '')
+}
+
export default clone
--
Gitblit v1.8.0