fix(recent-imagery): keep HLS drapes and empty halves steady when a probe gives no answer

- A Worldview 200 without Data-Present no longer takes an HLS day already on
  the map off it: the source reports only the halves that answered, and the
  renderer drapes a PNG on every part not confirmed empty.
- A re-probe keeps the last explicit answer for each half, so a side confirmed
  empty stays undraped when it does not answer again.
- A host change noticed while rendering after a probe sends a full
  notification, so the panel updates the divider.
- Tests: the short-arc refusal asserts the measured box, the widening test
  expects slot B on top on both sides, and the drape-policy cases are one
  table; the widening test moves into rendering.test.mjs.
- Shared box key and Data-Present parsing; transport errors pass through
  unchanged; unreachable guards and repeated comments removed; docs describe
  partial vs. unknown coverage.
This commit is contained in:
German Khokhlov committed 2026-11-20 19:20:49 +04:00
1 parent 8fd0a35f6a
commit 1f64a9ce44
19 files changed
+348 -272

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ export function initImageryBoxTool({
const lo = Math.min(anchor.lon, corner.lon);
const hi = Math.max(anchor.lon, corner.lon);
// Corners more than half the globe apart are the short way round, over
// the dateline: west is the eastern corner and east the western one.
// the dateline: west gets the larger longitude, east the smaller.
const crosses = hi - lo > 180;
return {
west: crosses ? hi : lo,
+11 -2
View File
@@ -10,6 +10,7 @@ import {
IMAGERY_BOX_POINTER_OWNER,
initImageryBoxTool,
} from './imageryBoxTool.js';
import { lonSpanDeg, validateBox } from '../layers/recentImagery/model.js';
import { boxToolFakes } from '../layers/recentImagery/testDoubles.mjs';
import { createImageryBoxPreview } from '../layers/recentImagery/rendering.js';
import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
@@ -230,11 +231,19 @@ test('a drag whose short arc is still over the size limit is refused as too larg
lon: nx < 0.5 ? 100 : -100,
lat: ny,
});
const f = fixture({ pickWorld });
const refused = [];
const f = fixture({
pickWorld,
onCancel: (reason, message, box) => refused.push({ reason, message, box }),
});
f.tool.start();
f.fire('LEFT_DOWN', { position: { x: 100, y: 200 } });
f.fire('LEFT_UP', { position: { x: 800, y: 250 } });
assert.equal(f.boxes.length, 0);
assert.equal(f.cancels.at(-1)[0], 'too-large');
const { reason, message, box } = refused.at(-1);
assert.equal(reason, 'too-large');
assert.deepEqual([box.west, box.east], [100, -100], 'the short arc');
assert.equal(lonSpanDeg(box.west, box.east), 160);
assert.equal(message, validateBox(box).message);
await f.tool.destroy();
});
-7
View File
@@ -529,7 +529,6 @@ export function createRecentImageryPanel({
function exportsView() {
const ab = snapshot.mode === 'ab';
// Worldview Snapshots rejects a crossing BBOX: say so up front.
const crossing = Boolean(
snapshot.box && snapshot.box.west > snapshot.box.east,
);
@@ -781,12 +780,6 @@ export function createRecentImageryPanel({
const candidate = exportTarget(slotId);
if (destroyed || !candidate || !snapshot.box || exporting.has(slotId))
return false;
// Worldview Snapshots rejects a west > east BBOX: say so, request nothing.
if (snapshot.box.west > snapshot.box.east) {
exportError = t('Select one side of the dateline');
preserveScroll(paint);
return false;
}
exporting.add(slotId);
exportError = null;
preserveScroll(paint);
+1 -2
View File
@@ -992,11 +992,10 @@ test('opacity drives both images; EXPORT downloads the pin or the preview and EX
const crossingExport = f.byAction('export-a');
assert.equal(crossingExport.disabled, true, 'EXPORT is off up front');
assert.equal(crossingExport.title, 'Select one side of the dateline');
// The exportImage guard stays as a backstop.
assert.equal(await f.readout.exportImage('a'), false);
assert.equal(
f.byId('ri-notice-text').textContent,
'Select one side of the dateline',
'Export failed · A snapshot cannot cross the dateline',
);
assert.equal(
f.fetches.length,
+6 -14
View File
@@ -13,26 +13,18 @@ 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'],
[{ 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]) => {
{ west: 170, south: 10, east: -170, north: 20 }, // dateline, over the size cap
{ west: 10, south: 80, east: 20, north: 89 },
{ west: 10, south: 10, east: 10, north: 20 },
{ west: 10, south: 10, east: 200, north: 20 },
{ west: Number.NaN, south: 10, east: 20, north: 20 },
].map((box) => {
const result = validateBox(box);
assert.equal(result.ok, false);
assert.equal(result.reason, reason);
return result.message;
}),
];
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) {