mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(street-level): "show me X on Street View" action, street_level view field and sl= links
show_street_level (voice and typed) flies to a place and opens its nearest street-level photo from Google Street View, Mapillary, KartaView or Panoramax; Street View switches to Google 3D first. The view model gains a street_level field, share links carry sl=<source>,<lat>,<lon>, and show_in_gods_eye_view can open a photo. A plain sl=google link only arms the point and waits for OPEN, so it never bills a key without a click. Embed pages show an open photo in an overlay that Esc closes. On-screen strings are translated into es, ru, zh-CN and zh-Hant. Covered by unit tests and three new steps in the Street Level browser suite.
This commit is contained in:
1 parent
f3adccd01a
commit
98de41c94a
64 files changed
+4147
-66
No files matched your search
@@ -113,3 +113,104 @@ test('links carry a camera, style, map and an entity to follow', async () => {
|
||||
/Give a view, an area, or a camera with lat and lon/,
|
||||
);
|
||||
});
|
||||
|
||||
test('links can open street-level photos at the area, on the map the source needs', async () => {
|
||||
const { viewFromParams } = await import('../../view/index.js');
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
services: { app: { baseUrl: 'http://localhost:4173/' } },
|
||||
});
|
||||
const result = await catalog.call('show_in_gods_eye_view', {
|
||||
area: { lat: 38.5799, lon: -121.4937, radius_km: 1 },
|
||||
street_level: { provider: 'google' },
|
||||
});
|
||||
const { view } = result.data;
|
||||
assert.equal(view.map, 'photoreal');
|
||||
assert.deepEqual(view.layers, ['street-level']);
|
||||
assert.deepEqual(view.street_level, {
|
||||
provider: 'google',
|
||||
lat: 38.5799,
|
||||
lon: -121.4937,
|
||||
});
|
||||
const params = new URLSearchParams(new URL(result.data.url).hash.slice(1));
|
||||
assert.equal(params.get('sl'), 'google,38.57990,-121.49370');
|
||||
assert.equal(params.get('map'), 'photoreal');
|
||||
assert.deepEqual(viewFromParams(params), view);
|
||||
|
||||
const point = await catalog.call('show_in_gods_eye_view', {
|
||||
view,
|
||||
street_level: { provider: 'mapillary', lat: 38.58, lon: -121.49 },
|
||||
});
|
||||
assert.deepEqual(point.data.view.street_level, {
|
||||
provider: 'mapillary',
|
||||
lat: 38.58,
|
||||
lon: -121.49,
|
||||
});
|
||||
await assert.rejects(
|
||||
catalog.call('show_in_gods_eye_view', {
|
||||
area: { lat: 0, lon: 0, radius_km: 1 },
|
||||
map: 'osm',
|
||||
street_level: { provider: 'google' },
|
||||
}),
|
||||
/photoreal/,
|
||||
);
|
||||
});
|
||||
|
||||
test('a new area moves a passed-through view’s photos, and a tilted area still opens them at its centre', async () => {
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
services: { app: { baseUrl: 'http://localhost:4173/' } },
|
||||
});
|
||||
const first = await catalog.call('show_in_gods_eye_view', {
|
||||
area: { lat: 38.5799, lon: -121.4937, radius_km: 1 },
|
||||
street_level: { provider: 'google' },
|
||||
});
|
||||
const second = await catalog.call('show_in_gods_eye_view', {
|
||||
view: first.data.view,
|
||||
area: { lat: 42.3314, lon: -83.0458, radius_km: 1 },
|
||||
});
|
||||
assert.deepEqual(second.data.view.street_level, {
|
||||
provider: 'google',
|
||||
lat: 42.3314,
|
||||
lon: -83.0458,
|
||||
});
|
||||
const tilted = await catalog.call('show_in_gods_eye_view', {
|
||||
area: { lat: 48.8584, lon: 2.2945, radius_km: 1 },
|
||||
camera: { pitch_deg: -30 },
|
||||
street_level: { provider: 'mapillary' },
|
||||
});
|
||||
assert.notEqual(
|
||||
tilted.data.view.camera.lat,
|
||||
48.8584,
|
||||
'the camera sits behind the target',
|
||||
);
|
||||
assert.deepEqual(tilted.data.view.street_level, {
|
||||
provider: 'mapillary',
|
||||
lat: 48.8584,
|
||||
lon: 2.2945,
|
||||
});
|
||||
await assert.rejects(
|
||||
catalog.call('show_in_gods_eye_view', {
|
||||
area: { lat: 0, lon: 0, radius_km: 1 },
|
||||
follow: { kind: 'aircraft', id: 'AE1234' },
|
||||
street_level: {},
|
||||
}),
|
||||
/cannot both follow/,
|
||||
);
|
||||
});
|
||||
|
||||
test('a view passed through alone keeps its street-level photos', async () => {
|
||||
const catalog = composeCatalog({
|
||||
tools: coreTools,
|
||||
services: { app: { baseUrl: 'http://localhost:4173/' } },
|
||||
});
|
||||
const first = await catalog.call('show_in_gods_eye_view', {
|
||||
area: { lat: 38.5799, lon: -121.4937, radius_km: 1 },
|
||||
street_level: { provider: 'mapillary' },
|
||||
});
|
||||
const again = await catalog.call('show_in_gods_eye_view', {
|
||||
view: first.data.view,
|
||||
});
|
||||
assert.deepEqual(again.data.view.street_level, first.data.view.street_level);
|
||||
assert.deepEqual(again.data.view, first.data.view);
|
||||
});
|
||||
Reference in new issue
Block a user