mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
Street Level is now a provider-neutral layer modelled on the iD editor's photo overlay. The core owns what every imagery provider shares: the enable state and a switch per provider, the imagery filter (360°/flat and captured-since in relative days), one click handler routed by pick prefix, one viewer host that mounts whichever provider's viewer adapter owns the open image, the position marker, camera follow, one on-globe credit per active provider, and share-link parameters (one bit per provider plus the filter). Providers implement the contract in registry.js: coverage, sequences, nearest-image lookup and a viewer adapter emitting a common pose. Mapillary is the only registered provider; Google Street View, KartaView and Panoramax slot in beside it. Panel: a PROVIDERS chip row (one chip per registered provider, keyless chips read as errors), relative-day SINCE options, a provider-neutral caption whose link label follows the provider, and no vendor mark in the header. The panel inner is a rail scroller like CCTV's. Tests cover the registry, params codec, filter, pick router, UI-state composition, the provider definition and coverage-tile decoding; the QA harness switches the provider off and on and checks the filter. Co-Authored-By: Claude Fable 5.1 <[email protected]>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { createPickRouter } from './pickRouter.js';
|
|
|
|
const providers = [
|
|
{ def: { id: 'mapillary', pickPrefix: 'mly:' }, instance: { name: 'm' } },
|
|
{ def: { id: 'panoramax', pickPrefix: 'pnx:' }, instance: { name: 'p' } },
|
|
];
|
|
|
|
test('ids are routed by prefix to their provider instance', () => {
|
|
const router = createPickRouter(() => providers, { positionId: 'sl:pos' });
|
|
assert.deepEqual(router.resolve('mly:seq:1'), {
|
|
providerId: 'mapillary',
|
|
instance: providers[0].instance,
|
|
id: 'mly:seq:1',
|
|
});
|
|
assert.equal(router.resolve('pnx:img:9').providerId, 'panoramax');
|
|
assert.equal(router.ownsPick('mly:img:2'), true);
|
|
});
|
|
|
|
test('the core-owned marker is owned but routes to no provider', () => {
|
|
const router = createPickRouter(() => providers, { positionId: 'sl:pos' });
|
|
assert.deepEqual(router.resolve('sl:pos'), {
|
|
providerId: null,
|
|
instance: null,
|
|
id: 'sl:pos',
|
|
});
|
|
assert.equal(router.ownsPick('sl:pos'), true);
|
|
});
|
|
|
|
test('foreign and malformed ids are not ours', () => {
|
|
const router = createPickRouter(() => providers);
|
|
for (const id of ['cctv:1', '', null, undefined, 42, {}])
|
|
assert.equal(router.ownsPick(id), false, String(id));
|
|
assert.equal(router.resolve('sl:pos'), null, 'no marker id configured');
|
|
});
|