@ -567,50 +567,31 @@ export function useLayer({ enabled = false, opacity = 0.5, map = null }) {
const upperSegments = splitAtDateLine ( enhancedUpper ) ;
const upperSegments = splitAtDateLine ( enhancedUpper ) ;
const lowerSegments = splitAtDateLine ( enhancedLower ) ;
const lowerSegments = splitAtDateLine ( enhancedLower ) ;
// For each upper segment, find corresponding lower segment and create polygon
console . log ( '🔶 Enhanced DX Zone segments:' , {
// If there's only one segment in each, create single polygon
upperCount : upperSegments . length ,
if ( upperSegments . length === 1 && lowerSegments . length === 1 ) {
lowerCount : lowerSegments . length ,
// No date line crossing - create single polygon
upperSegmentLengths : upperSegments . map ( s => s . length ) ,
const enhancedZone = [ ... upperSegments [ 0 ] , ... lowerSegments [ 0 ] . reverse ( ) ] ;
lowerSegmentLengths : lowerSegments . map ( s => s . length )
const enhancedPoly = L . polygon ( enhancedZone , {
color : '#ffaa00' ,
fillColor : '#ffaa00' ,
fillOpacity : opacity * 0.15 ,
weight : 1 ,
opacity : opacity * 0.3
} ) ;
} ) ;
enhancedPoly . bindPopup ( `
< div style = "font-family: 'JetBrains Mono', monospace;" >
// Create polygon for each corresponding segment pair
< b > ⭐ Enhanced DX Zone < / b > < b r >
// Both upper and lower should have same number of segments
Best HF propagation window < br >
const numSegments = Math . min ( upperSegments . length , lowerSegments . length ) ;
± 5 ° from terminator < br >
Ideal for long - distance contacts
for ( let i = 0 ; i < numSegments ; i ++ ) {
< / d i v >
const upperSeg = upperSegments [ i ] ;
` );
const lowerSeg = lowerSegments [ i ] ;
enhancedPoly . addTo ( map ) ;
newLayers . push ( enhancedPoly ) ;
if ( upperSeg . length > 1 && lowerSeg . length > 1 ) {
} else {
// Create polygon from upper segment + reversed lower segment
// Date line crossing - create multiple polygons
const enhancedZone = [ ... upperSeg , ... lowerSeg . reverse ( ) ] ;
// Match segments by their longitude ranges
upperSegments . forEach ( ( upperSeg , i ) => {
console . log ( ` 🔶 Creating Enhanced DX polygon segment ${ i + 1 } / ${ numSegments } : ` , {
// Find matching lower segment with similar longitude range
upperPoints : upperSeg . length ,
const upperLons = upperSeg . map ( p => p [ 1 ] ) ;
lowerPoints : lowerSeg . length ,
const upperMinLon = Math . min ( ... upperLons ) ;
totalPolygonPoints : enhancedZone . length
const upperMaxLon = Math . max ( ... upperLons ) ;
// Find lower segment that overlaps with this upper segment
const matchingLowerSeg = lowerSegments . find ( lowerSeg => {
const lowerLons = lowerSeg . map ( p => p [ 1 ] ) ;
const lowerMinLon = Math . min ( ... lowerLons ) ;
const lowerMaxLon = Math . max ( ... lowerLons ) ;
// Check for longitude overlap
return ( lowerMinLon <= upperMaxLon && lowerMaxLon >= upperMinLon ) ||
( upperMinLon <= lowerMaxLon && upperMaxLon >= lowerMinLon ) ;
} ) ;
} ) ;
if ( matchingLowerSeg && matchingLowerSeg . length > 1 ) {
const enhancedZone = [ ... upperSeg , ... matchingLowerSeg . reverse ( ) ] ;
const enhancedPoly = L . polygon ( enhancedZone , {
const enhancedPoly = L . polygon ( enhancedZone , {
color : '#ffaa00' ,
color : '#ffaa00' ,
fillColor : '#ffaa00' ,
fillColor : '#ffaa00' ,
@ -629,7 +610,6 @@ export function useLayer({ enabled = false, opacity = 0.5, map = null }) {
enhancedPoly . addTo ( map ) ;
enhancedPoly . addTo ( map ) ;
newLayers . push ( enhancedPoly ) ;
newLayers . push ( enhancedPoly ) ;
}
}
} ) ;
}
}
}
}
}
}