PANEL (links): - 240px breit (war 200px) - Checkboxen 16x16px (war 12x12) - Dots 10px (war 8px) - Layer-Namen 13px (war 11px) - Counts 12px (war 10px) - Mehr Padding pro Toggle-Zeile INFOBOX (bei Klick): - Links neben dem Panel platziert (254px vom Rand) - 420px breit, max 60vh hoch, scrollbar - Kollidiert nicht mit Panel oder Sidebar - Groesserer Titel (14px), mehr Padding PUNKTE AUF DEM GLOBUS: - Flugzeuge: 3/4/5px (war 2/2.5/3) - Schiffe: 3/4/5px (war 2/2.5/3) - Militaer: 6px (war 4) - Katastrophen: 10px (war 8) - Erdbeben: 6-15px (war 4-10) - GDELT: 7px (war 5) - ISS: 14px (war 10) - Cluster: +30% groesser HEADER + FOOTER: - Header 48px (war 44px) - Footer 32px (war 28px) - Titel 15px, Stats 12px - Lage-Select + Suche groesser
66 Zeilen
2.5 KiB
JavaScript
66 Zeilen
2.5 KiB
JavaScript
/**
|
|
* GDELT Nachrichten-Layer: Geokodierte Echtzeit-News.
|
|
*/
|
|
const GdeltLayer = {
|
|
_viewer: null,
|
|
_dataSource: null,
|
|
_interval: null,
|
|
_count: 0,
|
|
|
|
start(viewer) {
|
|
if (this._dataSource) return;
|
|
this._viewer = viewer;
|
|
this._dataSource = new Cesium.CustomDataSource('gdelt');
|
|
viewer.dataSources.add(this._dataSource);
|
|
this._fetch();
|
|
var self = this;
|
|
this._interval = setInterval(function() { self._fetch(); }, 600000);
|
|
},
|
|
|
|
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;
|
|
var loadEl = document.getElementById('loading-gdelt');
|
|
var statusEl = document.getElementById('status-gdelt');
|
|
if (loadEl) loadEl.classList.add('active');
|
|
if (statusEl) { statusEl.textContent = 'Lade Daten...'; statusEl.classList.add('active'); }
|
|
fetch('/api/gdelt')
|
|
.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;
|
|
features.forEach(function(f) {
|
|
var c = f.geometry.coordinates;
|
|
var p = f.properties || {};
|
|
var title = (p.name || p.title || 'Nachricht').substring(0, 80);
|
|
var url = p.url || '';
|
|
self._dataSource.entities.add({
|
|
position: Cesium.Cartesian3.fromDegrees(c[0], c[1]),
|
|
point: {
|
|
pixelSize: 7,
|
|
color: Cesium.Color.fromCssColorString('#ff8800'),
|
|
outlineColor: Cesium.Color.fromCssColorString('#663300'),
|
|
outlineWidth: 1,
|
|
heightReference: Cesium.HeightReference.NONE,
|
|
},
|
|
description: '<div style="font-family:monospace;font-size:12px;color:#ff8800">' +
|
|
'<strong>' + title + '</strong>' +
|
|
(url ? '<br><a href="' + url + '" target="_blank" style="color:#44aaff">Quelle</a>' : '') +
|
|
'</div>',
|
|
});
|
|
});
|
|
})
|
|
.catch(function(e) { console.warn('GDELT fetch error:', e); });
|
|
},
|
|
};
|