mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 11:42:21 +00:00
fix(recent-imagery): keep drapes and proven halves steady across re-probes
- The renderer compares the rectangles it actually drapes, so a probe that confirms the same halves no longer rebuilds a shown layer. - A re-probe of a present day keeps a side it proved earlier through a transient failure and drops it only on fresh empty evidence. - DETAILS shows partial coverage when a side is confirmed empty; the presentBoxes contract of the source is documented. - probeHalf, the presentBoxes filter, requestBoxes and mount are simplified; the frozen-response Proxy is gone. - Duplicate source tests move into their own suites and share the existing fixtures; tests pin the exact ±180 seam and the dateline refusals. - Comments, CURRENT-STATE and the changelog fragment are shortened and match the JPEG / PNG drape rules.
This commit is contained in:
1 parent
ccffaeca4d
commit
fc137bef85
21 files changed
+715
-1093
No files matched your search
@@ -23,8 +23,6 @@ export const IMAGERY_BOX_POINTER_OWNER = 'recent-imagery-box';
|
||||
* @param {{ viewer: object, onBox: (box: object) => void, onCancel?: (reason: string, message?: string, box?: object) => void, onActive?: (active: boolean) => void, onEscape?: () => boolean, cesium?: object, pickWorld?: Function, documentRef?: object }} deps
|
||||
* `onEscape` runs before the tool cancels on Escape; returning `true` claims
|
||||
* the key (it is still consumed) and leaves the tool armed.
|
||||
* A drag whose corners are more than 180 degrees of longitude apart is the
|
||||
* short box across the dateline, returned with west > east.
|
||||
* @returns {{ start: () => boolean, cancel: (reason?: string) => void, isActive: () => boolean, destroy: () => Promise<void> } | null}
|
||||
*/
|
||||
export function initImageryBoxTool({
|
||||
|
||||
+15
-3
@@ -22,7 +22,7 @@ import RecentImageryReadout from './recentImagery/RecentImageryReadout.vue';
|
||||
import {
|
||||
PRODUCTS,
|
||||
hhmm,
|
||||
lonSpanDeg,
|
||||
nonCrossingBoxes,
|
||||
wvsSnapshotUrl,
|
||||
} from '../layers/recentImagery/model.js';
|
||||
import { displayDay, displayMetres } from '../layers/recentImagery/display.js';
|
||||
@@ -142,6 +142,16 @@ function coverageText(coverage) {
|
||||
return t('unknown');
|
||||
}
|
||||
|
||||
/** A present day covers the box only in part when its probe omits a side. */
|
||||
function shownCoverage(candidate, box) {
|
||||
const drapes = candidate.thumbnail?.availableBoxes;
|
||||
return candidate.thumbnail?.status === 'present' &&
|
||||
Array.isArray(drapes) &&
|
||||
drapes.length < nonCrossingBoxes(box).length
|
||||
? 'partial'
|
||||
: candidate.coverage;
|
||||
}
|
||||
|
||||
function cloudText(candidate) {
|
||||
if (candidate.thumbnail?.status === 'empty') return t('no imagery');
|
||||
if (!candidate.cloud) return t('cloud unknown');
|
||||
@@ -579,7 +589,9 @@ export function createRecentImageryPanel({
|
||||
}),
|
||||
);
|
||||
times.push(
|
||||
t('Coverage {coverage}', { coverage: coverageText(focus.coverage) }),
|
||||
t('Coverage {coverage}', {
|
||||
coverage: coverageText(shownCoverage(focus, snapshot.box)),
|
||||
}),
|
||||
);
|
||||
lines.push({ id: 'acquired', text: times.join(' · ') });
|
||||
(focus.granules || []).forEach((granule, index) => {
|
||||
@@ -785,7 +797,7 @@ export function createRecentImageryPanel({
|
||||
// The snapshot is plate carrée: keep the box's degree aspect, with the
|
||||
// longer side at the size limit.
|
||||
const size = longerSideKm(snapshot.boxSizeKm) > 25 ? 2048 : 1024;
|
||||
const spanLon = lonSpanDeg(snapshot.box.west, snapshot.box.east) || 1;
|
||||
const spanLon = Math.abs(snapshot.box.east - snapshot.box.west) || 1;
|
||||
const spanLat = Math.abs(snapshot.box.north - snapshot.box.south) || 1;
|
||||
const width = Math.max(
|
||||
1,
|
||||
|
||||
@@ -4,9 +4,11 @@ import assert from 'node:assert/strict';
|
||||
import { assertSameNode } from '../testSupport/domAssert.mjs';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createRecentImageryPanel } from './recentImagery.js';
|
||||
import { nonCrossingBoxes } from '../layers/recentImagery/model.js';
|
||||
import { createRecentImageryLayer } from '../layers/recentImagery/index.js';
|
||||
import {
|
||||
BOX,
|
||||
FIJI_BOX,
|
||||
fakeCatalog,
|
||||
fakeController,
|
||||
fakeRenderer,
|
||||
@@ -1055,6 +1057,20 @@ test('DETAILS is a collapsed rail card holding every note, and the empty-days to
|
||||
assert.equal(article.dataset.open, 'false');
|
||||
});
|
||||
|
||||
test('DETAILS shows partial coverage when a present dateline day drapes one half', async () => {
|
||||
const f = fixture();
|
||||
f.layer.enable();
|
||||
f.layer.setBox(FIJI_BOX);
|
||||
f.catalog.resolveLast();
|
||||
await settle();
|
||||
assert.match(f.byId('ri-details').textContent, /Coverage full/);
|
||||
const get = f.thumbnails.get;
|
||||
const [west] = nonCrossingBoxes(FIJI_BOX);
|
||||
f.thumbnails.get = (key) => ({ ...get(key), availableBoxes: [west] });
|
||||
f.thumbnails.probe(f.snap().focus.key, 'present');
|
||||
assert.match(f.byId('ri-details').textContent, /Coverage partial/);
|
||||
});
|
||||
|
||||
test('the body scroll position survives renders even when DOM mutations reset it', async () => {
|
||||
const f = fixture();
|
||||
await f.ready();
|
||||
|
||||
@@ -14,14 +14,15 @@ const REFUSALS = [
|
||||
'Point the camera at the ground to use the view', // layers/recentImagery/index.js
|
||||
'That point cannot anchor a box', // layers/recentImagery/index.js
|
||||
...[
|
||||
{ west: 170, south: 10, east: -170, north: 20 }, // too large (dateline arc)
|
||||
{ west: 10, south: 80, east: 20, north: 89 }, // polar
|
||||
{ west: 10, south: 10, east: 10, north: 20 }, // degenerate
|
||||
{ west: 10, south: 10, east: 200, north: 20 }, // longitude range
|
||||
{ west: Number.NaN, south: 10, east: 20, north: 20 }, // not finite
|
||||
].map((box) => {
|
||||
[{ west: 170, south: 10, east: -170, north: 20 }, 'too-large'],
|
||||
[{ west: 10, south: 80, east: 20, north: 89 }, 'polar'],
|
||||
[{ west: 10, south: 10, east: 10, north: 20 }, 'degenerate'],
|
||||
[{ west: 10, south: 10, east: 200, north: 20 }, 'invalid'],
|
||||
[{ west: Number.NaN, south: 10, east: 20, north: 20 }, 'invalid'],
|
||||
].map(([box, reason]) => {
|
||||
const result = validateBox(box);
|
||||
assert.equal(result.ok, false);
|
||||
assert.equal(result.reason, reason);
|
||||
return result.message;
|
||||
}),
|
||||
];
|
||||
@@ -35,6 +36,13 @@ const SHOWN_EN = new Map([
|
||||
],
|
||||
]);
|
||||
|
||||
test('a dateline box is measured on its short arc', () => {
|
||||
assert.equal(
|
||||
validateBox({ west: 179, south: 0, east: -179, north: 1 }).ok,
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('en: refusals stay English', () => {
|
||||
setLocale('en');
|
||||
for (const text of REFUSALS) {
|
||||
|
||||
Reference in new issue
Block a user