Board index FlightGear Development Canvas

Developing a Canvas Cockpit for the CRJ700

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.

Re: Developing a Canvas Cockpit for the CRJ700

Postby Hooray » Sat Jul 18, 2015 4:50 pm

The ND framework is using the MapStructure framework for creating custom NDs -however, the MapStructure framework is not specific to any single use-case or aircraft, it can also be used for different purposes, such as the map-canvas.xml dialog:

Internally, the back-end code here is using MapStructure, which -in turn- is using Nasal/Canvas and a few abstraction layers for performance purposes, such as the concept of a SymbolCache and helpers for things like animations and event handling (think timers/listeners).

The key thing to take away from this is that the way the ND/MapStruct ure code is structured, it is fairly accessible and even simple, e.g. the ND stuff is completely aircraft agnostic, and can be easily customized/styled and even adapted to completely different aircraft, while still using much of the original back-end logic for common stuff (mapping/charts, symbols, caching, animations).

In addition, both frameworks are designed to be "modular", which means that there is not just a single monolithic file with all code, but separate files for different purposes, that can be easily updated/maintained and customized. For instance, MapStructure is using the notion of "layers" for different navaids/purposes:

Note that this stuff is designed to be reusable "as is", without ANY copy&paste required - i.e. it's using OOP, while still being accessible. Which also means, that it is trivial to run multiple INDEPENDENT instances of an aircraft/map at the same time, without any conflicts. Equally, this stuff is losely-coupled using the concept of "drivers" for its I/O, so that different aircraft/properties can be used to update an instrument - which means, that a Canvas ND can even be hooked up to an MP tanker or even to bombable aircraft (ai bots), all without any major coding required.

As has been mentioned previously, the key thing here is thinking in terms of building blocks and frameworks - there is no reason why the ND code couldn't be generalized a little more to also create PFD or other MFD instruments in a similarly generic fashion.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Posts: 11923
Joined: Tue Mar 25, 2008 8:40 am

Re: Developing a Canvas Cockpit for the CRJ700

Postby jsb » Fri Jul 24, 2015 7:06 am

Please have a look to the updates viewtopic.php?f=4&t=11863&start=375
Posts: 268
Joined: Sat Oct 25, 2014 8:17 pm
Location: Hamburg, Germany
Callsign: D-JSB
Version: next
OS: Win7/Linux


Return to Canvas

Who is online

Users browsing this forum: No registered users and 0 guests