Debian Codegraph @

Nasal/canvas/map/taxiways.draw

raw
1 # WARNING: *.draw files will be deprecated, see: http://wiki.flightgear.org/MapStructure
2 var draw_taxiways = func(group, apt, lod) { # TODO: the LOD arg isn't stricly needed here,
3 # the layer is a conventional canvas group, so it can access its map
4 # parent and just read the "range" property to do LOD handling
5 group.set("z-index",-100) # HACK: we need to encapsulate this
6 .set("stroke", "none");
7
8 # print("drawing taxiways for:", apt.id);
9 # Taxiways drawn first so the runways and parking positions end up on top.
10
11 # Preallocate all paths at once to gain some speed
12 var taxi_paths = group.createChildren("path", size(apt.taxiways));
13 var i = 0;
14 foreach(var taxi; apt.taxiways) {
15 var clr = SURFACECOLORS[taxi.surface];
16 if (clr == nil) { clr = SURFACECOLORS[0]};
17
18 var txi = Runway.new(taxi);
19 var beg1 = txi.pointOffCenterline(0, 0.5 * taxi.width);
20 var beg2 = txi.pointOffCenterline(0, -0.5 * taxi.width);
21 var end1 = txi.pointOffCenterline(taxi.length, 0.5 * taxi.width);
22 var end2 = txi.pointOffCenterline(taxi.length, -0.5 * taxi.width);
23
24 taxi_paths[i].setColorFill(clr.r, clr.g, clr.b)
25 .setDataGeo
26 (
27 [ canvas.Path.VG_MOVE_TO,
28 canvas.Path.VG_LINE_TO,
29 canvas.Path.VG_LINE_TO,
30 canvas.Path.VG_LINE_TO,
31 canvas.Path.VG_CLOSE_PATH ],
32 [ beg1[0], beg1[1],
33 beg2[0], beg2[1],
34 end2[0], end2[1],
35 end1[0], end1[1] ]
36 );
37 i += 1;
38 }
39 }
40