[feat](trx-frontend-http): draw radio path from each receiver location

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-26 18:57:41 +01:00
parent 10b1512d75
commit 1a744e427a
@@ -4246,7 +4246,7 @@ let aprsMap = null;
let aprsMapBaseLayer = null; let aprsMapBaseLayer = null;
let aprsMapReceiverMarker = null; let aprsMapReceiverMarker = null;
let aprsMapReceiverMarkers = {}; // keyed by rig remote id let aprsMapReceiverMarkers = {}; // keyed by rig remote id
let aprsRadioPath = null; let aprsRadioPaths = [];
let selectedLocatorMarker = null; let selectedLocatorMarker = null;
let selectedLocatorPulseRaf = null; let selectedLocatorPulseRaf = null;
let mapFullscreenListenerBound = false; let mapFullscreenListenerBound = false;
@@ -4880,10 +4880,8 @@ function startSelectedLocatorPulse(marker) {
} }
function clearMapRadioPath() { function clearMapRadioPath() {
if (aprsRadioPath) { for (const p of aprsRadioPaths) p.remove();
aprsRadioPath.remove(); aprsRadioPaths = [];
aprsRadioPath = null;
}
} }
function clearDecodeContactPathRender(entry) { function clearDecodeContactPathRender(entry) {
@@ -5025,19 +5023,27 @@ function syncDecodeContactPathVisibility() {
updateMapPathsAnimationClass(); updateMapPathsAnimationClass();
} }
function _resolveReceiverLocation(rigIds) { function _resolveReceiverLocations(rigIds) {
// Try to find location from the specific rig(s) that decoded this message // Return all unique receiver locations for the given rig(s)
const seen = new Set();
const locations = [];
if (rigIds && rigIds.size) { if (rigIds && rigIds.size) {
for (const rid of rigIds) { for (const rid of rigIds) {
const rig = serverRigs.find(r => r.remote === rid); const rig = serverRigs.find(r => r.remote === rid);
if (rig && rig.latitude != null && rig.longitude != null) { if (rig && rig.latitude != null && rig.longitude != null) {
return [rig.latitude, rig.longitude]; const key = _receiverLocationKey(rig.latitude, rig.longitude);
if (!seen.has(key)) {
seen.add(key);
locations.push([rig.latitude, rig.longitude]);
} }
} }
} }
// Fall back to active rig location }
if (serverLat != null && serverLon != null) return [serverLat, serverLon]; // Fall back to active rig location if no specific locations found
return null; if (locations.length === 0 && serverLat != null && serverLon != null) {
locations.push([serverLat, serverLon]);
}
return locations;
} }
function setMapRadioPathTo(lat, lon, color, className = "aprs-radio-path", rigIds) { function setMapRadioPathTo(lat, lon, color, className = "aprs-radio-path", rigIds) {
@@ -5045,12 +5051,15 @@ function setMapRadioPathTo(lat, lon, color, className = "aprs-radio-path", rigId
if (!mapP2pRadioPathsEnabled || !Number.isFinite(lat) || !Number.isFinite(lon) || !aprsMap) { if (!mapP2pRadioPathsEnabled || !Number.isFinite(lat) || !Number.isFinite(lon) || !aprsMap) {
return; return;
} }
const src = _resolveReceiverLocation(rigIds); const sources = _resolveReceiverLocations(rigIds);
if (!src) return; for (const src of sources) {
aprsRadioPath = L.polyline( aprsRadioPaths.push(
L.polyline(
[src, [lat, lon]], [src, [lat, lon]],
{ color, opacity: 0.85, weight: 2, interactive: false, className } { color, opacity: 0.85, weight: 2, interactive: false, className }
).addTo(aprsMap); ).addTo(aprsMap)
);
}
} }
function locatorMarkerCenter(marker) { function locatorMarkerCenter(marker) {