Canvas ND framework: Difference between revisions

Jump to navigation Jump to search
Line 202: Line 202:
If you are finding yourself having problems integrating the framework, please refer to already integrated aircraft as reference/example, or get in touch with their  maintainers - ideally, via the forum, so that everybody can contribute and benefit.
If you are finding yourself having problems integrating the framework, please refer to already integrated aircraft as reference/example, or get in touch with their  maintainers - ideally, via the forum, so that everybody can contribute and benefit.


== Design ==
{{FGCquote
  |Originally, it was a single monolithic update() method that would basically be called at frame rate using a settimer/maketimer callback.<br/>
When things were restructured, the conditional parts of this huge method were moved into predicates that reside in a huge hash: [https://gitorious.org/fg/fgdata/source/Nasal/canvas/map/navdisplay.styles#L14 https://gitorious.org/fg/fgdata/source/ ... styles#L14]<br/>
Meanwhile, the update() method has been inflated again due to some logic that wasn't added to the hash, e.g. see: [https://gitorious.org/fg/fgdata/source/Nasal/canvas/map/navdisplay.mfd#L476 https://gitorious.org/fg/fgdata/source/ ... y.mfd#L476]<br/>
<br/>
The meat of it still is in update(), and those "layers" are fairly boring meanwhile  because they're separately managed by Philosopher's MapStructure framework.<br/>
<br/>
But individual ND elements (canvas groups) are basically SVG-driven, i.e. SVG elements that are looked up and then updated/animated via timers and listeners: [https://gitorious.org/fg/fgdata/source/f3df87622ca60eb45f359c05bd913524eeb44667:Nasal/canvas/map/navdisplay.styles#L183 https://gitorious.org/fg/fgdata/source/ ... tyles#L183]<br/>
<br/>
The actual code evaluating each SVG predicate is still called via the update() method, but it's just a foreach loop with a few lines:<br/>
[https://gitorious.org/fg/fgdata/source/Nasal/canvas/map/navdisplay.mfd#L760-769 https://gitorious.org/fg/fgdata/source/ ... d#L760-769]<br/>
<br/>
None of this is set in stone, and we're actually looking forward to generalizing this some more.
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=212488#p212488
    |title=<nowiki>Re: Event Management module for post 3.2</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Fri Jun 13</nowiki>
  }}
}}
== Custom ND Styles ==
== Custom ND Styles ==


Navigation menu