// -*- 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] } } var TypeDesignatorIcons = { 'A318': 'airliner', // shortened a320 'A319': 'airliner', // shortened a320 'A320': 'airliner', 'A321': 'airliner', // stretched a320 'A388': 'heavy_4e', // dubious since these are old-generation 737s // but the shape is similar 'B731': 'airliner', 'B732': 'airliner', 'B733': 'airliner', 'B734': 'airliner', 'B735': 'airliner', // these probably need reworking // since they vary in length 'B736': 'airliner', 'B737': 'airliner', 'B738': 'airliner', 'B739': 'airliner', 'B741': 'heavy_4e', 'B742': 'heavy_4e', 'B743': 'heavy_4e', 'B744': 'heavy_4e', 'B74D': 'heavy_4e', 'B74S': 'heavy_4e', 'B74R': 'heavy_4e', 'BLCF': 'heavy_2e', 'BSCA': 'heavy_4e', // hah! 'B748': 'heavy_4e', 'B772': 'heavy_2e', // all pretty similar except for length 'B77W': 'heavy_2e', 'B773': 'heavy_2e', 'B77L': 'heavy_2e', 'E170': 'jet_swept', 'E45X': 'jet_swept', 'B712': 'jet_swept', 'C650': 'jet_swept', 'C750': 'jet_swept', 'E135': 'jet_swept', 'E145': 'jet_swept', 'CL30': 'jet_swept', 'CL35': 'jet_swept', 'CL60': 'jet_swept', 'GL5T': 'jet_swept', 'GLF2': 'jet_swept', // close enough 'GLF3': 'jet_swept', 'GLF4': 'jet_swept', 'GLF5': 'jet_swept', 'GLF6': 'jet_swept', 'CRJ1': 'jet_swept', 'CRJ2': 'jet_swept', 'CRJ7': 'jet_swept', 'CRJ9': 'jet_swept', 'H25A': 'jet_swept', 'H25B': 'jet_swept', 'H25C': 'jet_swept', 'MD80': 'jet_swept', 'MD81': 'jet_swept', 'MD82': 'jet_swept', 'MD83': 'jet_swept', 'MD87': 'jet_swept', 'MD88': 'jet_swept', 'A37': 'hi_perf', 'A700': 'hi_perf', 'LEOP': 'hi_perf', 'ME62': 'hi_perf', 'T2': 'hi_perf', 'T37': 'hi_perf', 'T38': 'hi_perf', 'A10': 'hi_perf', 'A148': 'hi_perf', 'A3': 'hi_perf', 'A6': 'hi_perf', 'AJET': 'hi_perf', 'AT3': 'hi_perf', 'CKUO': 'hi_perf', 'EUFI': 'hi_perf', 'F1': 'hi_perf', 'F100': 'hi_perf', 'F111': 'hi_perf', 'F117': 'hi_perf', 'F14': 'hi_perf', 'F15': 'hi_perf', 'F18': 'hi_perf', 'F22': 'hi_perf', 'F22A': 'hi_perf', 'F4': 'hi_perf', 'F5': 'hi_perf', 'FOUG': 'hi_perf', 'J8A': 'hi_perf', 'J8B': 'hi_perf', 'JH7': 'hi_perf', 'LTNG': 'hi_perf', 'METR': 'hi_perf', 'MG19': 'hi_perf', 'MG25': 'hi_perf', 'MG29': 'hi_perf', 'MG31': 'hi_perf', 'MG44': 'hi_perf', 'MIR4': 'hi_perf', 'MT2': 'hi_perf', 'Q5': 'hi_perf', 'RFAL': 'hi_perf', 'S3': 'hi_perf', 'S37': 'hi_perf', 'SR71': 'hi_perf', 'SU15': 'hi_perf', 'SU24': 'hi_perf', 'SU25': 'hi_perf', 'SU27': 'hi_perf', 'T22M': 'hi_perf', 'T4': 'hi_perf', 'TOR': 'hi_perf', 'TU22': 'hi_perf', 'VAUT': 'hi_perf', 'WB57': 'hi_perf', 'Y130': 'hi_perf', 'YK28': 'hi_perf', // 'BE20': _b200, // 'C130': _c130, // 'C30J': _c130 }; // 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)); }