SONNENTERMINATUR: - Echtzeit Tag/Nacht-Grenze als orange Linie auf dem Globus - Nachtseite als halbtransparenter schwarzer Schatten - Basiert auf Sonnendeklination + UTC-Zeit - Aktualisiert jede Minute ZEITZONEN: - 24 vertikale Linien (alle 15 Grad Laengengrad) - Jede Zone zeigt aktuelle Uhrzeit (z.B. UTC+2 14:30) - Labels bei Zoom (<8000km) sichtbar - Aktualisiert jede Minute Alle Features der ersten Tabelle nun implementiert.
76 Zeilen
2.7 KiB
JavaScript
76 Zeilen
2.7 KiB
JavaScript
/**
|
|
* Zeitzonen-Overlay: Vertikale Linien alle 15 Grad + aktuelle Uhrzeit.
|
|
*/
|
|
const TimezonesLayer = {
|
|
_viewer: null,
|
|
_primitives: null,
|
|
_labels: null,
|
|
_interval: null,
|
|
_count: 0,
|
|
|
|
start(viewer) {
|
|
if (this._primitives) return;
|
|
this._viewer = viewer;
|
|
this._primitives = viewer.scene.primitives.add(new Cesium.PolylineCollection());
|
|
this._labels = viewer.scene.primitives.add(new Cesium.LabelCollection());
|
|
this._render();
|
|
this._count = 24;
|
|
var self = this;
|
|
this._interval = setInterval(function() { self._updateLabels(); }, 60000);
|
|
},
|
|
|
|
stop() {
|
|
if (this._interval) { clearInterval(this._interval); this._interval = null; }
|
|
if (this._primitives && this._viewer) { this._viewer.scene.primitives.remove(this._primitives); this._primitives = null; }
|
|
if (this._labels && this._viewer) { this._viewer.scene.primitives.remove(this._labels); this._labels = null; }
|
|
this._count = 0;
|
|
},
|
|
|
|
_render() {
|
|
if (!this._primitives) return;
|
|
var lineColor = Cesium.Color.fromCssColorString('#ffffff').withAlpha(0.08);
|
|
// 24 Zeitzonen-Linien (alle 15 Grad)
|
|
for (var tz = -12; tz <= 12; tz++) {
|
|
var lon = tz * 15;
|
|
var positions = [];
|
|
for (var lat = -80; lat <= 80; lat += 10) {
|
|
positions.push(Cesium.Cartesian3.fromDegrees(lon, lat, 0));
|
|
}
|
|
this._primitives.add({
|
|
positions: positions,
|
|
width: 1,
|
|
material: Cesium.Material.fromType('Color', { color: lineColor }),
|
|
});
|
|
}
|
|
this._updateLabels();
|
|
},
|
|
|
|
_updateLabels() {
|
|
if (!this._labels) return;
|
|
this._labels.removeAll();
|
|
var now = new Date();
|
|
var utcH = now.getUTCHours();
|
|
var utcM = now.getUTCMinutes();
|
|
|
|
for (var tz = -12; tz <= 12; tz++) {
|
|
var lon = tz * 15;
|
|
var h = (utcH + tz + 24) % 24;
|
|
var timeStr = ('0' + h).slice(-2) + ':' + ('0' + utcM).slice(-2);
|
|
var label = 'UTC' + (tz >= 0 ? '+' : '') + tz + ' ' + timeStr;
|
|
|
|
this._labels.add({
|
|
position: Cesium.Cartesian3.fromDegrees(lon, 0, 0),
|
|
text: label,
|
|
font: '10px monospace',
|
|
fillColor: Cesium.Color.WHITE.withAlpha(0.4),
|
|
outlineColor: Cesium.Color.BLACK,
|
|
outlineWidth: 2,
|
|
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
scale: 0.7,
|
|
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
|
|
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 8000000),
|
|
});
|
|
}
|
|
},
|
|
};
|