Hallo
Hooray,
thanks for your most precious&stimulating notes!...I'm learning a lot from them.
Current development ('modernisation' phase) of the
Boeing 777 Seattle's EFB is going on nicely; the code is shorter, more readable and cleaner.
I have not finished it, yet (I'd say that it's almost 50% done).
These are the
basic steps I have set up
at the moment:
Some
code-sections have been splitted up in separate files, and included in the main
efb.nas module:
- Code: Select all
# Here we include the EFB Pages' DataBase
io.include("EFB_Pages.db");
# Here we include the EFB Applications' DataBase
io.include("EFB_Applications.db");
# Here we include the EFB Chart's DataBase
io.include("EFB_Charts.db");
# Here we include the EFB Conversion Factor's DataBase
io.include("EFB_CNV_Factors.db");
#
Canvas is now active and ok (contained in the main
efb.nas file)
- Code: Select all
#__________________________________________
# Initialize CANVAS |
#__________________________________________|
var EFB_canvas = canvas.new({
"name": "EFB",
"size": [1024, 1024],
"view": [511, 695],
"mipmapping": 1,
});
EFB_canvas.addPlacement({"node": "Display"});
# Creates the Text-Matrix Canvas Group element and set some values
var EFB_group = EFB_canvas.createGroup();
# Creates the Text-Matrix Canvas Elements
# Creates Text Rows
var Text_Line_Size = 16; # Number of EFB's rows
setsize(Text_Line_L, Text_Line_Size);
setsize(Text_Line_R, Text_Line_Size);
var xpos_L = 22.0;
var xpos_R = 487.0;
var ypos = 87.5;
for(var i = 0; i < (Text_Line_Size - 1); i += 1)
{
Text_Line_ID = "L_" ~ i;
Text_Line_L[i] = EFB_group.createChild("text", Text_Line_ID)
.setTranslation(xpos_L,ypos) # x-left-position, y-position
.setAlignment("left-center")
.setFont("Helvetica.txf")
.setFontSize(32,1)
.setColor(1,1,1)
.set("z-index",10)
.setText("TEST");
Text_Line_ID = "R_" ~ i;
Text_Line_R[i] = EFB_group.createChild("text", Text_Line_ID)
.setTranslation(xpos_R,ypos) # x-right-position, y-position
.setAlignment("right-center")
.setFont("Helvetica.txf")
.setFontSize(32,1)
.setColor(1,1,1)
.set("z-index",10)
.setText("TEST");
Text_Line_L[i].hide();
Text_Line_R[i].hide();
ypos = ypos + 40.5;
}
# Creates Title
var Title = EFB_group.createChild("text", "Title")
.setTranslation(255.5,27.1) # x-left-position, y-position
.setAlignment("center-center")
.setFont("Helvetica.txf")
.setFontSize(32,1)
.setColor(1,1,1)
.set("z-index",10)
.setText("TITLE TEST");
Title.hide();
# Creates Helper
var Helper = EFB_group.createChild("text", "Helper")
.setTranslation(255.5,654.5) # x-left-position, y-position
.setAlignment("center-center")
.setFont("Helvetica.txf")
.setFontSize(32,1)
.setColor(0,1,0)
.set("z-index",10)
.setText("HELPER TEST");
Helper.hide();
# Creates Screen
var screen = EFB_group.createChild("image")
.setFile("Models/Instruments/EFB/Displays/Initialize_0.jpg")
.setSize(511,695)
.setTranslation(0,0);
At the moment I have a single Canvas group (i.e.,
EFB_group), with 5 children: the text-matrix (16 left lines, 16 right lines), a Title line , an Helper line and the Display.
The
Display element is then textured with all the various pages' textures, called by the page-handler (
see here below).
Currently, I'm using the .jpg textures which I had previously generated through Photoshop; in the future they might be replaced by .svg files, depending from actual interactive use of some graphical objects (a few EFB pages do need interaction with graphical parts). Besides - if i'm not wrong - I've read somewhere on the FGWiki that gradients are not handled by the SVG parser...and I do like to use some gradients effects (antialiasing and such) to achieve a sort of realism on the displays.
Pages (currently, 28 pages...and growing) are now handled by an Hash (contained in a separate file,
EFB_pages.db); hash
pages contains all the various pages' hashes, with a structure like this (MAIN MENU):
- Code: Select all
var pages_path = "Models/Instruments/EFB/Displays/";
var pages = {
'MAIN_MENU' :
{
'title' : "MAIN MENU",
'MENU': {subpage_label : "MAIN_MENU", action : (pages_path ~ "Main_Menu.jpg"), launch : "NULL"},
'l1': {subpage_label : "AIRPORT MAP", action : (pages_path ~ "Loading.jpg"), launch : "NULL"},
'l2': {subpage_label : "PERFORMANCE", action : (pages_path ~ "Performance_1.jpg"), launch : "NULL"},
'l3': {subpage_label : "NULL", action : (pages_path ~ "NULL_1.jpg"), launch : "NULL"},
'l4': {subpage_label : "APT INFO", action : (pages_path ~ "Airport_Info.jpg"), launch : "Display_APTINFO"},
'l5': {subpage_label : "NULL", action : (pages_path ~ "NULL_1.jpg"), launch : "NULL"},
'l6': {subpage_label : "NULL", action : (pages_path ~ "NULL_1.jpg"), launch : "NULL"},
'l7': {subpage_label : "IDENT", action : (pages_path ~ "Ident_1.jpg"), launch : "Display_IDENT"},
'l8': {subpage_label : "SYSTEM", action : (pages_path ~ "System_1.jpg"), launch : "NULL"},
'r1': {subpage_label : "VIDEO", action : (pages_path ~ "Video_1.jpg"), launch : "NULL"},
'r2': {subpage_label : "DOCUMENTS", action : (pages_path ~ "Documents_1.jpg"), launch : "NULL"},
'r3': {subpage_label : "TERMINAL CHARTS", action : (pages_path ~ "NULL_1.jpg"), launch : "NULL"},
'r4': {subpage_label : "NULL", action : (pages_path ~ "NULL_1.jpg"), launch : "NULL"},
'r5': {subpage_label : "UTILITIES", action : (pages_path ~ "PU_1.jpg"), launch : "NULL"},
'r6': {subpage_label : "NULL", action : (pages_path ~ "NULL_1.jpg"), launch : "NULL"},
'r7': {subpage_label : "MONITOR", action : (pages_path ~ "Monitor.jpg"), launch : "Display_FLIGHTMONITOR"},
'r8': {subpage_label : "INITIALIZE", action : (pages_path ~ "Initialize_1.jpg"), launch : "NULL"},
},
subpage_label: it's the page to be set through (3D) button selection;
action: it's the page path/name to be loaded (texture on a Canvas object);
launch: it's the function containing all the necessary code for that subpage.
The
page-handler ( a simple function
Page_Set, which access the hashes and adresses Canvas accordingly) is contained in the main
efb.nas file, and it's very short (1 line of code):
- Code: Select all
...
Page_Set : func (keypress, PAGE) {
page.Reset_Text_Matrix();
GOTO = pages[PAGE][keypress].action;
SUB_PAGE = pages[PAGE][keypress].subpage_label;
setprop("/instrumentation/efb/page", SUB_PAGE);
screen.setFile(GOTO).show();
if (pages[PAGE][keypress].launch != "NULL") {
Page_Functions[pages[PAGE][keypress].launch]();
};
PAGE = SUB_PAGE;
if (PAGE == "NULL") {setprop("sim/sound/click10", 1)} else {setprop("sim/sound/click10", 0)}; # Plays a Warning sound
keypress ="";
return PAGE;
},
...
...
...
if ((keypress != "") and (keypress != "l1"))
{
efb.Page_Set(keypress, PAGE);
PAGE = getprop("/instrumentation/efb/page");
}
if (keypress == "l1") { setprop("/instrumentation/efb/page", "CHARTS");
setprop("/instrumentation/efb/chart/chartmenu", 0);
setprop("/instrumentation/efb/chart/zoom-in", 0);
ZoomFact = 0;
PanHFact = 0;
PanVFact = 0;
keypress = "";
}
As you see, I have already inserted a quick-and-short
Reset_Text_Matrix() function, using a
for loop to actually clear text-lines, and resetting them to their original values (
see Canvas above). (at the end...no more silly repetitive lines for clearing&resetting text!
)
The (keypress == 1) event it's still there, because I will deal with Charts section&functions once I'll finish setting up all the EFB pages and functions; so, it will be handled as a function and those lines will be eliminated.
The
EFB Applications are treated as functions (called by the
launch element in the
pages hash), contained in a separate file (
EFB_Applications.db); here's an example:
- Code: Select all
...
var Page_Functions = {}; # this Hash will contain all the Pages' functions, called by the 'launch' element in the Hash 'pages'.
...
...
#__________________________________________________________________________________________
# Boeing 777 EFB Applications -> UTILITIES/GPS POSITION -----------------------------------|
#__________________________________________________________________________________________|
Page_Functions.Display_GPS = func {
ypos = 450.0;
Title.setText("GPS POSITION / SETTINGS").show();
Text_Line_L[1].setTranslation(40.0,90.0).setAlignment("left-center").setFontSize(25,1).setColor(0,1,0).setText("Latitude: " ~ sprintf("%3.2f", getprop("/instrumentation/gps/indicated-latitude-deg")) ~ " degs").show();
Text_Line_L[2].setTranslation(472.0,90.0).setAlignment("right-center").setFontSize(25,1).setColor(0,1,0).setText("Longitude: " ~ sprintf("%3.2f", getprop("/instrumentation/gps/indicated-longitude-deg")) ~ " degs").show();
Text_Line_L[3].setTranslation(40.0,ypos).setAlignment("left-center").setFontSize(22,1).setColor(1,1,1).setText("GPS Mode: " ~ getprop("/instrumentation/gps/mode")).show();
Text_Line_L[4].setTranslation(300.0,ypos).setAlignment("left-center").setFontSize(22,1).setColor(1,1,1).setText("WayPoint ID: " ~ getprop("/instrumentation/gps/wp/wp[1]/ID")).show();
Text_Line_L[5].setTranslation(40.0,ypos+80.0).setAlignment("left-center").setFontSize(22,1).setColor(1,1,1).setText("Leg Distance: " ~ sprintf("%3.2f", getprop("/instrumentation/gps/wp/leg-distance-nm")) ~ " Nm").show();
Text_Line_L[6].setTranslation(40.0,ypos+120).setAlignment("left-center").setFontSize(22,1).setColor(1,1,1).setText("Leg Magnetic Course: " ~ sprintf("%3.2f", getprop("/instrumentation/gps/wp/leg-mag-course-deg")) ~ " degs").show();
Text_Line_L[7].setTranslation(40.0,ypos+160).setAlignment("left-center").setFontSize(22,1).setColor(1,1,1).setText("Leg True Heading: " ~ sprintf("%3.2f", getprop("/instrumentation/gps/wp/leg-true-course-deg")) ~ " degs").show();
}
...
Note: I'm aware that the
EFB Applications (...and other stuff, too) could be inserted into the relevant page's hash; I decided not to do it for readability (and portability: those Applications are consistent with the 777, and probably the code would result difficult to handle/modify/port)
Note 2: ehm...well,
you will excuse my pedant use of Comment Lines through the code: being old, I rather prefer to easily identify sections at a glance, together with a few reminders...the old-school taught me to always try to make easy the reading of a code by Comments!)
So...that's the
current status of the new 777
Seattle's EFB: it's still far from being perfect, but - as a newbie - I'm quite satisfied for the moment: I need to finish the first version fairly soon, because my to-do-list is long (I have to re-model all the aircraft fuselage [original model has wrong measures,
sigh!], produce better gears and flight-control surfaces model & animations in Blender, and then to produce a new Paint-Kit in Photoshop; then all 3D models optimizations...and so forth; of course, we also have to take care of CDU, which will interface with the EFB. So, the job is still very, very long...
I'd like to get your opinion and advice on this
first 'modernization': I hope that the EFB would comply -
at least, a bit - with your request for portability.
Also, three questions:
1. - My
very next task on the EFB has to do with all the
Conversion Utilities; I wish to use - in this case - some small canvas objects (if you still have the old EFB on the Seattle, go to '
Pilot Utilities/Speed Conversion': see those '
romboidal' markers?...those are the ones I need to handle); they need to be animated (moved), turned on/off, pushed (by the mouse) and parse. I've read this:
http://wiki.flightgear.org/Canvas_Nasal_API#createTransform, and I'd like to study some working examples for those Classes & Elements.
BTW, could you clarify what is intended by "
transformation matrices"?
2. My
last task on the EFB will be to take care of
Charts' handling: I will certainly clean-up the current code, but I need to study the matter first; I have seen the example you report in the last post of yours: as a graphic designer - please, don't feel offended - I do not like the visual outcome, but I do appreciate the handling capability. Any links/suggestion for learning (working examples, and coding)?
3. The idea of getting the
Charts from
airnav.com it's nice, but I have not an account on it (
where&how can I get access to the Charts?); also, I would like to insert hi-res Charts. Further, it seems that there's not a definite point on Charts' use (source, resolution, STAR/SID/IAP procedures
NOT inserted/handled into
Route Manager , and so on): is there a kind of generally-agreed
consensus among FG Pilots/Developers about a
standard (or something
sounding like that!) to be used for Navigation Charts?...if so, I would gladly comply with it (expecting that the same sort of standard, so to speak, is (will be) used also by other aircrafts); otherwise, I have to devise the better solution for the 777 together with Hyde. Being FG 3.2 soon to be released, I will postpone my study of Http's addressing later on.
Thank you very much -
again - for your kind support and advice!
Regards,
I-NEMO