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
44 Zeilen
1.8 KiB
JavaScript
44 Zeilen
1.8 KiB
JavaScript
const ISSLayer = {
|
|
_viewer: null, _entity: null, _interval: null, _count: 0,
|
|
|
|
start(viewer) {
|
|
if (this._entity) return;
|
|
this._viewer = viewer;
|
|
this._entity = viewer.entities.add({
|
|
name: 'ISS - International Space Station',
|
|
position: Cesium.Cartesian3.fromDegrees(0, 0, 420000),
|
|
point: { pixelSize: 18, color: Cesium.Color.fromCssColorString('#ff4444'),
|
|
outlineColor: Cesium.Color.WHITE, outlineWidth: 2 },
|
|
label: { text: 'ISS', font: '12px monospace bold',
|
|
fillColor: Cesium.Color.fromCssColorString('#ff4444'),
|
|
outlineColor: Cesium.Color.BLACK, outlineWidth: 3,
|
|
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
pixelOffset: new Cesium.Cartesian2(12, -6) },
|
|
description: '<div style="font-family:monospace;font-size:13px;color:#ff4444;padding:8px"><strong>International Space Station</strong><br>Hoehe: ~420 km<br>Geschwindigkeit: ~27.600 km/h</div>',
|
|
});
|
|
this._count = 1;
|
|
this._fetch();
|
|
var self = this;
|
|
this._interval = setInterval(function() { self._fetch(); }, 5000);
|
|
},
|
|
|
|
stop() {
|
|
if (this._interval) { clearInterval(this._interval); this._interval = null; }
|
|
if (this._entity && this._viewer) { this._viewer.entities.remove(this._entity); this._entity = null; }
|
|
this._count = 0;
|
|
},
|
|
|
|
_fetch() {
|
|
var self = this;
|
|
fetch('/api/iss')
|
|
.then(function(r) { return r.json(); })
|
|
.then(function(data) {
|
|
if (!self._entity || data.message !== 'success') return;
|
|
var pos = data.iss_position;
|
|
self._entity.position = Cesium.Cartesian3.fromDegrees(
|
|
parseFloat(pos.longitude), parseFloat(pos.latitude), 420000
|
|
);
|
|
}).catch(function() {});
|
|
},
|
|
};
|