mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +00:00
Main brings satellites and vessels moving every frame, smooth rewind for contacts, global clouds drawn to the level a feed names, and search for degrees-minutes-seconds, UTM, MGRS and plus codes. They keep this branch's renderer work: satellites write their reckoned positions into the points set once a frame; vessels move every frame and ask for frames from the camera pose and canvas, and a vessel not there yet is hidden through its icon; flights and military keep the branch's rendering, with main's timeline fixes, trail top-up and grounded lift; the cloud tiles keep their infrared transfer. The timeline history module uses the geo helpers instead of Cesium, and main's new tests use the draw port's items.
This commit is contained in:
commit
4b47d5e058
49 files changed
+3367
-348
No files matched your search
@@ -2739,6 +2739,99 @@ test('a frame source supplies regional tiles in place of the tile route, through
|
||||
h.rendering.clear();
|
||||
});
|
||||
|
||||
test('a frame source that names its tile detail draws global clouds from its tiles to that level', async () => {
|
||||
let now = 0;
|
||||
const requests = [];
|
||||
const h = renderingHarness({
|
||||
now: () => now,
|
||||
fetchImpl: () => assert.fail('supplied clouds are not fetched'),
|
||||
frameSource: {
|
||||
getImage: () => assert.fail('no mosaic when the feed tiles clouds'),
|
||||
getTile: async (request) => {
|
||||
requests.push(request);
|
||||
return suppliedTile();
|
||||
},
|
||||
maximumLevel: (product) => (product === 'clouds' ? 6 : 8),
|
||||
},
|
||||
});
|
||||
h.viewer.scene.globe.tilesLoaded = false;
|
||||
const loaded = h.rendering.setFrame(globalSnapshot, times[0]);
|
||||
assert.equal(h.providers.length, 1);
|
||||
const [provider] = h.providers;
|
||||
assert.equal(typeof provider.spec.fetchTile, 'function', 'not the route');
|
||||
assert.equal(provider.spec.maxLevel, 6);
|
||||
await provider.requestImage(5, 3, 4, {});
|
||||
assert.deepEqual(
|
||||
[requests[0].product, requests[0].z, requests[0].x, requests[0].y],
|
||||
['clouds', 4, 5, 3],
|
||||
);
|
||||
now = 500;
|
||||
h.settle();
|
||||
assert.equal(await loaded, true);
|
||||
h.rendering.clear();
|
||||
|
||||
// Radar takes the level the feed names for it.
|
||||
const radar = renderingHarness({
|
||||
frameSource: {
|
||||
getTile: async () => suppliedTile(),
|
||||
maximumLevel: () => 8,
|
||||
},
|
||||
});
|
||||
radar.rendering.setFrame(snapshot, times[0]);
|
||||
assert.equal(radar.providers[0].spec.maxLevel, 8);
|
||||
radar.rendering.clear();
|
||||
});
|
||||
|
||||
test("a frame source naming no usable level keeps the layer's own detail", async () => {
|
||||
for (const maximumLevel of [
|
||||
() => null,
|
||||
() => 13,
|
||||
() => 2.5,
|
||||
() => 'deep',
|
||||
() => {
|
||||
throw new Error('no level');
|
||||
},
|
||||
]) {
|
||||
const h = renderingHarness({
|
||||
frameSource: { getTile: async () => suppliedTile(), maximumLevel },
|
||||
});
|
||||
h.rendering.setFrame(snapshot, times[0]);
|
||||
assert.equal(h.providers[0].spec.maxLevel, 6);
|
||||
h.rendering.clear();
|
||||
// Global clouds stay on the one image, cut to level 3.
|
||||
let mosaics = 0;
|
||||
const clouds = renderingHarness({
|
||||
frameSource: {
|
||||
getImage: async () => {
|
||||
mosaics++;
|
||||
return { width: 2048, height: 1024, close() {} };
|
||||
},
|
||||
getTile: () => assert.fail('clouds are not tiled without a level'),
|
||||
maximumLevel,
|
||||
},
|
||||
});
|
||||
await showMosaic(clouds, times[0]);
|
||||
assert.equal(mosaics, 1);
|
||||
assert.equal(clouds.providers[0].spec.maxLevel, 3);
|
||||
clouds.rendering.clear();
|
||||
}
|
||||
// A level without tiles leaves global clouds on the mosaic.
|
||||
let images = 0;
|
||||
const h = renderingHarness({
|
||||
frameSource: {
|
||||
getImage: async () => {
|
||||
images++;
|
||||
return suppliedTile();
|
||||
},
|
||||
maximumLevel: () => 6,
|
||||
},
|
||||
});
|
||||
h.rendering.setFrame(globalSnapshot, times[0]);
|
||||
await flush();
|
||||
assert.equal(images, 1);
|
||||
h.rendering.clear();
|
||||
});
|
||||
|
||||
test('a failed supplied tile fails the staged frame through the tile error', async () => {
|
||||
const h = renderingHarness({
|
||||
frameSource: {
|
||||
@@ -2798,6 +2891,57 @@ test("supplied regional infrared tiles get the transfer upright, as the route's
|
||||
}
|
||||
});
|
||||
|
||||
test('global clouds tiles get the infrared transfer, and prefetch asks for tiles, not the image', async () => {
|
||||
const hadBitmap = Object.hasOwn(globalThis, 'ImageBitmap');
|
||||
const previous = globalThis.ImageBitmap;
|
||||
globalThis.ImageBitmap = class ImageBitmap {
|
||||
width = 256;
|
||||
height = 256;
|
||||
close() {}
|
||||
};
|
||||
try {
|
||||
const requests = [];
|
||||
const h = renderingHarness({
|
||||
frameSource: {
|
||||
getImage: () => assert.fail('no image when the feed tiles clouds'),
|
||||
getTile: async (request) => {
|
||||
requests.push(request);
|
||||
return new globalThis.ImageBitmap();
|
||||
},
|
||||
maximumLevel: () => 6,
|
||||
},
|
||||
});
|
||||
void h.rendering.setFrame(globalSnapshot, times[0]);
|
||||
const [provider] = h.providers;
|
||||
const decoded = await provider.requestImage(5, 3, 4, {});
|
||||
const tile = await provider.spec.tileTransform(
|
||||
{ x: 5, y: 3, level: 4 },
|
||||
decoded,
|
||||
);
|
||||
assert.equal(tile.drawnWith, null, 'drawn upright, not flipped');
|
||||
assert.ok(tile.pixels, 'the infrared transfer ran');
|
||||
h.rendering.clear();
|
||||
requests.length = 0;
|
||||
const warm = renderingHarness({
|
||||
frameSource: {
|
||||
getImage: () => assert.fail('no image when the feed tiles clouds'),
|
||||
getTile: async (request) => {
|
||||
requests.push(request);
|
||||
return new globalThis.ImageBitmap();
|
||||
},
|
||||
maximumLevel: () => 6,
|
||||
},
|
||||
});
|
||||
assert.equal(await warm.rendering.prefetch(globalSnapshot, times[1]), true);
|
||||
assert.ok(requests.length > 0, 'prefetch asked for tiles');
|
||||
assert.ok(requests.every((request) => request.product === 'clouds'));
|
||||
warm.rendering.clear();
|
||||
} finally {
|
||||
if (hadBitmap) globalThis.ImageBitmap = previous;
|
||||
else delete globalThis.ImageBitmap;
|
||||
}
|
||||
});
|
||||
|
||||
test('tiled prefetch asks the frame source for the same level 0/1 tiles and releases them', async (t) => {
|
||||
const requests = [];
|
||||
const supplied = [];
|
||||
|
||||
Reference in new issue
Block a user