Render local APRS symbol sprites with table and overlay details while preserving markers and open popups during refresh. Open the map around the local station with a 30 km radius and fit the densest station group without distant outliers. Add localization, attribution and regression coverage.
14 lines
748 B
JavaScript
14 lines
748 B
JavaScript
// APRS table identifiers and BPQ's row/column icon keys (APRSCode.c).
|
|
export function aprsSymbol(symset,symbol){
|
|
if(typeof symbol!=='string'||symbol.length!==1||symbol<'!'||symbol>'~'||!/^[/\\A-Z0-9]$/.test(symset||''))return null;
|
|
return {symbol,symset,table:symset==='/'?'primary':'alternate',overlay:/^[A-Z0-9]$/.test(symset)?symset:null};
|
|
}
|
|
export function nativeSymbol(key){
|
|
if(!/^[0-9a-f]{4}[@A-Z0-9]$/i.test(key||''))return null;
|
|
const row=parseInt(key.slice(0,2),16),col=parseInt(key.slice(2,4),16);
|
|
if(row>11||col>15)return null;
|
|
const index=(row%6)*16+col;if(index>93)return null;
|
|
const overlay=key[4]==='@'?null:key[4];if(overlay&&row<6)return null;
|
|
return aprsSymbol(overlay||(row<6?'/':'\\'),String.fromCharCode(33+index));
|
|
}
|