Check Pushback Routes

This commit is contained in:
portree_kid 2020-06-28 14:31:03 +02:00
parent 7b7afb357b
commit b9a34df117

View File

@ -117,28 +117,48 @@ async function checkGroundnet(data) {
var okPushbacks = []; var okPushbacks = [];
// Check pushback
var multiplePushbackRoutes = {};
//debugger;
parkings.forEach(parkingNode => { parkings.forEach(parkingNode => {
if(Object.keys(noPushbackGraph[parkingNode]).length === 0) {
// Not connected to a pushback must be forward push
okPushbacks.push(parkingNode);
return;
}
pushbackNodes.forEach(pushbackNode => { pushbackNodes.forEach(pushbackNode => {
var ok = checkRoute(noPushbackGraph, parkingNode, pushbackNode); var numRoutes = checkRoute(noPushbackGraph, parkingNode, pushbackNode);
if (ok) { if (numRoutes===0) {
okPushbacks.push(parkingNode); okPushbacks.push(parkingNode);
} else if (numRoutes===1){
if (multiplePushbackRoutes[parkingNode]===undefined) {
multiplePushbackRoutes[parkingNode] = [pushbackNode];
} else {
multiplePushbackRoutes[parkingNode].push(pushbackNode);
}
} else if (numRoutes>1){
if (multiplePushbackRoutes[parkingNode]===undefined) {
multiplePushbackRoutes[parkingNode] = [pushbackNode];
} else {
multiplePushbackRoutes[parkingNode].push(pushbackNode);
}
} }
this.postMessage(['progress', 1]); this.postMessage(['progress', 1]);
}); });
}); });
var wrongPushbackRoutes = parkings.filter( var wrongPushbackRoutes = parkings.filter(
function (e) { function (e) {
return this.indexOf(e) < 0; //debugger;
return this[e] != undefined && this[e].length != 1;
} }
, okPushbacks).map( , multiplePushbackRoutes).map(
id => { return { id: id, message: 'No way to pushback holdpoint' } }
);
//multiplePushbackRoutes.push();
id => {
var endPoints = multiplePushbackRoutes[id];
if( endPoints.length<1)
return { id: id, message: 'No way to pushback holdpoint' }
else
return { id: id, message: 'Multiple connected pushback points' }
}
);
wrongPushbackRoutes =wrongPushbackRoutes.concat(multiplePushbackRoutes);
okNodes = okNodes.filter((v, i) => okNodes.indexOf(v) === i); okNodes = okNodes.filter((v, i) => okNodes.indexOf(v) === i);
var notOkNodesParkings = parkings.filter( var notOkNodesParkings = parkings.filter(
@ -148,7 +168,7 @@ async function checkGroundnet(data) {
); );
var notOkNodesRunways = runwayNodes.filter( var notOkNodesRunways = runwayNodes.filter(
(v, i) => okNodes.indexOf(v) < 0 (v, i) => okNodes.indexOf(v) < 0
).map( ).map(
id => { return { id: id, message: 'No way from runway to each parking' } } id => { return { id: id, message: 'No way from runway to each parking' } }
); );
@ -252,12 +272,12 @@ function checkRoute(graph, from, to) {
var pathD = this.dijkstra.find_path(graph, from, to); var pathD = this.dijkstra.find_path(graph, from, to);
if (pathD.length > 0) { if (pathD.length > 0) {
console.log(pathD); console.log(pathD);
return true; return pathD.length;
} }
return false; return 0;
} catch (error) { } catch (error) {
console.error(error); // console.error(error);
return false; return 0;
} }
} }