Initial work on a KLN-94 GPS.
Not functional yet, patience.
This commit is contained in:
parent
5cba74b20f
commit
f9da4387e6
12 changed files with 1978 additions and 0 deletions
0
Aircraft/Instruments-3d/kln94/auxPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/auxPages.nas
Normal file
249
Aircraft/Instruments-3d/kln94/cdi.svg
Normal file
249
Aircraft/Instruments-3d/kln94/cdi.svg
Normal file
|
@ -0,0 +1,249 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448819"
|
||||
height="1052.3622047"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="New document 1">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.4142136"
|
||||
inkscape:cx="447.91003"
|
||||
inkscape:cy="1152.5914"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1574"
|
||||
inkscape:window-height="1278"
|
||||
inkscape:window-x="131"
|
||||
inkscape:window-y="26"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="cdi"
|
||||
transform="translate(-18,-64)">
|
||||
<rect
|
||||
y="63.826897"
|
||||
x="18.384771"
|
||||
height="112.42998"
|
||||
width="494.26764"
|
||||
id="background"
|
||||
style="fill:#000000;fill-opacity:1;stroke:none" />
|
||||
<g
|
||||
style="fill:#ffffff"
|
||||
transform="translate(-75.698485,-187.25102)"
|
||||
id="g3776">
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path2987"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(49,-23.999995)" />
|
||||
<path
|
||||
transform="translate(84.25,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3768"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3770"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(119.5,-23.999995)" />
|
||||
<path
|
||||
transform="translate(154.75,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3772"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3774"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(190,-23.999995)" />
|
||||
</g>
|
||||
<g
|
||||
style="fill:#ffffff"
|
||||
id="g3783"
|
||||
transform="translate(135.01934,-187.25102)">
|
||||
<path
|
||||
transform="translate(49,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3785"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3787"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(84.25,-23.999995)" />
|
||||
<path
|
||||
transform="translate(119.5,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3789"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
id="path3791"
|
||||
sodipodi:sides="4"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:arg2="0.78539816"
|
||||
inkscape:flatsided="true"
|
||||
inkscape:rounded="0"
|
||||
inkscape:randomized="0"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
transform="translate(154.75,-23.999995)" />
|
||||
<path
|
||||
transform="translate(190,-23.999995)"
|
||||
d="m 143,303.36218 -11,11 -11,-11 11,-11 z"
|
||||
inkscape:randomized="0"
|
||||
inkscape:rounded="0"
|
||||
inkscape:flatsided="true"
|
||||
sodipodi:arg2="0.78539816"
|
||||
sodipodi:arg1="0"
|
||||
sodipodi:r2="7.7781744"
|
||||
sodipodi:r1="11"
|
||||
sodipodi:cy="303.36218"
|
||||
sodipodi:cx="132"
|
||||
sodipodi:sides="4"
|
||||
id="path3793"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none"
|
||||
sodipodi:type="star" />
|
||||
</g>
|
||||
<rect
|
||||
y="68.069527"
|
||||
x="276.56424"
|
||||
height="50.204582"
|
||||
width="9.1923885"
|
||||
id="center-bar"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
d="m 236.79631,39.261933 25.4951,-25.495099 25.4951,25.495098 z"
|
||||
id="deviation-marker"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccc" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.3 KiB |
0
Aircraft/Instruments-3d/kln94/flightplanPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/flightplanPages.nas
Normal file
1100
Aircraft/Instruments-3d/kln94/kln94.ac
Normal file
1100
Aircraft/Instruments-3d/kln94/kln94.ac
Normal file
File diff suppressed because it is too large
Load diff
BIN
Aircraft/Instruments-3d/kln94/kln94.blend
Normal file
BIN
Aircraft/Instruments-3d/kln94/kln94.blend
Normal file
Binary file not shown.
385
Aircraft/Instruments-3d/kln94/kln94.nas
Normal file
385
Aircraft/Instruments-3d/kln94/kln94.nas
Normal file
|
@ -0,0 +1,385 @@
|
|||
var kln94 = nil;
|
||||
|
||||
var KLN94 = {
|
||||
|
||||
Page: {
|
||||
new : func(owner, s, idx)
|
||||
{
|
||||
m = {
|
||||
parents:[KLN94.Page],
|
||||
section: s,
|
||||
index: idx
|
||||
};
|
||||
return m;
|
||||
},
|
||||
|
||||
# encode various behavioural flags as predicates
|
||||
# real Pages can over-ride these defaults as needed
|
||||
hasActiveIdent: func { return 0; },
|
||||
numberOfCyanLines: func { return 0; },
|
||||
showsCDI: func { return 0; },
|
||||
isMulti: func { return 0; },
|
||||
|
||||
# cursor stuff
|
||||
|
||||
display: func(gps)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
refresh: func(gps)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
pageNames : ['APT', 'VOR', 'NDB', 'INT', 'USR', 'ACT', 'NAV', 'FPL', 'SET', 'AUX'],
|
||||
|
||||
PAGE_APT: 0,
|
||||
PAGE_VOR: 1,
|
||||
PAGE_NDB: 2,
|
||||
PAGE_INT: 3,
|
||||
PAGE_USR: 4,
|
||||
PAGE_ACT: 5,
|
||||
PAGE_NAV: 6,
|
||||
PAGE_FPL: 7,
|
||||
PAGE_SET: 8,
|
||||
PAGE_AUX: 9,
|
||||
|
||||
|
||||
PAGE_BAR_HEIGHT: 20,
|
||||
NAV_DATA_WIDTH: 128,
|
||||
|
||||
canvas_settings: {
|
||||
"name": "KLN94",
|
||||
"size": [512, 256],
|
||||
"view": [480, 160],
|
||||
"mipmapping": 1,
|
||||
},
|
||||
|
||||
new : func(prop1, placement)
|
||||
{
|
||||
m = { parents : [KLN94]};
|
||||
|
||||
m.rootNode = props.globals.initNode(prop1);
|
||||
m._setupCanvas(placement);
|
||||
m._page = nil;
|
||||
|
||||
m._messageScreenActive = 0;
|
||||
m._messages = [];
|
||||
|
||||
m._cursorActive = 0;
|
||||
m._cursorField = 0;
|
||||
m._enterAction = nil;
|
||||
|
||||
|
||||
m._setupProps();
|
||||
|
||||
return m;
|
||||
},
|
||||
|
||||
_setupCanvas: func(placement)
|
||||
{
|
||||
me._canvas = canvas.new(KLN94.canvas_settings);
|
||||
var text_style = {
|
||||
'font': "LiberationFonts/LiberationMono-Bold.ttf",
|
||||
'character-size': 34,
|
||||
'character-aspect-ratio': 1.2
|
||||
};
|
||||
|
||||
me.rootNode.initNode('brightness-norm', 0.5, 'DOUBLE');
|
||||
|
||||
me._canvas.setColorBackground(1.0, 0.0, 0.0);
|
||||
me._canvas.addPlacement(placement);
|
||||
|
||||
me._navDataArea = me._canvas.createGroup();
|
||||
me._navDataArea.setTranslation(0, 0);
|
||||
me._navDataLines = [];
|
||||
|
||||
var navAreaH = (KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT) / 2;
|
||||
var r1 = me._navDataArea.rect(0, 0, KLN94.NAV_DATA_WIDTH, navAreaH);
|
||||
var r2 = me._navDataArea.rect(0, navAreaH, KLN94.NAV_DATA_WIDTH, navAreaH);
|
||||
r1.setColor(0,1,1); # cyan
|
||||
r2.setColor(0,1,1);
|
||||
|
||||
var lineH = (KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT) / 5;
|
||||
|
||||
for (var i=0; i<4; i +=1) {
|
||||
var t = me._navDataArea.createChild("text");
|
||||
t.setColor(1, 1, 1);
|
||||
t._node.setValues(text_style);
|
||||
t.setAlignment("left-center");
|
||||
t.setTranslation(0.0, (i + 0.5) * lineH);
|
||||
append(me._navDataLines, t);
|
||||
}
|
||||
|
||||
me._pageBarArea = me._canvas.createGroup();
|
||||
me._pageBarArea.setTranslation(0, KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT);
|
||||
|
||||
var ln = me._pageBarArea.createChild('path');
|
||||
ln.setColor(0,1,1); # cyan
|
||||
|
||||
me._pageBarText = me._pageBarArea.createChild("text");
|
||||
me._pageBarText._node.setValues(text_style);
|
||||
me._pageBarText.setAlignment("left-center");
|
||||
me._pageBarText.setColor(0, 0, 1);
|
||||
|
||||
me._pageBarInverseText = me._pageBarArea.createChild("text");
|
||||
me._pageBarInverseText._node.setValues(text_style);
|
||||
me._pageBarInverseText.setAlignment("left-center");
|
||||
me._pageBarInverseText.setColor(1, 1, 1);
|
||||
me._pageBarInverseText.setColorFill(0, 0, 1);
|
||||
|
||||
me._pageArea = me._canvas.createGroup();
|
||||
me._pageBarArea.setTranslation(100, 0);
|
||||
|
||||
me._pageAreaLines = [];
|
||||
for (var i=0; i<5; i +=1) {
|
||||
var t = me._pageArea.createChild("text");
|
||||
t.setColor(0, 1, 0);
|
||||
t._node.setValues(text_style);
|
||||
t.setAlignment("left-center");
|
||||
t.setTranslation(0.0, (i + 0.5) * lineH);
|
||||
append(me._pageAreaLines, t);
|
||||
}
|
||||
|
||||
# inverted text block
|
||||
me._pageAreaInverted = me._pageArea.createChild("text");
|
||||
me._pageAreaInverted.setColor(0, 0, 0);
|
||||
me._pageAreaInverted.setColorFill(0, 1, 0);
|
||||
me._pageAreaInverted._node.setValues(text_style);
|
||||
me._pageAreaInverted.setAlignment("left-center");
|
||||
|
||||
me._cdiGroup = me._pageArea.createChild("group");
|
||||
canvas.parsesvg(me._cdiGroup, resolvepath('Aircraft/Instruments-3d/kln94/cdi.svg'));
|
||||
me._cdiGroup.setTranslation(0, lineH);
|
||||
},
|
||||
|
||||
_setupProps: func
|
||||
{
|
||||
var p = me.rootNode;
|
||||
me.props = {
|
||||
distanceToActiveNm: p.getNode(),
|
||||
groundspeedKt: p.getNode(),
|
||||
activeIdent: p.getNode(),
|
||||
previousIdent: p.getNode(),
|
||||
obsBearing: p.getNode(),
|
||||
legTrack: p.getNode(),
|
||||
groundTrack: p.getNode(),
|
||||
cdiDeviationNm: p.getNode(),
|
||||
};
|
||||
},
|
||||
|
||||
_setActivePage: func(pg)
|
||||
{
|
||||
me._page = pg;
|
||||
if (pg == nil) return;
|
||||
|
||||
# update line colors
|
||||
for (var l=0; l<4; l+=1) {
|
||||
me._pageAreaLines[l].setColor(0, 1, l < pg.numberOfCyanLines() ? 1 : 0);
|
||||
}
|
||||
|
||||
# hide or show the CDI area as appropriate
|
||||
me._cdiGroup.setVisible(pg.showsCDI());
|
||||
},
|
||||
|
||||
_updateNavData : func
|
||||
{
|
||||
me._navDataLines[0].setText(sprintf('%4dnm', me._props.distanceToActiveNm.getValue()));
|
||||
if (me._page.hasActiveIdent()) {
|
||||
me._navDataLines[1].setText(sprintf('%4dkt', me._props.groundspeedKt.getValue()));
|
||||
} else {
|
||||
me._navDataLines[1].setText(me._props.activeIdent.getValue());
|
||||
}
|
||||
if (me._obsMode) {
|
||||
me._navDataLines[2].setText(sprintf('OBS%03d*', me._props.obsBearing.getValue()));
|
||||
} else {
|
||||
me._navDataLines[2].setText(sprintf('DTK%03d*', me._props.legTrack.getValue()));
|
||||
}
|
||||
me._navDataLines[3].setText(sprintf(' TK%03d*', me._props.groundTrack.getValue()));
|
||||
},
|
||||
|
||||
_updateAnnunciationArea : func
|
||||
{
|
||||
if (size(me._messages) > 0) {
|
||||
# show 'M' symbol
|
||||
}
|
||||
|
||||
if (me._enterAction != nil) {
|
||||
# show 'ENT' symbol
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_updatePageBar : func
|
||||
{
|
||||
# hide in NAV-4 mode
|
||||
if (me.inNav4Mode()) {
|
||||
me._pageBarGroup.setVisible(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (me._cursorActive) {
|
||||
me._pageBarText.setText('');
|
||||
var t = ' * CRSR * ' ~ me.pageNames[activePage] ~ ' * CRSR *';
|
||||
me._pageBarInverseText.setText(t);
|
||||
return;
|
||||
}
|
||||
|
||||
# assemble the string
|
||||
var barString = '';
|
||||
var inverseBarString = '';
|
||||
var activePage = me.pageIndex[0];
|
||||
|
||||
for (var i=0; i < 10; i += 1) {
|
||||
if (activePage == i) {
|
||||
var sep = me.isMultiPage() ? '+' : ' ';
|
||||
inverseBarString ~= me.pageNames[i] ~ sep ~ me.pageIndex[1];
|
||||
barString ~= ' '; # 5 spaces
|
||||
} else {
|
||||
barString ~= ' ' ~ me.pageNames[i];
|
||||
if (i < activePage)
|
||||
inverseBarString ~= ' '; # 4 spaces
|
||||
}
|
||||
}
|
||||
|
||||
me._pageBarText.setText(barString);
|
||||
me._pageBarInverseText.setText(inverseBarString);
|
||||
},
|
||||
|
||||
_setInverted: func(line, firstcol, numcols=1)
|
||||
{
|
||||
var t = me._pageAreaInverted;
|
||||
var cellW = 20.0;
|
||||
var lineH = (KLN94.canvas_settings.view[1] - KLN94.PAGE_BAR_HEIGHT) / 5;
|
||||
t.setTranslation(firstcol * cellW, (line + 0.5) * lineH);
|
||||
t.setText(substr(me._pageAreaLines[line].getText(), firstcol, numcols));
|
||||
t.setVisible(1);
|
||||
},
|
||||
|
||||
_setBlink: func(line, firstcol, numcols=1)
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
isPageActive: func(nm, idx)
|
||||
{
|
||||
if (me._page == nil) return 0;
|
||||
return (me._page.section == nm) and (me._page.index == idx);
|
||||
},
|
||||
|
||||
isMultiPage: func { return me._page.isMulti(); },
|
||||
|
||||
toggleCursor: func
|
||||
{
|
||||
me._cursorActive = !me._cursorActive;
|
||||
if (me._cursorActive) {
|
||||
me._cursorField = 0;
|
||||
}
|
||||
|
||||
me._updatePageBar();
|
||||
},
|
||||
|
||||
messageButton: func
|
||||
{
|
||||
if (me._messageScreenActive) {
|
||||
me._messages = me._messages[1:]; # pop front
|
||||
if (size(me._messages) == 0) {
|
||||
me._messageScreenActive = 0;
|
||||
# refresh normal screen
|
||||
return;
|
||||
}
|
||||
|
||||
me._buildMessageScreen();
|
||||
return;
|
||||
}
|
||||
|
||||
if (size(me._messages) == 0) {
|
||||
debug.dump('no messages to show');
|
||||
return;
|
||||
}
|
||||
|
||||
me._messageScreenActive = 1;
|
||||
me._buildMessageScreen();
|
||||
},
|
||||
|
||||
_buildMessageScreen: func
|
||||
{
|
||||
|
||||
},
|
||||
|
||||
# Nav4 mode is special
|
||||
inNav4Mode: func { return me.isPageActive(NAV, 4); },
|
||||
|
||||
formatDuration: func(timeInSeconds)
|
||||
{
|
||||
if (timeInSeconds > 60) {
|
||||
return sprintf("0:%02d", timeInSeconds);
|
||||
}
|
||||
|
||||
if (timeInSeconds > 3600) {
|
||||
var mins = int(timeInSeconds / 60);
|
||||
var secs = timeInSeconds - (mins * 60);
|
||||
return sprintf("%d:%02d", mins, secs);
|
||||
}
|
||||
|
||||
var hours = int(timeInSeconds / 3600);
|
||||
timeInSeconds -= (hours * 3600);
|
||||
var mins = int(timeInSeconds / 60);
|
||||
var secs = timeInSeconds - (mins * 60);
|
||||
return sprintf("%d:%02d:%02d", hours, mins, secs);
|
||||
},
|
||||
|
||||
formatLatitude: func(lat)
|
||||
{
|
||||
var north = (lat >= 0.0);
|
||||
var latDeg = int(lat);
|
||||
var latMinutes = math.abs(lat - latDeg) * 60;
|
||||
return sprintf('%s%02d*%04.1f', north ? "N" : "S", abs(latDeg), latMinutes);
|
||||
},
|
||||
|
||||
formatLongitude: func(lon)
|
||||
{
|
||||
var east = (lon >= 0.0);
|
||||
var lonDeg = int(lon);
|
||||
var lonMinutes = math.abs(lon - lonDeg) * 60;
|
||||
sprintf("%s%03d*%04.1f", east ? 'E' : 'W', abs(lonDeg), lonMinutes);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
reload_gps = func
|
||||
{
|
||||
kln94._setActivePage(nil); # force existing page to be undisplayed cleanly
|
||||
|
||||
# make the cdu instance available inside the module namespace
|
||||
# we are going to load into.
|
||||
# for a reload this also wipes the existing namespace, which we want
|
||||
globals['kln94_NS'] = { gps: kln94, KLN94:KLN94 };
|
||||
|
||||
var pages = ['navPages.nas', 'infoPages.nas', 'flightplanPages.nas', 'settingPages.nas', 'auxPages.nas'];
|
||||
|
||||
#var settings = props.globals.getNode('/instrumentation/cdu/settings');
|
||||
foreach (var path; pages) {
|
||||
# resolve the path in FG_ROOT, and --fg-aircraft dir, etc
|
||||
var abspath = resolvepath('Aircraft/Instruments-3d/kln94/' ~ path);
|
||||
if (io.stat(abspath) == nil) {
|
||||
debug.dump('KN94 page not found:', path, abspath);
|
||||
continue;
|
||||
}
|
||||
|
||||
# load pages code into a seperate namespace which we defined above
|
||||
# also means we can clean out that namespace later
|
||||
io.load_nasal(abspath, 'kln94_NS');
|
||||
}
|
||||
# cdu.displayPageByTag(getprop('/instrumentation/cdu/settings/boot-page'));
|
||||
};
|
||||
|
||||
setlistener("/nasal/canvas/loaded", func
|
||||
{
|
||||
# create base PGS
|
||||
kln94 = KLN94.new('/instrumentation/gps', {"node": "screen"});
|
||||
reload_gps();
|
||||
}, 1);
|
BIN
Aircraft/Instruments-3d/kln94/kln94.png
Normal file
BIN
Aircraft/Instruments-3d/kln94/kln94.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
164
Aircraft/Instruments-3d/kln94/kln94.xml
Normal file
164
Aircraft/Instruments-3d/kln94/kln94.xml
Normal file
|
@ -0,0 +1,164 @@
|
|||
<PropertyList>
|
||||
|
||||
<path>kln94.ac</path>
|
||||
|
||||
<!--
|
||||
<animation>
|
||||
<type>material</type>
|
||||
<texture alias="../../texture"/>
|
||||
</animation>
|
||||
|
||||
<effect>
|
||||
<inherits-from>Effects/lightmap</inherits-from>
|
||||
<parameters>
|
||||
<texture n="1">
|
||||
<image>Aircraft/Instruments-3d/cdu2/boeing_lightmap.png</image>
|
||||
</texture>
|
||||
<condition><use>/instrumentation/cdu/serviceable</use></condition>
|
||||
|
||||
<factor><use>/instrumentation/cdu/brightness-norm</use></factor>
|
||||
</parameters>
|
||||
<object-name>CDU</object-name>
|
||||
<object-name>Btn.side.r.1</object-name>
|
||||
<object-name>Btn.side.r.2</object-name>
|
||||
<object-name>Btn.side.r.3</object-name>
|
||||
<object-name>Btn.side.r.4</object-name>
|
||||
<object-name>Btn.side.r.5</object-name>
|
||||
<object-name>Btn.side.r.6</object-name>
|
||||
</effect> -->
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>ent-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.enter();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>crsr-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.toggleCursorMode();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>nrst-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.nearestButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>dto-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.directTo();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>obs-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.obsButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>msg-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.messageButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>alt-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.altitudeButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>pick</type>
|
||||
<object-name>clr-btn</object-name>
|
||||
<action>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.clearButton();</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>knob</type>
|
||||
<object-name>knob-inner</object-name>
|
||||
<action>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.innerKnob(cmdarg().getNode('offset').getValue());</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
<animation>
|
||||
<type>knob</type>
|
||||
<object-name>knob-outer</object-name>
|
||||
<action>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>KLN94.outerKnob(cmdarg().getNode('offset').getValue());</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
|
||||
<animation>
|
||||
<type>knob</type>
|
||||
<object-name>knob-brightness</object-name>
|
||||
<action>
|
||||
<binding>
|
||||
<command>property-adjust</command>
|
||||
<property>/instrumentation/kln94/brightness-norm</property>
|
||||
<step>0.05</step>
|
||||
<min>0</min>
|
||||
<max>1</max>
|
||||
<wrap>false</wrap>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
||||
</PropertyList>
|
BIN
Aircraft/Instruments-3d/kln94/knob.rgb
Normal file
BIN
Aircraft/Instruments-3d/kln94/knob.rgb
Normal file
Binary file not shown.
80
Aircraft/Instruments-3d/kln94/navPages.nas
Normal file
80
Aircraft/Instruments-3d/kln94/navPages.nas
Normal file
|
@ -0,0 +1,80 @@
|
|||
|
||||
|
||||
var Nav1Page =
|
||||
{
|
||||
a:2,
|
||||
|
||||
|
||||
new: func()
|
||||
{
|
||||
m = {parents: [Nav1Page, KLN94.Page.new(KLN94.PAGE_NAV, 0)]};
|
||||
return m;
|
||||
},
|
||||
|
||||
hasActiveIdent: func { 1 },
|
||||
showsCDI: func { 1 },
|
||||
|
||||
display: func(gps)
|
||||
{
|
||||
if (gps.isDirectToActive()) {
|
||||
|
||||
} else {
|
||||
# leg mode
|
||||
gps.setLine(0, sprintf('%6s->%6s',
|
||||
gps.props.previousIdent.getStringValue(),
|
||||
gps.props.activeIdent.getStringValue())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
gps.setLine(3, ' VNV Off');
|
||||
|
||||
var toFrom = gps.isTo() ? 'To' : 'Fr';
|
||||
var eteToWp1 = gps.formatDuration(gps.props.timeToWaypoint.getIntValue());
|
||||
gps.setLine(4, sprintf('%03d*%s ', bearingToWp1, toFrom) ~ eteToWp1);
|
||||
},
|
||||
|
||||
refresh: func(gps)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var Nav2Page =
|
||||
{
|
||||
new: func()
|
||||
{
|
||||
m = {parents: [Nav2Page, KLN94.Page.new(KLN94.PAGE_NAV, 1)]};
|
||||
return m;
|
||||
},
|
||||
|
||||
display: func(gps)
|
||||
{
|
||||
# select refnavaid!
|
||||
|
||||
gps.setLine(0, ' PRESENT POSN'),
|
||||
gps.setLine(1, ' Ref:%s', gps.refNavaid.id);
|
||||
|
||||
gps.setLine(3, ' ' + gps.formatLatitude(gps.props.indicatedLat.getDoubleValue()));
|
||||
gps.setLine(4, ' ' + gps.formatLongitude(gps.props.indicatedLon.getDoubleValue()));
|
||||
}
|
||||
};
|
||||
|
||||
var Nav3Page =
|
||||
{
|
||||
new: func()
|
||||
{
|
||||
m = {parents: [Nav3Page, KLN94.Page.new(KLN94.PAGE_NAV, 2)]};
|
||||
return m;
|
||||
},
|
||||
};
|
||||
|
||||
var nav1 = Nav1Page.new();
|
||||
gps.addPage(nav1);
|
||||
|
||||
|
||||
gps.addPage(Nav2Page.new());
|
||||
gps.addPage(Nav3Page.new());
|
||||
|
||||
|
||||
|
0
Aircraft/Instruments-3d/kln94/settingPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/settingPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/waypointPages.nas
Normal file
0
Aircraft/Instruments-3d/kln94/waypointPages.nas
Normal file
Loading…
Reference in a new issue