1
0
Fork 0

Clean up Select Airport dialog a bit to make use of recent Canvas API improvements

This commit is contained in:
Thomas Geymayer 2012-09-18 00:32:54 +02:00
parent f3ac93b1ef
commit a870d8c4a3

View file

@ -479,12 +479,11 @@
rws_done[rw] = 1; rws_done[rw] = 1;
rw = me._apt.runways[rw]; rw = me._apt.runways[rw];
var icon_rw = me.grp_apt.createChild("path", "runway"); var icon_rw =
me.grp_apt.createChild("path", "runway")
icon_rw.setStrokeLineWidth(0.5); .setStrokeLineWidth(0.5)
icon_rw.setColor(1.0,1.0,1.0); .setColor(1.0,1.0,1.0)
icon_rw.setColorFill(0.2, 0.2, 0.2); .setColorFill(0.2, 0.2, 0.2);
icon_rw.setFill(1);
var rwy = Runway.new(rw); var rwy = Runway.new(rw);
var beg_thr = rwy.pointOffCenterline(rw.threshold); var beg_thr = rwy.pointOffCenterline(rw.threshold);
@ -516,10 +515,11 @@
{ {
# only runways which are much longer than wide are # only runways which are much longer than wide are
# real runways, otherwise it's probably a heliport. # real runways, otherwise it's probably a heliport.
var icon_cl = me.grp_apt.createChild("path", "centerline"); var icon_cl =
icon_cl.setStrokeLineWidth(0.5); me.grp_apt.createChild("path", "centerline")
icon_cl.setColor(1,1,1); .setStrokeLineWidth(0.5)
icon_cl.setStrokeDashArray([15, 10]); .setColor(1,1,1)
.setStrokeDashArray([15, 10]);
icon_cl.setDataGeo icon_cl.setDataGeo
( (
@ -529,9 +529,10 @@
end_thr[0], end_thr[1] ] end_thr[0], end_thr[1] ]
); );
var icon_thr = me.grp_apt.createChild("path", "threshold"); var icon_thr =
icon_thr.setStrokeLineWidth(1.5); me.grp_apt.createChild("path", "threshold")
icon_thr.setColor(1,1,1); .setStrokeLineWidth(1.5)
.setColor(1,1,1);
icon_thr.setDataGeo icon_thr.setDataGeo
( (
@ -549,12 +550,14 @@
foreach(var park; me._apt.parking()) foreach(var park; me._apt.parking())
{ {
var icon_park = me.grp_apt.createChild("text"); var icon_park =
icon_park.setDrawMode(9); me.grp_apt.createChild("text")
icon_park.setText(park.name); .setDrawMode( canvas.Text.ALIGNMENT
icon_park.setFont("LiberationFonts/LiberationMono-Bold.ttf"); + canvas.Text.TEXT )
icon_park.setGeoPosition(park.lat, park.lon); .setText(park.name)
icon_park.setFontSize(15, 1.3); .setFont("LiberationFonts/LiberationMono-Bold.ttf")
.setGeoPosition(park.lat, park.lon)
.setFontSize(15, 1.3);
} }
} }
}; };
@ -564,30 +567,21 @@
var root = my_canvas.createGroup(); var root = my_canvas.createGroup();
var map = root.createChild("map", "map-test"); var map = root.createChild("map", "map-test")
map.setTranslation(300, 200); .setTranslation(300, 200);
var layer_runways = map.createChild("group", "runways"); var layer_runways = map.createChild("group", "runways");
var icon_tower = map.createChild("path", "tower"); var icon_tower =
icon_tower.setStrokeLineWidth(1); map.createChild("path", "tower")
icon_tower.setScale(1.5); .setStrokeLineWidth(1)
icon_tower.setColor(0.2,0.2,1.0); .setScale(1.5)
.setColor(0.2,0.2,1.0)
icon_tower.setData .moveTo(-3, 0)
( .vert(-10)
[ canvas.Path.VG_MOVE_TO, .line(-3, -10)
canvas.Path.VG_VLINE_TO_REL, .horiz(12)
canvas.Path.VG_LINE_TO_REL, .line(-3, 10)
canvas.Path.VG_HLINE_TO_REL, .vert(10);
canvas.Path.VG_LINE_TO_REL,
canvas.Path.VG_VLINE_TO_REL ],
[ -3, 0,
-10,
-3, -10,
12,
-3, 10,
10 ]
);
var updateMap = func() { var updateMap = func() {
var id = getprop("/sim/gui/dialogs/airports/selected-airport/id"); var id = getprop("/sim/gui/dialogs/airports/selected-airport/id");
@ -615,7 +609,7 @@
var zoom = ranges[4 - z]; var zoom = ranges[4 - z];
map._node.getNode("range", 1).setDoubleValue(zoom); map._node.getNode("range", 1).setDoubleValue(zoom);
settimer(updateZoom, 0.5); settimer(updateZoom, 0.5, 1);
}; };
var aptlistener = setlistener("/sim/gui/dialogs/airports/selected-airport/id", updateMap); var aptlistener = setlistener("/sim/gui/dialogs/airports/selected-airport/id", updateMap);