Add aircraft type information to planeObject

This commit is contained in:
Carlos Salaverria 2016-08-29 10:07:03 -05:00
parent 812de53ec1
commit d17f027035
2 changed files with 15 additions and 3 deletions

View file

@ -89,9 +89,7 @@ function lookupIcaoAircraftType(aircraftData, defer) {
if (typeDesignator in _aircraft_type_cache) {
var typeData = _aircraft_type_cache[typeDesignator];
if (typeData.desc != undefined && typeData.desc != null && typeData.desc.length == 3) {
aircraftData.aircraftTypeCode = typeData.desc.charAt(0);
aircraftData.engineCount = parseInt(typeData.desc.charAt(1));
aircraftData.engineTypeCode = typeData.desc.charAt(2);
aircraftData.desc = typeData.desc;
}
aircraftData.wtc = typeData.wtc;
}

View file

@ -46,6 +46,10 @@ function PlaneObject(icao) {
// request metadata
this.registration = null;
this.icaotype = null;
this.aircraftTypeCode = null;
this.engineCount = null;
this.engineType = null;
this.wtc = null;
getAircraftData(this.icao).done(function(data) {
if ("r" in data) {
this.registration = data.r;
@ -55,6 +59,16 @@ function PlaneObject(icao) {
this.icaotype = data.t;
}
if ("desc" in data) {
this.aircraftTypeCode = data.desc.charAt(0);
this.engineCount = parseInt(data.desc.charAt(1));
this.engineTypeCode = data.desc.charAt(2);
}
if ("wtc" in data) {
this.wtc = data.wtc;
}
if (this.selected) {
refreshSelected();
}