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