5 neue Layer: Militaerflug, Seekabel, Infrastruktur, ISS Tracker
MILITAERFLUGVERKEHR (adsb.lol /v2/mil): - ~254 Militaerflugzeuge weltweit in Echtzeit (rot) - Callsign-Labels bei Zoom (RCH=USAF, GAF=Luftwaffe etc.) - Klick zeigt: Callsign, Registration, Typ, Hoehe, Squawk - 20s Refresh SEEKABEL (TeleGeography): - Untersee-Glasfaserkabel als cyan-Linien auf dem Globus - ~500+ internationale Kabelverbindungen - Geopolitisch relevant (Sabotage, Abhoerung) INFRASTRUKTUR (OpenStreetMap Overpass): - 348 Kernkraftwerke weltweit (gelb mit Orange-Rand) - Militaerflughaefen (rot) - Labels bei Zoom (<500km) - 24h Cache (statische Daten) ISS TRACKER (Open-Notify API): - Echtzeit-Position der ISS (roter Punkt, 420km Hoehe) - 5s Refresh, prominentes Label - Klick zeigt Details Backend: data_military.py, data_infra.py (2 neue Dateien) Frontend: military.js, cables.js, infra.js, iss.js (4 neue Dateien)
Dieser Commit ist enthalten in:
52
src/data_infra.py
Normale Datei
52
src/data_infra.py
Normale Datei
@@ -0,0 +1,52 @@
|
||||
"""Infrastruktur: Seekabel, Kernkraftwerke, Militaerbasen."""
|
||||
import logging, time, httpx
|
||||
from fastapi import APIRouter
|
||||
|
||||
logger = logging.getLogger("globe.infra")
|
||||
router = APIRouter()
|
||||
_cache = {}
|
||||
|
||||
async def _get_cached(key, url, ttl=86400, parser=None):
|
||||
if key in _cache and time.time() - _cache[key][0] < ttl:
|
||||
return _cache[key][1]
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=30) as client:
|
||||
r = await client.get(url)
|
||||
r.raise_for_status()
|
||||
data = parser(r) if parser else r.json()
|
||||
_cache[key] = (time.time(), data)
|
||||
return data
|
||||
except Exception as e:
|
||||
logger.warning(f"{key}: {e}")
|
||||
return _cache.get(key, (0, {}))[1]
|
||||
|
||||
@router.get("/submarine-cables")
|
||||
async def get_cables():
|
||||
return await _get_cached("cables",
|
||||
"https://www.submarinecablemap.com/api/v3/cable/cable-geo.json", 86400)
|
||||
|
||||
@router.get("/nuclear-plants")
|
||||
async def get_nuclear():
|
||||
data = await _get_cached("nuclear",
|
||||
"https://overpass-api.de/api/interpreter?data=%5Bout%3Ajson%5D%3Bnode%5B%22generator%3Asource%22%3D%22nuclear%22%5D%3Bout%3B",
|
||||
86400)
|
||||
plants = []
|
||||
for e in (data.get("elements") or []):
|
||||
name = e.get("tags", {}).get("name", "Kernkraftwerk")
|
||||
plants.append({"name": name, "lat": e["lat"], "lon": e["lon"]})
|
||||
return {"plants": plants, "total": len(plants)}
|
||||
|
||||
@router.get("/military-bases")
|
||||
async def get_bases():
|
||||
data = await _get_cached("bases",
|
||||
"https://overpass-api.de/api/interpreter?data=%5Bout%3Ajson%5D%3Bnode%5B%22military%22%3D%22airfield%22%5D%3Bout%3B",
|
||||
86400)
|
||||
bases = []
|
||||
for e in (data.get("elements") or []):
|
||||
name = e.get("tags", {}).get("name", "Militaerbasis")
|
||||
bases.append({"name": name, "lat": e["lat"], "lon": e["lon"]})
|
||||
return {"bases": bases, "total": len(bases)}
|
||||
|
||||
@router.get("/iss")
|
||||
async def get_iss():
|
||||
return await _get_cached("iss", "http://api.open-notify.org/iss-now.json", 5)
|
||||
49
src/data_military.py
Normale Datei
49
src/data_military.py
Normale Datei
@@ -0,0 +1,49 @@
|
||||
"""Militaerflugverkehr: adsb.lol /v2/mil Endpoint."""
|
||||
import asyncio, logging, time, httpx
|
||||
from fastapi import APIRouter
|
||||
|
||||
logger = logging.getLogger("globe.military")
|
||||
router = APIRouter()
|
||||
_cache = {"data": None, "ts": 0}
|
||||
_task = None
|
||||
|
||||
async def _fetch():
|
||||
now = time.time()
|
||||
if _cache["data"] and now - _cache["ts"] < 15:
|
||||
return _cache["data"]
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=15) as client:
|
||||
r = await client.get("https://api.adsb.lol/v2/mil")
|
||||
r.raise_for_status()
|
||||
ac = []
|
||||
for a in r.json().get("ac", []):
|
||||
if a.get("lat") and a.get("lon"):
|
||||
ac.append({
|
||||
"hex": a.get("hex",""), "flight": (a.get("flight") or "").strip(),
|
||||
"reg": a.get("r",""), "type": a.get("t",""),
|
||||
"lat": a["lat"], "lon": a["lon"],
|
||||
"alt_baro": a.get("alt_baro"), "gs": a.get("gs"),
|
||||
"track": a.get("track"), "squawk": a.get("squawk",""),
|
||||
"dbFlags": a.get("dbFlags", 0),
|
||||
})
|
||||
_cache["data"] = {"ac": ac, "total": len(ac)}
|
||||
_cache["ts"] = time.time()
|
||||
logger.info(f"Military: {len(ac)} Flugzeuge")
|
||||
except Exception as e:
|
||||
logger.warning(f"Military: {e}")
|
||||
return _cache["data"] or {"ac": [], "total": 0}
|
||||
|
||||
async def _loop():
|
||||
await asyncio.sleep(5)
|
||||
while True:
|
||||
await _fetch()
|
||||
await asyncio.sleep(20)
|
||||
|
||||
def start_mil_collector():
|
||||
global _task
|
||||
if _task is None or _task.done():
|
||||
_task = asyncio.create_task(_loop())
|
||||
|
||||
@router.get("/military")
|
||||
async def get_military():
|
||||
return await _fetch()
|
||||
@@ -33,6 +33,8 @@ from data_quakes import router as quakes_router
|
||||
from data_gdelt import router as gdelt_router
|
||||
from data_satellites import router as satellites_router
|
||||
from data_disasters import router as disasters_router
|
||||
from data_military import router as military_router, start_mil_collector
|
||||
from data_infra import router as infra_router
|
||||
from data_monitor import router as monitor_router
|
||||
from data_push import start_push_service
|
||||
|
||||
@@ -42,6 +44,8 @@ app.include_router(ships_router, prefix="/api", dependencies=[Depends(get_curren
|
||||
app.include_router(quakes_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
app.include_router(gdelt_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
app.include_router(satellites_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
app.include_router(military_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
app.include_router(infra_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
app.include_router(disasters_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
app.include_router(monitor_router, prefix="/api", dependencies=[Depends(get_current_user)])
|
||||
|
||||
@@ -66,4 +70,5 @@ async def startup():
|
||||
logger.info("AegisSight Globe gestartet")
|
||||
start_ais_collector()
|
||||
start_flight_collector()
|
||||
start_mil_collector()
|
||||
start_push_service()
|
||||
|
||||
@@ -569,3 +569,8 @@ html, body { height: 100%; overflow: hidden; background: var(--bg-primary); colo
|
||||
}
|
||||
.imagery-select:hover { border-color: var(--accent); }
|
||||
.imagery-select option { background: var(--bg-primary); color: var(--text); }
|
||||
|
||||
.dot-military { background: #ff2222; box-shadow: 0 0 4px rgba(255,34,34,0.5); }
|
||||
.dot-cables { background: #00ccff; }
|
||||
.dot-infra { background: #ffdd00; }
|
||||
.dot-iss { background: #ff4444; box-shadow: 0 0 6px rgba(255,68,68,0.6); }
|
||||
|
||||
@@ -59,6 +59,13 @@
|
||||
</label>
|
||||
<div class="layer-loading" id="loading-flights"></div>
|
||||
<div class="layer-status" id="status-flights"></div>
|
||||
<label class="layer-toggle">
|
||||
<input type="checkbox" id="layer-military" title="Militaerflugzeuge weltweit (adsb.lol, ~300 Flugzeuge, 20s Refresh)">
|
||||
<span class="layer-dot dot-military"></span>
|
||||
<span class="layer-name" title="Militaertransporter, Tanker, Aufklaerer, Kampfjets">Militaerflug</span>
|
||||
<span class="layer-count" id="count-military">-</span>
|
||||
</label>
|
||||
<div class="layer-status" id="status-military"></div>
|
||||
<label class="layer-toggle">
|
||||
<input type="checkbox" id="layer-ships" title="Echtzeit-Schiffsverkehr weltweit (AISStream AIS-Daten, kontinuierlich)">
|
||||
<span class="layer-dot dot-ships"></span>
|
||||
@@ -84,6 +91,25 @@
|
||||
</label>
|
||||
<div class="layer-loading" id="loading-satellites"></div>
|
||||
<div class="layer-status" id="status-satellites"></div>
|
||||
<label class="layer-toggle">
|
||||
<input type="checkbox" id="layer-cables" title="Untersee-Glasfaserkabel weltweit (TeleGeography)">
|
||||
<span class="layer-dot dot-cables"></span>
|
||||
<span class="layer-name" title="Internationale Seekabel-Infrastruktur">Seekabel</span>
|
||||
<span class="layer-count" id="count-cables">-</span>
|
||||
</label>
|
||||
<div class="layer-status" id="status-cables"></div>
|
||||
<label class="layer-toggle">
|
||||
<input type="checkbox" id="layer-infra" title="Kernkraftwerke + Militaerflughaefen (OpenStreetMap)">
|
||||
<span class="layer-dot dot-infra"></span>
|
||||
<span class="layer-name" title="Atomkraftwerke (gelb) + Militaerbasen (rot)">Infrastruktur</span>
|
||||
<span class="layer-count" id="count-infra">-</span>
|
||||
</label>
|
||||
<div class="layer-status" id="status-infra"></div>
|
||||
<label class="layer-toggle">
|
||||
<input type="checkbox" id="layer-iss" title="ISS Echtzeit-Position (5s Refresh)">
|
||||
<span class="layer-dot dot-iss"></span>
|
||||
<span class="layer-name" title="International Space Station, ~420km Hoehe">ISS Tracker</span>
|
||||
</label>
|
||||
<label class="layer-toggle">
|
||||
<input type="checkbox" id="layer-disasters" title="Naturkatastrophen + Erdbeben (NASA EONET + USGS: Waldbraende, Vulkane, Stuerme, Erdbeben M2.5+)">
|
||||
<span class="layer-dot dot-disasters"></span>
|
||||
@@ -198,6 +224,10 @@
|
||||
<script src="/static/js/layers/disasters.js"></script>
|
||||
<script src="/static/js/ui/sidebar.js"></script>
|
||||
<script src="/static/js/layers/monitor.js"></script>
|
||||
<script src="/static/js/layers/military.js"></script>
|
||||
<script src="/static/js/layers/cables.js"></script>
|
||||
<script src="/static/js/layers/infra.js"></script>
|
||||
<script src="/static/js/layers/iss.js"></script>
|
||||
<script src="/static/js/layers/weather.js"></script>
|
||||
<script src="/static/js/ui/imagery.js"></script>
|
||||
<script src="/static/js/ui/search.js"></script>
|
||||
|
||||
@@ -153,9 +153,13 @@ const Globe = {
|
||||
_setupLayerToggles() {
|
||||
var toggles = {
|
||||
'layer-flights': function(on) { on ? FlightsLayer.start(Globe.viewer) : FlightsLayer.stop(); },
|
||||
'layer-military': function(on) { on ? MilitaryLayer.start(Globe.viewer) : MilitaryLayer.stop(); },
|
||||
'layer-ships': function(on) { on ? ShipsLayer.start(Globe.viewer) : ShipsLayer.stop(); },
|
||||
'layer-gdelt': function(on) { on ? GdeltLayer.start(Globe.viewer) : GdeltLayer.stop(); },
|
||||
'layer-satellites': function(on) { on ? SatellitesLayer.start(Globe.viewer) : SatellitesLayer.stop(); },
|
||||
'layer-cables': function(on) { on ? CablesLayer.start(Globe.viewer) : CablesLayer.stop(); },
|
||||
'layer-infra': function(on) { on ? InfraLayer.start(Globe.viewer) : InfraLayer.stop(); },
|
||||
'layer-iss': function(on) { on ? ISSLayer.start(Globe.viewer) : ISSLayer.stop(); },
|
||||
'layer-disasters': function(on) { on ? DisastersLayer.start(Globe.viewer) : DisastersLayer.stop(); },
|
||||
'layer-weather': function(on) { on ? WeatherLayer.start(Globe.viewer) : WeatherLayer.stop(); },
|
||||
'layer-daynight': function(on) { Globe.viewer.scene.globe.enableLighting = on; },
|
||||
@@ -181,6 +185,9 @@ const Globe = {
|
||||
if (typeof QuakesLayer !== 'undefined' && QuakesLayer._count > 0) {
|
||||
document.getElementById('count-quakes').textContent = QuakesLayer._count.toLocaleString('de-DE');
|
||||
}
|
||||
if (typeof MilitaryLayer !== 'undefined' && MilitaryLayer._count > 0) {
|
||||
document.getElementById('count-military').textContent = MilitaryLayer._count.toLocaleString('de-DE');
|
||||
}
|
||||
if (typeof SatellitesLayer !== 'undefined' && SatellitesLayer._count > 0) {
|
||||
document.getElementById('count-satellites').textContent = SatellitesLayer._count.toLocaleString('de-DE');
|
||||
}
|
||||
|
||||
34
static/js/layers/cables.js
Normale Datei
34
static/js/layers/cables.js
Normale Datei
@@ -0,0 +1,34 @@
|
||||
const CablesLayer = {
|
||||
_viewer: null, _dataSource: null, _count: 0,
|
||||
|
||||
start(viewer) {
|
||||
if (this._dataSource) return;
|
||||
this._viewer = viewer;
|
||||
this._dataSource = new Cesium.GeoJsonDataSource('cables');
|
||||
this._fetch();
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (this._dataSource && this._viewer) { this._viewer.dataSources.remove(this._dataSource); this._dataSource = null; }
|
||||
this._count = 0;
|
||||
},
|
||||
|
||||
_fetch() {
|
||||
var self = this;
|
||||
var statusEl = document.getElementById('status-cables');
|
||||
if (statusEl) { statusEl.textContent = 'Lade Seekabel...'; statusEl.classList.add('active'); }
|
||||
fetch('/api/submarine-cables')
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
self._count = (data.features || []).length;
|
||||
return self._dataSource.load(data, {
|
||||
stroke: Cesium.Color.fromCssColorString('#00ccff').withAlpha(0.4),
|
||||
strokeWidth: 1.5,
|
||||
clampToGround: true,
|
||||
});
|
||||
})
|
||||
.then(function() { self._viewer.dataSources.add(self._dataSource); if (statusEl) statusEl.textContent = self._count + ' Kabel'; })
|
||||
.catch(function(e) { console.warn('Cables:', e); if (statusEl) statusEl.textContent = 'Fehler'; })
|
||||
.finally(function() { setTimeout(function() { if (statusEl) statusEl.classList.remove('active'); }, 5000); });
|
||||
},
|
||||
};
|
||||
63
static/js/layers/infra.js
Normale Datei
63
static/js/layers/infra.js
Normale Datei
@@ -0,0 +1,63 @@
|
||||
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: 5, 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: 4, 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() {});
|
||||
},
|
||||
};
|
||||
43
static/js/layers/iss.js
Normale Datei
43
static/js/layers/iss.js
Normale Datei
@@ -0,0 +1,43 @@
|
||||
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: 10, 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() {});
|
||||
},
|
||||
};
|
||||
88
static/js/layers/military.js
Normale Datei
88
static/js/layers/military.js
Normale Datei
@@ -0,0 +1,88 @@
|
||||
const MilitaryLayer = {
|
||||
_viewer: null, _points: null, _labels: null, _interval: null, _count: 0, _data: [],
|
||||
_handler: null,
|
||||
|
||||
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._fetch();
|
||||
var self = this;
|
||||
this._interval = setInterval(function() { self._fetch(); }, 20000);
|
||||
this._handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
|
||||
this._handler.setInputAction(function(c) { self._onClick(c.position); }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
|
||||
},
|
||||
|
||||
stop() {
|
||||
if (this._interval) { clearInterval(this._interval); this._interval = null; }
|
||||
if (this._handler) { this._handler.destroy(); this._handler = null; }
|
||||
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; this._data = [];
|
||||
},
|
||||
|
||||
_onClick(pos) {
|
||||
if (!this._viewer || !this._data.length) return;
|
||||
var cart = this._viewer.scene.pickPosition(pos);
|
||||
if (!cart) { var ray = this._viewer.scene.camera.getPickRay(pos); cart = this._viewer.scene.globe.pick(ray, this._viewer.scene); }
|
||||
if (!cart) return;
|
||||
var c = Cesium.Cartographic.fromCartesian(cart);
|
||||
var lat = Cesium.Math.toDegrees(c.latitude), lon = Cesium.Math.toDegrees(c.longitude);
|
||||
var best = null, bd = 999;
|
||||
for (var i = 0; i < this._data.length; i++) {
|
||||
var a = this._data[i], d = Math.abs(a.lat-lat) + Math.abs(a.lon-lon);
|
||||
if (d < bd) { bd = d; best = a; }
|
||||
}
|
||||
if (best && bd < 1) {
|
||||
var cs = best.flight || best.reg || best.hex || '?';
|
||||
this._viewer.trackedEntity = undefined;
|
||||
this._viewer.selectedEntity = new Cesium.Entity({
|
||||
name: 'MIL: ' + cs,
|
||||
description: '<div style="font-family:monospace;font-size:13px;color:#ff4444;padding:8px">' +
|
||||
'<strong>' + cs + '</strong><br>REG: ' + (best.reg||'?') + '<br>TYP: ' + (best.type||'?') +
|
||||
'<br>ALT: ' + (best.alt_baro||'?') + ' ft<br>SPD: ' + (best.gs||'?') + ' kts' +
|
||||
'<br>SQK: ' + (best.squawk||'?') + '</div>',
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_fetch() {
|
||||
var self = this;
|
||||
var statusEl = document.getElementById('status-military');
|
||||
if (statusEl) { statusEl.textContent = 'Lade...'; statusEl.classList.add('active'); }
|
||||
fetch('/api/military')
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
self._data = data.ac || [];
|
||||
self._count = self._data.length;
|
||||
self._render();
|
||||
if (statusEl) statusEl.textContent = self._count + ' Militaer';
|
||||
})
|
||||
.catch(function() { if (statusEl) statusEl.textContent = 'Fehler'; })
|
||||
.finally(function() { setTimeout(function() { if (statusEl) statusEl.classList.remove('active'); }, 5000); });
|
||||
},
|
||||
|
||||
_render() {
|
||||
if (!this._points) return;
|
||||
this._points.removeAll();
|
||||
this._labels.removeAll();
|
||||
var red = Cesium.Color.fromCssColorString('#ff2222');
|
||||
for (var i = 0; i < this._data.length; i++) {
|
||||
var a = this._data[i];
|
||||
var altM = (a.alt_baro || 10000) * 0.3048;
|
||||
this._points.add({ position: Cesium.Cartesian3.fromDegrees(a.lon, a.lat, altM), pixelSize: 4, color: red });
|
||||
var cs = a.flight || a.reg || '';
|
||||
if (cs) {
|
||||
this._labels.add({
|
||||
position: Cesium.Cartesian3.fromDegrees(a.lon, a.lat, altM),
|
||||
text: cs, font: '9px monospace',
|
||||
fillColor: red.withAlpha(0.8), outlineColor: Cesium.Color.BLACK, outlineWidth: 2,
|
||||
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
||||
pixelOffset: new Cesium.Cartesian2(6, -3), scale: 0.7,
|
||||
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 1500000),
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren