1
0
Fork 0
fgdata/Nasal/canvas/map/taxiways.draw
Gijs de Rooy a9576e8c8d Canvas Navigational Display:
- get rid of global variables and use instance variables
- identified all important drawing routines and move them into *.draw files
- changed to dynamic loading of *.draw *.model and *.layer files
- implemented poor-man's controller hash to move use-case specific conditionals out of the draw files, and back into the instantiation, i.e. Gijs' EFIS class
- started identifying stuff that is not specific to drawing, but to what is to be drawn, i.e. Model stuff - such as positioned queries, moved those out into *.model files
- some more work on supporting more than a single ND MFD instance per aircraft
- renamed a handful of SVG identifiers to avoid naming conflicts and to simplify usage of SVG IDs as member fields
- moved all of the setlistener setup out of the fdm-initialized stub right into the ctor of the Efis class (actually that's controller stuff...)
- initial MapStructure framework
- aircraft-agnostic NavDisplay class
- preparations for deprecating map.nas
- additions to canvas.map
- preparations for making NDStyles configurable via XML
2013-12-01 13:36:23 +01:00

39 lines
1.5 KiB
Text

var draw_taxiways = func(group, apt, lod) { # TODO: the LOD arg isn't stricly needed here,
# the layer is a conventional canvas group, so it can access its map
# parent and just read the "range" property to do LOD handling
group.set("z-index",-100) # HACK: we need to encapsulate this
.set("stroke", "none");
# print("drawing taxiways for:", apt.id);
# Taxiways drawn first so the runways and parking positions end up on top.
# Preallocate all paths at once to gain some speed
var taxi_paths = group.createChildren("path", size(apt.taxiways));
var i = 0;
foreach(var taxi; apt.taxiways) {
var clr = SURFACECOLORS[taxi.surface];
if (clr == nil) { clr = SURFACECOLORS[0]};
var txi = Runway.new(taxi);
var beg1 = txi.pointOffCenterline(0, 0.5 * taxi.width);
var beg2 = txi.pointOffCenterline(0, -0.5 * taxi.width);
var end1 = txi.pointOffCenterline(taxi.length, 0.5 * taxi.width);
var end2 = txi.pointOffCenterline(taxi.length, -0.5 * taxi.width);
taxi_paths[i].setColorFill(clr.r, clr.g, clr.b)
.setDataGeo
(
[ canvas.Path.VG_MOVE_TO,
canvas.Path.VG_LINE_TO,
canvas.Path.VG_LINE_TO,
canvas.Path.VG_LINE_TO,
canvas.Path.VG_CLOSE_PATH ],
[ beg1[0], beg1[1],
beg2[0], beg2[1],
end2[0], end2[1],
end1[0], end1[1] ]
);
i += 1;
}
}