Street Level: drop the unused coverageLines diagnostics

Nothing reads the drawn coverage lines: the browser gate aims elsewhere, so
lineCoverage's drawnLines, the providers' coverageLines and the layer's
coverageLines go, with their tests and the doc mention.
This commit is contained in:
German Khokhlov committed 2026-11-10 23:58:03 +04:00
1 parent e34b5103c6
commit c76832ca69
10 files changed
+2 -139

No files matched your search

+2 -3
View File
@@ -5121,9 +5121,8 @@ app.
(`revealPanel`, which does nothing above 720px).
The layer also exposes `requiredMapStack(id)` and `providerStatus(id)` for
callers that decide before the panel lists a source, `holdViewer()`, and
`coverageLines(id)` (the lines a provider draws now, as `[lon, lat]` parts)
for diagnostics. A caller's abort is honoured through the viewer's mount and
callers that decide before the panel lists a source, and `holdViewer()`. A
caller's abort is honoured through the viewer's mount and
load, and only the lookup that still owns the panel changes its spinner or
error.
-4
View File
@@ -515,10 +515,6 @@ export function createStreetLevelLayer({
const def = defs.find((entry) => entry.id === providerId);
return def?.requiresMapStack || null;
},
/** The coverage lines a provider draws now (see `coverageLines`). */
coverageLines(providerId) {
return state.providers.get(providerId)?.instance.coverageLines?.() ?? [];
},
/**
* A provider's name and key state on any map (the panel lists a provider
* only on the map it needs). `configured` is null until its status call
-37
View File
@@ -1604,43 +1604,6 @@ test('the action over the real layer: a billed link arms without a lookup, and o
assert.equal(fake.lookups.length, before + 2);
});
test('coverageLines hands back what a provider draws, and nothing for providers without lines', async (t) => {
const drawing = fakeProvider();
const create = drawing.create;
drawing.create = (context) => ({
...create(context),
coverageLines: () => [
{
id: 's1',
parts: [
[
[1, 2],
[1, 2.001],
],
],
},
],
});
const { layer } = await enabledLayer(t, [drawing]);
assert.deepEqual(layer.coverageLines(drawing.id), [
{
id: 's1',
parts: [
[
[1, 2],
[1, 2.001],
],
],
},
]);
assert.deepEqual(layer.coverageLines('nope'), []);
});
test('coverageLines is empty for a provider that draws no coverage', async (t) => {
const { layer } = await enabledLayer(t, [fakeProvider()]);
assert.deepEqual(layer.coverageLines(fakeProvider().id), []);
});
test('openNearest keeps honouring the caller after the lookup: an abort while the viewer loads opens nothing', async (t) => {
let releaseMount = null;
const provider = fakeProvider({ nearestImage: async () => 'img-1' });
-19
View File
@@ -531,24 +531,6 @@ export function createLineCoverage({
};
}
/**
* The sequence lines drawn now, as `[lon, lat]` parts per sequence, for
* diagnostics: what each tile drew (`attachPrimitive` keeps it in
* `entry.sequences`). Read-only copies.
*/
function drawnLines() {
const lines = [];
for (const entry of state.coverage.tiles.values())
for (const sequence of entry.sequences.values())
lines.push({
id: sequence.id,
parts: (sequence.parts || []).map((part) =>
part.map(([lon, lat]) => [lon, lat]),
),
});
return lines;
}
return {
attach,
detach,
@@ -561,6 +543,5 @@ export function createLineCoverage({
highlight,
sequenceCount,
stats,
drawnLines,
};
}
@@ -654,67 +654,3 @@ test('the selected sequence is drawn and highlighted even past the per-tile cap'
assert.ok(state.coverage.highlight, 'the selected line is highlighted');
coverage.clear();
});
test('drawnLines reports the lines on the globe as [lon, lat] copies, filtered like the drawing', async () => {
const { source, state, coverage, centre } = setup();
assert.deepEqual(coverage.drawnLines(), [], 'nothing before a tile');
const sequences = [
{
id: 'flat-1',
parts: [
[
[centre.lon - 0.001, centre.lat],
[centre.lon + 0.001, centre.lat],
],
],
capturedAt: 2_000_000_000_000,
},
{
id: 'pano-1',
parts: [
[
[centre.lon, centre.lat - 0.001],
[centre.lon, centre.lat],
[centre.lon, centre.lat + 0.001],
],
],
capturedAt: 1_000_000_000_000,
isPano: true,
},
];
state.filter = { pano: 'pano', sinceDays: 0 };
coverage.refresh();
source.calls[0].resolve(encodeCoverageTile(centre.tile, { sequences }));
await settle();
const lines = coverage.drawnLines();
assert.deepEqual(
lines.map((line) => line.id),
['pano-1'],
'only the drawn (filtered) lines',
);
assert.equal(lines[0].parts.length, 1);
assert.equal(lines[0].parts[0].length, 3);
// Tile coordinates are quantised to the tile grid (a few metres at z14).
const [midLon, midLat] = lines[0].parts[0][1];
assert.ok(
Math.abs(midLon - centre.lon) < 1e-4 &&
Math.abs(midLat - centre.lat) < 1e-4,
`coordinates as [lon, lat]: ${midLon}, ${midLat} vs ${centre.lon}, ${centre.lat}`,
);
assert.ok(
lines[0].parts[0][0][1] < lines[0].parts[0][2][1],
'vertex order kept: south to north',
);
// Copies: a caller cannot bend the drawn line.
lines[0].parts[0][1][0] = 0;
assert.notEqual(coverage.drawnLines()[0].parts[0][1][0], 0);
state.filter = { pano: 'all', sinceDays: 0 };
coverage.rebuild();
assert.deepEqual(
coverage
.drawnLines()
.map((line) => line.id)
.sort(),
['flat-1', 'pano-1'],
);
});
@@ -535,7 +535,6 @@ export function createKartaViewProvider({
loading: state.sequence.loading,
error: state.sequence.error,
}),
coverageLines: () => coverage.drawnLines(),
/**
* The nearest photo within the search radius that can be shown, or
@@ -196,7 +196,6 @@ export function createMapillaryProvider({ source, photoViewer = null }) {
loading: state.sequence.loading,
error: state.sequence.error,
}),
coverageLines: () => parts.coverage.drawnLines(),
/**
* The nearest image that passes the imagery filter, or null: what
@@ -526,9 +526,6 @@ export function createPanoramaxProvider({
cones.clearSelection();
drawn = null;
},
// The lines drawn now (current and stale tiles), as [lon, lat]
// parts, for diagnostics and the browser gate's line clicks.
coverageLines: () => coverage.drawnLines(),
sequenceStats: () => ({
selectedId: state.sequence.selectedId,
images: state.sequence.images.length,
@@ -1182,9 +1182,3 @@ test('a busy or timed-out tile keeps its own message; only a body that is not a
assert.equal(env.instance.sequenceStats().error, failure.message);
}
});
test('coverageLines exposes the drawn lines, none before any tile', () => {
const { instance } = setup();
assert.equal(typeof instance.coverageLines, 'function');
assert.deepEqual(instance.coverageLines(), []);
});
-1
View File
@@ -51,7 +51,6 @@ export function filtersOf(provider) {
* @property {(sequenceId: string) => Promise<void>} [selectSequence]
* @property {() => void} [clearSequence]
* @property {() => {selectedId: string|null, images: number, loading: boolean, error?: string|null}} [sequenceStats]
* @property {() => Array<{id: string, parts: Array<Array<[number, number]>>}>} [coverageLines] The coverage lines drawn now, as [lon, lat] parts (diagnostics).
* @property {(point: {lat: number, lon: number}, options?: {signal?: AbortSignal, radiusM?: number}) => Promise<string|null>} [nearestImage] For ground clicks and `openNearest`; an aborted lookup gives up (it may reject with an AbortError). `radiusM` asks for a wider search than NEAREST_RADIUS_M; a provider that cannot search wider ignores it.
* @property {ViewerAdapter} viewer
*