Browse Source

修复复制的计划比较点的时候可能有问题

wd 7 years ago
parent
commit
62a909a72e
1 changed files with 9 additions and 4 deletions
  1. 9 4
      index.js

+ 9 - 4
index.js

@@ -107,14 +107,12 @@ function addOvalPointConfig(lat, lng, imageName, dataType) {
     };
 }
 
-function pointCompare(point1, point2, isStrict) {
+function pointCompare(point1, point2) {
     const pointId1 = point1.point_id || point1.pointId;
     const pointId2 = point2.point_id || point2.pointId;
 
     if(pointId1 == pointId2) {
         return true;
-    } else if(isStrict) {
-        return false;
     }
 
     let [point1Lat, point1lng] = getFixedLatLng(point1)
@@ -132,7 +130,7 @@ function pointCompare(point1, point2, isStrict) {
 function getCrossPoint(points1, points2) {
     for(let point1 of points1) {
         for(let point2 of points2) {
-            if (pointCompare(point1, point2, true))
+            if (pointCompare(point1, point2))
                 return point1
         }
     }
@@ -269,6 +267,13 @@ function getLinesRouter(lineProps, lineAndMarkerStyle) {
 function getFixedLatLng(point) {
     let lat = point.latitude ? point.latitude : point.lat
     let lng = point.longitude ? point.longitude : point.lng
+
+    // 复制计划的数据,有的点是度数模式如 38°35′17″
+    if(isSafeString(lat)) {
+        lat = latLngDegreesToDecimal(lat);
+        lng = latLngDegreesToDecimal(lng);
+    }
+
     return [lat, lng]
 }