... | ... |
@@ -62,6 +62,9 @@ var mapClass = { |
62 | 62 |
.setColorFill(1,1,1) |
63 | 63 |
.setText(m.device.data.orientation.text); |
64 | 64 |
|
65 |
+ data.lat = getprop('/position/latitude-deg'); |
|
66 |
+ m.changeZoom(); |
|
67 |
+ |
|
65 | 68 |
# m.device.display.display.createGroup().createChild('path') |
66 | 69 |
# .setColor(1,0,0) |
67 | 70 |
# .setColorFill(1,0,0) |
... | ... |
@@ -90,8 +93,7 @@ var mapClass = { |
90 | 93 |
}, |
91 | 94 |
changeZoom : func (d = 0) { |
92 | 95 |
me.device.data.zoom = math.max(2, math.min(19, me.device.data.zoom + d)); |
93 |
- me.device.data['range-nm'] = me.device.display.display.get('view[1]') / 2 * 84.53 * math.cos(data.lat) / math.pow(2, me.device.data.zoom); |
|
94 |
- me.device.data['range-factor'] = math.pow(2,13 - me.device.data.zoom) * 1.45; |
|
96 |
+ me.device.data['range-nm'] = me.device.display.display.get('view[1]') / 2 * 84.53 * math.cos(data.lat * D2R) / math.pow(2, me.device.data.zoom); |
|
95 | 97 |
}, |
96 | 98 |
update : func { |
97 | 99 |
if (me.device.data.orientation.text == 'NORTH UP') { |
... | ... |
@@ -350,9 +350,8 @@ var MapNavaids = { |
350 | 350 |
.setTranslation( |
351 | 351 |
m.device.role == 'MFD' ? (m.device.data.mapview[0] + m.device.data.mapclip.left)/2 : 120, |
352 | 352 |
m.device.role == 'MFD' ? 400 : 600) |
353 |
+ .setRange(m.device.data['range-nm']/2) |
|
353 | 354 |
.setVisible(m._visibility); |
354 |
- m._group._node |
|
355 |
- .getNode('range', 1).setDoubleValue(m.device.data['range-factor']); |
|
356 | 355 |
|
357 | 356 |
m._can = {}; |
358 | 357 |
m._cache = {}; |
... | ... |
@@ -376,8 +375,7 @@ var MapNavaids = { |
376 | 375 |
lightning : 0, |
377 | 376 |
reports : 0, |
378 | 377 |
overlay : 0, |
379 |
- range : m.device.data['range-nm'], |
|
380 |
- rangeLow : m.device.data['range-nm'] / 2, |
|
378 |
+ range : m.device.data['range-nm'] / 2, |
|
381 | 379 |
runwayLength : -1, |
382 | 380 |
orientation : m.device.data.orientation.map, |
383 | 381 |
}; |
... | ... |
@@ -411,8 +409,7 @@ var MapNavaids = { |
411 | 409 |
me._group._node.getNode('ref-lat', 1).setDoubleValue(data.lat); |
412 | 410 |
me._group._node.getNode('ref-lon', 1).setDoubleValue(data.lon); |
413 | 411 |
|
414 |
- me._group._node |
|
415 |
- .getNode('range', 1).setDoubleValue(me.device.data['range-factor']); |
|
412 |
+ me._group.setRange(me.device.data['range-nm']/2); |
|
416 | 413 |
me._mapOptions.orientation = me.device.data.orientation.map; |
417 | 414 |
|
418 | 415 |
if (me._visibility == 1) { |
... | ... |
@@ -436,11 +433,6 @@ var MapNavaids = { |
436 | 433 |
item.update(me._mapOptions); |
437 | 434 |
} |
438 | 435 |
}, |
439 |
- setRange : func (range=100) { |
|
440 |
- me._mapOptions.range = me.device.data['range-nm']; |
|
441 |
- me._mapOptions.rangeLow = me._mapOptions.range/2; |
|
442 |
- me.update(); |
|
443 |
- }, |
|
444 | 436 |
setRotation : func (deg) { |
445 | 437 |
me._group.setRotation(deg * D2R); |
446 | 438 |
}, |
... | ... |
@@ -145,8 +145,7 @@ var MapRoute = { |
145 | 145 |
m.device.role == 'MFD' ? (m.device.data.mapview[0] + m.device.data.mapclip.left)/2 : 120, |
146 | 146 |
m.device.role == 'MFD' ? 400 : 600) |
147 | 147 |
.setVisible(m.visibility); |
148 |
- m.group._node |
|
149 |
- .getNode('range', 1).setDoubleValue(m.device.data['range-factor']); |
|
148 |
+ m.group.setRange(m.device.data['range-nm']/2); |
|
150 | 149 |
m.group._node |
151 | 150 |
.getNode('ref-lat', 1).setDoubleValue(data.lat); |
152 | 151 |
m.group._node |
... | ... |
@@ -226,8 +225,7 @@ var MapRoute = { |
226 | 225 |
}, |
227 | 226 |
update: func { |
228 | 227 |
me.visibility != 0 or return; |
229 |
- me.group._node |
|
230 |
- .getNode('range', 1).setDoubleValue(me.device.data['range-factor']); |
|
228 |
+ me.group.setRange(me.device.data['range-nm']/2); |
|
231 | 229 |
me.group._node.getNode('ref-lat', 1).setDoubleValue(data.lat); |
232 | 230 |
me.group._node.getNode('ref-lon', 1).setDoubleValue(data.lon); |
233 | 231 |
}, |
... | ... |
@@ -88,8 +88,7 @@ var MapTcas = { |
88 | 88 |
return; |
89 | 89 |
me.group._node.getNode('ref-lat', 1).setDoubleValue(data.lat); |
90 | 90 |
me.group._node.getNode('ref-lon', 1).setDoubleValue(data.lon); |
91 |
- me.group._node |
|
92 |
- .getNode('range', 1).setDoubleValue(me.device.data['range-factor']); |
|
91 |
+ me.group.setRange(me.device.data['range-nm']/2); |
|
93 | 92 |
me._itemIndex = 0; |
94 | 93 |
foreach (var ac; data.tcas) { |
95 | 94 |
if (me._itemIndex >= me._itemCount) { |