|
|
@@ -107,11 +107,18 @@ function addOvalPointConfig(lat, lng, imageName, dataType) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+function pointCompare(point1, point2) {
|
|
|
+ const pointId1 = point1.point_id || point1.pointId;
|
|
|
+ const pointId2 = point2.point_id || point2.pointId;
|
|
|
+
|
|
|
+ return pointId1 == pointId2;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
function getCrossPoint(points1, points2) {
|
|
|
for(let point1 of points1) {
|
|
|
for(let point2 of points2) {
|
|
|
- if (point1.point_id == point2.point_id)
|
|
|
+ if (pointCompare(point1, point2))
|
|
|
return point1
|
|
|
}
|
|
|
}
|
|
|
@@ -121,16 +128,14 @@ function getAirwayPoints(airway, pointBefore, pointAfter) {
|
|
|
let found = 0
|
|
|
let points = []
|
|
|
|
|
|
- let pointTypeFix, pointsFix, pointIdFix
|
|
|
+ let pointTypeFix, pointsFix
|
|
|
|
|
|
if ('points' in airway) {
|
|
|
pointTypeFix = 'point_type';
|
|
|
pointsFix = 'points'
|
|
|
- pointIdFix = 'point_id'
|
|
|
} else {
|
|
|
pointTypeFix = 'pointType'
|
|
|
pointsFix = 'airlines'
|
|
|
- pointIdFix = 'pointId'
|
|
|
}
|
|
|
|
|
|
// 如果前后是其他航线,那么找到交叉点作为前后的点
|
|
|
@@ -143,7 +148,7 @@ function getAirwayPoints(airway, pointBefore, pointAfter) {
|
|
|
}
|
|
|
|
|
|
for (let point of airway[pointsFix]) {
|
|
|
- if (pointBefore[pointIdFix] == point.point_id || pointAfter[pointIdFix] == point.point_id) {
|
|
|
+ if (pointCompare(pointBefore, point) || pointCompare(pointAfter, point)) {
|
|
|
found++
|
|
|
points.push(Object.assign({}, point))
|
|
|
continue
|