add track display
|
1 |
var MapTrack = { |
2 |
new : func (device, group) { |
|
3 |
var m = { parents: [MapTrack] }; |
|
4 |
m.device = device; |
|
5 |
m.visibility = 0; |
|
6 |
m.group = group.createChild('path', 'track') |
|
7 |
.moveTo((m.device.data.mapview[0] + m.device.data.mapclip.left)/2, 400) |
|
8 |
.vertTo(m.device.data.mapsize[1]) |
|
9 |
.setCenter((m.device.data.mapview[0] + m.device.data.mapclip.left)/2, 400) |
|
10 |
.setRotation((data.trk + 180) * D2R) |
|
11 |
.setColor(1,0,0) |
|
12 |
.setStrokeLineWidth(3) |
|
13 |
.setVisible(m.visibility); |
|
14 |
return m; |
|
15 |
}, |
|
16 |
off: func { |
|
17 |
me.setVisible(0); |
|
18 |
me.group.setVisible(0); |
|
19 |
me.group.removeAllChildren(); |
|
20 |
}, |
|
21 |
update: func { |
|
22 |
me.visibility != 0 or return; |
|
23 |
me.group.setRotation((data.trk + 180) * D2R); |
|
24 |
}, |
|
25 |
setVisible : func (v) { |
|
26 |
if (me.visibility != v) { |
|
27 |
me.visibility = v; |
|
28 |
me.group.setVisible(v); |
|
29 |
} |
|
30 |
}, |
|
31 |
}; |