Eigenstaendige GEOINT-Anwendung mit CesiumJS 3D-Globus. Echtzeit-Datenlayer: Flugverkehr (airplanes.live, 64 Stuetzpunkte), Schiffsverkehr (AISStream.io WebSocket), Erdbeben (USGS), Nachrichten (GDELT GEO). FastAPI Backend, taktisches Dark-UI.
72 Zeilen
2.7 KiB
JavaScript
72 Zeilen
2.7 KiB
JavaScript
/**
|
|
* Erdbeben-Layer: Farbige Kreise auf der Erdoberfläche.
|
|
*/
|
|
const QuakesLayer = {
|
|
_viewer: null,
|
|
_dataSource: null,
|
|
_interval: null,
|
|
_count: 0,
|
|
|
|
start(viewer) {
|
|
if (this._dataSource) return;
|
|
this._viewer = viewer;
|
|
this._dataSource = new Cesium.CustomDataSource('quakes');
|
|
viewer.dataSources.add(this._dataSource);
|
|
this._fetch();
|
|
var self = this;
|
|
this._interval = setInterval(function() { self._fetch(); }, 300000);
|
|
},
|
|
|
|
stop() {
|
|
if (this._interval) { clearInterval(this._interval); this._interval = null; }
|
|
if (this._dataSource && this._viewer) {
|
|
this._viewer.dataSources.remove(this._dataSource);
|
|
this._dataSource = null;
|
|
}
|
|
this._count = 0;
|
|
},
|
|
|
|
_fetch() {
|
|
var self = this;
|
|
fetch('/api/quakes')
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
if (!self._dataSource) return;
|
|
self._dataSource.entities.removeAll();
|
|
var features = data.features || [];
|
|
self._count = features.length;
|
|
var now = Date.now();
|
|
features.forEach(function(f) {
|
|
var c = f.geometry.coordinates;
|
|
var p = f.properties;
|
|
var mag = p.mag || 1;
|
|
var ageH = (now - p.time) / 3600000;
|
|
var color = ageH < 1
|
|
? Cesium.Color.RED.withAlpha(0.8)
|
|
: ageH < 6 ? Cesium.Color.ORANGE.withAlpha(0.7)
|
|
: ageH < 12 ? Cesium.Color.YELLOW.withAlpha(0.6)
|
|
: Cesium.Color.YELLOW.withAlpha(0.4);
|
|
var radius = Math.max(mag * 15000, 20000); // Meter
|
|
self._dataSource.entities.add({
|
|
position: Cesium.Cartesian3.fromDegrees(c[0], c[1]),
|
|
ellipse: {
|
|
semiMinorAxis: radius,
|
|
semiMajorAxis: radius,
|
|
material: color,
|
|
outline: true,
|
|
outlineColor: color.withAlpha(1.0),
|
|
outlineWidth: 1,
|
|
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
|
|
},
|
|
description: '<div style="font-family:monospace;font-size:12px;color:#ff6644">' +
|
|
'<strong>M' + mag.toFixed(1) + '</strong> ' + (p.place || '') + '<br>' +
|
|
'Tiefe: ' + (c[2] || '?') + ' km<br>' +
|
|
'Zeit: ' + new Date(p.time).toLocaleString('de-DE') +
|
|
'</div>',
|
|
});
|
|
});
|
|
})
|
|
.catch(function(e) { console.warn('Quakes fetch error:', e); });
|
|
},
|
|
};
|