2019-12-31 17:48:23 +00:00
|
|
|
var arrivalPage = {
|
|
|
|
title: [nil, nil, nil],
|
|
|
|
subtitle: [nil, nil],
|
|
|
|
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
|
|
|
arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
|
|
|
arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
|
|
|
|
L1: [nil, nil, "ack"], # content, title, colour
|
|
|
|
L2: [nil, nil, "ack"],
|
|
|
|
L3: [nil, nil, "ack"],
|
|
|
|
L4: [nil, nil, "ack"],
|
|
|
|
L5: [nil, nil, "ack"],
|
|
|
|
L6: [nil, nil, "ack"],
|
|
|
|
C1: [nil, nil, "ack"],
|
|
|
|
C2: [nil, nil, "ack"],
|
|
|
|
C3: [nil, nil, "ack"],
|
|
|
|
C4: [nil, nil, "ack"],
|
|
|
|
C5: [nil, nil, "ack"],
|
|
|
|
C6: [nil, nil, "ack"],
|
|
|
|
R1: [nil, nil, "ack"],
|
|
|
|
R2: [nil, nil, "ack"],
|
|
|
|
R3: [nil, nil, "ack"],
|
|
|
|
R4: [nil, nil, "ack"],
|
|
|
|
R5: [nil, nil, "ack"],
|
|
|
|
R6: [nil, nil, "ack"],
|
|
|
|
arrAirport: nil,
|
|
|
|
runways: nil,
|
2020-01-16 17:08:14 +00:00
|
|
|
selectedApproach: nil,
|
2020-01-11 13:30:08 +00:00
|
|
|
selectedVIA: nil,
|
|
|
|
selectedSTAR: nil,
|
|
|
|
selectedTransition: nil,
|
|
|
|
stars: nil,
|
|
|
|
transitions: nil,
|
|
|
|
vias: nil,
|
2019-12-31 17:48:23 +00:00
|
|
|
computer: nil,
|
2020-01-11 13:30:08 +00:00
|
|
|
enableScrollApproach: 0,
|
|
|
|
enableScrollStars: 0,
|
|
|
|
scrollApproach: 0,
|
|
|
|
scrollStars: 0,
|
|
|
|
activePage: 0, # runways, stars, trans
|
|
|
|
hasPressNoTrans: 0, # temporary
|
|
|
|
_approaches: nil,
|
|
|
|
_stars: nil,
|
|
|
|
_transitions: nil,
|
2019-12-31 17:48:23 +00:00
|
|
|
new: func(icao, computer) {
|
|
|
|
var lr = {parents:[arrivalPage]};
|
|
|
|
lr.id = icao;
|
|
|
|
lr.computer = computer;
|
|
|
|
lr._setupPageWithData();
|
|
|
|
return lr;
|
|
|
|
},
|
|
|
|
del: func() {
|
|
|
|
return nil;
|
|
|
|
},
|
|
|
|
_setupPageWithData: func() {
|
|
|
|
me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
|
2020-01-11 13:30:08 +00:00
|
|
|
|
|
|
|
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
2020-01-16 21:02:35 +00:00
|
|
|
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
|
|
|
|
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
if (fmgc.flightPlanController.flightplans[2].star != nil) {
|
|
|
|
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
|
|
|
|
}
|
|
|
|
} else {
|
2020-01-16 21:02:35 +00:00
|
|
|
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
|
|
|
|
me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach;
|
|
|
|
} elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
|
|
|
|
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
|
|
|
|
me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star;
|
|
|
|
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
|
|
|
|
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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]];
|
|
|
|
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
|
|
|
|
2020-01-05 20:21:28 +00:00
|
|
|
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
2019-12-31 17:48:23 +00:00
|
|
|
me.L6 = [" RETURN END", nil, "wht"];
|
|
|
|
} else {
|
|
|
|
me.L6 = [" F-PLN", " TMPY", "yel"];
|
|
|
|
me.arrowsColour[0][5] = "yel";
|
|
|
|
}
|
|
|
|
|
2020-01-11 13:30:08 +00:00
|
|
|
if (me.activePage == 0) {
|
|
|
|
me.updateApproaches();
|
|
|
|
} else {
|
|
|
|
me.updateSTARs();
|
|
|
|
}
|
|
|
|
|
2020-01-16 17:08:14 +00:00
|
|
|
me.updateActiveApproach();
|
|
|
|
me.updateActiveSTARs();
|
2020-01-16 21:02:35 +00:00
|
|
|
me.updateActiveTransitions();
|
2020-01-11 13:30:08 +00:00
|
|
|
},
|
|
|
|
_clearPage: func() {
|
|
|
|
me.L1 = [nil, nil, "ack"];
|
|
|
|
me.L2 = [nil, nil, "ack"];
|
|
|
|
me.L3 = [nil, nil, "ack"];
|
|
|
|
me.L4 = [nil, nil, "ack"];
|
|
|
|
me.L5 = [nil, nil, "ack"];
|
|
|
|
me.L6 = [nil, nil, "ack"];
|
|
|
|
me.C1 = [nil, nil, "ack"];
|
|
|
|
me.C2 = [nil, nil, "ack"];
|
|
|
|
me.C3 = [nil, nil, "ack"];
|
|
|
|
me.C4 = [nil, nil, "ack"];
|
|
|
|
me.C5 = [nil, nil, "ack"];
|
|
|
|
me.C6 = [nil, nil, "ack"];
|
|
|
|
me.R1 = [nil, nil, "ack"];
|
|
|
|
me.R2 = [nil, nil, "ack"];
|
|
|
|
me.R3 = [nil, nil, "ack"];
|
|
|
|
me.R4 = [nil, nil, "ack"];
|
|
|
|
me.R5 = [nil, nil, "ack"];
|
|
|
|
me.R6 = [nil, nil, "ack"];
|
2019-12-31 17:48:23 +00:00
|
|
|
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
2020-01-11 13:30:08 +00:00
|
|
|
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
|
|
|
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
|
|
|
},
|
|
|
|
updatePage: func() {
|
|
|
|
me._clearPage();
|
|
|
|
me._setupPageWithData();
|
2019-12-31 17:48:23 +00:00
|
|
|
},
|
2020-01-16 17:08:14 +00:00
|
|
|
updateActiveApproach: func() {
|
|
|
|
if (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) {
|
|
|
|
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
|
2019-12-31 17:48:23 +00:00
|
|
|
} else {
|
2020-01-11 13:30:08 +00:00
|
|
|
me.L1 = ["---", " APPR", "wht"];
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
2020-01-16 17:08:14 +00:00
|
|
|
} elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
|
|
|
|
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
|
2020-01-11 13:30:08 +00:00
|
|
|
} else {
|
|
|
|
me.L1 = ["---", " APPR", "wht"];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
me.L1 = ["---", " APPR", "wht"];
|
|
|
|
}
|
|
|
|
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
|
|
|
},
|
|
|
|
updateActiveSTARs: func() {
|
|
|
|
if (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, "SID", "grn"];
|
|
|
|
} elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
|
|
|
|
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
|
|
|
|
} else {
|
2020-01-16 17:08:14 +00:00
|
|
|
me.C1 = ["------- ", "STAR", "wht"];
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
} elsif (fmgc.flightPlanController.flightplans[me.computer].star.id != nil) {
|
|
|
|
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
|
|
|
|
} else {
|
2020-01-16 17:08:14 +00:00
|
|
|
me.C1 = ["------- ", "STAR", "wht"];
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-01-16 17:08:14 +00:00
|
|
|
me.C1 = ["------- ", "STAR", "wht"];
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
|
|
|
},
|
|
|
|
updateActiveTransitions: func() {
|
|
|
|
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) {
|
|
|
|
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS", "yel"];
|
|
|
|
} else {
|
|
|
|
me.R1 = ["-------", "TRANS ", "wht"];
|
|
|
|
}
|
|
|
|
} elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
|
|
|
|
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "SID", "yel"];
|
|
|
|
} else {
|
|
|
|
me.R1 = ["-------", "TRANS ", "wht"];
|
|
|
|
}
|
2019-12-31 17:48:23 +00:00
|
|
|
} else {
|
2020-01-11 13:30:08 +00:00
|
|
|
me.R1 = ["-------", "TRANS ", "wht"];
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-01-11 13:30:08 +00:00
|
|
|
me.R1 = ["NONE", "TRANS ", "yel"];
|
|
|
|
}
|
|
|
|
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
|
|
|
},
|
|
|
|
updateApproaches: func() {
|
|
|
|
if (me.arrAirport == nil) {
|
|
|
|
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
|
|
|
}
|
2020-01-16 17:08:14 +00:00
|
|
|
me._approaches = me.arrAirport[0].getApproachList();
|
2020-01-11 13:30:08 +00:00
|
|
|
me.approaches = sort(me._approaches,func(a,b) cmp(a,b));
|
|
|
|
|
|
|
|
if (size(me.approaches) >= 1) {
|
|
|
|
me.L3 = [" " ~ me.approaches[0 + me.scrollApproach], " APPR", "blu"];
|
2020-01-16 17:08:14 +00:00
|
|
|
me.C3 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].length) ~ "M", "AVAILABLE ", "blu"];
|
|
|
|
me.R3 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
|
|
|
|
if (me.approaches[0 + me.scrollApproach] != me.selectedApproach) {
|
|
|
|
me.arrowsMatrix[0][2] = 1;
|
|
|
|
me.arrowsColour[0][2] = "blu";
|
2020-01-11 13:30:08 +00:00
|
|
|
} else {
|
2020-01-16 17:08:14 +00:00
|
|
|
me.arrowsMatrix[0][2] = 0;
|
|
|
|
me.arrowsColour[0][2] = "ack";
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (size(me.approaches) >= 2) {
|
|
|
|
me.L4 = [" " ~ me.approaches[1 + me.scrollApproach], nil, "blu"];
|
2020-01-16 17:08:14 +00:00
|
|
|
if (me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).radio == "ILS") {
|
2020-01-16 21:02:35 +00:00
|
|
|
me.C4 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].length) ~ "M", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[0 + me.scrollApproach]).runways[0]].ils_frequency_mhz), "blu"];
|
2020-01-11 13:30:08 +00:00
|
|
|
} else {
|
2020-01-16 21:02:35 +00:00
|
|
|
me.C4 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].length) ~ "M", nil, "blu"];
|
2020-01-16 17:08:14 +00:00
|
|
|
}
|
|
|
|
me.R4 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
|
|
|
|
if (me.approaches[1 + me.scrollApproach] != me.selectedApproach) {
|
|
|
|
me.arrowsMatrix[0][3] = 1;
|
|
|
|
me.arrowsColour[0][3] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[0][3] = 0;
|
|
|
|
me.arrowsColour[0][3] = "ack";
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (size(me.approaches) >= 3) {
|
|
|
|
me.L5 = [" " ~ me.approaches[2 + me.scrollApproach], nil, "blu"];
|
2020-01-16 17:08:14 +00:00
|
|
|
if (me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).radio == "ILS") {
|
|
|
|
me.C5 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].length) ~ "M", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[1 + me.scrollApproach]).runways[0]].ils_frequency_mhz), "blu"];
|
2020-01-11 13:30:08 +00:00
|
|
|
} else {
|
2020-01-16 17:08:14 +00:00
|
|
|
me.C5 = [math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].length) ~ "M", nil, "blu"];
|
|
|
|
}
|
|
|
|
me.R5 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].heading), nil, "blu"];
|
|
|
|
if (me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).radio == "ILS") {
|
|
|
|
me.C6[1] = me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].ils.id ~ "/" ~ sprintf("%7.2f", me.arrAirport[0].runways[me.arrAirport[0].getIAP(me.approaches[2 + me.scrollApproach]).runways[0]].ils_frequency_mhz);
|
|
|
|
}
|
|
|
|
if (me.approaches[2 + me.scrollApproach] != me.selectedApproach) {
|
|
|
|
me.arrowsMatrix[0][4] = 1;
|
|
|
|
me.arrowsColour[0][4] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[0][3] = 0;
|
|
|
|
me.arrowsColour[0][3] = "ack";
|
2020-01-11 13:30:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size(me.approaches) > 3) {
|
|
|
|
me.enableScrollApproach = 1;
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
|
|
|
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
|
|
|
},
|
2020-01-11 13:30:08 +00:00
|
|
|
updateSTARs: func() {
|
|
|
|
if (me.arrAirport == nil) {
|
|
|
|
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
|
|
|
}
|
2020-01-16 17:08:14 +00:00
|
|
|
if (me.selectedApproach != nil) {
|
2020-01-23 14:14:48 +00:00
|
|
|
me._stars = me.arrAirport[0].stars(me.selectedApproach.runways[0]);
|
2020-01-11 13:30:08 +00:00
|
|
|
} else {
|
|
|
|
me._stars = me.arrAirport[0].stars();
|
|
|
|
}
|
2019-12-31 17:48:23 +00:00
|
|
|
|
2020-01-11 13:30:08 +00:00
|
|
|
me.stars = sort(me._stars,func(a,b) cmp(a,b));
|
2019-12-31 17:48:23 +00:00
|
|
|
|
2020-01-11 13:30:08 +00:00
|
|
|
if (size(me.stars) >= 1) {
|
|
|
|
me.L2 = [" " ~ me.stars[0 + me.scrollStars], "STARS", "blu"];
|
|
|
|
if (me.stars[0 + me.scrollStars] != me.selectedSTAR) {
|
|
|
|
me.arrowsMatrix[0][1] = 1;
|
|
|
|
me.arrowsColour[0][1] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[0][1] = 0;
|
|
|
|
me.arrowsColour[0][1] = "ack";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (size(me.stars) >= 2) {
|
|
|
|
me.L3 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"];
|
|
|
|
if (me.stars[1 + me.scrollStars] != me.selectedSTAR) {
|
|
|
|
me.arrowsMatrix[0][2] = 1;
|
|
|
|
me.arrowsColour[0][2] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[0][2] = 0;
|
|
|
|
me.arrowsColour[0][2] = "ack";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (size(me.stars) >= 3) {
|
|
|
|
me.L4 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"];
|
|
|
|
if (me.stars[2 + me.scrollStars] != me.selectedSTAR) {
|
|
|
|
me.arrowsMatrix[0][3] = 1;
|
|
|
|
me.arrowsColour[0][3] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[0][3] = 0;
|
|
|
|
me.arrowsColour[0][3] = "ack";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (size(me.stars) >= 4) {
|
|
|
|
me.L5 = [" " ~ me.stars[3 + me.scrollStars], nil, "blu"];
|
|
|
|
if (me.stars[3 + me.scrollStars] != me.selectedSTAR) {
|
|
|
|
me.arrowsMatrix[0][4] = 1;
|
|
|
|
me.arrowsColour[0][4] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[0][4] = 0;
|
|
|
|
me.arrowsColour[0][4] = "ack";
|
|
|
|
}
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
|
|
|
|
2020-01-11 13:30:08 +00:00
|
|
|
me.C2 = [nil, "AVAILABLE", "wht"];
|
|
|
|
me.R2 = [nil, "TRANS ", "wht"];
|
|
|
|
|
|
|
|
if (size(me.stars) > 4) {
|
|
|
|
me.enableScrollStars = 1;
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
|
|
|
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
|
|
|
},
|
2020-01-23 14:14:48 +00:00
|
|
|
clearTransitions: func() {
|
|
|
|
me.R2 = [nil, "TRANS", "wht"];
|
|
|
|
me.R3 = [nil, "TRANS", "wht"];
|
|
|
|
me.R4 = [nil, "TRANS", "wht"];
|
|
|
|
me.R5 = [nil, "TRANS", "wht"];
|
|
|
|
me.arrowsMatrix[1][1] = 0;
|
|
|
|
me.arrowsColour[1][1] = "ack";
|
|
|
|
me.arrowsMatrix[1][2] = 0;
|
|
|
|
me.arrowsColour[1][2] = "ack";
|
|
|
|
me.arrowsMatrix[1][3] = 0;
|
|
|
|
me.arrowsColour[1][3] = "ack";
|
|
|
|
me.arrowsMatrix[1][4] = 0;
|
|
|
|
me.arrowsColour[1][4] = "ack";
|
|
|
|
},
|
2020-01-11 13:30:08 +00:00
|
|
|
updateTransitions: func() {
|
|
|
|
if (me.arrAirport == nil) {
|
|
|
|
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
|
|
|
}
|
2020-01-23 14:14:48 +00:00
|
|
|
if (me.selectedSTAR == nil) {
|
|
|
|
me.R2 = ["NO TRANS ", "TRANS", "blu"];
|
|
|
|
if (!me.hasPressNoTrans) {
|
|
|
|
me.arrowsMatrix[1][1] = 1;
|
|
|
|
me.arrowsColour[1][1] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[1][1] = 0;
|
|
|
|
me.arrowsColour[1][1] = "ack";
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2020-01-11 13:30:08 +00:00
|
|
|
me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions;
|
|
|
|
me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
|
|
|
|
|
|
|
|
if (size(me.transitions) == 0) {
|
|
|
|
me.R2 = ["NO TRANS ", "TRANS", "blu"];
|
|
|
|
if (!me.hasPressNoTrans) {
|
|
|
|
me.arrowsMatrix[1][1] = 1;
|
|
|
|
me.arrowsColour[1][1] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[1][1] = 0;
|
|
|
|
me.arrowsColour[1][1] = "ack";
|
|
|
|
}
|
|
|
|
} elsif (size(me.transitions) >= 1) {
|
|
|
|
me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
|
|
|
|
if (me.transitions[0] != me.selectedTransition) {
|
|
|
|
me.arrowsMatrix[1][1] = 1;
|
|
|
|
me.arrowsColour[1][1] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[1][1] = 0;
|
|
|
|
me.arrowsColour[1][1] = "ack";
|
|
|
|
}
|
|
|
|
} elsif (size(me.transitions) >= 2) {
|
|
|
|
me.R3 = [me.transitions[1] ~ " ", nil, "blu"];
|
|
|
|
if (me.transitions[1] != me.selectedTransition) {
|
|
|
|
me.arrowsMatrix[1][2] = 1;
|
|
|
|
me.arrowsColour[1][2] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[1][2] = 0;
|
|
|
|
me.arrowsColour[1][2] = "ack";
|
|
|
|
}
|
|
|
|
} elsif (size(me.transitions) >= 3) {
|
|
|
|
me.R4 = [me.transitions[2] ~ " ", nil, "blu"];
|
|
|
|
if (me.transitions[2] != me.selectedTransition) {
|
|
|
|
me.arrowsMatrix[1][3] = 1;
|
|
|
|
me.arrowsColour[1][3] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[1][3] = 0;
|
|
|
|
me.arrowsColour[1][3] = "ack";
|
|
|
|
}
|
|
|
|
} elsif (size(me.transitions) >= 4) {
|
|
|
|
me.R5 = [me.transitions[3] ~ " ", nil, "blu"];
|
|
|
|
if (me.transitions[3] != me.selectedTransition) {
|
|
|
|
me.arrowsMatrix[1][4] = 1;
|
|
|
|
me.arrowsColour[1][4] = "blu";
|
|
|
|
} else {
|
|
|
|
me.arrowsMatrix[1][4] = 0;
|
|
|
|
me.arrowsColour[1][4] = "ack";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-12-31 17:48:23 +00:00
|
|
|
makeTmpy: func() {
|
2020-01-05 20:21:28 +00:00
|
|
|
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
|
|
|
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
|
2019-12-31 17:48:23 +00:00
|
|
|
me.L6 = [" F-PLN", " TMPY", "yel"];
|
|
|
|
me.arrowsColour[0][5] = "yel";
|
|
|
|
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
scrollUp: func() {
|
2020-01-11 13:30:08 +00:00
|
|
|
if (me.activePage == 0) {
|
|
|
|
if (me.enableScrollApproach) {
|
|
|
|
me.scrollApproach += 1;
|
|
|
|
if (me.scrollApproach > size(me.approaches) - 4) {
|
|
|
|
me.scrollApproach = 0;
|
|
|
|
}
|
|
|
|
me.updateApproaches();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (me.enableScrollStars) {
|
|
|
|
me.scrollStars += 1;
|
|
|
|
if (me.scrollStars > size(me.stars) - 4) {
|
|
|
|
me.scrollStars = 0;
|
|
|
|
}
|
|
|
|
me.updateSTARs();
|
2020-01-23 14:14:48 +00:00
|
|
|
if (me.selectedSTAR == nil) {
|
|
|
|
me.clearTransitions();
|
|
|
|
} else {
|
|
|
|
me.updateTransitions();
|
|
|
|
}
|
2020-01-16 17:08:14 +00:00
|
|
|
me.hasPressNoTrans = 0;
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
scrollDn: func() {
|
2020-01-11 13:30:08 +00:00
|
|
|
if (me.activePage == 0) {
|
|
|
|
if (me.enableScrollApproach) {
|
|
|
|
me.scrollApproach -= 1;
|
|
|
|
if (me.scrollApproach < 0) {
|
|
|
|
me.scrollApproach = size(me.approaches) - 4;
|
|
|
|
}
|
|
|
|
me.updateApproaches();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (me.enableScrollStars) {
|
|
|
|
me.scrollStars -= 1;
|
|
|
|
if (me.scrollStars < 0) {
|
|
|
|
me.scrollStars = size(me.stars) - 4;
|
|
|
|
}
|
|
|
|
me.updateSTARs();
|
2020-01-23 14:14:48 +00:00
|
|
|
if (me.selectedSTAR == nil) {
|
|
|
|
me.clearTransitions();
|
|
|
|
} else {
|
|
|
|
me.updateTransitions();
|
|
|
|
}
|
2020-01-11 13:30:08 +00:00
|
|
|
me.hasPressNoTrans = 0;
|
2019-12-31 17:48:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-01-11 13:30:08 +00:00
|
|
|
scrollLeft: func() {
|
|
|
|
me.activePage = !me.activePage;
|
|
|
|
me.updatePage();
|
|
|
|
},
|
|
|
|
scrollRight: func() {
|
|
|
|
me.activePage = !me.activePage;
|
|
|
|
me.updatePage();
|
|
|
|
},
|
2020-01-16 17:08:14 +00:00
|
|
|
arrPushbuttonLeft: func(index) {
|
2020-01-11 13:30:08 +00:00
|
|
|
if (me.activePage == 0) {
|
2020-01-16 17:08:14 +00:00
|
|
|
if (size(me.approaches) >= (index - 1) and index != 2) {
|
|
|
|
me.selectedApproach = me.arrAirport[0].getIAP(me.approaches[index - 3 + me.scrollApproach]);
|
2020-01-11 13:30:08 +00:00
|
|
|
me.makeTmpy();
|
2020-01-16 17:08:14 +00:00
|
|
|
fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.arrAirport[0].runways[me.selectedApproach.runways[0]];
|
|
|
|
fmgc.flightPlanController.flightplans[me.computer].approach = me.selectedApproach;
|
|
|
|
me.updateActiveApproach();
|
2020-01-11 13:30:08 +00:00
|
|
|
me.updateApproaches();
|
|
|
|
fmgc.flightPlanController.flightPlanChanged(me.computer);
|
|
|
|
me.scrollRight();
|
|
|
|
} else {
|
|
|
|
notAllowed(me.computer);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (size(me.stars) >= (index - 1)) {
|
2020-01-16 21:02:35 +00:00
|
|
|
me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
|
2020-01-11 13:30:08 +00:00
|
|
|
me.makeTmpy();
|
2020-01-16 17:08:14 +00:00
|
|
|
fmgc.flightPlanController.flightplans[me.computer].star = me.arrAirport[0].getStar(me.selectedSTAR);
|
2020-01-11 13:30:08 +00:00
|
|
|
me.updateActiveSTARs();
|
|
|
|
me.updateSTARs();
|
|
|
|
me.hasPressNoTrans = 0;
|
|
|
|
me.updateTransitions();
|
|
|
|
me.updateActiveTransitions();
|
|
|
|
fmgc.flightPlanController.flightPlanChanged(me.computer);
|
|
|
|
} else {
|
|
|
|
notAllowed(me.computer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-01-16 17:08:14 +00:00
|
|
|
arrPushbuttonRight: func(index) {
|
2020-01-11 13:30:08 +00:00
|
|
|
if (index == 2 and size(me.transitions) == 0) {
|
|
|
|
me.hasPressNoTrans = 1;
|
|
|
|
me.updateActiveTransitions();
|
|
|
|
me.updateTransitions();
|
|
|
|
} elsif (size(me.transitions) >= (index - 1)) {
|
|
|
|
me.selectedTransition = me.transitions[index - 2];
|
2019-12-31 17:48:23 +00:00
|
|
|
me.makeTmpy();
|
2020-01-11 13:30:08 +00:00
|
|
|
fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition;
|
|
|
|
me.updateActiveTransitions();
|
|
|
|
me.updateTransitions();
|
|
|
|
fmgc.flightPlanController.flightPlanChanged(me.computer);
|
2019-12-31 17:48:23 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(me.computer);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|