Преглед изворни кода

Merge branch 'fix_airline_bug' into 'master'

修复航线截断不对的问题

See merge request BA/amap-shapes-generator!12
haoxinlei пре 7 година
родитељ
комит
fffbcf08c2
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      index.js

+ 4 - 2
index.js

@@ -119,14 +119,16 @@ function getAirwayPoints(airway, pointBefore, pointAfter) {
     let found = 0
     let points = []
 
-    let pointTypeFix, pointsFix
+    let pointTypeFix, pointsFix, pointIdFix
 
     if ('points' in airway) {
         pointTypeFix = 'point_type';
         pointsFix = 'points'
+        pointIdFix = 'point_id'
     } else {
         pointTypeFix = 'pointType'
         pointsFix = 'airlines'
+        pointIdFix = 'pointId'
     }
 
     // 如果前后是其他航线,那么找到交叉点作为前后的点
@@ -139,7 +141,7 @@ function getAirwayPoints(airway, pointBefore, pointAfter) {
     }
 
     for (let point of airway[pointsFix]) {
-        if (pointBefore.point_id == point.point_id || pointAfter.point_id == point.point_id) {
+        if (pointBefore[pointIdFix] == point.point_id || pointAfter[pointIdFix] == point.point_id) {
             found++
             points.push(Object.assign({}, point))
             continue