1
0
Fork 0
fgdata/Nasal/canvas/map/runway-nd.draw

54 lines
1.6 KiB
Text
Raw Normal View History

var draw_rwy_nd = func (group, rwy, controller=nil, lod=nil) {
# print("drawing runways-nd");
canvas._draw_rwy_nd(group,rwy.lat,rwy.lon,rwy.length,rwy.width,rwy.heading);
}
##
# TODO: this is not yet a real draw callback ... (wrong signature, not yet integrated)
var _draw_rwy_nd = func (group, lat, lon, length, width, rwyhdg) {
var apt = airportinfo("EHAM");
var rwy = apt.runway("18R");
var crds = [];
var coord = geo.Coord.new();
width=width*20; # Else rwy is too thin to be visible
coord.set_latlon(lat, lon);
coord.apply_course_distance(rwyhdg, -14.2*NM2M);
append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg, 28.4*NM2M+length);
append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon());
icon_rwy = group.createChild("path", "rwy-cl")
.setStrokeLineWidth(3)
.setDataGeo([2,4],crds)
.setColor(1,1,1)
.setStrokeDashArray([10, 20, 10, 20, 10]);
var crds = [];
coord.set_latlon(lat, lon);
coord.apply_course_distance(rwyhdg + 90, width/2);
append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg, length);
append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon());
icon_rwy = group.createChild("path", "rwy")
.setStrokeLineWidth(3)
.setDataGeo([2,4],crds)
.setColor(1,1,1);
var crds = [];
coord.apply_course_distance(rwyhdg - 90, width);
append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon());
coord.apply_course_distance(rwyhdg, -length);
append(crds,"N"~coord.lat());
append(crds,"E"~coord.lon());
icon_rwy = group.createChild("path", "rwy")
.setStrokeLineWidth(3)
.setDataGeo([2,4],crds)
.setColor(1,1,1);
}