Hooray wrote in Wed Feb 05, 2014 3:53 am:EDIT: Okay, here's a patch:
Did this make it into your team clone? I'm working on it currently, and need to know if I should apply it. Working on making Map-Controllers.
Hooray wrote in Wed Feb 05, 2014 3:53 am:EDIT: Okay, here's a patch:
##
# storage container for all ND instances
var nd_display = {};
###
# entry point, this will set up all ND instances
setlistener("sim/signals/fdm-initialized", func() {
##
# configure aircraft specific cockpit/ND switches here
# these are to be found in the property branch you specify
# via the NavDisplay.new() call
# the backend code in navdisplay.mfd should NEVER contain any aircraft-specific
# properties, or it will break other aircraft using different properties
# instead, make up an identifier (hash key) and map it to the property used
# in your aircraft, relative to your ND root in the backend code, only ever
# refer to the handle/key instead via the me.get_switch('toggle_range') method
# which would internally look up the matching aircraft property, e.g. '/instrumentation/efis'/inputs/range-nm'
#
# note: it is NOT sufficient to just add new switches here, the backend code in navdisplay.mfd also
# needs to know what to do with them !
# refer to incomplete symbol implementations to learn how they work (e.g. WXR, STA)
var myCockpit_switches = {
# symbolic alias : relative property (as used in bindings), initial value, type
'toggle_range': {path: '/inputs/range-nm', value:40, type:'INT'},
'toggle_weather': {path: '/inputs/wxr', value:0, type:'BOOL'},
'toggle_airports': {path: '/inputs/arpt', value:0, type:'BOOL'},
'toggle_stations': {path: '/inputs/sta', value:0, type:'BOOL'},
'toggle_waypoints': {path: '/inputs/wpt', value:0, type:'BOOL'},
'toggle_position': {path: '/inputs/pos', value:0, type:'BOOL'},
'toggle_data': {path: '/inputs/data',value:0, type:'BOOL'},
'toggle_terrain': {path: '/inputs/terr',value:0, type:'BOOL'},
'toggle_traffic': {path: '/inputs/tfc',value:0, type:'BOOL'},
'toggle_centered': {path: '/inputs/nd-centered',value:0, type:'BOOL'},
'toggle_lh_vor_adf': {path: '/inputs/lh-vor-adf',value:0, type:'INT'},
'toggle_rh_vor_adf': {path: '/inputs/rh-vor-adf',value:0, type:'INT'},
'toggle_display_mode': {path: '/mfd/display-mode', value:'MAP', type:'STRING'},
'toggle_display_type': {path: '/mfd/display-type', value:'LCD', type:'STRING'},
'toggle_true_north': {path: '/mfd/true-north', value:0, type:'BOOL'},
# add new switches here
};
# get a handle to the NavDisplay in canvas namespace (for now), see $FG_ROOT/Nasal/canvas/map/navdisplay.mfd
var ND = canvas.NavDisplay;
## TODO: We want to support multiple independent ND instances here!
# foreach(var pilot; var pilots = [ {name:'cpt', path:'instrumentation/efis',
# name:'fo', path:'instrumentation[1]/efis']) {
##
# set up a new ND instance, under 'instrumentation/efis' and use the
# myCockpit_switches hash to map control properties
var NDCpt = ND.new("instrumentation/efis", myCockpit_switches);
nd_display.cpt = canvas.new({
"name": "ND",
"size": [2048, 2048],
"view": [1024, 1024],
"mipmapping": 1
});
nd_display.cpt.addPlacement({"node": "blackbkd"});
var group = nd_display.cpt.createGroup();
NDCpt.newMFD(group);
NDCpt.update();
}); # fdm-initialized listener callback
var showNd = func(pilot='cpt') {
# The optional second arguments enables creating a window decoration
var dlg = canvas.Window.new([400, 400], "dialog");
dlg.setCanvas( nd_display[pilot] );
}
How does the NavDisplay is updated ? If it's a loop, could it be possible to have a variable to set the frequencies ?
Philosopher wrote in Mon Feb 10, 2014 9:53 pm:Did this make it into your team clone? I'm working on it currently, and need to know if I should apply it. Working on making Map-Controllers.
Some things to keep in mind when working on Map Controllers:
- we may also want to support optional mouse-panning (see airport-select dialog)
- we may also want to support optional tooltips for layer elements
<animation>
<type>pick</type>
<object-name>screen</object-name>
<action>
<button>4</button>
<!-- scroll up -->
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>/instrumentation/efis/inputs/range-nm</property>
<value>10</value>
<value>20</value>
<value>40</value>
<value>80</value>
<value>160</value>
<value>320</value>
</binding>
</action>
</animation>
<animation>
<type>pick</type>
<object-name>screen</object-name>
<action>
<button>3</button>
<!-- scroll up -->
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>/instrumentation/efis/inputs/range-nm</property>
<value>320</value>
<value>160</value>
<value>80</value>
<value>40</value>
<value>20</value>
<value>10</value>
</binding>
</action>
</animation>
Users browsing this forum: No registered users and 1 guest