|
updateDetections() { |
|
const detections = document.getElementById('detections'); |
|
detections.innerHTML = Array.from(this.targets) |
|
.map(target => ` |
|
<div class="detection"> |
|
${target.type === 'aircraft' ? 'โ๏ธ' : '๐'} |
|
${target.id} |
|
${target.speed.toFixed(0)}kts |
|
${target.type === 'aircraft' ? `${target.altitude.toFixed(0)}ft` : ''} |
|
Signal: ${(target.signalStrength * 100).toFixed(0)}% |
|
Position: ${target.position.lat.toFixed(2)}ยฐ, ${target.position.lon.toFixed(2)}ยฐ |
|
</div> |
|
`).join(''); |
|
} |
|
|
|
updateSignalStrengths() { |
|
sdrStations.forEach(station => { |
|
const bar = document.querySelector(`#rx-${station.url.split(':')[0]} .signal-bar`); |
|
if(bar) { |
|
const strength = 40 + Math.random() * 60; |
|
bar.style.width = `${strength}%`; |
|
} |
|
}); |
|
} |
|
|
|
startTracking() { |
|
setInterval(() => { |
|
// ํ๊ฒ ์ถ๊ฐ/์ ๊ฑฐ |
|
if(Math.random() < 0.1 && this.targets.size < 15) { |
|
this.targets.add(this.generateTarget()); |
|
} |
|
if(Math.random() < 0.1 && this.targets.size > 0) { |
|
this.targets.delete(Array.from(this.targets)[0]); |
|
} |
|
|
|
// ๊ธฐ์กด ํ๊ฒ ์
๋ฐ์ดํธ (์์ง์ ์๋ฎฌ๋ ์ด์
) |
|
this.targets.forEach(target => { |
|
// ํ์ฌ ๋ฐฉํฅ์ผ๋ก ์ด๋ |
|
const speed = target.speed / 3600; // kts to degrees per second (approximate) |
|
const radians = target.heading * Math.PI / 180; |
|
|
|
target.position.lon += Math.sin(radians) * speed; |
|
target.position.lat += Math.cos(radians) * speed; |
|
|
|
// ํ๋ฉด ๊ฒฝ๊ณ ์ฒ๋ฆฌ |
|
if(target.position.lon > 180) target.position.lon -= 360; |
|
if(target.position.lon < -180) target.position.lon += 360; |
|
if(target.position.lat > 75) target.position.lat = 75; |
|
if(target.position.lat < -75) target.position.lat = -75; |
|
|
|
// ๊ฐ๋ ๋ฐฉํฅ ๋ณ๊ฒฝ |
|
if(Math.random() < 0.05) { |
|
target.heading += (Math.random() - 0.5) * 30; |
|
target.heading = (target.heading + 360) % 360; |
|
} |
|
|
|
// ์ ํธ ๊ฐ๋ ๋ณ๋ |
|
target.signalStrength = Math.max(0.1, Math.min(1, target.signalStrength + (Math.random() - 0.5) * 0.1)); |
|
}); |
|
|
|
this.drawWorldMap(); |
|
this.drawStations(); |
|
this.drawTargets(); |
|
this.updateDetections(); |
|
this.updateSignalStrengths(); |
|
}, 100); |
|
} |
|
} |
|
|
|
// Initialize global radar system |
|
const radar = new GlobalRadarSystem(); |
|
</script> |
|
</body> |
|
</html> |