1
0
Fork 0

Fixes for arrival / departure page so they now show selected departure / approach properly at the top

This commit is contained in:
legoboyvdlp R 2020-04-28 12:35:23 +01:00
parent 62931a38a5
commit b9fb07ec8b
3 changed files with 118 additions and 53 deletions

View file

@ -100,10 +100,17 @@ var flightPlanController = {
me.flightplans[plan].departure = airportinfo(dep);
me.flightplans[plan].destination = airportinfo(arr);
if (plan == 2) {
destroyTemporaryFlightPlan(0, 0);
destroyTemporaryFlightPlan(1, 0);
me.currentToWptIndex.setValue(0);
}
me.addDiscontinuity(1, plan);
# reset mcdu if it exists
if (canvas_mcdu.myArrival[0] != nil) { canvas_mcdu.myArrival[0].reset(); }
if (canvas_mcdu.myArrival[1] != nil) { canvas_mcdu.myArrival[1].reset(); }
if (canvas_mcdu.myDeparture[0] != nil) { canvas_mcdu.myDeparture[0].reset(); }
if (canvas_mcdu.myDeparture[1] != nil) { canvas_mcdu.myDeparture[1].reset(); }
#todo if plan = 2, kill any tmpy flightplan
me.flightPlanChanged(plan);
},

View file

@ -1,3 +1,5 @@
var isNoStar = [0, 0];
var arrivalPage = {
title: [nil, nil, nil],
subtitle: [nil, nil],
@ -43,24 +45,32 @@ var arrivalPage = {
_stars: nil,
_transitions: nil,
new: func(icao, computer) {
var lr = {parents:[arrivalPage]};
lr.id = icao;
lr.computer = computer;
lr._setupPageWithData();
return lr;
var page = {parents:[arrivalPage]};
page.id = icao;
page.computer = computer;
page._setupFirstTime();
page._setupPageWithData();
return page;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
reset: func() {
isNoStar[me.computer] = 0;
me.selectedSTAR = nil;
me.hasPressNoTrans = 0;
},
_setupFirstTime: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
}
if (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
isNoStar[me.computer] = 0;
} elsif (isNoStar[me.computer] == 1) {
me.selectedSTAR = "NO STAR";
me.hasPressNoTrans = 1;
}
} else {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
@ -70,10 +80,18 @@ var arrivalPage = {
}
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star;
isNoStar[me.computer] = 0;
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
isNoStar[me.computer] = 0;
} elsif (isNoStar[me.computer] == 1) {
me.selectedSTAR = "NO STAR";
me.hasPressNoTrans = 1;
}
}
},
_setupPageWithData: func() {
me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
@ -126,10 +144,10 @@ var arrivalPage = {
updateActiveApproach: func() {
if (me.apprIsRwyFlag) {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"];
} else {
me.L1 = ["---", " APPR", "wht"];
}
@ -142,10 +160,10 @@ var arrivalPage = {
}
} elsif (me.selectedApproach != nil) {
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
if (fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) {
me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].approach.id == me.selectedApproach.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"];
} else {
me.L1 = ["---", " APPR", "wht"];
}
@ -160,7 +178,7 @@ var arrivalPage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveSTARs: func() {
if (me.selectedSTAR == " NO STAR") {
if (me.selectedSTAR == "NO STAR") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.C1 = ["NONE", "STAR", "grn"];
} else {
@ -168,10 +186,10 @@ var arrivalPage = {
}
} elsif (me.selectedSTAR != nil) {
if (fmgc.flightPlanController.flightplans[2].star != nil) {
if (fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) {
me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].star.id == me.selectedSTAR.id) {
me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR", "grn"];
} else {
me.C1 = ["------- ", "STAR", "wht"];
}
@ -189,10 +207,10 @@ var arrivalPage = {
if (!me.hasPressNoTrans) {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.flightplans[2].star_trans != nil) {
if (fmgc.flightPlanController.flightplans[2].star_trans == me.selectedTransition) {
me.R1 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].star_trans.id == me.selectedTransition.id) {
me.R1 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS", "grn"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
@ -205,7 +223,11 @@ var arrivalPage = {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["NONE", "TRANS ", "yel"];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.R1 = ["NONE", "TRANS ", "grn"];
} else {
me.R1 = ["NONE", "TRANS ", "yel"];
}
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
@ -337,9 +359,9 @@ var arrivalPage = {
me.stars = sort(me._stars,func(a,b) cmp(a,b));
if (me.stars == nil) {
me.stars = [" NO STAR"];
me.stars = ["NO STAR"];
} else {
append(me.stars, " NO STAR");
append(me.stars, "NO STAR");
}
if (size(me.stars) >= 1) {
@ -420,6 +442,10 @@ var arrivalPage = {
}
return;
}
if (me.selectedSTAR == "NO STAR") {
return;
}
me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions;
me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
@ -499,7 +525,7 @@ var arrivalPage = {
me.scrollStars = 0;
}
me.updateSTARs();
if (me.selectedSTAR == nil or me.selectedSTAR == " NO STAR") {
if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -524,7 +550,7 @@ var arrivalPage = {
me.scrollStars = size(me.stars) - 4;
}
me.updateSTARs();
if (me.selectedSTAR == nil or me.selectedSTAR == " NO STAR") {
if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -545,6 +571,9 @@ var arrivalPage = {
if (me.activePage == 0) {
if (size(me.approaches) >= (index - 2) and index != 2) {
if (!dirToFlag) {
me.selectedSTAR = nil;
me.hasPressNoTrans = 0;
isNoStar[me.computer] = 0;
me.makeTmpy();
if (!me.apprIsRwyFlag) {
me.selectedApproach = me.arrAirport[0].getIAP(me.approaches[index - 3 + me.scrollApproach]);
@ -573,9 +602,11 @@ var arrivalPage = {
if (!dirToFlag) {
me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
me.makeTmpy();
if (me.selectedSTAR != " NO STAR") {
if (me.selectedSTAR != "NO STAR") {
isNoStar[me.computer] = 0;
fmgc.flightPlanController.flightplans[me.computer].star = me.arrAirport[0].getStar(me.selectedSTAR);
} else {
isNoStar[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].star = nil;
if (fmgc.flightPlanController.flightplans[me.computer].approach == nil) {
fmgc.flightPlanController.insertNOSTAR(me.computer);
@ -583,7 +614,7 @@ var arrivalPage = {
}
me.updateActiveSTARs();
me.updateSTARs();
if (me.selectedSTAR != " NO STAR") {
if (me.selectedSTAR != "NO STAR") {
me.hasPressNoTrans = 0;
me.updateTransitions();
} else {

View file

@ -1,3 +1,5 @@
var isNoSid = [0, 0];
var departurePage = {
title: [nil, nil, nil],
subtitle: [nil, nil],
@ -40,24 +42,32 @@ var departurePage = {
_sids: nil,
_transitions: nil,
new: func(icao, computer) {
var lr = {parents:[departurePage]};
lr.id = icao;
lr.computer = computer;
lr._setupPageWithData();
return lr;
var page = {parents:[departurePage]};
page.id = icao;
page.computer = computer;
page._setupFirstTime();
page._setupPageWithData();
return page;
},
del: func() {
return nil;
},
_setupPageWithData: func() {
me.title = ["DEPARTURE", " FROM ", left(me.id, 4)];
reset: func() {
isNoSid[me.computer] = 0;
me.selectedSID = nil;
me.hasPressNoTrans = 0;
},
_setupFirstTime: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
me.selectedRunway = fmgc.flightPlanController.flightplans[2].departure_runway;
}
if (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
isNoSid[me.computer] = 0;
} elsif (isNoSid[me.computer] == 1) {
me.selectedSID = "NO SID";
me.hasPressNoTrans = 1;
}
} else {
if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
@ -67,10 +77,18 @@ var departurePage = {
}
if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid;
isNoSid[me.computer] = 0;
} elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
isNoSid[me.computer] = 0;
} elsif (isNoSid[me.computer] == 1) {
me.selectedSID = "NO SID";
me.hasPressNoTrans = 1;
}
}
},
_setupPageWithData: func() {
me.title = ["DEPARTURE", " FROM ", left(me.id, 4)];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
@ -123,10 +141,10 @@ var departurePage = {
updateActiveRunway: func() {
if (me.selectedRunway != nil) {
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
if (fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"];
} else {
me.L1 = ["---", " RWY", "wht"];
}
@ -141,7 +159,7 @@ var departurePage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveSIDs: func() {
if (me.selectedSID == " NO SID") {
if (me.selectedSID == "NO SID") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.C1 = ["NONE", "SID", "grn"];
} else {
@ -149,10 +167,10 @@ var departurePage = {
}
} elsif (me.selectedSID != nil) {
if (fmgc.flightPlanController.flightplans[2].sid != nil) {
if (fmgc.flightPlanController.flightplans[2].sid == me.selectedSID) {
me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].sid.id == me.selectedSID.id) {
me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"];
} else {
me.C1 = ["------- ", "SID", "wht"];
}
@ -170,10 +188,10 @@ var departurePage = {
if (!me.hasPressNoTrans) {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.flightplans[2].sid_trans != nil) {
if (fmgc.flightPlanController.flightplans[2].sid_trans == me.selectedTransition) {
me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "TRANS", "grn"];
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "TRANS", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].sid_trans.id == me.selectedTransition.id) {
me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "TRANS", "grn"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
@ -186,7 +204,11 @@ var departurePage = {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["NONE", "TRANS ", "yel"];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.R1 = ["NONE", "TRANS ", "grn"];
} else {
me.R1 = ["NONE", "TRANS ", "yel"];
}
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
@ -264,9 +286,9 @@ var departurePage = {
me.sids = sort(me._sids,func(a,b) cmp(a,b));
if (me.sids == nil) {
me.stars = [" NO SID"];
me.sids = ["NO SID"];
} else {
append(me.sids, " NO SID");
append(me.sids, "NO SID");
}
if (size(me.sids) >= 1) {
@ -427,7 +449,7 @@ var departurePage = {
me.scrollSids = 0;
}
me.updateSIDs();
if (me.selectedSID == nil or me.selectedSID == " NO SID") {
if (me.selectedSID == nil or me.selectedSID == "NO SID") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -452,7 +474,7 @@ var departurePage = {
me.scrollSids = size(me.sids) - 4;
}
me.updateSIDs();
if (me.selectedSID == nil or me.selectedSID == " NO SID") {
if (me.selectedSID == nil or me.selectedSID == "NO SID") {
me.clearTransitions();
} else {
me.updateTransitions();
@ -473,6 +495,9 @@ var departurePage = {
if (me.activePage == 0) {
if (size(me.runways) >= (index - 1)) {
if (!dirToFlag) {
me.selectedSID = nil;
isNoSid[me.computer] = 0;
me.hasPressNoTrans = 0;
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]);
me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway;
@ -492,15 +517,17 @@ var departurePage = {
if (!dirToFlag) {
me.selectedSID = me.sids[index - 2 + me.scrollSids];
me.makeTmpy();
if (me.selectedSID != " NO SID") {
if (me.selectedSID != "NO SID") {
isNoSid[me.computer] = 0;
fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID;
} else {
isNoSid[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].sid = nil;
fmgc.flightPlanController.insertNOSID(me.computer);
}
me.updateActiveSIDs();
me.updateSIDs();
if (me.selectedSID != " NO SID") {
if (me.selectedSID != "NO SID") {
me.hasPressNoTrans = 0;
me.updateTransitions();
} else {