Many improvements
This commit is contained in:
parent
9affa52adb
commit
ec68189ce1
8 changed files with 862 additions and 131 deletions
|
@ -1887,6 +1887,7 @@
|
|||
<mcdu>
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/LATREV.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN-rework.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
|
||||
|
|
|
@ -8,7 +8,9 @@ var MCDU1_display = nil;
|
|||
var MCDU2_display = nil;
|
||||
var myLatRev = [nil, nil];
|
||||
var myDeparture = [nil, nil];
|
||||
var myArrival = [nil, nil];
|
||||
var myFpln = [nil, nil];
|
||||
var myDuplicate = [nil, nil];
|
||||
var default = "BoeingCDU-Large.ttf";
|
||||
var symbol = "helvetica_medium.txf";
|
||||
var normal = 70;
|
||||
|
@ -230,7 +232,6 @@ var canvas_MCDU_base = {
|
|||
}
|
||||
|
||||
if (myFpln[i] != nil) {
|
||||
myFpln[i].update();
|
||||
|
||||
if (flightNumSet.getValue()) {
|
||||
me["FPLN_Callsign"].setText(flightNum.getValue());
|
||||
|
@ -2341,6 +2342,319 @@ var canvas_MCDU_base = {
|
|||
}
|
||||
pageSwitch[i].setBoolValue(1);
|
||||
}
|
||||
} elsif (page == "DUPLICATENAMES") {
|
||||
if (!pageSwitch[i].getBoolValue()) {
|
||||
me["Simple"].show();
|
||||
me["Simple_Center"].show();
|
||||
me["FPLN"].hide();
|
||||
me["INITA"].hide();
|
||||
me["INITB"].hide();
|
||||
me["PERFTO"].hide();
|
||||
me["arrowsDepArr"].hide();
|
||||
me["Simple_PageNum"].setText("X/X");
|
||||
me["Simple_PageNum"].hide();
|
||||
me["Simple_Title"].show();
|
||||
me["ArrowLeft"].hide();
|
||||
me["ArrowRight"].hide();
|
||||
|
||||
me.fontLeft(default, default, default, default, default, default);
|
||||
me.fontLeftS(default, default, default, default, default, default);
|
||||
me.fontRight(default, default, default, default, default, default);
|
||||
me.fontRightS(default, default, default, default, default, default);
|
||||
|
||||
me.fontSizeLeft(normal, normal, normal, normal, normal, normal);
|
||||
me.fontSizeRight(normal, normal, normal, normal, normal, normal);
|
||||
|
||||
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
|
||||
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
|
||||
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
|
||||
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
|
||||
|
||||
|
||||
if (myDuplicate[i] != nil) {
|
||||
me["Simple_Title"].setText(sprintf("%s", myDuplicate[i].title));
|
||||
|
||||
forindex (var matrixArrow; myDuplicate[i].arrowsMatrix) {
|
||||
if (matrixArrow == 0) {
|
||||
var sign = "L";
|
||||
} else {
|
||||
var sign = "R";
|
||||
}
|
||||
forindex (var item; myDuplicate[i].arrowsMatrix[matrixArrow]) {
|
||||
if (myDuplicate[i].arrowsMatrix[matrixArrow][item] == 1) {
|
||||
me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show();
|
||||
} else {
|
||||
me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
me.colorLeftArrow(myDuplicate[i].arrowsColour[0][0],myDuplicate[i].arrowsColour[0][1],myDuplicate[i].arrowsColour[0][2],myDuplicate[i].arrowsColour[0][3],myDuplicate[i].arrowsColour[0][4],myDuplicate[i].arrowsColour[0][5]);
|
||||
|
||||
|
||||
forindex (var matrixFont; myDuplicate[i].fontMatrix) {
|
||||
if (matrixFont == 0) {
|
||||
var sign = "L";
|
||||
} else {
|
||||
var sign = "R";
|
||||
}
|
||||
forindex (var item; myDuplicate[i].fontMatrix[matrixFont]) {
|
||||
if (myDuplicate[i].fontMatrix[matrixFont][item] == 1) {
|
||||
me["Simple_" ~ sign ~ (item + 1)].setFont(symbol);
|
||||
me["Simple_" ~ sign ~ (item + 1)].setFontSize(small);
|
||||
} else {
|
||||
me["Simple_" ~ sign ~ (item + 1)].setFont(default);
|
||||
me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].L1[0] == nil) {
|
||||
me["Simple_L1"].hide();
|
||||
me["Simple_L1S"].hide();
|
||||
} else {
|
||||
me["Simple_L1"].show();
|
||||
me["Simple_L1"].setText(myDuplicate[i].L1[0]);
|
||||
if (myDuplicate[i].L1[1] != nil) {
|
||||
me["Simple_L1S"].show();
|
||||
me["Simple_L1S"].setText(myDuplicate[i].L1[1]);
|
||||
} else {
|
||||
me["Simple_L1S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].L2[0] == nil) {
|
||||
me["Simple_L2"].hide();
|
||||
me["Simple_L2S"].hide();
|
||||
} else {
|
||||
me["Simple_L2"].show();
|
||||
me["Simple_L2"].setText(myDuplicate[i].L2[0]);
|
||||
if (myDuplicate[i].L2[1] != nil) {
|
||||
me["Simple_L2S"].show();
|
||||
me["Simple_L2S"].setText(myDuplicate[i].L2[1]);
|
||||
} else {
|
||||
me["Simple_L2S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].L3[0] == nil) {
|
||||
me["Simple_L3"].hide();
|
||||
me["Simple_L3S"].hide();
|
||||
} else {
|
||||
me["Simple_L3"].show();
|
||||
me["Simple_L3"].setText(myDuplicate[i].L3[0]);
|
||||
if (myDuplicate[i].L3[1] != nil) {
|
||||
me["Simple_L3S"].show();
|
||||
me["Simple_L3S"].setText(myDuplicate[i].L3[1]);
|
||||
} else {
|
||||
me["Simple_L3S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].L4[0] == nil) {
|
||||
me["Simple_L4"].hide();
|
||||
me["Simple_L4S"].hide();
|
||||
} else {
|
||||
me["Simple_L4"].show();
|
||||
me["Simple_L4"].setText(myDuplicate[i].L4[0]);
|
||||
if (myDuplicate[i].L4[1] != nil) {
|
||||
me["Simple_L4S"].show();
|
||||
me["Simple_L4S"].setText(myDuplicate[i].L4[1]);
|
||||
} else {
|
||||
me["Simple_L4S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].L5[0] == nil) {
|
||||
me["Simple_L5"].hide();
|
||||
me["Simple_L5S"].hide();
|
||||
} else {
|
||||
me["Simple_L5"].show();
|
||||
me["Simple_L5"].setText(myDuplicate[i].L5[0]);
|
||||
if (myDuplicate[i].L5[1] != nil) {
|
||||
me["Simple_L5S"].show();
|
||||
me["Simple_L5S"].setText(myDuplicate[i].L5[1]);
|
||||
} else {
|
||||
me["Simple_L5S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].L6[0] == nil) {
|
||||
me["Simple_L6"].hide();
|
||||
me["Simple_L6S"].hide();
|
||||
} else {
|
||||
me["Simple_L6"].show();
|
||||
me["Simple_L6"].setText(myDuplicate[i].L6[0]);
|
||||
if (myDuplicate[i].L6[1] != nil) {
|
||||
me["Simple_L6S"].show();
|
||||
me["Simple_L6S"].setText(myDuplicate[i].L6[1]);
|
||||
} else {
|
||||
me["Simple_L6S"].hide();
|
||||
}
|
||||
}
|
||||
me.colorLeft(myDuplicate[i].L1[2],myDuplicate[i].L2[2],myDuplicate[i].L3[2],myDuplicate[i].L4[2],myDuplicate[i].L5[2],myDuplicate[i].L6[2]);
|
||||
|
||||
|
||||
if (myDuplicate[i].C1[0] == nil) {
|
||||
me["Simple_C1"].hide();
|
||||
me["Simple_C1S"].hide();
|
||||
} else {
|
||||
me["Simple_C1"].show();
|
||||
me["Simple_C1"].setText(myDuplicate[i].C1[0]);
|
||||
if (myDuplicate[i].C1[1] != nil) {
|
||||
me["Simple_C1S"].show();
|
||||
me["Simple_C1S"].setText(myDuplicate[i].C1[1]);
|
||||
} else {
|
||||
me["Simple_C1S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].C2[0] == nil) {
|
||||
me["Simple_C2"].hide();
|
||||
me["Simple_C2S"].hide();
|
||||
} else {
|
||||
me["Simple_C2"].show();
|
||||
me["Simple_C2"].setText(myDuplicate[i].C2[0]);
|
||||
if (myDuplicate[i].C2[1] != nil) {
|
||||
me["Simple_C2S"].show();
|
||||
me["Simple_C2S"].setText(myDuplicate[i].C2[1]);
|
||||
} else {
|
||||
me["Simple_C2S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].C3[0] == nil) {
|
||||
me["Simple_C3"].hide();
|
||||
me["Simple_C3S"].hide();
|
||||
} else {
|
||||
me["Simple_C3"].show();
|
||||
me["Simple_C3"].setText(myDuplicate[i].C3[0]);
|
||||
if (myDuplicate[i].C3[1] != nil) {
|
||||
me["Simple_C3S"].show();
|
||||
me["Simple_C3S"].setText(myDuplicate[i].C3[1]);
|
||||
} else {
|
||||
me["Simple_C3S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].C4[0] == nil) {
|
||||
me["Simple_C4"].hide();
|
||||
me["Simple_C4S"].hide();
|
||||
} else {
|
||||
me["Simple_C4"].show();
|
||||
me["Simple_C4"].setText(myDuplicate[i].C4[0]);
|
||||
if (myDuplicate[i].C4[1] != nil) {
|
||||
me["Simple_C4S"].show();
|
||||
me["Simple_C4S"].setText(myDuplicate[i].C4[1]);
|
||||
} else {
|
||||
me["Simple_C4S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].C5[0] == nil) {
|
||||
me["Simple_C5"].hide();
|
||||
me["Simple_C5S"].hide();
|
||||
} else {
|
||||
me["Simple_C5"].show();
|
||||
me["Simple_C5"].setText(myDuplicate[i].C5[0]);
|
||||
if (myDuplicate[i].C5[1] != nil) {
|
||||
me["Simple_C5S"].show();
|
||||
me["Simple_C5S"].setText(myDuplicate[i].C5[1]);
|
||||
} else {
|
||||
me["Simple_C5S"].hide();
|
||||
}
|
||||
}
|
||||
me.colorCenter(myDuplicate[i].C1[2],myDuplicate[i].C2[2],myDuplicate[i].C3[2],myDuplicate[i].C4[2],myDuplicate[i].C5[2],myDuplicate[i].C6[2]);
|
||||
|
||||
me["Simple_C6"].hide();
|
||||
me["Simple_C6S"].hide();
|
||||
|
||||
if (myDuplicate[i].R1[0] == nil) {
|
||||
me["Simple_R1"].hide();
|
||||
me["Simple_R1S"].hide();
|
||||
} else {
|
||||
me["Simple_R1"].show();
|
||||
me["Simple_R1"].setText(myDuplicate[i].R1[0]);
|
||||
if (myDuplicate[i].R1[1] != nil) {
|
||||
me["Simple_R1S"].show();
|
||||
me["Simple_R1S"].setText(myDuplicate[i].R1[1]);
|
||||
} else {
|
||||
me["Simple_R1S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].R2[0] == nil) {
|
||||
me["Simple_R2"].hide();
|
||||
me["Simple_R2S"].hide();
|
||||
} else {
|
||||
me["Simple_R2"].show();
|
||||
me["Simple_R2"].setText(myDuplicate[i].R2[0]);
|
||||
if (myDuplicate[i].R2[1] != nil) {
|
||||
me["Simple_R2S"].show();
|
||||
me["Simple_R2S"].setText(myDuplicate[i].R2[1]);
|
||||
} else {
|
||||
me["Simple_R2S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].R3[0] == nil) {
|
||||
me["Simple_R3"].hide();
|
||||
me["Simple_R3S"].hide();
|
||||
} else {
|
||||
me["Simple_R3"].show();
|
||||
me["Simple_R3"].setText(myDuplicate[i].R3[0]);
|
||||
if (myDuplicate[i].R3[1] != nil) {
|
||||
me["Simple_R3S"].show();
|
||||
me["Simple_R3S"].setText(myDuplicate[i].R3[1]);
|
||||
} else {
|
||||
me["Simple_R3S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].R4[0] == nil) {
|
||||
me["Simple_R4"].hide();
|
||||
me["Simple_R4S"].hide();
|
||||
} else {
|
||||
me["Simple_R4"].show();
|
||||
me["Simple_R4"].setText(myDuplicate[i].R4[0]);
|
||||
if (myDuplicate[i].R4[1] != nil) {
|
||||
me["Simple_R4S"].show();
|
||||
me["Simple_R4S"].setText(myDuplicate[i].R4[1]);
|
||||
} else {
|
||||
me["Simple_R4S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].R5[0] == nil) {
|
||||
me["Simple_R5"].hide();
|
||||
me["Simple_R5S"].hide();
|
||||
} else {
|
||||
me["Simple_R5"].show();
|
||||
me["Simple_R5"].setText(myDuplicate[i].R5[0]);
|
||||
if (myDuplicate[i].R5[1] != nil) {
|
||||
me["Simple_R5S"].show();
|
||||
me["Simple_R5S"].setText(myDuplicate[i].R5[1]);
|
||||
} else {
|
||||
me["Simple_R5S"].hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (myDuplicate[i].R6[0] == nil) {
|
||||
me["Simple_R6"].hide();
|
||||
me["Simple_R6S"].hide();
|
||||
} else {
|
||||
me["Simple_R6"].show();
|
||||
me["Simple_R6"].setText(myDuplicate[i].R6[0]);
|
||||
if (myDuplicate[i].R6[1] != nil) {
|
||||
me["Simple_R6S"].show();
|
||||
me["Simple_R6S"].setText(myDuplicate[i].R6[1]);
|
||||
} else {
|
||||
me["Simple_R6S"].hide();
|
||||
}
|
||||
}
|
||||
me.colorRight(myDuplicate[i].R1[2],myDuplicate[i].R2[2],myDuplicate[i].R3[2],myDuplicate[i].R4[2],myDuplicate[i].R5[2],myDuplicate[i].R6[2]);
|
||||
}
|
||||
pageSwitch[i].setBoolValue(1);
|
||||
}
|
||||
} else {
|
||||
if (!pageSwitch[i].getBoolValue()) {
|
||||
me["Simple"].hide();
|
||||
|
|
|
@ -117,10 +117,10 @@ var flightPlanController = {
|
|||
me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), 0);
|
||||
},
|
||||
|
||||
deleteWP: func(index, n) {
|
||||
deleteWP: func(index, n, a = 0) { # a = 1, means adding a waypoint via deleting intermediate
|
||||
var wp = wpID[n][index].getValue();
|
||||
if (wp != FMGCdep.getValue() and wp != FMGCarr.getValue() and me.flightplans[n].getPlanSize() > 2) {
|
||||
if (me.flightplans[n].getWP(index).id != "DISCONTINUITY") { # if it is a discont, don't make a new one
|
||||
if (me.flightplans[n].getWP(index).id != "DISCONTINUITY" and a == 0) { # if it is a discont, don't make a new one
|
||||
me.flightplans[n].deleteWP(index);
|
||||
if (me.flightplans[n].getWP(index).id != "DISCONTINUITY") { # else, if the next one isn't a discont, add one
|
||||
me.addDiscontinuity(index, n);
|
||||
|
@ -128,7 +128,8 @@ var flightPlanController = {
|
|||
} else {
|
||||
me.flightplans[n].deleteWP(index);
|
||||
}
|
||||
me.flightPlanChanged(n);
|
||||
me.updatePlans();
|
||||
canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed");
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
|
@ -154,7 +155,7 @@ var flightPlanController = {
|
|||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(airport[0]) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 0);
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
|
@ -167,18 +168,24 @@ var flightPlanController = {
|
|||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(airport[overrideIndex]) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 0);
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
} elsif (size(airport) >= 1) {
|
||||
# spawn DUPLICATE NAMES
|
||||
if (canvas_mcdu.myDeparture[plan] != nil) {
|
||||
canvas_mcdu.myDeparture[plan].del();
|
||||
}
|
||||
canvas_mcdu.myDeparture[plan] = nil;
|
||||
canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(airport, index, 0, plan);
|
||||
setprop("/MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
|
||||
return 2;
|
||||
}
|
||||
},
|
||||
|
||||
insertFix: func(text, index, plan, override = 0) { # override - means always choose [0]
|
||||
insertFix: func(text, index, plan, override = 0, overrideIndex = -1) { # override - means always choose [0]
|
||||
if (index == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -197,7 +204,7 @@ var flightPlanController = {
|
|||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(fix[0]) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 0);
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
|
@ -210,18 +217,53 @@ var flightPlanController = {
|
|||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(fix[overrideIndex]) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 0);
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
} elsif (size(fix) >= 1) {
|
||||
# spawn DUPLICATE NAMES
|
||||
if (canvas_mcdu.myDeparture[plan] != nil) {
|
||||
canvas_mcdu.myDeparture[plan].del();
|
||||
}
|
||||
canvas_mcdu.myDeparture[plan] = nil;
|
||||
canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(fix, index, 0, plan);
|
||||
setprop("/MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
|
||||
return 2;
|
||||
}
|
||||
},
|
||||
|
||||
insertNavaid: func(text, index, plan, override = 0) {
|
||||
insertLatLonFix: func(text, index, plan) {
|
||||
if (index == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var lat = split("/", text)[0];
|
||||
var lon = split("/", text)[1];
|
||||
var latDecimal = mcdu.stringToDegrees(lat, "lat");
|
||||
var lonDecimal = mcdu.stringToDegrees(lon, "lon");
|
||||
|
||||
if (latDecimal > 90 or latDecimal < -90 or lonDecimal > 180 or lonDecimal < -180) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var myWpLatLon = createWP(latDecimal, lonDecimal, "LL" ~ index);
|
||||
if (me.flightplans[plan].indexOfWP(myWpLatLon) == -1) {
|
||||
me.flightplans[plan].insertWP(myWpLatLon, index);
|
||||
me.flightPlanChanged(plan);
|
||||
return 2;
|
||||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(myWpLatLon) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
},
|
||||
|
||||
insertNavaid: func(text, index, plan, override = 0, overrideIndex = -1) {
|
||||
if (index == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -240,7 +282,7 @@ var flightPlanController = {
|
|||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(navaid[0]) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 0);
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
|
@ -253,14 +295,20 @@ var flightPlanController = {
|
|||
} else {
|
||||
var numToDel = me.flightplans[plan].indexOfWP(navaid[overrideIndex]) - index;
|
||||
while (numToDel > 0) {
|
||||
me.deleteWP(index + 1, plan, 0);
|
||||
me.deleteWP(index + 1, plan, 1);
|
||||
numToDel -= 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
} elsif (size(navaid) >= 1) {
|
||||
# spawn DUPLICATE NAMES
|
||||
if (canvas_mcdu.myDeparture[plan] != nil) {
|
||||
canvas_mcdu.myDeparture[plan].del();
|
||||
}
|
||||
canvas_mcdu.myDeparture[plan] = nil;
|
||||
canvas_mcdu.myDuplicate[plan] = mcdu.duplicateNamesPage.new(navaid, index, 1, plan);
|
||||
setprop("/MCDU[" ~ plan ~ "]/page", "DUPLICATENAMES");
|
||||
return 2;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -277,7 +325,9 @@ var flightPlanController = {
|
|||
}
|
||||
|
||||
if (text == "CLR") {
|
||||
return me.deleteWP(index, thePlan);
|
||||
return me.deleteWP(index, thePlan, 0);
|
||||
} elsif (size(text) == 16) {
|
||||
return me.insertLatLonFix(text, index, thePlan);
|
||||
} elsif (size(text) == 5) {
|
||||
return me.insertFix(text, index, thePlan);
|
||||
} elsif (size(text) == 4) {
|
||||
|
@ -301,6 +351,7 @@ var flightPlanController = {
|
|||
append(wpDistancePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance-from-prev", 0, "DOUBLE"));
|
||||
}
|
||||
me.updatePlans();
|
||||
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
|
||||
},
|
||||
|
||||
updatePlans: func() {
|
||||
|
@ -355,7 +406,6 @@ var flightPlanController = {
|
|||
}
|
||||
me.arrivalDist = me._arrivalDist;
|
||||
me.updateMCDUDriver(n);
|
||||
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
|
||||
},
|
||||
|
||||
updateCurrentWaypoint: func() {
|
||||
|
|
|
@ -25,22 +25,27 @@ var arrivalPage = {
|
|||
arrAirport: nil,
|
||||
runways: nil,
|
||||
selectedRunway: nil,
|
||||
sids: nil,
|
||||
selectedVIA: nil,
|
||||
selectedSTAR: nil,
|
||||
selectedTransition: nil,
|
||||
stars: nil,
|
||||
transitions: nil,
|
||||
vias: nil,
|
||||
computer: nil,
|
||||
enableScroll: 0,
|
||||
scroll: 0,
|
||||
_runways: nil,
|
||||
_sids: nil,
|
||||
enableScrollApproach: 0,
|
||||
enableScrollStars: 0,
|
||||
scrollApproach: 0,
|
||||
scrollStars: 0,
|
||||
activePage: 0, # runways, stars, trans
|
||||
hasPressNoTrans: 0, # temporary
|
||||
_approaches: nil,
|
||||
_stars: nil,
|
||||
_transitions: nil,
|
||||
new: func(icao, computer) {
|
||||
var lr = {parents:[arrivalPage]};
|
||||
lr.id = icao;
|
||||
lr.computer = computer;
|
||||
lr._setupPageWithData();
|
||||
lr.updateRunways();
|
||||
if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
|
||||
lr.selectedRunway = fmgc.flightPlanController.flightplans[2].destination_runway;
|
||||
}
|
||||
lr.updateActiveRunway();
|
||||
return lr;
|
||||
},
|
||||
del: func() {
|
||||
|
@ -48,6 +53,31 @@ var arrivalPage = {
|
|||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = ["ARRIVAL", " TO ", left(me.id, 4)];
|
||||
|
||||
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||
if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
|
||||
me.selectedRunway = fmgc.flightPlanController.flightplans[2].destination_runway;
|
||||
}
|
||||
if (fmgc.flightPlanController.flightplans[2].star != nil) {
|
||||
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
|
||||
}
|
||||
} else {
|
||||
if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) {
|
||||
me.selectedRunway = fmgc.flightPlanController.flightplans[me.computer].destination_runway;
|
||||
} elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
|
||||
me.selectedRunway = fmgc.flightPlanController.flightplans[2].destination_runway;
|
||||
}
|
||||
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"]];
|
||||
|
||||
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||
me.L6 = [" RETURN END", nil, "wht"];
|
||||
} else {
|
||||
|
@ -55,74 +85,273 @@ var arrivalPage = {
|
|||
me.arrowsColour[0][5] = "yel";
|
||||
}
|
||||
|
||||
me.C1 = ["------- ", "VIA", "wht"];
|
||||
me.R1 = ["-------", "STAR ", "wht"];
|
||||
me.R1 = ["-------", "TRANS ", "wht"];
|
||||
if (me.activePage == 0) {
|
||||
me.updateApproaches();
|
||||
} else {
|
||||
me.updateSTARs();
|
||||
}
|
||||
|
||||
me.updateActiveRunway();
|
||||
me.updateActiveSTARs();
|
||||
me.updateActiveTransitions();
|
||||
},
|
||||
_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"];
|
||||
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"]];
|
||||
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();
|
||||
},
|
||||
updateActiveRunway: func() {
|
||||
if (me.selectedRunway != nil) {
|
||||
if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
|
||||
if (fmgc.flightPlanController.flightplans[2].destination_runway.id == me.selectedRunway.id) {
|
||||
me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " RWY", "grn"];
|
||||
me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"];
|
||||
} elsif (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) {
|
||||
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " RWY", "yel"];
|
||||
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"];
|
||||
} else {
|
||||
me.L1 = ["---", " RWY", "wht"];
|
||||
me.L1 = ["---", " APPR", "wht"];
|
||||
}
|
||||
} elsif (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) {
|
||||
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " RWY", "yel"];
|
||||
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"];
|
||||
} else {
|
||||
me.L1 = ["---", " RWY", "wht"];
|
||||
me.L1 = ["---", " APPR", "wht"];
|
||||
}
|
||||
} else {
|
||||
me.L1 = ["---", " RWY", "wht"];
|
||||
me.L1 = ["---", " APPR", "wht"];
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
updateRunways: func() {
|
||||
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
||||
me._runways = keys(me.arrAirport[0].runways);
|
||||
me.runways = sort(me._runways,func(a,b) cmp(a,b));
|
||||
|
||||
me.fourRunways = [nil, nil, nil, nil];
|
||||
|
||||
if (size(me.runways) >= 1) {
|
||||
me.L2 = [" " ~ me.runways[0 + me.scroll], nil, "blu"];
|
||||
me.C2 = [math.round(me.arrAirport[0].runways[me.runways[0 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R2 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[0 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][1] = 1;
|
||||
me.arrowsColour[0][1] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 2) {
|
||||
me.L3 = [" " ~ me.runways[1 + me.scroll], nil, "blu"];
|
||||
me.C3 = [math.round(me.arrAirport[0].runways[me.runways[1 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R3 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[1 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
me.arrowsColour[0][2] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 3) {
|
||||
me.L4 = [" " ~ me.runways[2 + me.scroll], nil, "blu"];
|
||||
me.C4 = [math.round(me.arrAirport[0].runways[me.runways[2 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R4 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[2 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][3] = 1;
|
||||
me.arrowsColour[0][3] = "blu";
|
||||
}
|
||||
if (size(me.runways) >= 4) {
|
||||
me.L5 = [" " ~ me.runways[3 + me.scroll], nil, "blu"];
|
||||
me.C5 = [math.round(me.arrAirport[0].runways[me.runways[3 + me.scroll]].length) ~ "M", nil, "blu"];
|
||||
me.R5 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.runways[3 + me.scroll]].heading), nil, "blu"];
|
||||
me.arrowsMatrix[0][4] = 1;
|
||||
me.arrowsColour[0][4] = "blu";
|
||||
}
|
||||
|
||||
if (size(me.runways) > 4) {
|
||||
me.enableScroll = 1;
|
||||
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 {
|
||||
me.C1 = ["------- ", "SID", "wht"];
|
||||
}
|
||||
} elsif (fmgc.flightPlanController.flightplans[me.computer].star.id != nil) {
|
||||
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "SID", "yel"];
|
||||
} else {
|
||||
me.C1 = ["------- ", "SID", "wht"];
|
||||
}
|
||||
} else {
|
||||
me.C1 = ["------- ", "SID", "wht"];
|
||||
}
|
||||
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"];
|
||||
}
|
||||
} else {
|
||||
me.R1 = ["-------", "TRANS ", "wht"];
|
||||
}
|
||||
} else {
|
||||
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));
|
||||
}
|
||||
me._approaches = keys(me.arrAirport[0].getApproachList());
|
||||
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"];
|
||||
me.C3 = [math.round(me.arrAirport[0].runways[me.approaches[0 + me.scrollApproach]].runways[0].length) ~ "M", "AVAILABLE ", "blu"];
|
||||
me.R3 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.approaches[0 + me.scrollApproach]].runways[0].heading), nil, "blu"];
|
||||
if (me.approaches[0 + me.scrollApproach] != me.selectedRunway) {
|
||||
me.arrowsMatrix[0][1] = 1;
|
||||
me.arrowsColour[0][1] = "blu";
|
||||
} else {
|
||||
me.arrowsMatrix[0][1] = 0;
|
||||
me.arrowsColour[0][1] = "ack";
|
||||
}
|
||||
}
|
||||
if (size(me.approaches) >= 2) {
|
||||
me.L4 = [" " ~ me.approaches[1 + me.scrollApproach], nil, "blu"];
|
||||
me.C4 = [math.round(me.arrAirport[0].runways[me.approaches[1 + me.scrollApproach]].runways[1].length) ~ "M", sprintf("%7.2f", me.arrAirport[0].runways[0 + me.scrollApproach].ils_frequency_mhz), "blu"];
|
||||
me.R4 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.approaches[1 + me.scrollApproach]].runways[1].heading), nil, "blu"];
|
||||
if (me.approaches[1 + me.scrollApproach] != me.selectedRunway) {
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
me.arrowsColour[0][2] = "blu";
|
||||
} else {
|
||||
me.arrowsMatrix[0][2] = 0;
|
||||
me.arrowsColour[0][2] = "ack";
|
||||
}
|
||||
}
|
||||
if (size(me.approaches) >= 3) {
|
||||
me.L5 = [" " ~ me.approaches[2 + me.scrollApproach], nil, "blu"];
|
||||
me.C5 = [math.round(me.arrAirport[0].runways[me.approaches[2 + me.scrollApproach]].runways[2].length) ~ "M", sprintf("%7.2f", me.arrAirport[0].runways[1 + me.scrollApproach].ils_frequency_mhz), "blu"];
|
||||
me.R5 = ["CRS" ~ math.round(me.arrAirport[0].runways[me.approaches[2 + me.scrollApproach]].runways[2].heading), nil, "blu"];
|
||||
me.C6[1] = sprintf("%7.2f", me.arrAirport[0].runways[2 + me.scrollApproach].ils_frequency_mhz);
|
||||
if (me.approaches[2 + me.scrollApproach] != me.selectedRunway) {
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
me.arrowsColour[0][2] = "blu";
|
||||
} else {
|
||||
me.arrowsMatrix[0][2] = 0;
|
||||
me.arrowsColour[0][2] = "ack";
|
||||
}
|
||||
}
|
||||
|
||||
if (size(me.approaches) > 3) {
|
||||
me.enableScrollApproach = 1;
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
updateSTARs: func() {
|
||||
if (me.arrAirport == nil) {
|
||||
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
||||
}
|
||||
if (me.selectedRunway != nil) {
|
||||
me._stars = me.arrAirport[0].stars(me.selectedRunway.id);
|
||||
} else {
|
||||
me._stars = me.arrAirport[0].stars();
|
||||
}
|
||||
|
||||
me.stars = sort(me._stars,func(a,b) cmp(a,b));
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
me.C2 = [nil, "AVAILABLE", "wht"];
|
||||
me.R2 = [nil, "TRANS ", "wht"];
|
||||
|
||||
if (size(me.stars) > 4) {
|
||||
me.enableScrollStars = 1;
|
||||
}
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
updateTransitions: func() {
|
||||
if (me.arrAirport == nil) {
|
||||
me.arrAirport = findAirportsByICAO(left(me.id, 4));
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
},
|
||||
makeTmpy: func() {
|
||||
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
|
||||
|
@ -132,30 +361,93 @@ var arrivalPage = {
|
|||
}
|
||||
},
|
||||
scrollUp: func() {
|
||||
if (me.enableScroll) {
|
||||
me.scroll += 1;
|
||||
if (me.scroll > size(me.runways) - 4) {
|
||||
me.scroll = 0;
|
||||
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();
|
||||
}
|
||||
me.updateRunways();
|
||||
}
|
||||
},
|
||||
scrollDn: func() {
|
||||
if (me.enableScroll) {
|
||||
me.scroll -= 1;
|
||||
if (me.scroll < 0) {
|
||||
me.scroll = size(me.runways) - 4;
|
||||
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();
|
||||
me.hasPressNoTrans = 0;
|
||||
}
|
||||
me.updateRunways();
|
||||
}
|
||||
},
|
||||
scrollLeft: func() {
|
||||
me.activePage = !me.activePage;
|
||||
me.updatePage();
|
||||
},
|
||||
scrollRight: func() {
|
||||
me.activePage = !me.activePage;
|
||||
me.updatePage();
|
||||
},
|
||||
depPushbuttonLeft: func(index) {
|
||||
if (size(me.runways) >= (index - 1)) {
|
||||
me.selectedRunway = me.arrAirport[0].runway(me.runways[index - 2 + me.scroll]);
|
||||
if (me.activePage == 0) {
|
||||
if (size(me.approaches) >= (index - 1)) {
|
||||
me.selectedRunway = me.arrAirport[0].runway(me.approaches[index - 2 + me.scrollApproach]);
|
||||
me.makeTmpy();
|
||||
fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.selectedRunway;
|
||||
me.updateActiveRunway();
|
||||
me.updateApproaches();
|
||||
fmgc.flightPlanController.flightPlanChanged(me.computer);
|
||||
me.scrollRight();
|
||||
} else {
|
||||
notAllowed(me.computer);
|
||||
}
|
||||
} else {
|
||||
if (size(me.stars) >= (index - 1)) {
|
||||
me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
|
||||
me.makeTmpy();
|
||||
fmgc.flightPlanController.flightplans[me.computer].star = me.selectedSTAR;
|
||||
me.updateActiveSTARs();
|
||||
me.updateSTARs();
|
||||
me.hasPressNoTrans = 0;
|
||||
me.updateTransitions();
|
||||
me.updateActiveTransitions();
|
||||
fmgc.flightPlanController.flightPlanChanged(me.computer);
|
||||
} else {
|
||||
notAllowed(me.computer);
|
||||
}
|
||||
}
|
||||
},
|
||||
depPushbuttonRight: func(index) {
|
||||
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];
|
||||
me.makeTmpy();
|
||||
fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.selectedRunway;
|
||||
me.updateActiveRunway();
|
||||
fmgc.flightPlanController.checkWPOutputs(me.computer);
|
||||
fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition;
|
||||
me.updateActiveTransitions();
|
||||
me.updateTransitions();
|
||||
fmgc.flightPlanController.flightPlanChanged(me.computer);
|
||||
} else {
|
||||
notAllowed(me.computer);
|
||||
}
|
||||
|
|
|
@ -51,12 +51,6 @@ var departurePage = {
|
|||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = ["DEPARTURE", " FROM ", left(me.id, 4)];
|
||||
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||
me.L6 = [" RETURN END", nil, "wht"];
|
||||
} else {
|
||||
me.L6 = [" F-PLN", " TMPY", "yel"];
|
||||
me.arrowsColour[0][5] = "yel";
|
||||
}
|
||||
|
||||
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
|
||||
|
@ -82,6 +76,13 @@ var departurePage = {
|
|||
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"]];
|
||||
|
||||
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||
me.L6 = [" RETURN END", nil, "wht"];
|
||||
} else {
|
||||
me.L6 = [" F-PLN", " TMPY", "yel"];
|
||||
me.arrowsColour[0][5] = "yel";
|
||||
}
|
||||
|
||||
if (me.activePage == 0) {
|
||||
me.updateRunways();
|
||||
} else {
|
||||
|
|
|
@ -12,10 +12,14 @@ var fplnItem = {
|
|||
if (me.wp != nil) {
|
||||
if (me.wp.wp_name != "DISCONTINUITY") {
|
||||
var wptName = split("-", me.wp.wp_name);
|
||||
if (size(wptName) == 2) {
|
||||
return[wptName[0] ~ wptName[1], nil, me.colour];
|
||||
if (wptName[0] == "VECTORS") {
|
||||
return ["MANUAL", nil, me.colour];
|
||||
} else {
|
||||
return [me.wp.wp_name, nil, me.colour];
|
||||
if (size(wptName) == 2) {
|
||||
return[wptName[0] ~ wptName[1], nil, me.colour];
|
||||
} else {
|
||||
return [me.wp.wp_name, nil, me.colour];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return [nil, nil, "ack"];
|
||||
|
@ -210,7 +214,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th
|
|||
}
|
||||
append(me.planList, staticText.new(me.computer, me.getText("fplnEnd")));
|
||||
append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
|
||||
me.update();
|
||||
me.basePage();
|
||||
},
|
||||
basePage: func() {
|
||||
me.outputList = [];
|
||||
|
@ -272,7 +276,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th
|
|||
me.R6 = ["--.-", "EFOB", "wht"];
|
||||
},
|
||||
update: func() {
|
||||
me.basePage();
|
||||
#me.basePage();
|
||||
},
|
||||
scrollUp: func() {
|
||||
if (size(me.planList) > 5) {
|
||||
|
@ -378,13 +382,15 @@ var duplicateNamesPage = {
|
|||
computer: nil,
|
||||
enableScroll: 0,
|
||||
scroll: 0,
|
||||
distances: [],
|
||||
new: func(vector, type, computer) {
|
||||
distances: nil,
|
||||
new: func(vector, index, type, computer) {
|
||||
var fp = {parents:[duplicateNamesPage]};
|
||||
fp.id = vector;
|
||||
fp.vector = vector;
|
||||
fp.index = index;
|
||||
fp.type = type; # 0 = other, 1 = navaid
|
||||
fp.computer = computer;
|
||||
fp._setupPageWithData();
|
||||
fp.distances = [];
|
||||
return fp;
|
||||
},
|
||||
del: func() {
|
||||
|
@ -396,8 +402,9 @@ var duplicateNamesPage = {
|
|||
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
|
||||
for (var i = 0; i <= size(me.vector); i += 1) {
|
||||
append(distances, courseAndDistance(me.vector[i]));
|
||||
me.distances = [];
|
||||
for (var i = 0; i < size(me.vector); i += 1) {
|
||||
append(me.distances, math.round(courseAndDistance(me.vector[i])[1]));
|
||||
}
|
||||
|
||||
me.C1[1] = "LAT/LONG";
|
||||
|
@ -407,8 +414,10 @@ var duplicateNamesPage = {
|
|||
me.arrowsMatrix[0][0] = 1;
|
||||
me.arrowsColour[0][0] = "blu";
|
||||
me.C1 = [" " ~ decimalToShortString(me.vector[0 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[0 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
|
||||
if (me.vector[0 + me.scroll].frequency != nil) {
|
||||
me.R1 = [me.vector[0 + me.scroll].frequency, "FREQ", "grn"];
|
||||
if (me.type == 1) {
|
||||
if (me.vector[0 + me.scroll].frequency != nil) {
|
||||
me.R1 = [sprintf("%7.2f", me.vector[0 + me.scroll].frequency / 100), "FREQ", "grn"];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (size(me.vector) >= 2) {
|
||||
|
@ -416,8 +425,10 @@ var duplicateNamesPage = {
|
|||
me.arrowsMatrix[0][1] = 1;
|
||||
me.arrowsColour[0][1] = "blu";
|
||||
me.C2 = [" " ~ decimalToShortString(me.vector[1 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[1 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
|
||||
if (me.vector[1 + me.scroll].frequency != nil) {
|
||||
me.R2 = [me.vector[1 + me.scroll].frequency, nil, "grn"];
|
||||
if (me.type == 1) {
|
||||
if (me.vector[1 + me.scroll].frequency != nil) {
|
||||
me.R2 = [sprintf("%7.2f", me.vector[1 + me.scroll].frequency / 100), "FREQ", "grn"];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (size(me.vector) >= 3) {
|
||||
|
@ -425,8 +436,10 @@ var duplicateNamesPage = {
|
|||
me.arrowsMatrix[0][2] = 1;
|
||||
me.arrowsColour[0][2] = "blu";
|
||||
me.C3 = [" " ~ decimalToShortString(me.vector[2 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[2 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
|
||||
if (me.vector[2 + me.scroll].frequency != nil) {
|
||||
me.R3 = [me.vector[2 + me.scroll].frequency, nil, "grn"];
|
||||
if (me.type == 1) {
|
||||
if (me.vector[2 + me.scroll].frequency != nil) {
|
||||
me.R3 = [sprintf("%7.2f", me.vector[2 + me.scroll].frequency / 100), "FREQ", "grn"];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (size(me.vector) >= 4) {
|
||||
|
@ -434,8 +447,10 @@ var duplicateNamesPage = {
|
|||
me.arrowsMatrix[0][3] = 1;
|
||||
me.arrowsColour[0][3] = "blu";
|
||||
me.C4 = [" " ~ decimalToShortString(me.vector[3 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[3 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
|
||||
if (me.vector[3 + me.scroll].frequency != nil) {
|
||||
me.R4 = [me.vector[3 + me.scroll].frequency, nil, "grn"];
|
||||
if (me.type == 1) {
|
||||
if (me.vector[3 + me.scroll].frequency != nil) {
|
||||
me.R4 = [sprintf("%7.2f", me.vector[3 + me.scroll].frequency / 100), "FREQ", "grn"];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (size(me.vector) >= 5) {
|
||||
|
@ -443,8 +458,10 @@ var duplicateNamesPage = {
|
|||
me.arrowsMatrix[0][4] = 1;
|
||||
me.arrowsColour[0][4] = "blu";
|
||||
me.C5 = [" " ~ decimalToShortString(me.vector[4 + me.scroll].lat, "lat") ~ "/" ~ decimalToShortString(me.vector[4 + me.scroll].lon, "lon"), "LAT/LONG", "grn"];
|
||||
if (me.vector[4 + me.scroll].frequency != nil) {
|
||||
me.R5 = [me.vector[4 + me.scroll].frequency, nil, "grn"];
|
||||
if (me.type == 1) {
|
||||
if (me.vector[4 + me.scroll].frequency != nil) {
|
||||
me.R5 = [sprintf("%7.2f", me.vector[4 + me.scroll].frequency / 100), "FREQ", "grn"];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (size(me.vector) > 5) { me.enableScroll = 1; }
|
||||
|
@ -452,25 +469,37 @@ var duplicateNamesPage = {
|
|||
me.L6 = [" RETURN", nil, "wht"];
|
||||
},
|
||||
scrollUp: func() {
|
||||
#if (me.enableScroll) {
|
||||
# me.scroll += 1;
|
||||
# if (me.scroll > size(me.vector) - 5) {
|
||||
# me.scroll = 0;
|
||||
# }
|
||||
#}
|
||||
if (me.enableScroll) {
|
||||
me.scroll += 1;
|
||||
if (me.scroll > size(me.vector) - 5) {
|
||||
me.scroll = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollDn: func() {
|
||||
#if (me.enableScroll) {
|
||||
# me.scroll -= 1;
|
||||
# if (me.scroll < 0) {
|
||||
# me.scroll = size(me.vector) - 5;
|
||||
# }
|
||||
#}
|
||||
if (me.enableScroll) {
|
||||
me.scroll -= 1;
|
||||
if (me.scroll < 0) {
|
||||
me.scroll = size(me.vector) - 5;
|
||||
}
|
||||
}
|
||||
},
|
||||
pushButtonLeft: func(indexSelect) {
|
||||
if (size(me.vector[0].id) == 5) {
|
||||
fmgc.flightPlanController.insertFix(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
|
||||
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
|
||||
} elsif (size(me.vector[0].id) == 4) {
|
||||
fmgc.flightPlanController.insertAirport(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
|
||||
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
|
||||
} elsif (size(me.vector[0].id) == 3 or size(me.vector[0].id)== 2) {
|
||||
fmgc.flightPlanController.insertNavaid(me.vector[0].id, me.index, me.computer, 1, indexSelect - 1);
|
||||
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var decimalToShortString = func(dms, type) {
|
||||
var degrees = split(".", dms)[0];
|
||||
var degrees = split(".", sprintf(dms))[0];
|
||||
if (type == "lat") {
|
||||
var sign = degrees >= 0 ? "N" : "S";
|
||||
} else {
|
||||
|
|
|
@ -213,4 +213,32 @@ var dmsToString = func(dms, type) {
|
|||
var sign = degrees >= 0 ? "E" : "W";
|
||||
}
|
||||
return abs(degrees) ~ "g" ~ minutes ~ " " ~ sign;
|
||||
}
|
||||
|
||||
|
||||
var stringToDegrees = func(string, type) {
|
||||
if (type == "lat") {
|
||||
var degrees = left(string, 2);
|
||||
var minutesStr = right(string, 5);
|
||||
} else {
|
||||
var degrees = left(string, 3);
|
||||
var minutesStr = right(string, 5);
|
||||
}
|
||||
|
||||
var minutes = left(minutesStr, 4);
|
||||
var sign = right(minutesStr, 1);
|
||||
var decimal = degrees + (minutes / 60);
|
||||
if (type == "lat") {
|
||||
if (sign == "N") {
|
||||
return decimal;
|
||||
} else {
|
||||
return -decimal;
|
||||
}
|
||||
} else {
|
||||
if (sign == "E") {
|
||||
return decimal;
|
||||
} else {
|
||||
return -decimal;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -114,6 +114,8 @@ var lskbutton = func(btn, i) {
|
|||
setprop("/MCDU[" ~ i ~ "]/page", "DEPARTURE");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
canvas_mcdu.myFpln[i].pushButtonLeft(1);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
|
||||
canvas_mcdu.myDuplicate[i].pushButtonLeft(1);
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
@ -140,6 +142,8 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myFpln[i].pushButtonLeft(2);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
canvas_mcdu.myDeparture[i].depPushbuttonLeft(2);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
|
||||
canvas_mcdu.myDuplicate[i].pushButtonLeft(2);
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
@ -160,6 +164,8 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myFpln[i].pushButtonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
canvas_mcdu.myDeparture[i].depPushbuttonLeft(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
|
||||
canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
@ -176,6 +182,8 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myFpln[i].pushButtonLeft(4);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
canvas_mcdu.myDeparture[i].depPushbuttonLeft(4);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
|
||||
canvas_mcdu.myDuplicate[i].pushButtonLeft(4);
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
@ -200,6 +208,8 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myFpln[i].pushButtonLeft(5);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
canvas_mcdu.myDeparture[i].depPushbuttonLeft(5);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
|
||||
canvas_mcdu.myDuplicate[i].pushButtonLeft(5);
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
@ -216,7 +226,7 @@ var lskbutton = func(btn, i) {
|
|||
printInput2("L6", i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
canvas_mcdu.myFpln[i].pushButtonLeft(6);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") {
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV" or getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") {
|
||||
if (fmgc.flightPlanController.temporaryFlag[i]) {
|
||||
|
@ -246,6 +256,12 @@ var rskbutton = func(btn, i) {
|
|||
printInput("R1", i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") {
|
||||
printInput2("R1", i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "/page") == "LATREV") {
|
||||
if (canvas_mcdu.myArrival[i] != nil) {
|
||||
canvas_mcdu.myArrival[i].del();
|
||||
}
|
||||
canvas_mcdu.myArrival[i] = nil;
|
||||
canvas_mcdu.myArrival[i] = arrivalPage.new(canvas_mcdu.myLatRev[i].title[2], i);
|
||||
} else {
|
||||
notAllowed(i);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue