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
64 Zeilen
3.1 KiB
JavaScript
64 Zeilen
3.1 KiB
JavaScript
const InfraLayer = {
|
|
_viewer: null, _points: null, _labels: null, _count: 0,
|
|
|
|
start(viewer) {
|
|
if (this._points) return;
|
|
this._viewer = viewer;
|
|
this._points = viewer.scene.primitives.add(new Cesium.PointPrimitiveCollection());
|
|
this._labels = viewer.scene.primitives.add(new Cesium.LabelCollection());
|
|
this._fetchNuclear();
|
|
this._fetchBases();
|
|
},
|
|
|
|
stop() {
|
|
if (this._points && this._viewer) { this._viewer.scene.primitives.remove(this._points); this._points = null; }
|
|
if (this._labels && this._viewer) { this._viewer.scene.primitives.remove(this._labels); this._labels = null; }
|
|
this._count = 0;
|
|
},
|
|
|
|
_fetchNuclear() {
|
|
var self = this;
|
|
fetch('/api/nuclear-plants')
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
var yellow = Cesium.Color.fromCssColorString('#ffdd00');
|
|
(data.plants || []).forEach(function(p) {
|
|
self._points.add({ position: Cesium.Cartesian3.fromDegrees(p.lon, p.lat, 0), pixelSize: 7, color: yellow,
|
|
outlineColor: Cesium.Color.fromCssColorString('#ff8800'), outlineWidth: 2 });
|
|
self._labels.add({
|
|
position: Cesium.Cartesian3.fromDegrees(p.lon, p.lat, 0), text: p.name,
|
|
font: '9px sans-serif', fillColor: yellow, outlineColor: Cesium.Color.BLACK, outlineWidth: 2,
|
|
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
pixelOffset: new Cesium.Cartesian2(0, -10), scale: 0.6,
|
|
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 500000),
|
|
});
|
|
});
|
|
self._count += (data.plants || []).length;
|
|
var s = document.getElementById('status-infra');
|
|
if (s) { s.textContent = self._count + ' Standorte'; s.classList.add('active');
|
|
setTimeout(function() { s.classList.remove('active'); }, 5000); }
|
|
}).catch(function() {});
|
|
},
|
|
|
|
_fetchBases() {
|
|
var self = this;
|
|
fetch('/api/military-bases')
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
var red = Cesium.Color.fromCssColorString('#ff4444');
|
|
(data.bases || []).forEach(function(b) {
|
|
self._points.add({ position: Cesium.Cartesian3.fromDegrees(b.lon, b.lat, 0), pixelSize: 6, color: red,
|
|
outlineColor: Cesium.Color.fromCssColorString('#aa0000'), outlineWidth: 1 });
|
|
self._labels.add({
|
|
position: Cesium.Cartesian3.fromDegrees(b.lon, b.lat, 0), text: b.name,
|
|
font: '9px sans-serif', fillColor: red, outlineColor: Cesium.Color.BLACK, outlineWidth: 2,
|
|
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
pixelOffset: new Cesium.Cartesian2(0, -10), scale: 0.6,
|
|
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 500000),
|
|
});
|
|
});
|
|
self._count += (data.bases || []).length;
|
|
}).catch(function() {});
|
|
},
|
|
};
|