Board index FlightGear Development Canvas

T/C and T/D mark display on ND (from PM)

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

T/C and T/D mark display on ND (from PM)

Postby Hyde » Fri Jan 02, 2015 6:15 pm

Hyde wrote:Happy New Year!

I have a question.
How can I refresh the ND screen.
When T/D position is changed, I want to refresh the ND display to get immediate change. Currently I change the range or mode to get it.
I want to it automatically in the program.


Hooray wrote:for properties, you can use the update_on vector: ... styles#L45

if there's an embedded hash named "rate_hz", it will set up a timer accordingly

equally, you could also introduce a callback here or some other condition - it really depends on how you're updating the T/D and if you'd like to use a property/timer or other callback here.

You can see how this actually works here: ... y.mfd#L356

PS: it's better to post/discuss these things in public, or at least help update the wiki accordingly.

Hooray wrote:Regarding the code in AFDS.nas, I would move this stuff into its own MapStructure layer so that other aircraft (747, A320, A330 etc) can more easily reuse your work:

Code: Select all
var tcNode = me.NDSymbols.getNode("tc", 1);
tcNode.getNode("longitude-deg", 1).setValue(topClimb.lon);
               tcNode.getNode("latitude-deg", 1).setValue(;
                var tdNode = me.NDSymbols.getNode("td", 1);
                tdNode.getNode("longitude-deg", 1).setValue(topDescent.lon);
                tdNode.getNode("latitude-deg", 1).setValue(;

I believe it's technically corrrect to generalize and refactor your code accordingly, so that only aircraft-specific code resides there - ideally, customized using "behavior hashes", with generic functionality living elsewhere.

I think Gijs already created some kind of TC/TD layer a while ago - so this should be easy to adapt accordingly

Hyde wrote:I'm fine.
Once interface is establised, I will update my side.

Thank you,

Hooray wrote:the easiest option might be updating the RTE (=route) layer and adding the logic there - as an optional feature, that would by default by not visible, but could be enabled by airliners/glass cockpit aircraft.

The TC/TD computations could then be done as part of some searchCmd()-like callback invoked via a timer.

But like I said, it's better to move this to the public forum.
Posts: 728
Joined: Fri Aug 12, 2011 1:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest