|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<title>Hyperscan: Global SDR Radar(Simul)</title> |
|
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" /> |
|
<style> |
|
|
|
body { |
|
margin: 0; |
|
padding: 20px; |
|
background: #000; |
|
color: #0f0; |
|
font-family: monospace; |
|
overflow: hidden; |
|
} |
|
.container { |
|
display: grid; |
|
grid-template-columns: 300px 1fr; |
|
gap: 20px; |
|
} |
|
.sidebar { |
|
background: #111; |
|
padding: 15px; |
|
border-radius: 8px; |
|
height: calc(100vh - 40px); |
|
overflow-y: auto; |
|
} |
|
|
|
#map { |
|
height: calc(100vh - 40px); |
|
border-radius: 8px; |
|
background: #111; |
|
} |
|
|
|
.leaflet-tile-pane { |
|
filter: invert(1) hue-rotate(180deg); |
|
} |
|
.leaflet-container { |
|
background: #111 !important; |
|
} |
|
.leaflet-control-attribution { |
|
background: #222 !important; |
|
color: #666 !important; |
|
} |
|
.leaflet-popup-content-wrapper, |
|
.leaflet-popup-tip { |
|
background: #222 !important; |
|
color: #0f0 !important; |
|
} |
|
|
|
|
|
.receiver { |
|
margin: 10px 0; |
|
padding: 10px; |
|
background: #1a1a1a; |
|
border-radius: 4px; |
|
position: relative; |
|
} |
|
.status { |
|
display: flex; |
|
align-items: center; |
|
margin-bottom: 5px; |
|
} |
|
.led { |
|
width: 8px; |
|
height: 8px; |
|
border-radius: 50%; |
|
margin-right: 8px; |
|
} |
|
.active { |
|
background: #0f0; |
|
box-shadow: 0 0 10px #0f0; |
|
animation: pulse 2s infinite; |
|
} |
|
@keyframes pulse { |
|
0% { opacity: 1; } |
|
50% { opacity: 0.5; } |
|
100% { opacity: 1; } |
|
} |
|
.inactive { |
|
background: #f00; |
|
} |
|
.signal-strength { |
|
height: 4px; |
|
background: #222; |
|
margin-top: 5px; |
|
border-radius: 2px; |
|
} |
|
.signal-bar { |
|
height: 100%; |
|
background: #0f0; |
|
width: 50%; |
|
transition: width 0.3s; |
|
} |
|
|
|
|
|
.detection { |
|
padding: 5px; |
|
margin: 5px 0; |
|
font-size: 12px; |
|
border-left: 2px solid #0f0; |
|
} |
|
|
|
|
|
.alert { |
|
background: #911; |
|
padding: 5px; |
|
margin: 5px 0; |
|
border-left: 2px solid #f00; |
|
color: #f66; |
|
} |
|
|
|
|
|
.station-range { |
|
stroke: #0f0; |
|
stroke-width: 1; |
|
fill: #0f0; |
|
fill-opacity: 0.1; |
|
} |
|
.storm-range { |
|
stroke: #f00; |
|
stroke-width: 1; |
|
fill: #f00; |
|
fill-opacity: 0.1; |
|
} |
|
|
|
|
|
</style> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
|
|
<div class="sidebar"> |
|
<h2>Hyperscan: Global SDR Radar(Simul)</h2> |
|
|
|
<h3>SDR Receivers</h3> |
|
<div id="receivers"></div> |
|
|
|
<h3>Real-time Detections</h3> |
|
<div id="detections"></div> |
|
|
|
<h3>Events</h3> |
|
<div id="events"></div> |
|
</div> |
|
|
|
|
|
<div id="map"></div> |
|
</div> |
|
|
|
|
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> |
|
<script> |
|
|
|
const sdrStations = [ |
|
{ |
|
name: "Twente WebSDR", |
|
url: "websdr.ewi.utwente.nl:8901", |
|
location: [52.2389, 6.8343], |
|
frequency: "0-29.160 MHz", |
|
range: 200, |
|
active: true |
|
}, |
|
{ |
|
name: "KiwiSDR Switzerland", |
|
url: "hb9ryz.no-ip.org:8073", |
|
location: [47.3769, 8.5417], |
|
frequency: "0-30 MHz", |
|
range: 160, |
|
active: true |
|
}, |
|
{ |
|
name: "SUWS WebSDR UK", |
|
url: "websdr.suws.org.uk", |
|
location: [51.2785, -0.7642], |
|
frequency: "0-30 MHz", |
|
range: 150, |
|
active: true |
|
} |
|
]; |
|
|
|
|
|
class RadarSystem { |
|
constructor() { |
|
|
|
this.stormActive = false; |
|
|
|
this.stormCenter = [50.5, 5.0]; |
|
|
|
this.stormRadius = 200; |
|
|
|
|
|
this.targets = new Map(); |
|
|
|
this.targetMarkers = new Map(); |
|
|
|
this.targetSignalLines = new Map(); |
|
|
|
|
|
this.eventsLog = []; |
|
|
|
this.initializeMap(); |
|
this.renderReceivers(); |
|
this.startTracking(); |
|
} |
|
|
|
|
|
initializeMap() { |
|
this.map = L.map('map', { |
|
center: [51.5, 5.0], |
|
zoom: 5, |
|
worldCopyJump: true |
|
}); |
|
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
|
maxZoom: 19, |
|
attribution: 'ยฉ OpenStreetMap contributors' |
|
}).addTo(this.map); |
|
|
|
|
|
sdrStations.forEach(st => { |
|
|
|
const stationMarker = L.circleMarker(st.location, { |
|
radius: 5, |
|
color: '#0f0', |
|
fillColor: '#0f0', |
|
fillOpacity: 1 |
|
}).addTo(this.map); |
|
|
|
|
|
const coverage = L.circle(st.location, { |
|
radius: st.range * 1000, |
|
className: 'station-range' |
|
}).addTo(this.map); |
|
|
|
|
|
stationMarker.bindTooltip(` |
|
<b>${st.name}</b><br/> |
|
Frequency: ${st.frequency}<br/> |
|
Range: ${st.range} km |
|
`); |
|
}); |
|
} |
|
|
|
|
|
renderReceivers() { |
|
const container = document.getElementById('receivers'); |
|
container.innerHTML = sdrStations.map(st => ` |
|
<div class="receiver" id="rx-${st.url.split(':')[0]}"> |
|
<div class="status"> |
|
<div class="led ${st.active ? 'active' : 'inactive'}"></div> |
|
<strong>${st.name}</strong> |
|
</div> |
|
<div>๐ก ${st.url}</div> |
|
<div>๐ป ${st.frequency}</div> |
|
<div>๐ ${st.location.join(', ')}</div> |
|
<div>Range: ${st.range}km</div> |
|
<div class="signal-strength"> |
|
<div class="signal-bar"></div> |
|
</div> |
|
</div> |
|
`).join(''); |
|
} |
|
|
|
|
|
addEventLog(msg) { |
|
this.eventsLog.push(msg); |
|
const eventsDiv = document.getElementById('events'); |
|
eventsDiv.innerHTML += `<div class="alert">${msg}</div>`; |
|
|
|
if (this.eventsLog.length > 15) { |
|
this.eventsLog.shift(); |
|
eventsDiv.removeChild(eventsDiv.firstChild); |
|
} |
|
} |
|
|
|
|
|
toggleStorm() { |
|
this.stormActive = !this.stormActive; |
|
const msg = this.stormActive |
|
? "ํญํ ๋ฐ์! (๊ต๋ ๊ฐ๋ฅ)" |
|
: "ํญํ์ด ์๋ฉธ๋์์ต๋๋ค."; |
|
this.addEventLog(msg); |
|
|
|
|
|
|
|
if (this.stormCircle) { |
|
this.map.removeLayer(this.stormCircle); |
|
} |
|
|
|
if (this.stormActive) { |
|
this.stormCircle = L.circle(this.stormCenter, { |
|
radius: this.stormRadius * 1000, |
|
className: 'storm-range' |
|
}).addTo(this.map); |
|
} |
|
} |
|
|
|
|
|
generateTarget() { |
|
const lat = 51.5 + (Math.random()-0.5)*6; |
|
const lon = 5.0 + (Math.random()-0.5)*10; |
|
return { |
|
id: Math.random().toString(36).substr(2, 6).toUpperCase(), |
|
type: Math.random() > 0.7 ? 'aircraft' : 'vehicle', |
|
lat, |
|
lon, |
|
speed: Math.floor(Math.random()*200 + 100), |
|
altitude: Math.floor(Math.random()*30000 + 1000), |
|
heading: Math.random()*360, |
|
signalStrength: Math.random() |
|
}; |
|
} |
|
|
|
|
|
moveTarget(t) { |
|
|
|
const speedFactor = 0.00005; |
|
const rad = t.heading * Math.PI / 180; |
|
t.lat += Math.cos(rad) * t.speed * speedFactor; |
|
t.lon += Math.sin(rad) * t.speed * speedFactor; |
|
|
|
|
|
if (this.stormActive) { |
|
const distStorm = this.getDistance( |
|
t.lat, t.lon, |
|
this.stormCenter[0], this.stormCenter[1] |
|
); |
|
if (distStorm <= this.stormRadius) { |
|
t.signalStrength = Math.max(0, t.signalStrength - 0.01); |
|
} |
|
} |
|
} |
|
|
|
|
|
getDistance(lat1, lon1, lat2, lon2) { |
|
const R = 6371; |
|
const dLat = (lat2 - lat1) * Math.PI/180; |
|
const dLon = (lon2 - lon1) * Math.PI/180; |
|
const a = Math.sin(dLat/2)*Math.sin(dLat/2) |
|
+ Math.cos(lat1*Math.PI/180)*Math.cos(lat2*Math.PI/180) |
|
* Math.sin(dLon/2)*Math.sin(dLon/2); |
|
return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); |
|
} |
|
|
|
|
|
updateTargetsOnMap() { |
|
|
|
this.targetSignalLines.forEach(line => { |
|
this.map.removeLayer(line); |
|
}); |
|
this.targetSignalLines.clear(); |
|
|
|
|
|
this.targets.forEach((t, id) => { |
|
|
|
let marker = this.targetMarkers.get(id); |
|
if (!marker) { |
|
marker = L.circleMarker([t.lat, t.lon], { |
|
radius: 4, |
|
color: (t.type === 'aircraft') ? '#ff0' : '#0ff', |
|
fillColor: (t.type === 'aircraft') ? '#ff0' : '#0ff', |
|
fillOpacity: 1 |
|
}).addTo(this.map); |
|
|
|
|
|
marker.bindTooltip(this.makeTargetTooltip(t), { sticky: true }); |
|
this.targetMarkers.set(id, marker); |
|
} else { |
|
|
|
marker.setLatLng([t.lat, t.lon]); |
|
marker.setTooltipContent(this.makeTargetTooltip(t)); |
|
|
|
marker.setStyle({ |
|
color: (t.type === 'aircraft') ? '#ff0' : '#0ff', |
|
fillColor: (t.type === 'aircraft') ? '#ff0' : '#0ff' |
|
}); |
|
} |
|
|
|
|
|
sdrStations.forEach(st => { |
|
if (st.active) { |
|
const dist = this.getDistance(t.lat, t.lon, st.location[0], st.location[1]); |
|
if (dist <= st.range) { |
|
const line = L.polyline([ |
|
[t.lat, t.lon], |
|
st.location |
|
], { |
|
color: '#0f0', |
|
opacity: t.signalStrength * 0.3, |
|
weight: 1 |
|
}).addTo(this.map); |
|
this.targetSignalLines.set(`${id}-${st.name}`, line); |
|
} |
|
} |
|
}); |
|
}); |
|
} |
|
|
|
|
|
makeTargetTooltip(t) { |
|
return ` |
|
<b>${t.id}</b><br/> |
|
Type: ${t.type}<br/> |
|
Speed: ${t.speed} kts<br/> |
|
${t.type === 'aircraft' ? `Alt: ${t.altitude} ft<br/>` : ''} |
|
Sig: ${(t.signalStrength*100).toFixed(0)}% |
|
`; |
|
} |
|
|
|
|
|
updateDetections() { |
|
const detections = document.getElementById('detections'); |
|
let html = ''; |
|
this.targets.forEach(t => { |
|
html += ` |
|
<div class="detection"> |
|
${t.type === 'aircraft' ? 'โ๏ธ' : '๐'} |
|
${t.id} |
|
${t.type === 'aircraft' ? `Alt: ${t.altitude}ft` : ''} |
|
Speed: ${t.speed}kts |
|
Sig: ${(t.signalStrength*100).toFixed(0)}% |
|
</div> |
|
`; |
|
}); |
|
detections.innerHTML = html; |
|
} |
|
|
|
|
|
updateSignalStrengths() { |
|
sdrStations.forEach(st => { |
|
const bar = document.querySelector(`#rx-${st.url.split(':')[0]} .signal-bar`); |
|
if (bar) { |
|
const strength = 40 + Math.random() * 60; |
|
bar.style.width = `${strength}%`; |
|
} |
|
}); |
|
} |
|
|
|
|
|
startTracking() { |
|
|
|
setInterval(() => { |
|
if (Math.random() < 0.2) { |
|
this.toggleStorm(); |
|
} |
|
}, 10000); |
|
|
|
|
|
setInterval(() => { |
|
|
|
if (Math.random() < 0.1 && this.targets.size < 15) { |
|
const newT = this.generateTarget(); |
|
this.targets.set(newT.id, newT); |
|
this.addEventLog(`ํ๊ฒ ์ถํ: ${newT.id}`); |
|
} |
|
|
|
if (Math.random() < 0.1 && this.targets.size > 0) { |
|
|
|
const firstKey = Array.from(this.targets.keys())[0]; |
|
this.removeTarget(firstKey); |
|
} |
|
|
|
|
|
this.targets.forEach((t, id) => { |
|
this.moveTarget(t); |
|
}); |
|
|
|
|
|
this.updateTargetsOnMap(); |
|
|
|
this.updateDetections(); |
|
|
|
this.updateSignalStrengths(); |
|
}, 100); |
|
} |
|
|
|
|
|
removeTarget(id) { |
|
const removed = this.targets.get(id); |
|
if (!removed) return; |
|
this.targets.delete(id); |
|
this.addEventLog(`ํ๊ฒ ์๋ฉธ: ${removed.id}`); |
|
|
|
|
|
const marker = this.targetMarkers.get(id); |
|
if (marker) { |
|
this.map.removeLayer(marker); |
|
this.targetMarkers.delete(id); |
|
} |
|
|
|
[...this.targetSignalLines.keys()].forEach(k => { |
|
if (k.includes(id)) { |
|
this.map.removeLayer(this.targetSignalLines.get(k)); |
|
this.targetSignalLines.delete(k); |
|
} |
|
}); |
|
} |
|
} |
|
|
|
|
|
window.addEventListener('load', () => { |
|
const radar = new RadarSystem(); |
|
}); |
|
</script> |
|
</body> |
|
</html> |
|
|