|
|
|
|
@ -1630,12 +1630,20 @@
|
|
|
|
|
// Add new DX paths if enabled
|
|
|
|
|
if (showDXPaths && dxPaths && dxPaths.length > 0) {
|
|
|
|
|
dxPaths.forEach((path, index) => {
|
|
|
|
|
try {
|
|
|
|
|
// Skip if missing or invalid coordinates
|
|
|
|
|
if (!path.spotterLat || !path.spotterLon || !path.dxLat || !path.dxLon) return;
|
|
|
|
|
if (isNaN(path.spotterLat) || isNaN(path.spotterLon) || isNaN(path.dxLat) || isNaN(path.dxLon)) return;
|
|
|
|
|
|
|
|
|
|
// Draw great circle line from spotter to DX station
|
|
|
|
|
const pathPoints = getGreatCirclePoints(
|
|
|
|
|
path.spotterLat, path.spotterLon,
|
|
|
|
|
path.dxLat, path.dxLon
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Skip if no valid path points
|
|
|
|
|
if (!pathPoints || !Array.isArray(pathPoints) || pathPoints.length === 0) return;
|
|
|
|
|
|
|
|
|
|
// Use different colors based on band (derived from frequency)
|
|
|
|
|
const freq = parseFloat(path.freq);
|
|
|
|
|
let color = '#4488ff'; // Default blue
|
|
|
|
|
@ -1650,15 +1658,20 @@
|
|
|
|
|
else if (freq >= 28 && freq < 30) color = '#9966ff'; // 10m - purple
|
|
|
|
|
else if (freq >= 50 && freq < 54) color = '#ff66ff'; // 6m - magenta
|
|
|
|
|
|
|
|
|
|
// Handle antimeridian crossing
|
|
|
|
|
const segments = Array.isArray(pathPoints[0]) ? pathPoints : [pathPoints];
|
|
|
|
|
// Handle antimeridian crossing - pathPoints may be array of segments or single segment
|
|
|
|
|
// Check if first element's first element is an array (segment structure) vs just [lat, lon]
|
|
|
|
|
const isSegmented = Array.isArray(pathPoints[0]) && pathPoints[0].length > 0 && Array.isArray(pathPoints[0][0]);
|
|
|
|
|
const segments = isSegmented ? pathPoints : [pathPoints];
|
|
|
|
|
|
|
|
|
|
segments.forEach(segment => {
|
|
|
|
|
if (segment && Array.isArray(segment) && segment.length > 1) {
|
|
|
|
|
const line = L.polyline(segment, {
|
|
|
|
|
color: color,
|
|
|
|
|
weight: 1.5,
|
|
|
|
|
opacity: 0.5
|
|
|
|
|
}).addTo(map);
|
|
|
|
|
dxPathsLinesRef.current.push(line);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Add small markers at DX station end only (to reduce clutter)
|
|
|
|
|
@ -1681,6 +1694,9 @@
|
|
|
|
|
`)
|
|
|
|
|
.addTo(map);
|
|
|
|
|
dxPathsMarkersRef.current.push(marker);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('[DX Paths] Error rendering path:', err, path);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, [dxPaths, showDXPaths]);
|
|
|
|
|
|