SUBMENU (Schiffstypen etc.): - Links eingerueckt (28px padding-left + 12px margin) - Gruene Linie am linken Rand zur Abgrenzung - Leicht dunklerer Hintergrund - Klar als Untermenue erkennbar PUNKTGROESSEN (alle Layer nochmals ~60% groesser): - Flugzeuge: 5/6/8px (war 3/4/5) - Schiffe: 4/5/7px (war 3/4/5) - Militaer: 8px (war 6) - Katastrophen: 14px (war 10) - Erdbeben: 8-20px (war 6-15) - GDELT: 10px (war 7) - ISS: 18px (war 14) - AKWs: 10px (war 7) - Satelliten: 3/5px (war 1.5/3) - Cluster: +40% 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: 10, 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: 8, 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() {});
|
|
},
|
|
};
|