mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw Radio stations and their clusters through the draw port and take the Radio renderer off the Cesium list
The stations, the cluster dots and the selected station's dot and bracket are draw-port point and icon sets. Stations drawn too close together on screen are grouped by geo/screenCluster.js as the default renderer's entity clustering grouped them: the same boxes and screen coordinates, the same reuse of the last pass's clusters when the eye comes lower, a pass whenever the camera moves enough or a station is shown or hidden, and stations a pass passes over hidden until the next. A cluster dot names its seed station, so a click plays it as before. The Radio QA script reads the drawn sets; the unused cluster-collection internals helper is gone.
This commit is contained in:
1 parent
b2502d6f37
commit
a59f9b10b2
17 files changed
+1134
-352
No files matched your search
@@ -1,4 +1,6 @@
|
||||
import { radioLayer } from '../data/radio.js';
|
||||
import { bindRenderer } from '../render/rendererOf.js';
|
||||
import { bindFakeDraw } from './fakeDrawPort.mjs';
|
||||
|
||||
export function radioStationRow(overrides = {}) {
|
||||
return {
|
||||
@@ -21,11 +23,17 @@ export function radioStationRow(overrides = {}) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run `body` against an enabled `radioLayer` that serves `stations`.
|
||||
* Run `body` against an enabled `radioLayer` that serves `stations`, drawing
|
||||
* through `renderer.draw`, or a fake draw port (with `renderer`'s other
|
||||
* ports, if given).
|
||||
* Streams listed in `failingUrls` (mutable) reject play(); `body` receives the
|
||||
* played URLs and the catalog, whose rows and generation the next update() serves.
|
||||
* played URLs, the catalog, whose rows and generation the next update()
|
||||
* serves, and the fake draw port.
|
||||
*/
|
||||
export async function withRadioLayer({ stations, failingUrls = [] }, body) {
|
||||
export async function withRadioLayer(
|
||||
{ stations, failingUrls = [], renderer = {} },
|
||||
body,
|
||||
) {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalAudio = globalThis.Audio;
|
||||
const playUrls = [];
|
||||
@@ -76,24 +84,23 @@ export async function withRadioLayer({ stations, failingUrls = [] }, body) {
|
||||
removeEventListener() {},
|
||||
},
|
||||
},
|
||||
dataSources: { add() {}, remove() {} },
|
||||
entities: {
|
||||
add(entity) {
|
||||
return entity;
|
||||
},
|
||||
remove() {},
|
||||
},
|
||||
};
|
||||
// The stations draw through the renderer's draw port: `renderer.draw`
|
||||
// when given, else a fake one.
|
||||
const { draw, unbind } = renderer.draw
|
||||
? { draw: renderer.draw, unbind: bindRenderer(viewer, renderer) }
|
||||
: bindFakeDraw(viewer, renderer);
|
||||
radioLayer.destroy();
|
||||
try {
|
||||
radioLayer.init(viewer);
|
||||
radioLayer.enable();
|
||||
await radioLayer.update();
|
||||
await body({ playUrls, catalog });
|
||||
await body({ playUrls, catalog, draw });
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
if (originalAudio === undefined) delete globalThis.Audio;
|
||||
else globalThis.Audio = originalAudio;
|
||||
radioLayer.destroy();
|
||||
unbind();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user