Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G


From FlightGear wiki
Jump to: navigation, search
Note  Canvas draw is currently work in progress. You can test and improve it by downloading the CanvasDrawDev add-on. The canvas.draw library will hopefully be ready to use in FG version 2019.1


Please have a look at Canvas draw library first.



draw(cgroup, radius, style=nil);

Draws a compass rose with given radius. Marks and text labels are drawn as defined in style. A default style will be used if style is not given.


The style class for CompassRose, derived from canvas.draw.marksStyle.


return a new style hash

var myStyle = canvas.CompassRose.Style.new();


value number of marks on compass rose, default: 36


value number of text labels on compass rose to generate from course degrees, default: 12


value divide course degrees by this value to create text label, default: 10


value fontsize for labels

{Note|This should be changed to scale with the radius parameter of the draw function.}}


Compass rose HSI style and ND style
Compass example with eight marks.
    # compass test
    var style_HSI = canvas.CompassRose.Style.new();

    var style_NAV = canvas.CompassRose.Style.new();
    style_NAV.set("circle_width", 2)
    var style_3 = canvas.CompassRose.Style.new();
        .set("nesw", 0); # No label N,E,S,W instead of 0, 90, 180, 270 degree
    var compass1 = myRoot.createChild("group", "compass1");
    var compass2 = myRoot.createChild("group", "compass2");
    var compass3 = myRoot.createChild("group", "compass3");
    canvas.CompassRose.draw(compass1, 100, style_HSI).setTranslation(150, 250);
    canvas.CompassRose.draw(compass2, 140, style_NAV).setTranslation(150, 250);
    canvas.CompassRose.draw(compass3, 210, style_3).setTranslation(...);