// // Features Management // function Features() { // Currently known features this.types = {}; // Colors used for features this.colors = { 'KiwiSDR' : '#800000', 'WebSDR' : '#000080', 'OpenWebRX' : '#006000' }; // Symbols used for features this.symbols = { 'KiwiSDR' : '⨺', 'WebSDR' : '◬', 'OpenWebRX' : '⨹', 'APRS' : '⚐', 'AIS' : '⩯', 'HFDL' : '✈' }; // Feature type shown/hidden status this.enabled = { 'KiwiSDR' : false, 'WebSDR' : false, 'OpenWebRX' : false }; } Features.prototype.getColor = function(type) { // Default color is black return type in this.colors? this.colors[type] : '#000000'; }; Features.prototype.getSymbol = function(type) { // Default symbol is a rombus return type in this.symbols? this.symbols[type] : '◇'; }; Features.prototype.isEnabled = function(type) { // Features are shown by default return type in this.enabled? this.enabled[type] : true; }; Features.prototype.toggle = function(map, markers, type, onoff) { // Keep track of each feature table being show or hidden this.enabled[type] = onoff; // Show or hide features on the map $.each(markers, function(_, r) { if (r.mode === type) r.setMap(onoff ? map : undefined); }); }; Features.prototype.addType = function(type) { // Do not add feature twice if (type in this.types) return; // Determine symbol and its color var color = this.getColor(type); var symbol = this.getSymbol(type); var enabled = this.isEnabled(type); // Add type to the list of known types this.types[type] = symbol; this.enabled[type] = enabled; // If there is a list of features... var $content = $(".openwebrx-map-legend").find('.features'); if($content) { // Add visual list item for the type $content.append( '