Add initial load flightplan support
This commit is contained in:
parent
3c793c44e1
commit
4a74f0a25f
4 changed files with 121 additions and 1 deletions
|
@ -209,6 +209,15 @@
|
|||
<dialog-name>autopilot</dialog-name>
|
||||
</binding>
|
||||
</item>
|
||||
<item>
|
||||
<label>Load Flightplans</label>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
acconfig.loadflightplan_dlg.open();
|
||||
</script>
|
||||
</binding>
|
||||
</item>
|
||||
</menu>
|
||||
<menu n="103">
|
||||
<label>DU</label>
|
||||
|
|
|
@ -119,6 +119,7 @@ var updated_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/updated/dialog", "Ai
|
|||
var error_mismatch = gui.Dialog.new("/sim/gui/dialogs/acconfig/error/mismatch/dialog", "Aircraft/A320-family/AircraftConfig/error-mismatch.xml");
|
||||
var fuel_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/fuel/dialog", "Aircraft/A320-family/AircraftConfig/fuel.xml");
|
||||
var groundservices_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/groundsrvc/dialog", "Aircraft/A320-family/AircraftConfig/groundservices.xml");
|
||||
var loadflightplan_dlg = gui.Dialog.new("/sim/gui/dialogs/acconfig/loadfpln/dialog","Aircraft/A320-family/AircraftConfig/load-flightplan.xml");
|
||||
var du_quality = gui.Dialog.new("/sim/gui/dialogs/acconfig/du-quality/dialog", "Aircraft/A320-family/AircraftConfig/du-quality.xml");
|
||||
var rendering_dlg = gui.Dialog.new("/sim/gui/dialogs/rendering/dialog", "Aircraft/A320-family/AircraftConfig/rendering.xml");
|
||||
spinning.start();
|
||||
|
|
98
AircraftConfig/load-flightplan.xml
Normal file
98
AircraftConfig/load-flightplan.xml
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!-- Copyright (c) 2020 Josh Davidson (Octal450) -->
|
||||
|
||||
<!-- A3XX Load Flightplans -->
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<name>load-flightplans</name>
|
||||
<layout>vbox</layout>
|
||||
|
||||
<nasal>
|
||||
<open><![CDATA[
|
||||
var loadfpl = func(path) {
|
||||
fmgc.flightPlanController.loadFlightPlan(path.getValue());
|
||||
}
|
||||
|
||||
var defaultDirInFileSelector = getprop("/sim/fg-home") ~ "/Export";
|
||||
|
||||
var file_selector = gui.FileSelector.new(
|
||||
callback: loadfpl, title: "Load flightplan", button: "Load",
|
||||
dir: defaultDirInFileSelector, dotfiles: 1, pattern: ["*.xml","*.gpx","*.fgfp"]);
|
||||
|
||||
]]></open>
|
||||
|
||||
<close><![CDATA[
|
||||
file_selector.del();
|
||||
]]></close>
|
||||
</nasal>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>Load Flightplans</label>
|
||||
</text>
|
||||
<button>
|
||||
<halign>right</halign>
|
||||
<pref-width>20</pref-width>
|
||||
<pref-height>20</pref-height>
|
||||
<legend>X</legend>
|
||||
<key>Esc</key>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<group>
|
||||
<layout>vbox</layout>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>This dialog allows users to load their own .gpx / .fgfp flightplans.</label>
|
||||
</text>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>Follow these guidelines. Not doing so will cause problems!</label>
|
||||
</text>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>1. You must have a departure and destination airport set on MCDU INIT A</label>
|
||||
</text>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>2. Your file's destination / departure must match exactly the one set in INITA</label>
|
||||
</text>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>3. If your file includes SIDS / STARS you CANNOT change them in the MCDU.</label>
|
||||
</text>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>If you have a NAVIGRAPH subcription, we reccomend to load them in the MCDU instead of here.</label>
|
||||
</text>
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>Load a flightplan</label>
|
||||
</text>
|
||||
|
||||
<button>
|
||||
<legend>Load flightplan</legend>
|
||||
<equal>true</equal>
|
||||
<enable>
|
||||
<property>FMGC/internal/tofrom-set</property>
|
||||
</enable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>file_selector.open()</script>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
</PropertyList>
|
|
@ -30,7 +30,7 @@ var wpCoursePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course-fr
|
|||
var wpDistancePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance-from-prev", 0, "DOUBLE")]];
|
||||
|
||||
var flightPlanController = {
|
||||
flightplans: [createFlightplan(), createFlightplan(), createFlightplan()],
|
||||
flightplans: [createFlightplan(), createFlightplan(), createFlightplan(), nil],
|
||||
temporaryFlag: [0, 0],
|
||||
|
||||
# These flags are only for the main flgiht-plan
|
||||
|
@ -80,6 +80,17 @@ var flightPlanController = {
|
|||
me.flightPlanChanged(n);
|
||||
},
|
||||
|
||||
loadFlightPlan: func(path) {
|
||||
call(func {me.flightplans[3] = createFlightplan(path);}, nil, var err = []);
|
||||
if (size(err) or me.flightplans[3] == nil) {
|
||||
print(err[0]);
|
||||
print("Load failed.");
|
||||
}
|
||||
me.flightplans[3].departure = airportinfo(getprop("FMGC/internal/dep-arpt"));
|
||||
me.flightplans[3].destination = airportinfo(getprop("FMGC/internal/arr-arpt"));
|
||||
me.destroyTemporaryFlightPlan(3, 1);
|
||||
},
|
||||
|
||||
destroyTemporaryFlightPlan: func(n, a) { # a = 1 activate, a = 0 erase
|
||||
if (a == 1) {
|
||||
flightPlanTimer.stop();
|
||||
|
@ -88,6 +99,7 @@ var flightPlanController = {
|
|||
me.flightPlanChanged(2);
|
||||
flightPlanTimer.start();
|
||||
}
|
||||
if (n == 3) { return; }
|
||||
me.resetFlightplan(n);
|
||||
me.temporaryFlag[n] = 0;
|
||||
if (canvas_mcdu.myDirTo[n] != nil) {
|
||||
|
|
Loading…
Add table
Reference in a new issue