|
@@ -88,17 +88,39 @@ function addOvalPointConfig(lat, lng, imageName, dataType) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+function getCrossPoint(points1, points2) {
|
|
|
|
|
+ for(let point1 of points1) {
|
|
|
|
|
+ for(let point2 of points2) {
|
|
|
|
|
+ if (point1.point_id == point2.point_id)
|
|
|
|
|
+ return point1
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function getAirwayPoints(airway, pointBefore, pointAfter) {
|
|
function getAirwayPoints(airway, pointBefore, pointAfter) {
|
|
|
let found = 0
|
|
let found = 0
|
|
|
let points = []
|
|
let points = []
|
|
|
|
|
|
|
|
- let airwayPoints
|
|
|
|
|
- if (points in airway)
|
|
|
|
|
- airwayPoints = airway.points
|
|
|
|
|
- else
|
|
|
|
|
- airwayPoints = airway.airlines
|
|
|
|
|
|
|
+ let pointTypeFix, pointsFix
|
|
|
|
|
+
|
|
|
|
|
+ if (points in airway) {
|
|
|
|
|
+ pointTypeFix = 'point_type';
|
|
|
|
|
+ pointsFix = 'points'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ pointTypeFix = 'pointType'
|
|
|
|
|
+ pointsFix = 'airlines'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果前后是其他航线,那么找到交叉点作为前后的点
|
|
|
|
|
+ if ( pointBefore[pointTypeFix] == Global.pointTypes.line ) {
|
|
|
|
|
+ pointBefore = getCrossPoint(airway[pointsFix], pointBefore[pointsFix])
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(pointAfter[pointTypeFix] == Global.pointTypes.line) {
|
|
|
|
|
+ pointAfter = getCrossPoint(airway[pointsFix], pointAfter[pointsFix])
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- for (let point of airwayPoints) {
|
|
|
|
|
|
|
+ for (let point of airway[pointsFix]) {
|
|
|
if (pointBefore.point_id == point.point_id || pointAfter.point_id == point.point_id) {
|
|
if (pointBefore.point_id == point.point_id || pointAfter.point_id == point.point_id) {
|
|
|
found++
|
|
found++
|
|
|
points.push(Object.assign({}, point))
|
|
points.push(Object.assign({}, point))
|
|
@@ -112,7 +134,7 @@ function getAirwayPoints(airway, pointBefore, pointAfter) {
|
|
|
|
|
|
|
|
if (!(points.length > 0 && found == 2)) {
|
|
if (!(points.length > 0 && found == 2)) {
|
|
|
// 如果两个点不全在航线上面,那么画全部航线
|
|
// 如果两个点不全在航线上面,那么画全部航线
|
|
|
- points = airwayPoints
|
|
|
|
|
|
|
+ points = airway[pointsFix]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return points;
|
|
return points;
|