MapStructure: a few WPT/RTE bugfixes
This commit is contained in:
parent
807062d0b6
commit
501f8ba881
5 changed files with 13 additions and 9 deletions
|
@ -403,6 +403,7 @@ var Symbol = {
|
|||
# Private constructor:
|
||||
_new: func(m) {
|
||||
m.style = m.layer.style;
|
||||
m.options = m.layer.options;
|
||||
if (m.controller != nil) {
|
||||
temp = m.controller.new(m,m.model);
|
||||
if (temp != nil)
|
||||
|
|
|
@ -42,12 +42,11 @@ var searchCmd = func {
|
|||
# http://wiki.flightgear.org/Nasal_Flightplan
|
||||
var fp = flightplan();
|
||||
var fpSize = fp.getPlanSize();
|
||||
if (!getprop(me.layer.options.active_node)) fpSize = 0;
|
||||
var coords = [];
|
||||
for (var i=0; i<fpSize; i += 1) {
|
||||
var leg = fp.getWP(i);
|
||||
foreach (var c; leg.path()) {
|
||||
append(coords, c);
|
||||
}
|
||||
coords ~= leg.path();
|
||||
}
|
||||
append(plans, coords);
|
||||
return plans;
|
||||
|
|
|
@ -17,6 +17,7 @@ var new = func(layer) {
|
|||
var m = {
|
||||
parents: [__self__],
|
||||
layer: layer,
|
||||
options: layer.options,
|
||||
map: layer.map,
|
||||
listeners: [],
|
||||
};
|
||||
|
@ -33,8 +34,8 @@ var del = func() {
|
|||
};
|
||||
|
||||
var WPT_model = {
|
||||
new: func(fp, idx) {
|
||||
var m = { parents:[WPT_model], idx:idx };
|
||||
new: func(fp, idx, offset=0) {
|
||||
var m = { parents:[WPT_model], idx:(idx+offset) };
|
||||
var wp = fp.getWP(idx);
|
||||
|
||||
m.name = wp.wp_name;
|
||||
|
@ -42,7 +43,8 @@ var WPT_model = {
|
|||
if (alt != 0)
|
||||
m.name ~= "\n"~alt;
|
||||
|
||||
var n = wp.path()[0];
|
||||
if (idx) var n = wp.path()[-1];
|
||||
else var n = fp.getWP(1).path()[0];
|
||||
(m.lat,m.lon) = (n.lat,n.lon);
|
||||
return m;
|
||||
},
|
||||
|
@ -55,10 +57,12 @@ var WPT_model = {
|
|||
var searchCmd = func {
|
||||
printlog(_MP_dbg_lvl, "Running query: "~name);
|
||||
|
||||
if (!getprop(me.options.active_node)) return [];
|
||||
|
||||
var fp = flightplan();
|
||||
var fpSize = fp.getPlanSize();
|
||||
var result = [];
|
||||
for (var i = 1; i < fpSize; i+=1)
|
||||
for (var i = 0; i < fpSize; i+=1)
|
||||
append(result, WPT_model.new(fp, i));
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ var new = func(symbol, model) {
|
|||
symbol.update();
|
||||
m.last_idx = n;
|
||||
}, 0, 0));
|
||||
m.last_idx = getprop(symbol.layer.options.current_wp_node);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ var element_type = "group"; # we want a group, becomes "me.element"
|
|||
var active = nil;
|
||||
|
||||
var init = func {
|
||||
# TODO: active vs inactive?
|
||||
me.path = me.element.createChild("path")
|
||||
.setStrokeLineWidth(me.style.line_width)
|
||||
.moveTo(0,-25)
|
||||
|
@ -40,7 +39,7 @@ var init = func {
|
|||
me.draw();
|
||||
};
|
||||
var draw = func {
|
||||
var active = (getprop(me.layer.options.current_wp_node) == me.model.idx);
|
||||
var active = (getprop(me.options.current_wp_node) == me.model.idx);
|
||||
if (active != me.active) {
|
||||
me.path.setColor(
|
||||
active ?
|
||||
|
|
Loading…
Reference in a new issue