Only set/reset position_from_mlat when we actually see position data.
Otherwise, if the position data times out on the dump1090 side, we'd keep the last seen position on the webpage side but lose the mlat status.
This commit is contained in:
parent
32f87412d6
commit
e5053ac5c9
|
@ -13,6 +13,7 @@ function PlaneObject(icao) {
|
||||||
this.speed = null;
|
this.speed = null;
|
||||||
this.track = null;
|
this.track = null;
|
||||||
this.position = null;
|
this.position = null;
|
||||||
|
this.position_from_mlat = false
|
||||||
this.sitedist = null;
|
this.sitedist = null;
|
||||||
|
|
||||||
// Data packet numbers
|
// Data packet numbers
|
||||||
|
@ -290,6 +291,16 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
|
||||||
if (SitePosition !== null) {
|
if (SitePosition !== null) {
|
||||||
this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position);
|
this.sitedist = google.maps.geometry.spherical.computeDistanceBetween (SitePosition, this.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.position_from_mlat = false;
|
||||||
|
if (typeof data.mlat !== "undefined") {
|
||||||
|
for (var i = 0; i < data.mlat.length; ++i) {
|
||||||
|
if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
|
||||||
|
this.position_from_mlat = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeof data.flight !== "undefined")
|
if (typeof data.flight !== "undefined")
|
||||||
this.flight = data.flight;
|
this.flight = data.flight;
|
||||||
|
@ -297,16 +308,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
|
||||||
this.squawk = data.squawk;
|
this.squawk = data.squawk;
|
||||||
if (typeof data.category !== "undefined")
|
if (typeof data.category !== "undefined")
|
||||||
this.category = data.category;
|
this.category = data.category;
|
||||||
|
|
||||||
this.position_from_mlat = false
|
|
||||||
if (typeof data.mlat !== "undefined") {
|
|
||||||
for (var i = 0; i < data.mlat.length; ++i) {
|
|
||||||
if (data.mlat[i] === "lat" || data.mlat[i] == "lon") {
|
|
||||||
this.position_from_mlat = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {
|
PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {
|
||||||
|
|
Loading…
Reference in a new issue