// -*- mode: javascript; indent-tabs-mode: nil; c-basic-offset: 8 -*- "use strict"; // FA icons var shapes = { 'airliner': { svg: 'airliner_live', size: [25,26] }, 'balloon': { svg: 'balloon_live', size: [9,13], noRotate: true }, 'cessna': { svg: 'cessna_live', size: [17,13] }, 'heavy_2e': { svg: 'heavy_2e_live', size: [28,29] }, 'heavy_4e': { svg: 'heavy_4e_live', size: [28,30] }, 'helicopter': { svg: 'helicopter_live', size: [16,18] }, 'hi_perf': { svg: 'hi_perf_live', size: [15,21] }, 'jet_nonswept': { svg: 'jet_nonswept_live', size: [18,18] }, 'jet_swept': { svg: 'jet_swept_live', size: [18,24] }, 'twin_large': { svg: 'twin_large_live', size: [21,20] }, 'twin_small': { svg: 'twin_small_live', size: [19,16] }, 'ground_emergency': { svg: 'emergency_dark', size: [6, 15] }, 'ground_service': { svg: 'service_dark', size: [6, 15] }, 'ground_unknown': { svg: 'unknown_dark', size: [6, 15] }, 'ground_fixed': { svg: 'fixed_dark', size: [12, 12] }, 'unknown': { svg: 'unknown_live', size: [17,17] } } // Mechanically generated exceptions to the general rules below var TypeDesignatorIcons = { 'A10': 'hi_perf', 'A148': 'hi_perf', 'A225': 'heavy_4e', 'A3': 'hi_perf', 'A37': 'jet_nonswept', 'A5': 'cessna', 'A6': 'hi_perf', 'A700': 'jet_nonswept', 'AC80': 'twin_small', 'AC90': 'twin_small', 'AC95': 'twin_small', 'AJ27': 'jet_nonswept', 'AJET': 'hi_perf', 'AN28': 'twin_small', 'ARCE': 'hi_perf', 'AT3': 'hi_perf', 'ATG1': 'jet_nonswept', 'B18T': 'twin_small', 'B190': 'twin_small', 'B25': 'twin_large', 'B350': 'twin_small', 'B52': 'heavy_4e', 'B712': 'jet_swept', 'B721': 'airliner', 'B722': 'airliner', 'BALL': 'balloon', 'BE10': 'twin_small', 'BE20': 'twin_small', 'BE30': 'twin_small', 'BE32': 'twin_small', 'BE40': 'jet_nonswept', 'BE99': 'twin_small', 'BE9L': 'twin_small', 'BE9T': 'twin_small', 'BN2T': 'twin_small', 'BPOD': 'jet_swept', 'BU20': 'twin_small', 'C08T': 'jet_swept', 'C125': 'twin_small', 'C212': 'twin_small', 'C21T': 'twin_small', 'C22J': 'jet_nonswept', 'C25A': 'jet_nonswept', 'C25B': 'jet_nonswept', 'C25C': 'jet_nonswept', 'C25M': 'jet_nonswept', 'C425': 'twin_small', 'C441': 'twin_small', 'C46': 'twin_large', 'C500': 'jet_nonswept', 'C501': 'jet_nonswept', 'C510': 'jet_nonswept', 'C525': 'jet_nonswept', 'C526': 'jet_nonswept', 'C550': 'jet_nonswept', 'C551': 'jet_nonswept', 'C55B': 'jet_nonswept', 'C560': 'jet_nonswept', 'C56X': 'jet_nonswept', 'C650': 'jet_swept', 'C680': 'jet_nonswept', 'C68A': 'jet_nonswept', 'C750': 'jet_swept', 'C82': 'twin_large', 'CKUO': 'hi_perf', 'CL30': 'jet_swept', 'CL35': 'jet_swept', 'CL60': 'jet_swept', 'CRJ1': 'jet_swept', 'CRJ2': 'jet_swept', 'CRJ7': 'jet_swept', 'CRJ9': 'jet_swept', 'CRJX': 'jet_swept', 'CVLP': 'twin_large', 'D228': 'twin_small', 'DA36': 'hi_perf', 'DA50': 'airliner', 'DC10': 'heavy_2e', 'DC3': 'twin_large', 'DC3S': 'twin_large', 'DHA3': 'twin_small', 'DHC4': 'twin_large', 'DHC6': 'twin_small', 'DLH2': 'hi_perf', 'E110': 'twin_small', 'E135': 'jet_swept', 'E145': 'jet_swept', 'E29E': 'hi_perf', 'E45X': 'jet_swept', 'E500': 'jet_nonswept', 'E50P': 'jet_nonswept', 'E545': 'jet_swept', 'E55P': 'jet_nonswept', 'EA50': 'jet_nonswept', 'EFAN': 'jet_nonswept', 'EFUS': 'hi_perf', 'ELIT': 'jet_nonswept', 'EUFI': 'hi_perf', 'F1': 'hi_perf', 'F100': 'jet_swept', 'F111': 'hi_perf', 'F117': 'hi_perf', 'F14': 'hi_perf', 'F15': 'hi_perf', 'F22': 'hi_perf', 'F2TH': 'jet_swept', 'F4': 'hi_perf', 'F406': 'twin_small', 'F5': 'hi_perf', 'F900': 'jet_swept', 'FA50': 'jet_swept', 'FA5X': 'jet_swept', 'FA7X': 'jet_swept', 'FA8X': 'jet_swept', 'FJ10': 'jet_nonswept', 'FOUG': 'jet_nonswept', 'FURY': 'hi_perf', 'G3': 'airliner', 'GENI': 'hi_perf', 'GL5T': 'jet_swept', 'GLF2': 'jet_swept', 'GLF3': 'jet_swept', 'GLF4': 'jet_swept', 'GLF5': 'jet_swept', 'GLF6': 'jet_swept', 'GSPN': 'jet_nonswept', 'H25A': 'jet_swept', 'H25B': 'jet_swept', 'H25C': 'jet_swept', 'HA4T': 'airliner', 'HDJT': 'jet_nonswept', 'HERN': 'jet_swept', 'J8A': 'hi_perf', 'J8B': 'hi_perf', 'JH7': 'hi_perf', 'JS31': 'twin_small', 'JS32': 'twin_small', 'JU52': 'twin_small', 'L101': 'heavy_2e', 'LAE1': 'hi_perf', 'LEOP': 'jet_nonswept', 'LJ23': 'jet_nonswept', 'LJ24': 'jet_nonswept', 'LJ25': 'jet_nonswept', 'LJ28': 'jet_nonswept', 'LJ31': 'jet_nonswept', 'LJ35': 'jet_nonswept', 'LJ40': 'jet_nonswept', 'LJ45': 'jet_nonswept', 'LJ55': 'jet_nonswept', 'LJ60': 'jet_nonswept', 'LJ70': 'jet_nonswept', 'LJ75': 'jet_nonswept', 'LJ85': 'jet_nonswept', 'LTNG': 'hi_perf', 'M28': 'twin_small', 'MD11': 'heavy_2e', 'MD81': 'jet_swept', 'MD82': 'jet_swept', 'MD83': 'jet_swept', 'MD87': 'jet_swept', 'MD88': 'jet_swept', 'MD90': 'jet_swept', 'ME62': 'jet_nonswept', 'METR': 'hi_perf', 'MG19': 'hi_perf', 'MG25': 'hi_perf', 'MG29': 'hi_perf', 'MG31': 'hi_perf', 'MG44': 'hi_perf', 'MH02': 'jet_nonswept', 'MS76': 'jet_nonswept', 'MT2': 'hi_perf', 'MU2': 'twin_small', 'P180': 'twin_small', 'P2': 'twin_large', 'P68T': 'twin_small', 'PA47': 'jet_nonswept', 'PAT4': 'twin_small', 'PAY1': 'twin_small', 'PAY2': 'twin_small', 'PAY3': 'twin_small', 'PAY4': 'twin_small', 'PIAE': 'hi_perf', 'PIT4': 'hi_perf', 'PITE': 'hi_perf', 'PRM1': 'jet_nonswept', 'PRTS': 'jet_nonswept', 'Q5': 'hi_perf', 'R721': 'airliner', 'R722': 'airliner', 'RFAL': 'hi_perf', 'ROAR': 'hi_perf', 'S3': 'hi_perf', 'S32E': 'hi_perf', 'S37': 'hi_perf', 'S601': 'jet_nonswept', 'SATA': 'jet_nonswept', 'SB05': 'jet_nonswept', 'SC7': 'twin_small', 'SF50': 'jet_nonswept', 'SJ30': 'jet_nonswept', 'SLCH': 'heavy_4e', 'SM60': 'twin_small', 'SOL1': 'jet_swept', 'SOL2': 'jet_swept', 'SP33': 'jet_nonswept', 'SR71': 'hi_perf', 'SS2': 'hi_perf', 'SU15': 'hi_perf', 'SU24': 'hi_perf', 'SU25': 'hi_perf', 'SU27': 'hi_perf', 'SW2': 'twin_small', 'SW3': 'twin_small', 'SW4': 'twin_small', 'T154': 'airliner', 'T2': 'jet_nonswept', 'T22M': 'hi_perf', 'T37': 'jet_nonswept', 'T38': 'jet_nonswept', 'T4': 'hi_perf', 'TJET': 'jet_nonswept', 'TOR': 'hi_perf', 'TRIM': 'twin_small', 'TRIS': 'twin_small', 'TRMA': 'twin_small', 'TU22': 'hi_perf', 'VAUT': 'hi_perf', 'Y130': 'hi_perf', 'Y141': 'airliner', 'YK28': 'hi_perf', 'YK38': 'airliner', 'YK40': 'airliner', 'YK42': 'airliner', 'YURO': 'hi_perf' }; // Maps ICAO aircraft type description codes (e.g. "L2J") to aircraft icons. This is used if the ICAO type designator (e.g. "B731") // cannot be found in the TypeDesignatorIcons mappings. The key can be one of the following: // - Single character: The basic aircraft type letter code (e.g. "H" for helicopter). // - Three characters: The ICAO type description code (e.g. "L2J" for landplanes with 2 jet engines). // - Five characters: The ICAO type description code concatenated with the wake turbulence category code, separated by // a dash (e.g. "L2J-M"). var TypeDescriptionIcons = { 'H': 'helicopter', 'L1P': 'cessna', 'L1T': 'cessna', 'L1J': 'hi_perf', 'L2P': 'twin_small', 'L2T': 'twin_large', 'L2J-L': 'jet_swept', 'L2J-M': 'airliner', 'L2J-H': 'heavy_2e', 'L4T': 'heavy_4e', 'L4J-H': 'heavy_4e' }; var CategoryIcons = { "A1" : 'cessna', "A2" : 'jet_nonswept', "A3" : 'airliner', "A5" : 'heavy_4e', "A7" : 'helicopter', "B2" : 'balloon', 'C0' : 'ground_unknown', 'C1' : 'ground_emergency', 'C2' : 'ground_service', 'C3' : 'ground_fixed' }; function getBaseMarker(category, typeDesignator, typeDescription, wtc) { if (typeDesignator in TypeDesignatorIcons) { return shapes[TypeDesignatorIcons[typeDesignator]]; } if (typeDescription !== undefined && typeDescription !== null && typeDescription.length === 3) { if (wtc !== undefined && wtc !== null && wtc.length === 1) { var typeDescriptionWithWtc = typeDescription + "-" + wtc; if (typeDescriptionWithWtc in TypeDescriptionIcons) { return shapes[TypeDescriptionIcons[typeDescriptionWithWtc]]; } } if (typeDescription in TypeDescriptionIcons) { return shapes[TypeDescriptionIcons[typeDescription]]; } var basicType = typeDescription.charAt(0); if (basicType in TypeDescriptionIcons) { return shapes[TypeDescriptionIcons[basicType]]; } } if (category in CategoryIcons) { return shapes[CategoryIcons[category]]; } return shapes['unknown']; } function svgPathToSvg(path, stroke, fill, selected_stroke) { path = path.replace('aircraft_color_fill', fill).replace('aircraft_color_stroke', stroke).replace('add_stroke_selected', selected_stroke); return path; } function svgPathToURI(path, stroke, fill, selected_stroke) { return "data:image/svg+xml;base64," + btoa(svgPathToSvg(path, stroke, fill, selected_stroke)); }