better seismic drawings, and adsb enrichment

This commit is contained in:
2026-06-27 15:20:21 -04:00
parent f3356ff05c
commit d34f3cfa0e
6 changed files with 276 additions and 66 deletions

View File

@@ -62,9 +62,13 @@ export class AirTrafficLayer {
this._draw()
this._attachClick()
this.refreshTimer = adjustedInterval(async () => {
await this._fetch()
this._draw()
this._refreshPopups()
try {
await this._fetch()
this._draw()
this._refreshPopups()
} catch (err) {
console.error(err)
}
}, 1_000)
}

View File

@@ -69,9 +69,13 @@ export class AISLayer {
this._draw()
this._attachClick()
this.refreshTimer = adjustedInterval(async () => {
await this._fetch()
this._draw()
this._refreshPopups()
try {
await this._fetch()
this._draw()
this._refreshPopups()
} catch (err) {
console.error(err);
}
}, 5_000)
}

View File

@@ -11,11 +11,12 @@ export class RangeLayer {
private map: Map
private layer!: VectorLayer<VectorSource>
visible = false
interval: any;
constructor(map: Map) { this.map = map }
async show() {
if (this.visible) return
if(this.visible) this.hide(false);
this.visible = true
const points: [number, number][] = await fetch(`${BASE}/api/range`).then(r => r.json())
@@ -30,11 +31,16 @@ export class RangeLayer {
const source = new VectorSource({ features: [feature] })
this.layer = new VectorLayer({ source, zIndex: 50 })
this.map.addLayer(this.layer)
if(!this.interval) this.interval = setInterval(() => this.show, 60_000);
}
hide() {
hide(stop = true) {
if (!this.visible) return
this.visible = false
this.map.removeLayer(this.layer)
if(stop && this.interval) {
clearInterval(this.interval);
this.interval = null;
}
}
}