Merge main into fix/earthquake-click-details

Resolves conflicts with main: a world focus target's own range past its
framed radius replaces the kind's range (#1832), so a quake asks for its
own range only past M6 and the earthquake framing stays its floor; FIRMS
keeps main's marker stand-in under the card-on-top rule; launches keep
main's label click and also read the card on top through the pick
registry.
This commit is contained in:
Sameh Khamis committed 2026-11-18 18:58:07 -08:00
commit e87aa5190d
1337 files changed
+38638 -9950

No files matched your search

+8
View File
@@ -8,6 +8,9 @@ import { useDisplayStore } from '../ui/stores/display.js';
import { applicationPinia } from '../ui/vueRuntime.js';
import { t } from '../i18n/index.js';
/** Where the camera starts unless a host gives a `startView`. */
export { START_VIEW };
/**
* Construct the existing controls and camera presentation. `initialShareCode`
* opens a share code (the `<code>` of `/share/<code>`) at start-up, for a host
@@ -15,6 +18,9 @@ import { t } from '../i18n/index.js';
* picker, for a host that offers its own language choice (`switchLocale` from
* the `./i18n` entry). `startView` is where the camera starts (the whole
* planet by default; a host may pass a city); a shared view flies from there.
* `homeView` is where the title's logo goes back to (with the clock live): the
* start view unless given, for a host whose `startView` only carries a view
* across a rebuild.
* `services.cockpitSubjects` adds the application's own first-person subjects
* to the Cockpit (src/cockpitSubjectProviders.js).
*/
@@ -29,6 +35,7 @@ export function createApplicationControls({
initialShareCode = null,
localePicker = true,
startView = START_VIEW,
homeView = startView,
}) {
// Every boot starts from the same view, before share restoration flies on.
applyStartView(viewer, startView);
@@ -51,6 +58,7 @@ export function createApplicationControls({
// A share code to open at start-up instead of the page's address.
initialShareCode,
localePicker,
homeView,
});
defer(() => styleManager.orbitController.stop());
defer(() => styleManager.hud.destroy());
+62 -45
View File
@@ -48,6 +48,13 @@ import { overlayHost } from './layers/overlayHost.js';
* Attach scene tools, rendering listeners and the application debug handle.
* `scene` is what `createApplicationScene` returns; its `trimStaleCommands`
* runs after each layer disable (a scene without one keeps that memory).
* `library.fetchTile` and `library.fetchData` fetch the Data Library's tiles
* and proxied datasets in place of the defaults (`createLibrarySource`).
* `library.fetchImpl` asks the library server (its catalog) in place of the
* page's fetch, for a server that wants the application's own credentials.
* `library.requireCatalog` offers only what the server's library catalog
* names, and nothing while it does not answer. `library: false` leaves the
* Data Library out: no catalog is asked, and no Browse button is drawn.
*/
export function createApplicationTools({
scene,
@@ -60,6 +67,7 @@ export function createApplicationTools({
onSceneDirector,
sceneDataPacks,
drawMarkActions = [],
library = {},
signal,
defer,
}) {
@@ -148,51 +156,60 @@ export function createApplicationTools({
connect: connectDisplay,
});
defer(() => geoFileImport?.destroy());
// DATA ▸ Library: entries register their layers only when a viewer adds
// them, after the core catalog is sealed. The browser dialog and the
// controller share the application lifetime.
const dataLibrary = createDataLibrary({
dataManager,
services: localGeoJsonServices,
getTileset: () => tileset,
mapStackController,
shareLink: styleManager.shareLinkManager,
requestRender: governorRequestRender,
// Zoom to layer: an immediate navigation, so Cockpit can refuse it and
// the current follow owner is released first (as for imported files).
zoomTo: (extent) =>
styleManager.runImmediateNavigation('layer', () =>
flyToLibraryExtent(viewer, extent),
) !== false,
});
defer(() => dataLibrary.destroy());
// Browse: the owner presents the dialog through the store; LayerPanelsView
// draws the Browse button and the dialog from it.
const libraryStore = useDataLibraryStore(applicationPinia());
const libraryBrowser = createLibraryBrowser({
library: dataLibrary,
publish: (view) => libraryStore.publish(view),
});
libraryStore.connect(libraryBrowser.controls);
defer(() => {
libraryBrowser.destroy();
libraryStore.connect(null);
});
dataLibrary.start({ signal }).catch((error) => {
if (!signal?.aborted) console.warn('[Library] start failed:', error);
});
// The live gate's handle (scripts/qa-data-library.mjs).
const libraryHandle = {
library: dataLibrary,
browser: libraryBrowser,
// What Copy Link would copy.
buildShareLink: () => styleManager.shareLinkManager?.buildLink?.() ?? null,
};
window.__gevDataLibrary = libraryHandle;
defer(() => {
if (window.__gevDataLibrary === libraryHandle)
delete window.__gevDataLibrary;
});
if (library !== false) {
// DATA ▸ Library: entries register their layers only when a viewer adds
// them, after the core catalog is sealed. The browser dialog and the
// controller share the application lifetime.
const dataLibrary = createDataLibrary({
dataManager,
services: localGeoJsonServices,
getTileset: () => tileset,
mapStackController,
shareLink: styleManager.shareLinkManager,
requestRender: governorRequestRender,
// An application's own tile and dataset fetches, when it keeps them in
// its own cache.
fetchImpl: library.fetchImpl ?? undefined,
fetchTile: library.fetchTile ?? null,
fetchData: library.fetchData ?? null,
requireCatalog: library.requireCatalog === true,
// Zoom to layer: an immediate navigation, so Cockpit can refuse it and
// the current follow owner is released first (as for imported files).
zoomTo: (extent) =>
styleManager.runImmediateNavigation('layer', () =>
flyToLibraryExtent(viewer, extent),
) !== false,
});
defer(() => dataLibrary.destroy());
// Browse: the owner presents the dialog through the store; LayerPanelsView
// draws the Browse button and the dialog from it.
const libraryStore = useDataLibraryStore(applicationPinia());
const libraryBrowser = createLibraryBrowser({
library: dataLibrary,
publish: (view) => libraryStore.publish(view),
});
libraryStore.connect(libraryBrowser.controls);
defer(() => {
libraryBrowser.destroy();
libraryStore.connect(null);
});
dataLibrary.start({ signal }).catch((error) => {
if (!signal?.aborted) console.warn('[Library] start failed:', error);
});
// The live gate's handle (scripts/qa-data-library.mjs).
const libraryHandle = {
library: dataLibrary,
browser: libraryBrowser,
// What Copy Link would copy.
buildShareLink: () =>
styleManager.shareLinkManager?.buildLink?.() ?? null,
};
window.__gevDataLibrary = libraryHandle;
defer(() => {
if (window.__gevDataLibrary === libraryHandle)
delete window.__gevDataLibrary;
});
}
// DATA ▸ Recent Imagery: the box tool claims the pointer like Draw and the
// panel lives on the right rail, so both belong to the application
// lifetime. The tileset lets the layer drape while the globe is hidden.
+8 -6
View File
@@ -595,7 +595,7 @@ test('Cockpit Display portal retains both scroll owners across round trips', ()
const portal = CockpitDisplayPortal.toString();
assert.match(
portal,
/this\.standardScrollTop =\s*displayPanelScroller\(standardPanel\)\?\.scrollTop \|\| 0/,
/this\.standardScrollTop = standardPanel\?\.scrollTop \|\| 0/,
);
assert.match(
portal,
@@ -603,7 +603,7 @@ test('Cockpit Display portal retains both scroll owners across round trips', ()
);
assert.match(
portal,
/if \(!this\.active\)[\s\S]*?this\.standardScrollTop =\s*displayPanelScroller\(standardPanel\)\.scrollTop/,
/if \(!this\.active\)[\s\S]*?this\.standardScrollTop = standardPanel\.scrollTop/,
);
assert.match(
portal,
@@ -611,7 +611,7 @@ test('Cockpit Display portal retains both scroll owners across round trips', ()
);
assert.match(
portal,
/this\.cockpitPanel\.scrollTop = this\.cockpitScrollTop[\s\S]*?displayPanelScroller\(this\.standardPanel\)\.scrollTop =\s*this\.standardScrollTop/,
/this\.cockpitPanel\.scrollTop = this\.cockpitScrollTop[\s\S]*?this\.standardPanel\.scrollTop = this\.standardScrollTop/,
);
});
@@ -680,6 +680,7 @@ test('fresh Cockpit entry temporarily collapses map panels and exit restores the
'scene-panel',
'pp-toggles',
'global-context-panel',
'space-missions-panel',
'radio-panel',
]) {
assert.match(
@@ -1261,14 +1262,15 @@ test('Global Context uses its dedicated right rail without a duplicate Data Laye
);
assert.match(html, /id="global-context-panel"/);
assert.match(html, /id="global-context-flights-btn"/);
assert.match(html, /id="global-context-missions-btn"/);
assert.doesNotMatch(html, /id="global-context-missions-btn"/);
assert.match(html, /id="space-missions-panel"/);
});
test('Global Context standby describes both chooser modes', () => {
test('Global Context standby describes Contacts', () => {
const match = html.match(/<div id="context-mode-standby"[\s\S]*?<\/div>/);
assert.ok(match, 'Global Context standby is missing');
assert.match(match[0], /CONTACTS — nearest planes · vessels · sites/);
assert.match(match[0], /SPACE MISSIONS — launches &amp; orbital assets/);
assert.doesNotMatch(match[0], /SPACE MISSIONS/);
});
test('cockpit briefing cycle control keeps its state as the accessible name', () => {
+7 -4
View File
@@ -58,12 +58,15 @@ export function cockpitAnchorCorrectionStep(
return Math.min(distanceM, eased, correctionRateMps * dt);
}
/** How late past its interval an update may come and still count in full. */
const COCKPIT_SUBJECT_LATE_SEC = 1;
/**
* The seconds an application subject's camera update advances its heading
* slew, ground lift and anchor by: the time since the last update, at most
* its update interval plus 0.1 s. A subject updated every 500 ms then turns
* and eases at its configured rates, while a long stall (a hidden tab) still
* moves it no further than one late update would.
* its interval plus COCKPIT_SUBJECT_LATE_SEC. A subject updated every 500 ms,
* or a browser drawing 5 frames a second, then keeps up, while a long stall
* (a hidden tab) counts as one late update.
* @param {number} elapsedMs Time since the last camera update.
* @param {number} intervalMs The subject's update interval (0: every frame).
* @returns {number}
@@ -75,7 +78,7 @@ export function cockpitSubjectStepSec(elapsedMs, intervalMs) {
const intervalSec = Number.isFinite(intervalMs)
? Math.max(0, intervalMs) / 1000
: 0;
return Math.min(intervalSec + 0.1, elapsedSec);
return Math.min(intervalSec + COCKPIT_SUBJECT_LATE_SEC, elapsedSec);
}
/** Return whether a throttled cockpit presentation update is due. */
+7 -4
View File
@@ -73,12 +73,15 @@ test('an application subject steps by its interval, never by a long stall', () =
assert.equal(cockpitSubjectStepSec(16, 0), 0.016);
assert.equal(cockpitSubjectStepSec(500, 500), 0.5);
assert.equal(cockpitSubjectStepSec(520, 500), 0.52);
// A hidden tab's minutes count as one late update.
assert.equal(cockpitSubjectStepSec(60_000, 500), 0.6);
assert.equal(cockpitSubjectStepSec(60_000, 0), 0.1);
// Slow frames (5 a second) count in full...
assert.equal(cockpitSubjectStepSec(200, 50), 0.2);
assert.equal(cockpitSubjectStepSec(1000, 0), 1);
// ...and a hidden tab's minutes as one late update.
assert.equal(cockpitSubjectStepSec(60_000, 500), 1.5);
assert.equal(cockpitSubjectStepSec(60_000, 0), 1);
assert.equal(cockpitSubjectStepSec(-5, 500), 0);
assert.equal(cockpitSubjectStepSec(Number.NaN, 500), 0);
assert.equal(cockpitSubjectStepSec(1000, Number.NaN), 0.1);
assert.equal(cockpitSubjectStepSec(1000, Number.NaN), 1);
});
test('cockpit camera clearance never falls below the rendered ground floor', () => {
+19 -6
View File
@@ -30,13 +30,26 @@ const TONE_RANK = Object.freeze([
const stronger = (a, b) =>
TONE_RANK.indexOf(b) > TONE_RANK.indexOf(a) ? b : a;
/** A label's width estimate (px): its longer line in small capitals. */
/** Full-width glyphs in the BMP: CJK, kana, Hangul, full-width forms. */
const WIDE_GLYPHS =
/[\u1100-\u115F\u2E80-\u303E\u3041-\u33FF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7A3\uF900-\uFAFF\uFE30-\uFE4F\uFF00-\uFF60\uFFE0-\uFFE6]/g;
/**
* One line's width (px) in `.cockpit-progress-label` type (cockpitSubject.css:
* 10 px, 0.06 em spacing): 10.6 px a full-width glyph and 6.4 px each UTF-16
* unit of any other, so an astral glyph (an emoji, a CJK extension) counts as
* two and an emoji in the BMP (☕) as one, narrower than it is drawn. The
* detail line's `<small>` draws smaller, so these widths only overestimate it.
*/
function lineWidthPx(line) {
const text = String(line ?? '');
const wide = text.match(WIDE_GLYPHS)?.length ?? 0;
return wide * 10.6 + (text.length - wide) * 6.4;
}
/** A label's width estimate (px): its wider line and 8 px of padding. */
export function estimateProgressLabelPx(label) {
const longest = Math.max(
String(label?.text ?? '').length,
String(label?.detail ?? '').length,
);
return longest * 6.4 + 8;
return Math.max(lineWidthPx(label?.text), lineWidthPx(label?.detail)) + 8;
}
/**
+60 -1
View File
@@ -4,7 +4,10 @@
// the travelled part.
import test from 'node:test';
import assert from 'node:assert/strict';
import { cockpitProgressLayout } from './cockpitProgress.js';
import {
cockpitProgressLayout,
estimateProgressLabelPx,
} from './cockpitProgress.js';
const tick = (at, label = null, tone = 'normal') => ({ at, tone, label });
const label = (text, priority, align = 'center', detail = '') => ({
@@ -142,3 +145,59 @@ test('a long run of calls still lays out, every one a tick or part of one', () =
assert.ok(narrow.ticks.length < wide.ticks.length);
assert.equal(wide.ticks.length, 60);
});
test('a CJK stop name gets the width its full-width glyphs need', () => {
const text = '中央駅前広場東口'; // 8 full-width glyphs
// 10 px type, 0.06 em apart.
const needPx = text.length * (10 + 0.6);
const givenPx = estimateProgressLabelPx({ text, detail: '' });
assert.ok(
givenPx >= needPx,
`${givenPx} px given, about ${needPx} px needed`,
);
// As many Latin letters are narrower; half-width katakana are as narrow.
assert.ok(givenPx > estimateProgressLabelPx({ text: 'CENTRALS' }));
assert.equal(
estimateProgressLabelPx({ text: 'カタカナ' }),
estimateProgressLabelPx({ text: 'KANA' }),
);
});
test('astral glyphs (emoji outside the BMP, supplementary kana) in a progress label get at least 1 em each', () => {
// About 1 em in 10 px type, 0.06 em apart.
const emPx = 10 + 0.6;
for (const [text, needPx] of [
['🚉🚆🚇🚋', 4 * emPx],
['🚆'.repeat(8), 8 * emPx],
// Supplementary kana, outside the full-width ranges.
['𛀁𛀂', 2 * emPx],
// Mixed: four emoji, a space and two full-width glyphs.
['🚆🚇🚌🚕 乗換', 4 * emPx + 6.4 + 2 * emPx],
]) {
const givenPx = estimateProgressLabelPx({ text, detail: '' });
assert.ok(
givenPx >= needPx + 8,
`${text}: ${givenPx} px given, about ${needPx} px needed`,
);
}
});
test('a label is as wide as its wider line, its smaller detail line included', () => {
assert.ok(
estimateProgressLabelPx({ text: 'GATE', detail: '中央駅前' }) >
estimateProgressLabelPx({ text: 'GATE', detail: '' }),
'the wider detail line widens the label',
);
// As headless Chrome draws the detail's <small> (8.333 px JetBrains Mono,
// 0.6 px apart): 'WWWWMMMMWWWW' at 67.2 px, '中央駅前広場東口' at 72.9 px.
for (const [detail, needPx] of [
['W'.repeat(64), 64 * (67.2 / 12)],
['駅'.repeat(45), 45 * (72.9 / 8)],
]) {
const givenPx = estimateProgressLabelPx({ text: 'A', detail });
assert.ok(
givenPx >= needPx,
`${detail.length} × ${detail[0]}: ${givenPx} px given, ${needPx} px needed`,
);
}
});
+91 -62
View File
@@ -117,20 +117,27 @@ function lookOf(raw) {
});
}
/** Promises already given a catch: a pending one is read again on every use. */
const caughtWords = new WeakSet();
/**
* A provider's worded member `key` as it reads now, normalized: the value,
* or what the function it is returns when called on `provider` (so it can
* follow the page's language); null when it is malformed or a read throws.
* Reading the member, and reading what it gives, runs provider code too (a
* getter), so both are guarded as the call is.
* A worded member as `read()` gives it, normalized: called on `provider`
* when it is a function (so it can follow the page's language); null when it
* is malformed (a promise too) or provider code throws, its getter included
* (hence `read`).
*/
function wordedNow(provider, key, normalize) {
function worded(provider, read, normalize) {
try {
const value = provider[key];
return (
normalize(typeof value === 'function' ? value.call(provider) : value) ??
null
);
const value = read();
const words = typeof value === 'function' ? value.call(provider) : value;
if (typeof words?.then === 'function') {
if (!caughtWords.has(words)) {
caughtWords.add(words);
Promise.resolve(words).catch(() => {});
}
return null;
}
return normalize(words) ?? null;
} catch {
return null;
}
@@ -146,7 +153,7 @@ function providerName(provider, order) {
return `#${order}`;
}
/** Why `provider` cannot be kept, or null. */
/** Why `provider` cannot be kept, its worded members aside, or null. */
function refusal(provider, kinds) {
if (!isObject(provider)) return 'not an object';
if (typeof provider.kind !== 'string' || !KIND_PATTERN.test(provider.kind))
@@ -165,14 +172,25 @@ function refusal(provider, kinds) {
typeof provider.isEntryAllowed !== 'function'
)
return 'isEntryAllowed is not a function';
if (!wordedNow(provider, 'entryFace', faceOf)) return 'malformed entry face';
if (!wordedNow(provider, 'labels', labelsOf))
return 'labels need view, exit and exitText';
if (provider.look != null && !wordedNow(provider, 'look', lookOf))
return 'look needs an aheadLabel';
return null;
}
/**
* A provider's worded members, each read once, to seed its copy (so one that
* fails when read again cannot undo this check), or why one is malformed.
* @returns {{face: object, labels: object, look: ?object}|string}
*/
function checkedWords(provider) {
const face = worded(provider, () => provider.entryFace, faceOf);
if (!face) return 'malformed entry face';
const labels = worded(provider, () => provider.labels, labelsOf);
if (!labels) return 'labels need view, exit and exitText';
const lookValue = provider.look;
if (lookValue == null) return { face, labels, look: null };
const look = worded(provider, () => lookValue, lookOf);
return look ? { face, labels, look } : 'look needs an aheadLabel';
}
/**
* The application's subject providers, checked once and frozen, in the order
* entry asks them: ascending `priority`, ties in list order. Each has
@@ -191,7 +209,8 @@ function refusal(provider, kinds) {
* object: it is called on the provider again whenever they are shown and
* when the page's language changes, so its words can follow it
* (`./i18n`). A read that throws or is malformed keeps the last
* good one; `look` is on or off and `restPitchDeg` fixed as first read;
* good one; `look` is on or off and `restPitchDeg` fixed as read at
* registration;
* - `cameraIntervalMs` (optional): 0..1000, null for the Cockpit's default; 0
* updates the camera every rendered frame;
* - `headingSlewDps` (optional): how fast the view turns to a new heading,
@@ -224,7 +243,11 @@ export function cockpitSubjectProviders(
let copy = null;
try {
reason = refusal(provider, kinds);
if (!reason) copy = keptProvider(provider, order);
if (!reason) {
const words = checkedWords(provider);
if (typeof words === 'string') reason = words;
else copy = keptProvider(provider, order, words);
}
} catch {
reason = 'a member threw when read';
}
@@ -241,14 +264,12 @@ export function cockpitSubjectProviders(
return Object.freeze(kept);
}
/** The frozen copy the Cockpit keeps of a provider `refusal` passed. */
function keptProvider(provider, order) {
// Worded members are read again on each use (see above); the last good
// read stands in for one that is malformed or throws.
let face = wordedNow(provider, 'entryFace', faceOf);
let labels = wordedNow(provider, 'labels', labelsOf);
// On or off, and its rest pitch, as first read.
let look = wordedNow(provider, 'look', lookOf);
/**
* The frozen copy the Cockpit keeps of a provider that passed `refusal`,
* seeded with the worded members `checkedWords` read.
*/
function keptProvider(provider, order, words) {
let { face, labels, look } = words;
const restPitchDeg = look?.restPitchDeg ?? 0;
return Object.freeze({
kind: provider.kind,
@@ -256,16 +277,16 @@ function keptProvider(provider, order) {
priority: finite(provider.priority) ? provider.priority : 0,
order,
get entryFace() {
face = wordedNow(provider, 'entryFace', faceOf) ?? face;
face = worded(provider, () => provider.entryFace, faceOf) ?? face;
return face;
},
get labels() {
labels = wordedNow(provider, 'labels', labelsOf) ?? labels;
labels = worded(provider, () => provider.labels, labelsOf) ?? labels;
return labels;
},
get look() {
if (!look) return null;
const now = wordedNow(provider, 'look', lookOf);
const now = worded(provider, () => provider.look, lookOf);
if (now)
look = Object.freeze({ restPitchDeg, aheadLabel: now.aheadLabel });
return look;
@@ -335,11 +356,11 @@ function candidateOf(raw) {
* a position that is not finite, an eye with no valid `upM` (0..1000), or a
* read of it that throws (a getter runs provider code).
* A `heightM` that is not finite or lies outside
* COCKPIT_SUBJECT_MIN_HEIGHT_M..COCKPIT_SUBJECT_MAX_HEIGHT_M reads as null:
* the eye then stands on the shared floor, or where it last stood while that
* is cold. The anchor is `'inertial'` only when asked for and the frame
* gives a speed; otherwise it is `'exact'`. An id is compared with `heldId`
* trimmed, as `cockpitSubjectCandidate` trims it.
* COCKPIT_SUBJECT_MIN_HEIGHT_M..COCKPIT_SUBJECT_MAX_HEIGHT_M reads as null,
* for the eye to stand on the shared floor (ui/cockpitCamera.js). The anchor
* is `'inertial'` by default for a frame with a valid speed, and `'exact'`
* when asked for or with no speed. An id is compared with `heldId` trimmed,
* as `cockpitSubjectCandidate` trims it.
* @param {unknown} raw What `read()` returned.
* @param {string} heldId The subject the view holds.
* @returns {object|null} `{id, name, latitude, longitude, heightM, headingDeg,
@@ -356,49 +377,57 @@ export function cockpitSubjectFrame(raw, heldId) {
}
function frameOf(raw, heldId) {
if (!isObject(raw) || typeof raw.id !== 'string' || raw.id.trim() !== heldId)
return null;
const latitude = raw.latitude;
const longitude = raw.longitude;
if (!isObject(raw)) return null;
// Each field read once: a getter on the frame runs provider code.
const {
id,
name,
latitude,
longitude,
heightM,
headingDeg: rawHeadingDeg,
courseDeg,
speedMps: rawSpeedMps,
stale,
groundClamp,
anchor,
eye: rawEye,
} = raw;
if (typeof id !== 'string' || id.trim() !== heldId) return null;
if (!finite(latitude) || !finite(longitude) || Math.abs(latitude) > 90)
return null;
const eye = isObject(raw.eye) ? raw.eye : null;
if (!eye || !finite(eye.upM) || eye.upM < 0 || eye.upM > 1000) return null;
if (!isObject(rawEye)) return null;
const { upM, forwardM, pitchDeg, minClearanceM } = rawEye;
if (!finite(upM) || upM < 0 || upM > 1000) return null;
const heading = (value) =>
finite(value) ? ((value % 360) + 360) % 360 : null;
const headingDeg = heading(raw.headingDeg);
const speedMps =
finite(raw.speedMps) && raw.speedMps >= 0 ? raw.speedMps : null;
const headingDeg = heading(rawHeadingDeg);
const speedMps = finite(rawSpeedMps) && rawSpeedMps >= 0 ? rawSpeedMps : null;
return {
id: heldId,
name: cockpitSubjectText(raw.name, 64) || cockpitSubjectText(heldId, 64),
name: cockpitSubjectText(name, 64) || cockpitSubjectText(heldId, 64),
latitude,
longitude: ((((longitude + 180) % 360) + 360) % 360) - 180,
heightM:
finite(raw.heightM) &&
raw.heightM >= COCKPIT_SUBJECT_MIN_HEIGHT_M &&
raw.heightM <= COCKPIT_SUBJECT_MAX_HEIGHT_M
? raw.heightM
finite(heightM) &&
heightM >= COCKPIT_SUBJECT_MIN_HEIGHT_M &&
heightM <= COCKPIT_SUBJECT_MAX_HEIGHT_M
? heightM
: null,
headingDeg,
courseDeg: heading(raw.courseDeg) ?? headingDeg,
courseDeg: heading(courseDeg) ?? headingDeg,
speedMps,
stale: raw.stale === true,
groundClamp: raw.groundClamp !== false,
stale: stale === true,
groundClamp: groundClamp !== false,
// An inertial anchor runs on at the frame's speed; with none it would
// close on a moving subject at the correction's floor and fall behind.
anchor: raw.anchor === 'exact' || speedMps === null ? 'exact' : 'inertial',
anchor: anchor === 'exact' || speedMps === null ? 'exact' : 'inertial',
eye: {
upM: eye.upM,
forwardM:
finite(eye.forwardM) && Math.abs(eye.forwardM) <= 500
? eye.forwardM
: 0,
pitchDeg: finite(eye.pitchDeg) ? clamp(eye.pitchDeg, -90, 90) : 0,
upM,
forwardM: finite(forwardM) && Math.abs(forwardM) <= 500 ? forwardM : 0,
pitchDeg: finite(pitchDeg) ? clamp(pitchDeg, -90, 90) : 0,
minClearanceM:
finite(eye.minClearanceM) && eye.minClearanceM >= 0
? eye.minClearanceM
: 0,
finite(minClearanceM) && minClearanceM >= 0 ? minClearanceM : 0,
},
};
}
+42 -8
View File
@@ -642,11 +642,15 @@ test('a provider whose getter throws is left out with one warning; the next is k
]);
});
test('a worded getter that starts throwing keeps the last good words', () => {
let failing = false;
const words = (value) => () => {
if (failing) throw new Error('translations unavailable');
return value;
test('a worded getter that throws from its second read keeps the last good words', () => {
// Registration reads each once: the second read is the first use.
const once = (value) => {
let read = false;
return () => {
if (read) throw new Error('translations unavailable');
read = true;
return value;
};
};
const definition = provider();
for (const [key, value] of Object.entries({
@@ -654,22 +658,52 @@ test('a worded getter that starts throwing keeps the last good words', () => {
entryFace: { icon: 'commute', label: 'RIDE' },
look: { restPitchDeg: 10, aheadLabel: 'Look ahead' },
}))
Object.defineProperty(definition, key, { get: words(value) });
Object.defineProperty(definition, key, { get: once(value) });
const { kept, warnings } = keep([definition]);
assert.deepEqual(warnings, []);
const [ride] = kept;
failing = true;
assert.equal(ride.labels.view, 'Ride view');
assert.equal(ride.entryFace.label, 'RIDE');
assert.deepEqual(ride.look, { restPitchDeg: 10, aheadLabel: 'Look ahead' });
// So does a worded object whose own member throws when read.
failing = false;
Object.defineProperty(definition, 'labels', {
get: () => throwingGetter({ view: 'v', exit: 'e', exitText: 'x' }, 'view'),
});
assert.equal(ride.labels.view, 'Ride view');
});
test('a worded member that returns a rejected promise keeps the last good words, the rejection caught', async () => {
const definition = provider();
const words = definition.labels;
let reads = 0;
definition.labels = () => {
reads += 1;
return reads === 1 ? words : Promise.reject(new Error('late words'));
};
const { kept, warnings } = keep([definition]);
assert.deepEqual(warnings, []);
assert.equal(kept[0].labels.view, words.view);
// An unhandled rejection would fail this test once it surfaces.
await new Promise((resolve) => setTimeout(resolve, 10));
});
test('a frame field read through a getter is read once', () => {
const frame = { id: 'a1', latitude: 1, longitude: 2, eye: { upM: 3 } };
const once = (value) => {
let read = false;
return () => {
const answer = read ? undefined : value;
read = true;
return answer;
};
};
Object.defineProperty(frame, 'heightM', { get: once(420) });
Object.defineProperty(frame, 'speedMps', { get: once(12) });
const normalized = cockpitSubjectFrame(frame, 'a1');
assert.equal(normalized.heightM, 420);
assert.equal(normalized.speedMps, 12);
});
test('a candidate, frame or HUD view whose getter throws reads as null', () => {
assert.equal(
cockpitSubjectCandidate(throwingGetter({ name: 'Example' }, 'id')),
+1 -44
View File
@@ -17,11 +17,6 @@
* @param {number} [input.signalGap] Clearance above the briefing card.
* @param {number} [input.minTopFloor] Absolute ceiling for the strip, in px.
* @param {number} [input.minTopRatio] Viewport-relative ceiling, 0..1.
* @param {boolean} [input.signalCollapsed] Whether the briefing card is collapsed.
* @param {boolean} [input.utilityExpanded] Whether Display or Radio is expanded.
* @param {number} [input.bottomInset] Reserved viewport space below an expanded panel.
* @param {number} [input.signalHeight] Collapsed briefing header reserved below the utility.
* @param {boolean} [input.reserveViewportLane] Theme relocates the briefing below the expanded utility.
* @returns {{ top: number, maxHeight: number }}
*/
export function resolveCockpitUtilityAnchor({
@@ -34,29 +29,13 @@ export function resolveCockpitUtilityAnchor({
signalGap = 8,
minTopFloor = 96,
minTopRatio = 0.12,
signalCollapsed = false,
utilityExpanded = false,
bottomInset = 80,
signalHeight = 0,
reserveViewportLane = false,
}) {
const viewport = Math.max(0, Number(viewportHeight) || 0);
const minTop = Math.max(minTopFloor, viewport * minTopRatio);
const anchoredTop = Math.max(minTop, (Number(recBottom) || 0) + recGap);
const strip = Math.max(0, Number(stripHeight) || 0);
const signal = Number(signalTop);
const expandedLaneBottom = Math.max(
0,
viewport -
Math.max(0, Number(bottomInset) || 0) -
Math.max(0, Number(signalHeight) || 0),
);
const lowerBound =
reserveViewportLane && signalCollapsed && utilityExpanded
? expandedLaneBottom
: Number.isFinite(signal)
? signal
: viewport;
const lowerBound = Number.isFinite(signal) ? signal : viewport;
const clearedTop = lowerBound - signalGap - strip;
const top = Math.max(minTop, Math.min(anchoredTop, clearedTop));
const floor = Math.max(0, Number(collapsedHeight) || 0) || 50;
@@ -100,25 +79,3 @@ export function resolveCockpitUtilityLayout({
),
};
}
/** Shared Cyber panel slot, with footer controls above the lower frame (83vh). */
export function resolveCyberCockpitPanelLane({
viewportHeight,
top,
launcherHeight = 60,
signalHeight = 44,
contactHeight = 64,
}) {
const gap = 8;
const footerHeight = Math.max(
contactHeight + gap,
launcherHeight + signalHeight + gap * 2,
);
const bottom = viewportHeight * 0.82;
const panelHeight = Math.max(120, bottom - top - footerHeight);
return {
panelHeight,
utilityHeight: panelHeight + gap + launcherHeight,
signalTop: top + panelHeight + launcherHeight + gap * 2,
};
}
+1 -71
View File
@@ -4,58 +4,11 @@ import assert from 'node:assert/strict';
import {
resolveCockpitUtilityAnchor,
resolveCockpitUtilityLayout,
resolveCyberCockpitPanelLane,
} from './cockpitUtilityLayout.js';
// 1512x790, the height the strip used to collide with the briefing card at.
const desktop = { viewportHeight: 790, stripHeight: 107, collapsedHeight: 50 };
test('Cyber shared panel slot reserves both footer lanes above the decorative frame', () => {
for (const viewportHeight of [600, 673, 713, 986, 1376]) {
for (const signalHeight of [44, 76]) {
for (const contactHeight of [44, 84, 120]) {
const top = Math.max(164, Math.min(204, viewportHeight * 0.19));
const lane = resolveCyberCockpitPanelLane({ viewportHeight, top, signalHeight, contactHeight });
assert.ok(lane.panelHeight >= 120);
assert.ok(top + lane.panelHeight + 8 + contactHeight <= viewportHeight * 0.82 + .01);
assert.ok(lane.signalTop + signalHeight <= viewportHeight * 0.82 + .01);
assert.equal(lane.signalTop, top + lane.utilityHeight + 8);
}
}
}
});
test('Cyber keeps the Data Layers top while reserving briefing clearance', () => {
for (const viewportHeight of [673, 713, 986, 1376]) {
const leftTop = Math.max(164, Math.min(204, viewportHeight * 0.19));
const collapsed = resolveCockpitUtilityAnchor({
viewportHeight, stripHeight: 128, collapsedHeight: 60, recBottom: 0,
signalTop: leftTop + 128 + 28, minTopFloor: leftTop, minTopRatio: 0,
});
assert.equal(collapsed.top, leftTop);
assert.ok(collapsed.maxHeight >= 128);
const expanded = resolveCockpitUtilityAnchor({
viewportHeight, stripHeight: 700, collapsedHeight: 60, recBottom: 0,
signalTop: 255, minTopFloor: leftTop, minTopRatio: 0,
signalCollapsed: true, utilityExpanded: true, reserveViewportLane: true, signalHeight: 44,
});
assert.equal(expanded.top, leftTop);
assert.equal(expanded.top + expanded.maxHeight + 8 + 44 + 80, viewportHeight);
}
});
test('expanded utilities reserve the visible collapsed briefing header at every desktop height', () => {
for (const viewportHeight of [640, 720, 987, 1376]) {
for (const signalHeight of [48, 76, 100]) {
const { top, maxHeight } = resolveCockpitUtilityAnchor({
...desktop, viewportHeight, recBottom: 0, signalTop: 255,
signalCollapsed: true, utilityExpanded: true, signalHeight, reserveViewportLane: true,
});
assert.equal(top + maxHeight + 8, viewportHeight - 80 - signalHeight);
}
}
});
test('the strip hangs 12px under the REC readout when the briefing card leaves room', () => {
const { top } = resolveCockpitUtilityAnchor({ ...desktop, recBottom: 148.1, signalTop: 420 });
assert.equal(Number(top.toFixed(1)), 160.1);
@@ -101,34 +54,11 @@ test('a missing REC readout leaves the strip on the viewport ceiling', () => {
assert.equal(top, 96);
});
test('an expanded utility claims the vertical lane released by a collapsed briefing', () => {
const { top, maxHeight } = resolveCockpitUtilityAnchor({
...desktop,
recBottom: 148.1,
signalTop: 265.4,
signalCollapsed: true,
utilityExpanded: true,
reserveViewportLane: true,
});
assert.equal(Number(top.toFixed(1)), 160.1);
assert.equal(Number(maxHeight.toFixed(1)), 541.9);
});
test('non-relocating themes preserve the visible briefing boundary even when collapsed', () => {
test('the visible briefing card bounds the utility strip, collapsed or not', () => {
const { top, maxHeight } = resolveCockpitUtilityAnchor({
...desktop, recBottom: 148.1, signalTop: 265.4,
signalCollapsed: true, utilityExpanded: true,
});
assert.equal(Number((top + maxHeight).toFixed(1)), 257.4);
});
test('a collapsed briefing still bounds the utility strip until a panel expands', () => {
const { maxHeight } = resolveCockpitUtilityAnchor({
...desktop,
recBottom: 148.1,
signalTop: 265.4,
signalCollapsed: true,
});
assert.equal(Number(maxHeight.toFixed(1)), 107);
});
+19 -106
View File
@@ -1,5 +1,3 @@
import { msg } from './i18n/marker.js';
const CONTEXT_DEPENDENCIES = Object.freeze({
flights: new Set([
'military-awareness',
@@ -8,15 +6,18 @@ const CONTEXT_DEPENDENCIES = Object.freeze({
'ais-live-vessels',
'military-installations',
]),
'space-missions': new Set(['rocket-launches', 'satellites']),
});
const CONTEXT_COMPANIONS = new Set(['radio']);
/** The Space Missions refusal, with the blocked layer's name as {layer}. */
export const SPACE_MISSIONS_LAYER_BLOCK_REASON = msg(
'Space Missions isolates replay data. Exit the mode to enable {layer}.',
);
const [BLOCK_REASON_PREFIX, BLOCK_REASON_SUFFIX] =
SPACE_MISSIONS_LAYER_BLOCK_REASON.split('{layer}');
/**
* Layers Context never touches: Space Missions and the Satellites layer it
* depends on. Contacts neither switches them off on entry nor restores them
* on exit, so they run beside it in either order and keep their own state
* (the mission controller owns the Satellites dependency).
*/
export const CONTEXT_INDEPENDENT_LAYER_IDS = Object.freeze([
'rocket-launches',
'satellites',
]);
/** Return whether an origin represents a direct user choice on this route. */
export function isExplicitUserIntentOrigin(origin, layerId = null) {
return origin === 'user' || origin === 'voice';
@@ -27,7 +28,8 @@ export function recordContextRestoreExplicitChange({ restoreState, change }) {
if (
!restoreState?.enabledLayerIds ||
change?.type !== 'visibility' ||
!isExplicitUserIntentOrigin(change.origin, change.layerId)
!isExplicitUserIntentOrigin(change.origin, change.layerId) ||
CONTEXT_INDEPENDENT_LAYER_IDS.includes(change.layerId)
)
return false;
if (!restoreState.explicitLayerStates)
@@ -121,10 +123,7 @@ export async function settleUserFacingContextAction({
* one into `userAdded` makes exit restoration re-enable the mode layer the
* user just turned off.
*/
export const CONTEXT_ENTRY_LAYER_IDS = Object.freeze([
'military-awareness',
'rocket-launches',
]);
export const CONTEXT_ENTRY_LAYER_IDS = Object.freeze(['military-awareness']);
/**
* Leave a Context transaction: publish the settled coordination flag, then
@@ -193,7 +192,8 @@ export function shouldExitContextForLayerChange({
change?.type !== 'visibility' ||
!isExplicitUserIntentOrigin(change.origin, change.layerId) ||
change.layerId === 'military-awareness' ||
CONTEXT_COMPANIONS.has(change.layerId)
CONTEXT_COMPANIONS.has(change.layerId) ||
CONTEXT_INDEPENDENT_LAYER_IDS.includes(change.layerId)
) {
return false;
}
@@ -215,6 +215,7 @@ export function contextAllowedLayerIds(contextMode) {
return new Set([
...(CONTEXT_DEPENDENCIES[contextMode] || ['military-awareness']),
...CONTEXT_COMPANIONS,
...CONTEXT_INDEPENDENT_LAYER_IDS,
]);
}
@@ -235,21 +236,6 @@ export function shouldCaptureContextSession(change) {
);
}
/**
* Return whether one explicit mission intent superseded an in-flight Clear All
* reservation and therefore needs deferred Context adoption.
*/
export function shouldDeferContextEntryDuringClear({ change, clearInFlight }) {
return Boolean(
clearInFlight &&
change?.type === 'visibility-requested' &&
change.layerId === 'rocket-launches' &&
change.enabled === true &&
isExplicitUserIntentOrigin(change.origin, change.layerId) &&
Number.isInteger(change.intentEpoch),
);
}
/**
* Bookkeep a user-owned layer change against the active Context session so
* exit restoration can honor layers the user added mid-session. Two rules
@@ -273,7 +259,8 @@ export function recordContextSessionUserChange({
if (
!snapshot?.userAdded ||
change?.type !== 'visibility' ||
!isExplicitUserIntentOrigin(change.origin, change.layerId)
!isExplicitUserIntentOrigin(change.origin, change.layerId) ||
CONTEXT_INDEPENDENT_LAYER_IDS.includes(change.layerId)
) {
return false;
}
@@ -319,83 +306,10 @@ export function contextSnapshotLayerIds(
) {
const snapshot = new Set(restoringLayerIds || currentEnabledLayerIds || []);
for (const layerId of excludeLayerIds || []) snapshot.delete(layerId);
for (const layerId of CONTEXT_INDEPENDENT_LAYER_IDS) snapshot.delete(layerId);
return snapshot;
}
/**
* Block layers that would mix unrelated live/current data into Space Missions.
* The manager calls this before lifecycle work so a refused layer never starts.
* @param {object} input Current mode and requested visibility transition.
* @param {string|null} input.contextMode Active Context mode.
* @param {object|null} input.change Requested visibility transition.
* @param {string|null} [input.layerName] User-facing layer name.
* @returns {string|null} Honest user-facing refusal reason, or null when allowed.
*/
export function contextLayerEnableBlockReason({
contextMode,
change,
layerName = null,
}) {
if (
contextMode !== 'space-missions' ||
change?.enabled !== true ||
contextAllowedLayerIds('space-missions').has(change.layerId)
) {
return null;
}
const label = String(layerName || change.layerId || 'that layer');
return SPACE_MISSIONS_LAYER_BLOCK_REASON.replace('{layer}', label);
}
/**
* The layer name from a Space Missions refusal, so the UI can rebuild the
* sentence in its language.
* @param {string} reason
* @returns {{layer: string}|null} The blocked layer's name, or null when the
* reason is not a Space Missions refusal.
*/
export function parseContextLayerBlockReason(reason) {
if (
typeof reason !== 'string' ||
!reason.startsWith(BLOCK_REASON_PREFIX) ||
!reason.endsWith(BLOCK_REASON_SUFFIX) ||
reason.length <= BLOCK_REASON_PREFIX.length + BLOCK_REASON_SUFFIX.length
)
return null;
return {
layer: reason.slice(
BLOCK_REASON_PREFIX.length,
reason.length - BLOCK_REASON_SUFFIX.length,
),
};
}
/**
* Resolve who owns a cancelled direct Space Missions entry. A newer ON keeps
* the entry shell reserved for its replacement transaction; every other
* cancellation must roll back the isolated pre-entry session.
*
* @param {object} input Cancellation and current manager intent state.
* @param {object|null} input.change Manager visibility notification.
* @returns {'ignore'|'replacement'|'restore'} Cancellation disposition.
*/
export function spaceMissionEntryCancellationDisposition({ change }) {
if (
change?.type !== 'visibility-cancelled' ||
change.layerId !== 'rocket-launches' ||
change.enabled !== true
)
return 'ignore';
if (
change.cancellationReason === 'superseded' &&
Number.isInteger(change.successorIntentEpoch) &&
change.successorIntentEpoch > change.intentEpoch &&
change.successorEnabled === true
)
return 'replacement';
return 'restore';
}
/**
* Merge the pre-entry layer snapshot with layers the user enabled during the
* Context session so both survive restoration.
@@ -510,7 +424,6 @@ export function subjectEntryAllowed({
*/
export const CONTEXT_MODE_VOICE_NAMES = Object.freeze({
flights: 'contacts',
'space-missions': 'space-missions',
});
/**
+63 -111
View File
@@ -5,7 +5,6 @@ import {
orbitEntryAllowed,
cockpitEntryAllowed,
contextAllowedLayerIds,
contextLayerEnableBlockReason,
contextRestoreLayerIds,
isExplicitUserIntentOrigin,
mergeContextTransitionErrors,
@@ -17,9 +16,7 @@ import {
settleContextIntentReplay,
settleUserFacingContextAction,
shouldCaptureContextSession,
shouldDeferContextEntryDuringClear,
shouldExitContextForLayerChange,
spaceMissionEntryCancellationDisposition,
} from './contextModePolicy.js';
test('Context transition errors preserve primary identity and aggregate failed layers', () => {
@@ -119,11 +116,6 @@ test('user-enabled layers are additive and do not exit Context', () => {
globalContextEnabled: true,
change: userEnable('earthquakes'),
}), false);
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
globalContextEnabled: false,
change: userEnable('traffic'),
}), false);
assert.equal(shouldExitContextForLayerChange({
contextMode: null,
globalContextEnabled: true,
@@ -133,48 +125,16 @@ test('user-enabled layers are additive and do not exit Context', () => {
test('programmatic Context dependencies and direct mode setup remain allowed', () => {
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
contextMode: 'flights',
globalContextEnabled: true,
change: { ...userEnable('satellites'), origin: 'programmatic' },
change: { ...userEnable('military'), enabled: false, origin: 'programmatic' },
}), false);
});
test('Space Missions cancellation retains only a newer authoritative ON entry', () => {
const cancelledEntry = {
type: 'visibility-cancelled',
layerId: 'rocket-launches',
enabled: true,
intentEpoch: 8,
cancellationReason: 'superseded',
successorIntentEpoch: 9,
successorEnabled: true,
successorOrigin: 'programmatic',
};
assert.equal(spaceMissionEntryCancellationDisposition({
change: cancelledEntry,
}), 'replacement');
assert.equal(spaceMissionEntryCancellationDisposition({
change: { ...cancelledEntry, successorEnabled: false },
}), 'restore', 'a newer OFF releases the entry shell');
assert.equal(spaceMissionEntryCancellationDisposition({
change: {
...cancelledEntry,
cancellationReason: 'caller-abort',
successorIntentEpoch: undefined,
successorEnabled: undefined,
},
}), 'restore', 'caller abort at the same epoch restores the isolated session');
assert.equal(spaceMissionEntryCancellationDisposition({
change: { ...cancelledEntry, enabled: false },
currentIntentEpoch: 9,
effectivelyEnabled: true,
}), 'ignore');
});
test('only explicit user-owned shell enables capture a Context restoration snapshot', () => {
const userMissionEnable = {
type: 'visibility-requested',
layerId: 'rocket-launches',
layerId: 'military-awareness',
enabled: true,
origin: 'user',
};
@@ -186,40 +146,25 @@ test('only explicit user-owned shell enables capture a Context restoration snaps
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, origin: 'context-restore' }), false);
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, enabled: false }), false);
assert.equal(shouldCaptureContextSession({ ...userMissionEnable, layerId: 'satellites' }), false);
assert.equal(
shouldCaptureContextSession({ ...userMissionEnable, layerId: 'rocket-launches' }),
false,
'Space Missions is an ordinary layer, not a Context entry',
);
});
test('voice dependency OFF exits Space Missions like the equivalent UI action', () => {
test('voice dependency OFF exits Contacts like the equivalent UI action', () => {
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
contextMode: 'flights',
globalContextEnabled: false,
change: { type: 'visibility', layerId: 'satellites', enabled: false, origin: 'voice' },
change: { type: 'visibility', layerId: 'flights', enabled: false, origin: 'voice' },
}), true);
});
test('only a newer explicit mission request is deferred during Clear All', () => {
const change = {
type: 'visibility-requested',
layerId: 'rocket-launches',
enabled: true,
origin: 'voice',
intentEpoch: 12,
};
assert.equal(shouldDeferContextEntryDuringClear({ change, clearInFlight: true }), true);
assert.equal(shouldDeferContextEntryDuringClear({ change, clearInFlight: false }), false);
assert.equal(shouldDeferContextEntryDuringClear({
change: { ...change, origin: 'programmatic' },
clearInFlight: true,
}), false);
assert.equal(shouldDeferContextEntryDuringClear({
change: { ...change, enabled: false },
clearInFlight: true,
}), false);
});
test('a rapid re-entry snapshots the settled restore target, not partial manager state', () => {
assert.deepEqual(
[...contextSnapshotLayerIds(
new Set(['rocket-launches', 'earthquakes']),
new Set(['cctv', 'earthquakes']),
new Set(['flights', 'traffic']),
)],
['flights', 'traffic'],
@@ -230,31 +175,15 @@ test('a rapid re-entry snapshots the settled restore target, not partial manager
);
assert.deepEqual(
[...contextSnapshotLayerIds(
new Set(['rocket-launches', 'satellites']),
new Set(['military-awareness', 'cctv']),
null,
['rocket-launches'],
['military-awareness'],
)],
['satellites'],
['cctv'],
'the synchronous entry intent is not part of the pre-entry snapshot',
);
});
test('Space Missions blocks unrelated layer enables before replay data can mix', () => {
const change = { layerId: 'flights', enabled: true, origin: 'user' };
assert.match(
contextLayerEnableBlockReason({ contextMode: 'space-missions', change, layerName: 'Live Flights' }),
/Exit the mode to enable Live Flights/,
);
assert.equal(contextLayerEnableBlockReason({
contextMode: 'space-missions',
change: { ...change, layerId: 'satellites' },
}), null);
assert.equal(contextLayerEnableBlockReason({
contextMode: 'flights',
change,
}), null, 'live cockpit keeps additive user layers');
});
test('the Global Context shell and layers selected while Context is off remain allowed', () => {
assert.equal(shouldExitContextForLayerChange({
contextMode: null,
@@ -275,14 +204,38 @@ test('manually disabling a mode dependency exits that Context bundle', () => {
change: { ...userEnable('military'), enabled: false },
}), true);
assert.equal(shouldExitContextForLayerChange({
contextMode: 'space-missions',
contextMode: 'flights',
globalContextEnabled: false,
change: { ...userEnable('satellites'), enabled: false },
}), true);
}), false, 'Satellites is not a Contacts dependency');
});
test('Context never isolates, snapshots, restores or bookkeeps Space Missions and Satellites', () => {
for (const layerId of ['rocket-launches', 'satellites']) {
assert.equal(contextAllowedLayerIds('flights').has(layerId), true);
const snapshot = { userAdded: new Set(), userRemoved: new Set() };
for (const enabled of [true, false]) {
assert.equal(recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', origin: 'user', layerId, enabled },
effectiveContextMode: 'flights',
}), false);
const restoreState = { enabledLayerIds: new Set() };
assert.equal(recordContextRestoreExplicitChange({
restoreState,
change: { type: 'visibility', origin: 'user', layerId, enabled },
}), false);
}
assert.equal(snapshot.userAdded.size + snapshot.userRemoved.size, 0);
}
assert.deepEqual(
[...contextSnapshotLayerIds(new Set(['rocket-launches', 'satellites', 'cctv']))],
['cctv'],
);
});
test('Radio remains an independent companion across Context transitions', () => {
for (const contextMode of ['flights', 'space-missions']) {
for (const contextMode of ['flights', null]) {
for (const enabled of [true, false]) {
assert.equal(shouldExitContextForLayerChange({
contextMode,
@@ -292,21 +245,17 @@ test('Radio remains an independent companion across Context transitions', () =>
}
assert.equal(contextAllowedLayerIds(contextMode).has('radio'), true);
}
assert.equal(contextLayerEnableBlockReason({
contextMode: 'space-missions',
change: { type: 'visibility', origin: 'user', layerId: 'radio', enabled: true },
layerName: 'Radio',
}), null);
});
test('each Context mode exposes only its shell and dependencies', () => {
assert.deepEqual(
[...contextAllowedLayerIds(null)],
['military-awareness', 'radio'],
['military-awareness', 'radio', 'rocket-launches', 'satellites'],
);
assert.deepEqual(
[...contextAllowedLayerIds('space-missions')],
['rocket-launches', 'satellites', 'radio'],
['military-awareness', 'radio', 'rocket-launches', 'satellites'],
'Space Missions is not a Context mode',
);
});
@@ -332,7 +281,7 @@ test('Context restoration honors an explicit companion disable', () => {
});
test('the latest explicit Radio state wins across a Context session', () => {
for (const effectiveContextMode of [null, 'flights', 'space-missions']) {
for (const effectiveContextMode of [null, 'flights']) {
for (const origin of ['user', 'voice']) {
const snapshot = { userAdded: new Set(), userRemoved: new Set() };
const record = (enabled) => recordContextSessionUserChange({
@@ -368,7 +317,7 @@ test('only direct UI and voice origins count as explicit Context intent', () =>
assert.equal(recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', origin, layerId: 'radio', enabled: true },
effectiveContextMode: 'space-missions',
effectiveContextMode: 'flights',
}), false);
assert.equal(snapshot.userAdded.size, 0);
}
@@ -526,16 +475,8 @@ test('the teardown guard re-publishes on the way out, so a mid-flight exit is no
test('the session-starting entry layer is never bookkept as user-added (chip ON→OFF restores exactly)', () => {
const snapshot = { enabledLayerIds: new Set(['flights', 'ais-live-vessels']), userAdded: new Set() };
// The exact left-panel regression: the rockets enable event lands while the
// mode is still being entered (or even null); it must not survive its own exit.
for (const effectiveContextMode of ['space-missions', null]) {
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'rocket-launches', enabled: true, origin: 'user' },
effectiveContextMode,
});
assert.equal(snapshot.userAdded.has('rocket-launches'), false);
}
// The entry layer's enable event lands while the mode is still being
// entered; it must not survive its own exit.
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'military-awareness', enabled: true, origin: 'user' },
@@ -559,10 +500,21 @@ test('mid-session user additions are recorded, removed on disable, and judged ag
// A dependency of the mode being ENTERED is not a user addition.
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'satellites', enabled: true, origin: 'user' },
effectiveContextMode: 'space-missions',
change: { type: 'visibility', layerId: 'military', enabled: true, origin: 'user' },
effectiveContextMode: 'flights',
});
assert.equal(snapshot.userAdded.has('satellites'), false);
assert.equal(snapshot.userAdded.has('military'), false);
// Space Missions is not Context's: it is never bookkept.
recordContextSessionUserChange({
snapshot,
change: { type: 'visibility', layerId: 'rocket-launches', enabled: true, origin: 'user' },
effectiveContextMode: 'flights',
});
assert.equal(
snapshot.userAdded.has('rocket-launches'),
false,
'Space Missions is not Context state',
);
// Disabling a recorded addition removes it before any exit restore reads it.
recordContextSessionUserChange({
snapshot,
+38 -36
View File
@@ -13,10 +13,7 @@ const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', imp
// - session bookkeeping ran AFTER the exit early-return, so the compensating
// userAdded.delete never ran on the left-panel chip exit and restoration
// resurrected the mission layer the user just disabled;
// - the effective mode was read AFTER the entering flag was cleared, so the
// entry layer's own enable event was judged against a null mode;
// - a failed Space Missions START from the chip route cleared siblings with
// no rollback;
// - a failed direct Contacts START cleared siblings with no rollback;
// - the right-rail entry ignored the activation result entirely.
import { test } from 'node:test';
import assert from 'node:assert/strict';
@@ -33,25 +30,20 @@ test('context handler: session bookkeeping runs before the exit early-return', (
assert.ok(record < exit, 'bookkeeping must precede the exit check');
});
test('context handler: effective mode is read before the entering flag is cleared', () => {
const effective = handler.indexOf('this._contextModeEntering || this._contextMode');
const clear = handler.indexOf('this._contextModeEntering = null');
assert.ok(effective > 0, 'effective-mode read present');
assert.ok(clear > 0, 'entering-flag clear present');
assert.ok(effective < clear, 'effective mode must be captured first');
test('Space Missions is an ordinary layer the Context handler never enters', () => {
assert.doesNotMatch(handler, /'space-missions'/);
assert.doesNotMatch(handler, /_contextModeEntering = /);
const attach = connectContextManager.toString();
assert.doesNotMatch(attach, /rocket-launches|space-missions/);
});
test('cancelled Space Missions entry resolves ownership before settled bookkeeping', () => {
test('a cancelled visibility request returns before settled bookkeeping', () => {
const cancelled = handler.indexOf("change?.type === 'visibility-cancelled'");
const bookkeeping = handler.indexOf('recordContextSessionUserChange(');
assert.ok(cancelled > 0, 'cancellation branch present');
assert.ok(cancelled < bookkeeping, 'cancellation returns before settled session bookkeeping');
const branch = handler.slice(cancelled, handler.indexOf("change?.type === 'visibility-blocked'"));
assert.match(branch, /spaceMissionEntryCancellationDisposition\(\{/);
assert.match(branch, /cancellationDisposition === 'replacement'[\s\S]*?_contextModeEntering = 'space-missions'[\s\S]*?entryIntent\.intentEpoch === change\.intentEpoch[\s\S]*?_contextModeReplacementIntent = \{[\s\S]*?intentEpoch: change\.successorIntentEpoch/);
assert.match(branch, /cancellationDisposition === 'restore'[\s\S]*?_contextModeEntering = null/);
assert.match(branch, /_restoreContextSessionAfterLayerSettles\(/);
assert.match(branch, /return;/);
assert.match(branch, /this\._syncContextModeButtons\(\);\s*return;/);
});
test('direct Context entry captures on the synchronous request boundary', () => {
@@ -60,18 +52,29 @@ test('direct Context entry captures on the synchronous request boundary', () =>
attach,
/subscribeVisibilityRequests\(\(change\) => \{[\s\S]*?shouldCaptureContextSession\(change\)/,
);
assert.match(
attach,
/_captureContextSessionSnapshot\(\{\s*excludeLayerIds:\s*\[change\.layerId\],?\s*\}\)/,
);
});
test('Clear All defers a newer explicit mission guard until its batch settles', () => {
const attach = connectContextManager.toString();
assert.match(attach, /shouldDeferContextEntryDuringClear\(\{/);
assert.match(attach, /_contextModeDeferredEntryIntent = \{/);
assert.match(attach, /await this\._clearSelectedLayersManagerPromise/);
assert.match(attach, /await this\._clearLayersOutsideContextMode\(entryMode/);
test('only a direct Contacts entry request snapshots the layers', () => {
let request;
const controls = new ContextControls({
elements: {},
installations: {},
actions: { getCockpit: () => null },
});
const captures = [];
controls._captureContextSessionSnapshot = (options) => captures.push(options);
controls._syncContextModeButtons = () => {};
controls.connect({
subscribe: () => () => {},
subscribeVisibilityRequests(listener) {
request = listener;
return () => {};
},
});
for (const layerId of ['rocket-launches', 'military-awareness'])
request({ type: 'visibility-requested', layerId, enabled: true, origin: 'user', intentEpoch: 1 });
controls.stop();
assert.deepEqual(captures, [{ excludeLayerIds: ['military-awareness'] }]);
});
test('context restore replays explicit companion intent after the stale restore queue drains', () => {
@@ -91,7 +94,7 @@ test('context restore settles the Contacts coordinator before dependency fanout'
assert.ok(settle > 0, 'Contacts coordinator settlement is present');
assert.ok(coordinatorOff > settle, 'Contacts OFF is awaited');
assert.ok(fanout > coordinatorOff, 'snapshot fanout starts after Contacts settles');
assert.match(restore, /excludeLayerIds: settleContactsCoordinator[\s\S]*?contactsCoordinatorId/);
assert.match(restore, /excludeLayerIds: \[[\s\S]*?CONTEXT_INDEPENDENT_LAYER_IDS[\s\S]*?settleContactsCoordinator \? \[contactsCoordinatorId\]/);
});
test('Clear All during the Contacts settle stops the snapshot coming back', () => {
@@ -116,7 +119,7 @@ test('context handler: either failed direct Context-shell start rolls the sessio
handler.indexOf("change?.type === 'visibility-failed'"),
handler.indexOf("change?.type === 'visibility-will-change'"),
);
assert.match(failedBranch, /\['military-awareness', 'rocket-launches'\]\.includes\(change\.layerId\)/);
assert.match(failedBranch, /change\.layerId === 'military-awareness' &&/);
assert.match(
failedBranch,
/_restoreContextSessionAfterLayerSettles\(\s*change\.layerId,\s*\{\s*notificationToken,?\s*\},?\s*\)/,
@@ -154,14 +157,14 @@ test('wrapped visibility blocks leave the accessible toast to the wrapper token
test('every user-facing Context exit route settles through the failure surface', () => {
const initPanel = _initGlobalContextPanel.toString();
assert.equal((initPanel.match(/void this\._runUserFacingContextAction/g) || []).length, 3);
assert.equal((initPanel.match(/void this\._runUserFacingContextAction/g) || []).length, 2);
assert.doesNotMatch(initPanel, /falseIsFailure:\s*false/);
assert.doesNotMatch(initPanel, /void this\._selectContextMode/);
const deactivationCalls = [...handler.matchAll(
/void this\._trackContextLayerReaction\(\s*this\._runUserFacingContextAction\(\(notificationToken\) =>\s*this\._deactivateContextForLayerChange\(\{ notificationToken \}\),?\s*\),?\s*\)/g,
)];
assert.equal(deactivationCalls.length, 4, 'dependency and primary layer exits share the caught restore path');
assert.equal(deactivationCalls.length, 3, 'dependency and primary layer exits share the caught restore path');
assert.doesNotMatch(handler, /void this\._deactivateContextForLayerChange\(\)/);
});
@@ -193,10 +196,7 @@ test('right-rail context entry is transactional: activation result gates the mod
const failureBlock = select.slice(activation);
assert.match(failureBlock, /activated = await activationIntent\.promise/);
assert.match(failureBlock, /catch \(error\) \{\s*activationError = error;/);
assert.match(failureBlock, /_contextModeReplacementIntent\?\.generation === generation/);
assert.match(failureBlock, /await this\._dataManager\._waitForVisibilityIntent\?\.\(/);
assert.match(failureBlock, /outcome\?\.intentEpoch === replacementIntent\.intentEpoch[\s\S]*?outcome\.succeeded === true/);
assert.match(failureBlock, /outcome\?\.cancellationReason === 'superseded'[\s\S]*?outcome\.successorEnabled === true[\s\S]*?outcome\.successorIntentEpoch > replacementIntent\.intentEpoch/);
assert.match(failureBlock, /activationError\s*\|\|\s*activated === false\s*\|\|\s*!this\._dataManager\.isEnabled\(entryLayerId\)/);
assert.match(failureBlock, /cancelledAndSettled\s*=\s*terminalIntentOutcome\?\.succeeded === false/);
assert.match(failureBlock, /\['caller-abort', 'resource-abort', 'superseded'\]/);
@@ -216,9 +216,11 @@ test('Context entry awaits isolation and direct shell routes isolate in the visi
// rests on Context OFF; the honesty lives in the REPORT, not in a racy
// attempt to put the prior mode back (see the note above
// _restoreContextSessionAfterLayerSettles).
const capture = select.indexOf('this._captureContextSessionSnapshot(');
assert.ok(capture > 0, 'Context snapshot capture is missing');
const crossMode = select.slice(
select.indexOf('const crossModeSwitch = Boolean('),
select.indexOf('this._captureContextSessionSnapshot();'),
capture,
);
assert.ok(crossMode, 'cross-mode teardown block is missing');
assert.doesNotMatch(crossMode, /if \(signal\?\.aborted\)[\s\S]*?await this\._restoreContextSession/);
@@ -242,10 +244,10 @@ test('Context entry awaits isolation and direct shell routes isolate in the visi
assert.match(ContextControls.prototype.stop.toString(), /this\._contextModeGeneration\+\+/);
const guard = connectContextManager.toString();
assert.match(guard, /\['military-awareness', 'rocket-launches'\]\.includes\(change\.layerId\)/);
assert.match(guard, /change\.layerId !== 'military-awareness'/);
assert.match(guard, /const notificationToken\s*=\s*change\.notificationToken\s*\|\|\s*Symbol\('direct-context-shell-entry'\)/);
assert.match(guard, /this\._userFacingContextNotificationTokens\.add\(notificationToken\)/);
assert.match(guard, /await this\._clearLayersOutsideContextMode\(entryMode,\s*\{\s*notificationToken,?\s*\}\)/);
assert.match(guard, /await this\._clearLayersOutsideContextMode\(null,\s*\{\s*notificationToken,?\s*\}\)/);
assert.match(
guard,
/await this\._restoreContextSession\(\{\s*excludeLayerIds: \[change\.layerId\],\s*notificationToken,\s*\}\)/,
+40 -45
View File
@@ -2,7 +2,9 @@ import { renderApplicationHtml } from './testSupport/applicationHtml.mjs';
import { readStylesheet } from './testSupport/readStylesheet.mjs';
import { _selectContextMode } from './ui/contextTransactions.js';
import { _initGlobalContextPanel } from './ui/contextBindings.js';
import { ContextControls } from './ui/contextControls.js';
import { clearSelectedLayers } from './ui/contextActions.js';
import { PANEL_RAIL_ITEMS } from './ui/panelRailCatalog.js';
import { readFileSync as readRadioSource } from 'node:fs';
const radioBindings = readRadioSource(
new URL('./ui/radioBindings.js', import.meta.url),
@@ -21,43 +23,24 @@ const html = await renderApplicationHtml(
);
const css = readStylesheet(new URL('../style.css', import.meta.url));
test('Contacts and Space Missions both participate in the ordinary Tab sequence', () => {
for (const id of [
'global-context-flights-btn',
'global-context-missions-btn',
]) {
const button = html.match(
new RegExp(`<button id="${id}"[\\s\\S]*?</button>`),
);
assert.ok(button, `${id} is missing`);
assert.match(button[0], /role="tab"/);
assert.match(button[0], /tabindex="0"/);
}
// The view keeps both tabs' tabindex static and never disables them; the
// transition itself is covered over happy-dom in ui/contextPanel.test.mjs.
for (const id of [
'global-context-flights-btn',
'global-context-missions-btn',
]) {
const tag = contextView.match(new RegExp(`<button id="${id}"[^>]*>`))?.[0];
assert.ok(tag, `${id} is missing from the view`);
assert.doesNotMatch(tag, /:tabindex|:disabled|\sdisabled/);
}
test('Contacts stays in the keyboard sequence and Space Missions owns its rail item', () => {
const button = html.match(
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
)?.[0];
assert.ok(button, 'Contacts control is missing');
assert.match(button, /role="tab"/);
assert.match(button, /tabindex="0"/);
const tag = contextView.match(/<button id="global-context-flights-btn"[^>]*>/)?.[0];
assert.ok(tag, 'Contacts control is missing from the view');
assert.doesNotMatch(tag, /:tabindex|:disabled|\sdisabled/);
assert.doesNotMatch(html, /id="global-context-missions-btn"/);
assert.match(html, /id="space-missions-panel"[^>]*data-panel-id="space-missions-panel"/);
assert.equal(PANEL_RAIL_ITEMS['space-missions-panel'].icon, 'rocket_launch');
});
test('Context activation and Clear All never native-disable tabs and guard repeated clicks', () => {
const init = _initGlobalContextPanel.toString();
const select = _selectContextMode.toString();
const clear = clearSelectedLayers.toString();
assert.equal(
(
init.match(
/if \(\s*this\.destroyed\s*\|\|\s*this\._contextModeChanging\s*\|\|\s*this\._clearSelectedLayersPromise\s*\)\s*return;/g,
) || []
).length,
2,
);
assert.doesNotMatch(
select,
/_globalContext(?:Flights|Missions)Btn\.disabled\s*=\s*true/,
@@ -68,17 +51,29 @@ test('Context activation and Clear All never native-disable tabs and guard repea
);
});
test('Context tablist retains Left, Right, Home, and End keyboard navigation', () => {
const initSource = _initGlobalContextPanel.toString();
assert.match(initSource, /event\.key === 'ArrowRight'/);
assert.match(initSource, /event\.key === 'ArrowLeft'/);
assert.match(initSource, /event\.key === 'Home'/);
assert.match(initSource, /event\.key === 'End'/);
assert.match(
initSource,
/contextTabs\[nextIndex\]\.focus\(\{ preventScroll: true \}\)/,
);
assert.match(initSource, /contextTabs\[nextIndex\]\.click\(\)/);
test('a Contacts click while Context is busy is ignored', () => {
const button = new EventTarget();
const controls = new ContextControls({
elements: { _globalContextFlightsBtn: button },
installations: {},
actions: { getCockpit: () => null, claimVisualAuthority() {} },
});
const runs = [];
controls._runUserFacingContextAction = (operation) => {
runs.push(operation);
return Promise.resolve(false);
};
const click = () => button.dispatchEvent(new Event('click'));
controls._contextModeChanging = true;
click();
controls._contextModeChanging = false;
controls._clearSelectedLayersPromise = Promise.resolve();
click();
assert.equal(runs.length, 0, 'a transition or Clear All in flight drops it');
controls._clearSelectedLayersPromise = null;
click();
assert.equal(runs.length, 1, 'an idle panel takes the click');
controls.stop();
});
test('Context tabs draw a visible keyboard-focus outline including active tabs', () => {
@@ -102,7 +97,6 @@ test('Context tabs draw a visible keyboard-focus outline including active tabs',
});
test('Context async action buttons remain focused while busy', () => {
const init = _initGlobalContextPanel.toString();
const radio = radioBindings.slice(
radioBindings.indexOf('const toggleRadio = async (trigger) => {'),
radioBindings.indexOf('this._storeToken = this.store?.connect?.('),
@@ -113,6 +107,7 @@ test('Context async action buttons remain focused while busy', () => {
);
const clear = clearSelectedLayers.toString();
const init = _initGlobalContextPanel.toString();
assert.match(init, /if \(this\._installationsSearchBusy\) return;/);
assert.doesNotMatch(init, /\.disabled\s*=\s*true/);
const search = contextView.match(
@@ -220,7 +215,7 @@ test('Context reads as one segmented control with legible type and no halo', ()
// open Context title legible; no Context-only rule dims it again.
assert.equal(
rule(
":root:not([data-ui-theme='cyber']) #global-context-panel:not(.collapsed) .panel-title",
":root #global-context-panel:not(.collapsed) .panel-title",
),
'',
);
+226 -33
View File
@@ -6,6 +6,12 @@ import test from 'node:test';
import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
// The Omnibar's desktop footer (src/ui/styles/omnibar-dock.css) is part of
// the cascade below like every other stylesheet; its rules carry the
// Omnibar scope, so they are modelled as a layout of their own.
const omnibarCss = readStylesheet(
path.join(ROOT, 'src/ui/styles/omnibar-dock.css'),
);
const css = readStylesheet(path.join(ROOT, 'style.css'));
/*
@@ -125,11 +131,56 @@ function specificity(selector) {
return [ids, classes, types];
}
/** Flatten style.css into rules carrying their raw media stack. */
/** Collapse whitespace and the padding inside brackets of a selector. */
const tidySelector = (part) =>
part
.replace(/\s+/g, ' ')
.trim()
.replace(/\(\s+/g, '(')
.replace(/\s+\)/g, ')');
/**
* A nested selector resolved against its parent rule's selectors, as CSS
* nesting does: `&` stands for the parent, and a selector without one is a
* descendant of it.
*/
function nestSelectors(parents, head) {
const own = splitTopLevel(head, ',').map(tidySelector).filter(Boolean);
if (!parents) return own;
return parents.flatMap((parent) =>
own.map((part) =>
part.includes('&') ? part.replaceAll('&', parent) : `${parent} ${part}`,
),
);
}
/**
* Flatten style.css into rules carrying their raw media stack. Nested style
* rules (CSS nesting) and media queries nested in a rule are resolved to
* full selectors, so a nested rule is modelled like any other.
*/
function flattenRules(source) {
const src = source.replace(/\/\*[\s\S]*?\*\//g, '');
const rules = [];
const mediaStack = [];
// Open blocks, innermost last: media queries and style rules.
const stack = [];
const mediaStack = () =>
stack.filter((frame) => frame.media).map((frame) => frame.media);
const parentRule = () =>
[...stack].reverse().find((frame) => frame.rule)?.rule || null;
const declare = (text) => {
const rule = parentRule();
const trimmed = text.trim();
if (!rule || !trimmed) return;
const colon = trimmed.indexOf(':');
if (colon < 0) return;
const value = trimmed.slice(colon + 1).trim();
rule.decls.push({
prop: trimmed.slice(0, colon).trim().toLowerCase(),
value: value.replace(/\s*!important$/i, '').trim(),
important: /!important\s*$/i.test(value),
});
};
let index = 0;
let prelude = '';
while (index < src.length) {
@@ -137,14 +188,13 @@ function flattenRules(source) {
if (char === '{') {
const head = prelude.replace(/\s+/g, ' ').trim();
prelude = '';
index += 1;
if (head.startsWith('@media')) {
mediaStack.push(head.slice('@media'.length).trim());
index += 1;
stack.push({ media: head.slice('@media'.length).trim() });
continue;
}
if (head.startsWith('@')) {
let level = 1;
index += 1;
while (index < src.length && level > 0) {
if (src[index] === '{') level += 1;
else if (src[index] === '}') level -= 1;
@@ -152,43 +202,34 @@ function flattenRules(source) {
}
continue;
}
const close = src.indexOf('}', index);
assert.ok(close > index, `unterminated rule block for "${head}"`);
const decls = [];
for (const raw of src.slice(index + 1, close).split(';')) {
const text = raw.trim();
if (!text) continue;
const colon = text.indexOf(':');
if (colon < 0) continue;
const value = text.slice(colon + 1).trim();
decls.push({
prop: text.slice(0, colon).trim().toLowerCase(),
value: value.replace(/\s*!important$/i, '').trim(),
important: /!important\s*$/i.test(value),
});
}
rules.push({
const rule = {
order: rules.length,
media: [...mediaStack],
parts: splitTopLevel(head, ',')
.map((part) =>
part.trim().replace(/\(\s+/g, '(').replace(/\s+\)/g, ')'),
)
.filter(Boolean),
decls,
});
index = close + 1;
media: mediaStack(),
parts: nestSelectors(parentRule()?.parts, head),
decls: [],
};
rules.push(rule);
stack.push({ rule });
continue;
}
if (char === ';') {
declare(prelude);
prelude = '';
index += 1;
continue;
}
if (char === '}') {
mediaStack.pop();
// The last declaration of a block may omit its semicolon.
declare(prelude);
prelude = '';
stack.pop();
index += 1;
continue;
}
prelude += char;
index += 1;
}
assert.equal(stack.length, 0, 'unbalanced braces in style.css');
return rules;
}
@@ -227,6 +268,29 @@ const RECOGNIZED = new Set([
]);
const DOCKED_RAIL = 'body.context-docked #right-context-rail';
// The desktop Omnibar layout: the scope its stylesheet nests every rule in.
// It applies on the desktop shell (above the 720px phone breakpoint) while
// the Omnibar and the voice control share the dock; outside it the legacy
// layout below governs.
const OMNIBAR_SCOPE =
'body:not(.mobile-shell):not(.cockpit-mode):not(.scene-playback-mode):not(.ui-clean-view):not(.recording-mode):where(:has(#gev-omnibar):has(#command-dock > #gev-voice-control))';
const OMNIBAR = Object.freeze({
dock: `${OMNIBAR_SCOPE} #command-dock`,
credit: `${OMNIBAR_SCOPE} :is(#cesium-credits, #gev-credits)`,
minimalCredit: `${OMNIBAR_SCOPE}:has(#intel-hud[data-variant='minimal'].active) :is(#cesium-credits, #gev-credits)`,
minimalRail: `${OMNIBAR_SCOPE}:not(.context-docked):has(#intel-hud[data-variant='minimal'].active) #right-context-rail`,
trays: `${OMNIBAR_SCOPE} #command-dock > :is(#location-bar, #control-panel)`,
});
// What each Omnibar-scope rule may set on a modelled box; the Omnibar
// clearance test resolves every one of them through the full cascade.
const OMNIBAR_RECOGNIZED = new Map([
[OMNIBAR.dock, new Set(['top', 'bottom', 'height', 'min-height'])],
[OMNIBAR.credit, new Set(['bottom'])],
[OMNIBAR.minimalCredit, new Set(['bottom'])],
[OMNIBAR.minimalRail, new Set(['max-height'])],
]);
const OMNIBAR_MIN_WIDTH = 721;
const ELEMENT_KEYS = [
'#cesium-credits',
'#command-dock',
@@ -300,8 +364,11 @@ function ownBoxEntries() {
// So is Stories, with GEV's chrome stepped aside; storiesCredit.test.mjs
// pins its attribution placement.
if (
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(part)
) continue;
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(
part,
)
)
continue;
entries.push({ rule, part });
}
}
@@ -521,6 +588,22 @@ test('the model refuses every cascade construct it cannot resolve', () => {
// Expanded Context covers the right edge top to bottom; the credit row
// stops short of it instead (the docked-Context test below).
if (part === DOCKED_RAIL) continue;
if (part.startsWith(OMNIBAR_SCOPE)) {
const allowed = OMNIBAR_RECOGNIZED.get(part);
for (const decl of guarded) {
if (!allowed?.has(decl.prop))
complaints.push(
`unrecognized Omnibar rule positions a modelled element: "${part}" (${decl.prop})`,
);
if (decl.important)
complaints.push(`!important on ${decl.prop} of "${part}"`);
}
if (rule.media.length)
complaints.push(
`media query on Omnibar rule "${part}": ${rule.media.join(' && ')}`,
);
continue;
}
if (!RECOGNIZED.has(part)) {
complaints.push(
`unrecognized selector positions a modelled element: "${part}" (${guarded.map((d) => d.prop).join(', ')})`,
@@ -771,6 +854,116 @@ test('right rail measurement cannot persist into a painted attribution layout',
// ── Clearance ───────────────────────────────────────────────────────────────
/** A custom property's value as the Omnibar scope declares it. */
function omnibarVar(name) {
const decls = RULES.filter((rule) => rule.parts.includes(OMNIBAR_SCOPE))
.flatMap((rule) => rule.decls)
.filter((decl) => decl.prop === name);
assert.equal(decls.length, 1, `${name} is declared once in the Omnibar scope`);
return decls[0].value;
}
/** A length in the Omnibar layout, with its scope's own custom properties. */
function omnibarPx(value, viewportHeight, where) {
const substituted = value.replace(
/var\((--omnibar-[\w-]+)\)/g,
(_, name) => omnibarVar(name),
);
return toPx(substituted, viewportHeight, where);
}
test('Omnibar reserves a non-overlapping desktop footer at native credit sizing', () => {
// The Omnibar layout resolves through the same cascade as the legacy one:
// every legacy rule that could still match competes with the scope's.
const trayOpen = [
'#command-dock:has(#location-bar:not(.collapsed))',
'#command-dock:has(#control-panel:not(.collapsed))',
];
assert.equal(
omnibarVar('--world-timeline-lift'),
'0px',
'the Omnibar layout holds the timeline lift at 0',
);
for (const width of WIDTHS.filter((w) => w >= OMNIBAR_MIN_WIDTH)) {
for (const height of HEIGHTS) {
for (const minimal of [false, true]) {
const dock = resolve(
['#command-dock', ...trayOpen, OMNIBAR.dock],
'bottom',
width,
'Omnibar dock',
);
assert.equal(dock.part, OMNIBAR.dock, `the Omnibar owns the dock at ${width}px`);
// Its top and height too: a legacy top or height winning here would
// move or stretch the dock the clearance below is measured from.
for (const [prop, value] of [
['top', 'auto'],
['height', '56px'],
]) {
const own = resolve(
['#command-dock', ...trayOpen, OMNIBAR.dock],
prop,
width,
`Omnibar dock ${prop}`,
);
assert.equal(own.part, OMNIBAR.dock, `the Omnibar owns the dock ${prop} at ${width}px`);
assert.equal(own.decl.value, value, `Omnibar dock ${prop} at ${width}px`);
}
const credit = resolve(
[
...CREDIT_SELECTORS,
OMNIBAR.credit,
...(minimal ? [MINIMAL_HUD_CREDIT, OMNIBAR.minimalCredit] : []),
],
'bottom',
width,
'Omnibar credit',
);
assert.ok(
credit.part.startsWith(OMNIBAR_SCOPE),
`the Omnibar owns the credit row at ${width}px`,
);
const dockBottom = omnibarPx(dock.decl.value, height, 'Omnibar dock bottom');
const creditTop =
omnibarPx(credit.decl.value, height, 'Omnibar credit bottom') +
CREDIT_HEIGHT_PX;
assert.ok(
dockBottom - creditTop >= MIN_CLEARANCE_PX,
`at ${width}x${height}${minimal ? ' (minimal HUD)' : ''} the Omnibar dock (${dockBottom}px) must clear the credit line (${creditTop}px)`,
);
}
}
}
// No legacy tray opens over the credit: both are hidden in this layout,
// and no rule elsewhere forces them back.
const trays = RULES.find((rule) => rule.parts.includes(OMNIBAR.trays));
assert.ok(trays, 'the Omnibar layout hides the legacy trays');
assert.equal(trays.decls.find((decl) => decl.prop === 'display')?.value, 'none');
for (const rule of RULES) {
for (const part of rule.parts) {
if (!/#(location-bar|control-panel)$/.test(lastCompound(part))) continue;
assert.ok(
!rule.decls.some((decl) => decl.prop === 'display' && decl.important),
`"${part}" forces a hidden tray back with !important`,
);
}
}
// The minimal-HUD rail cap only shortens the rail, which is anchored at
// its top, so it can only add room above the credit.
const rail = RULES.find((rule) => rule.parts.includes(OMNIBAR.minimalRail));
const cap = rail.decls.find((decl) => decl.prop === '--omnibar-minimal-rail-height');
assert.match(cap?.value || '', /^min\(\s*var\(--right-stack-max-height, 70vh\),/);
assert.equal(
rail.decls.find((decl) => decl.prop === 'max-height')?.value,
'var(--omnibar-minimal-rail-height)',
);
assert.doesNotMatch(
omnibarCss,
/\.cesium-widget-credits|\.cesium-credit-logoContainer|\.cesium-credit-textContainer/,
'the footer uses the original credit text and logo sizing',
);
});
test('every open dock tray clears the required credit at every modelled viewport', () => {
// Below 900px the tray widens to nearly the viewport and lands on the
// bottom-left corner where the credit lives. The clearance is NOT one fixed
+8 -6
View File
@@ -527,10 +527,15 @@ export function cyberSonarLabelIntensity(
return labelDimFactor + (1 - labelDimFactor) * normalized;
}
/**
* Sonar is an opt-in visual style over any HUD layout: it is on only after
* the Display panel's Sonar toggle, a voice request or a legacy Cyber link
* turns it on.
*/
export function isCyberSonarEnabled(
root = globalThis.document?.documentElement,
) {
return root?.dataset?.cyberSonar !== 'off';
return root?.dataset?.cyberSonar === 'on';
}
export function setCyberSonarEnabled(
@@ -539,9 +544,7 @@ export function setCyberSonarEnabled(
) {
if (!root?.dataset) return false;
root.dataset.cyberSonar = enabled ? 'on' : 'off';
if (root.dataset.uiTheme === 'cyber') {
applyCyberSonarThemePhase(root, enabled);
}
applyCyberSonarThemePhase(root, enabled);
return enabled;
}
@@ -566,7 +569,6 @@ export function isCyberSonarActive({
globalThis.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches ??
false;
return !!(
root?.dataset?.uiTheme === 'cyber' &&
isCyberSonarEnabled(root) &&
(hudActive ?? hud?.classList?.contains?.('active')) &&
!body?.classList?.contains?.('cockpit-mode') &&
@@ -583,7 +585,7 @@ export function isCyberMapThemeActive({
if (hud === undefined)
hud = globalThis.document?.getElementById?.('intel-hud');
return !!(
root?.dataset?.uiTheme === 'cyber' &&
isCyberSonarEnabled(root) &&
(hudActive ?? hud?.classList?.contains?.('active')) &&
!body?.classList?.contains?.('cockpit-mode')
);
+13 -9
View File
@@ -39,7 +39,7 @@ test('production-transformed sonar defaults retain the document method receiver'
const previous = Object.getOwnPropertyDescriptor(globalThis, 'document');
const hud = { classList: { contains: (name) => name === 'active' } };
const document = {
documentElement: { dataset: { uiTheme: 'cyber' } },
documentElement: { dataset: { cyberSonar: 'on' } },
body: { classList: { contains: () => false } },
getElementById(id) {
assert.equal(this, document);
@@ -57,7 +57,7 @@ test('production-transformed sonar defaults retain the document method receiver'
assert.ok(
Number.isFinite(compiled.createCyberSonarSampler(800, 600).at(400, 300)),
);
document.documentElement.dataset.uiTheme = 'tactical';
document.documentElement.dataset.cyberSonar = 'off';
assert.equal(compiled.isCyberSonarActive(), false);
assert.equal(compiled.isCyberMapThemeActive(), false);
} finally {
@@ -139,8 +139,8 @@ test('the sweep brightens contacts inside its sector and dims the remainder', ()
);
});
test('the sonar activates only for a visible Cyber map HUD with motion enabled', () => {
const root = { dataset: { uiTheme: 'cyber' } };
test('the sonar activates only while on, over a visible map HUD with motion enabled', () => {
const root = { dataset: { cyberSonar: 'on' } };
const classes = (...values) => ({
contains: (value) => values.includes(value),
});
@@ -220,14 +220,18 @@ test('the opacity setting controls every contact floor and preserves brighter la
);
});
test('the sonar control defaults on and records explicit operator state', () => {
test('the sonar control defaults off and records explicit operator state', () => {
const root = { dataset: {} };
assert.equal(isCyberSonarEnabled(root), false);
// The removed Cyber theme no longer turns it on.
root.dataset.uiTheme = 'cyber';
assert.equal(isCyberSonarEnabled(root), false);
assert.equal(setCyberSonarEnabled(true, root), true);
assert.equal(root.dataset.cyberSonar, 'on');
assert.equal(isCyberSonarEnabled(root), true);
assert.equal(setCyberSonarEnabled(false, root), false);
assert.equal(root.dataset.cyberSonar, 'off');
assert.equal(isCyberSonarEnabled(root), false);
assert.equal(setCyberSonarEnabled(true, root), true);
assert.equal(root.dataset.cyberSonar, 'on');
});
test('real Cesium points and billboards recover after repeated low/high opacity cycles', () => {
@@ -349,10 +353,10 @@ test('the sweep corrects delayed starts and reacquires restarted animations with
assert.doesNotThrow(() => syncCyberSonarAnimation({}));
});
test('the selected Cyber theme seeds and releases the compositor sweep phase', () => {
test('turning Sonar on seeds and releases the compositor sweep phase', () => {
const values = new Map();
const root = {
dataset: {},
dataset: { cyberSonar: 'on' },
style: {
setProperty: (name, value) => values.set(name, value),
removeProperty: (name) => values.delete(name),
+27 -16
View File
@@ -45,7 +45,7 @@ test('frame sampler matches reference without per-contact settings access', () =
});
test('removed CSS mode cannot disable GPU contacts; unsupported renderers fail closed', () => {
const root = { dataset: { uiTheme: 'cyber' }, style: { setProperty() {} } };
const root = { dataset: { cyberSonar: 'on' }, style: { setProperty() {} } };
const options = {
root,
body: { classList: { contains: () => false } },
@@ -97,7 +97,7 @@ function fixture({ modulation = true, lists = true } = {}) {
document: globalThis.document,
matchMedia: globalThis.matchMedia,
};
const root = { dataset: { uiTheme: 'cyber', cyberSonar: 'on' } };
const root = { dataset: { cyberSonar: 'on' } };
const status = { textContent: '' };
const state = { cockpit: false, reducedMotion: false };
globalThis.document = {
@@ -232,36 +232,47 @@ test('the sweep sets its sector on drawing ticks and at the cadence, and changes
f.tick(false);
assert.equal(f.sets.length, 4, 'a resize sets it at once');
assert.deepEqual(f.sets[3].center, { x: 300, y: 400 });
f.root.dataset.cyberSonar = 'off';
f.root.dataset.cyberSonarOpacity = '50';
f.tick(false);
assert.equal(f.sets[4].radius, 0, 'Sonar OFF rests every contact');
assert.equal(f.sets.length, 5, 'a setting change sets it at once');
assert.equal(
f.sets[4].floor,
0.5,
'while sweeping the floor is the opacity',
);
f.state.reducedMotion = true;
f.tick(false);
assert.equal(f.sets[5].radius, 0, 'reduced motion rests the sweep');
assert.equal(f.sets[5].floor, 0.5 + 0.5 * 0.46, 'at rest it lifts');
clock += 1000;
f.tick(true);
f.tick(false);
assert.equal(f.sets.length, 5, 'at rest only changes set it');
f.root.dataset.cyberSonarOpacity = '50';
f.tick(false);
assert.equal(f.sets.length, 6);
assert.equal(f.sets[5].floor, 0.5 + 0.5 * 0.46);
assert.equal(f.sets.length, 6, 'at rest only changes set it');
f.state.reducedMotion = false;
f.state.cockpit = true;
f.tick(false);
assert.equal(f.sets[6], null, 'out of the map theme it clears');
assert.equal(f.sets[6], null, 'out of the map it clears');
f.tick(true);
assert.equal(f.sets.length, 7, 'cleared once');
f.state.cockpit = false;
f.root.dataset.cyberSonar = 'off';
f.tick(false);
assert.equal(f.sets.length, 7, 'Sonar OFF leaves contacts untreated');
f.root.dataset.cyberSonar = 'on';
f.state.reducedMotion = true;
f.tick(false);
assert.equal(f.sets[7].radius, 0, 'reduced motion rests the sweep');
f.state.reducedMotion = false;
f.root.dataset.uiTheme = 'tactical';
assert.ok(f.sets[7]?.radius > 0, 'Sonar ON sweeps at once');
f.root.dataset.cyberSonar = 'off';
f.tick(false);
assert.equal(f.sets[8], null, 'another HUD style clears it');
assert.equal(f.sets[8], null, 'Sonar OFF clears it');
f.tick(true);
assert.equal(f.sets.length, 9);
// The removed Cyber theme attribute alone does nothing.
f.root.dataset.uiTheme = 'cyber';
f.tick(false);
assert.ok(f.sets[9]?.radius > 0, 'back in Cyber it sweeps at once');
assert.equal(f.sets.length, 9);
f.root.dataset.cyberSonar = 'on';
f.tick(false);
assert.ok(f.sets[9]?.radius > 0, 'back on, it sweeps at once');
assert.deepEqual(f.requests, [], 'the scene itself never asks for frames');
dispose();
assert.equal(f.sets[10], null, 'disposal clears it');
+9 -2
View File
@@ -98,7 +98,7 @@ export function normalizeAdsbLolAircraftState(aircraft, nowSeconds) {
* Normalize an adsb.lol point response to an OpenSky-compatible response.
* Invalid rows and positionless contacts are intentionally excluded.
* @param {object} payload adsb.lol v2 response.
* @returns {{time:number,states:Array[]}}
* @returns {{time:number,states:Array[],emergencyByIcao?:object,typeByIcao?:object}}
*/
export function normalizeAdsbLolPointResponse(payload) {
const responseNow = finiteNumber(payload?.now);
@@ -111,9 +111,10 @@ export function normalizeAdsbLolPointResponse(payload) {
const aircraft = Array.isArray(payload?.ac) ? payload.ac : [];
const states = [];
// Keep the OpenSky vectors unchanged. The regional fallback's extra readsb
// status travels alongside them, keyed only to admitted aircraft.
// status and type travel alongside them, keyed only to admitted aircraft.
const admitted = new Set();
const statuses = [];
const types = [];
for (const row of aircraft) {
const state = normalizeAdsbLolAircraftState(row, nowSeconds);
if (!state) continue;
@@ -125,11 +126,17 @@ export function normalizeAdsbLolPointResponse(payload) {
admitted.add(id);
if (typeof row.emergency === 'string')
statuses.push([id, row.emergency.trim().toLowerCase()]);
const type = typeof row.t === 'string' ? row.t.trim().toUpperCase() : '';
if (type) types.push([id, type]);
}
const emergencyByIcao = Object.fromEntries(statuses);
const typeByIcao = Object.fromEntries(types);
return {
time: nowSeconds,
states,
...(Object.keys(emergencyByIcao).length ? { emergencyByIcao } : {}),
// The ICAO type designator (readsb `t`), so the aircraft is classed from
// its first fix instead of after a lookup.
...(types.length ? { typeByIcao } : {}),
};
}
+19
View File
@@ -61,3 +61,22 @@ test('an aircraft with no track takes its true heading, never its magnetic one',
assert.equal(at({ mag_heading: 278.44 }), null, 'not magnetic');
assert.equal(at({}), null, 'none');
});
test('the point response sends each admitted aircraft type alongside the vectors', () => {
const response = normalizeAdsbLolPointResponse({
now: 1000,
ac: [
{ hex: 'A1B2C3', lat: 30, lon: -97, t: 'ec45' },
{ hex: 'A1B2C3', lat: 31, lon: -97, t: 'B738' },
{ hex: 'D4E5F6', lat: 30, lon: -98 },
{ hex: 'BAD000', t: 'A320' },
],
});
assert.equal(response.states.length, 3);
assert.deepEqual(response.typeByIcao, { a1b2c3: 'EC45' });
const untyped = normalizeAdsbLolPointResponse({
now: 1000,
ac: [{ hex: 'D4E5F6', lat: 30, lon: -98 }],
});
assert.equal(Object.hasOwn(untyped, 'typeByIcao'), false);
});
+35 -13
View File
@@ -401,6 +401,11 @@ const OPENSKY_CATEGORY = {
7: 'fastjet', // High performance (>5g, >400 kt)
8: 'helicopter', // Rotorcraft
9: 'glider',
16: 'vehicle', // Surface vehicle, emergency
17: 'vehicle', // Surface vehicle, service
18: 'station', // Point obstacle
19: 'station', // Cluster obstacle
20: 'station', // Line obstacle
};
/** ADS-B emitter-category string → class. */
@@ -413,13 +418,35 @@ const EMITTER_CATEGORY = {
A6: 'fastjet',
A7: 'helicopter',
B1: 'glider',
C1: 'vehicle', // Surface vehicle, emergency
C2: 'vehicle', // Surface vehicle, service
C3: 'station', // Point obstacle
C4: 'station', // Cluster obstacle
C5: 'station', // Line obstacle
};
/**
* The type codes feeds give what is not an aircraft: an airport vehicle
* (ZVEH) and a ground station (GRND).
*/
const GROUND_TYPE_CLASS = { ZVEH: 'vehicle', GRND: 'station' };
/**
* The class an aircraft draws and reads as, from its ICAO type code (which
* outranks the category), else its OpenSky integer or ADS-B emitter category.
* Besides the aircraft classes, `vehicle` is an airport vehicle (type ZVEH,
* emitter C1 or C2) and `station` a ground station or obstacle (type GRND,
* emitter C3 to C5). A known type code outside every set is an airliner, and
* so is a contact with nothing to go on.
* @param {{typeCode?: string|null, category?: string|number|null}} [record]
* @returns {string}
*/
export function classifyAircraft({ typeCode, category } = {}) {
const code = String(typeCode || '')
.trim()
.toUpperCase();
if (code) {
if (GROUND_TYPE_CLASS[code]) return GROUND_TYPE_CLASS[code];
if (FASTJET.has(code)) return 'fastjet';
if (UAV.has(code)) return 'uav';
if (HELI.has(code)) return 'helicopter';
@@ -452,18 +479,13 @@ export const AIRCRAFT_CLASS_LABELS = Object.freeze({
fastjet: msg('Fast jet'),
bizjet: msg('Business jet'),
uav: msg('Drone'),
vehicle: msg('Airport vehicle'),
station: msg('Ground station / obstacle'),
});
/** Billboard scale multipliers (skylight GLYPH_SCALE, + fastjet). */
export const CLASS_SCALE_2D = {
light: 0.62,
glider: 0.58,
turboprop: 0.86,
airliner: 1.0,
widebody: 1.3,
quadjet: 1.45,
helicopter: 0.82,
fastjet: 0.8,
bizjet: 0.72,
uav: 0.75,
};
/**
* The tint an airport vehicle's sprite draws with in Flights and Local
* ADS-B: an orange amber, apart from aircraft white and the military layer's
* yellow amber (#FFB800).
*/
export const VEHICLE_TINT_CSS = '#FF8F1F';
+49 -4
View File
@@ -1,7 +1,7 @@
// src/data/aircraftClass.test.mjs
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { classifyAircraft, CLASS_SCALE_2D } from './aircraftClass.js';
import { AIRCRAFT_CLASS_LABELS, classifyAircraft } from './aircraftClass.js';
test('type-code classification (military layer path)', () => {
assert.equal(classifyAircraft({ typeCode: 'F16' }), 'fastjet');
@@ -48,8 +48,53 @@ test('typeCode outranks category; unknown → airliner', () => {
assert.equal(classifyAircraft({ typeCode: null, category: 0 }), 'airliner');
});
test('the icon scale table covers every class', () => {
for (const kind of ['light','glider','turboprop','airliner','widebody','quadjet','helicopter','fastjet','bizjet','uav']) {
assert.ok(Number.isFinite(CLASS_SCALE_2D[kind]), kind);
test('every class has a label', () => {
for (const kind of [
'light',
'glider',
'turboprop',
'airliner',
'widebody',
'quadjet',
'helicopter',
'fastjet',
'bizjet',
'uav',
'vehicle',
'station',
]) {
assert.ok(AIRCRAFT_CLASS_LABELS[kind], kind);
}
});
test('airport vehicles and ground stations class apart from aircraft', () => {
// A feed's own types, in any case.
assert.equal(classifyAircraft({ typeCode: 'ZVEH' }), 'vehicle');
assert.equal(classifyAircraft({ typeCode: ' zveh ' }), 'vehicle');
assert.equal(classifyAircraft({ typeCode: 'GRND' }), 'station');
// Emitter categories: surface vehicles, then obstacles.
assert.equal(classifyAircraft({ category: 'C1' }), 'vehicle');
assert.equal(classifyAircraft({ category: 'C2' }), 'vehicle');
for (const category of ['C3', 'C4', 'C5'])
assert.equal(classifyAircraft({ category }), 'station', category);
// OpenSky's integer categories for the same.
assert.equal(classifyAircraft({ category: 16 }), 'vehicle');
assert.equal(classifyAircraft({ category: 17 }), 'vehicle');
assert.equal(classifyAircraft({ category: 18 }), 'station');
// A type code still outranks the category.
assert.equal(
classifyAircraft({ typeCode: 'ZVEH', category: 'A3' }),
'vehicle',
);
assert.equal(
classifyAircraft({ typeCode: 'A320', category: 'C1' }),
'airliner',
);
});
test('helicopter types and categories', () => {
for (const typeCode of ['EC35', 'R44', 'S76', 'H60', 'AS50', 'B407'])
assert.equal(classifyAircraft({ typeCode }), 'helicopter', typeCode);
assert.equal(classifyAircraft({ category: 'A7' }), 'helicopter');
assert.equal(classifyAircraft({ category: 8 }), 'helicopter');
});
+5 -6
View File
@@ -1,5 +1,3 @@
import { TRACKED_ICON_COLOR } from '../layers/military/policy.js';
import { TRACKED_CYAN } from '../layers/flights/policy.js';
import { createRendering as civilRendering } from '../layers/flights/rendering.js';
import { createRendering as militaryRendering } from '../layers/military/rendering.js';
import { createMilitarySnapshotRenderer } from '../layers/military/snapshotRenderer.js';
@@ -463,15 +461,16 @@ test('tint priorities cover normal, priority, emergency, tracking and Cockpit do
assert.equal(rendering._modelColor('civil'), red);
if (rendering._cockpitContactColor)
assert.equal(rendering._cockpitContactColor('civil'), red);
// Tracking never recolours: a tracked emergency stays red.
flightState._trackedIcao = 'civil';
assert.equal(
rendering._modelColor('civil'),
factory === civilRendering ? TRACKED_CYAN : TRACKED_ICON_COLOR,
);
assert.equal(rendering._modelColor('civil'), red);
flightState._trackedIcao = null;
flightState.records.data.set('civil', { emergency: null });
// An ordinary model draws its mesh's own colours, whatever the billboard's.
assert.deepEqual([...rendering._modelColor('civil')], [1, 1, 1, 1]);
flightState._trackedIcao = 'civil';
assert.deepEqual([...rendering._modelColor('civil')], [1, 1, 1, 1]);
flightState._trackedIcao = null;
}
});
+161 -8
View File
@@ -32,6 +32,7 @@ import {
TRACKED_ICON_PX,
} from './aircraftIcons.js';
import { cockpitContactDotImage } from './cockpitContactDot.js';
import { rotorFrame, rotorTurns } from './rotorFrames.js';
import { aircraftRecedeSpec } from './aircraftRecession.js';
import { TIMELINE_UNSEEN_MS } from '../time/timelineFixes.js';
@@ -456,6 +457,14 @@ export function createAircraftIcons({
const { focusPassIsNeeded } = services.focus;
// The near-image switch the rows were last written with (CSS px).
let switchPx = nearImageSwitchPx(1);
/**
* Airborne helicopters drawn as their glyph, whose rotor turns: the rotor
* frame each was last drawn at, and the frame it was last judged at
* (`_turnRotors`), so one out of view is judged again only once its frame
* has stepped on.
* @type {Map<string, {drawn: number, checked: number}>}
*/
const rotors = new Map();
/** The delayed instant (epoch ms) every untracked contact is drawn at. */
const _displayMs = () =>
@@ -473,6 +482,9 @@ export function createAircraftIcons({
* back before it (`_replanExpired`).
*/
const planFrom = new Map();
/** When each placed contact's running ease ends (epoch ms): a new answer
* while it runs eases on from where it is drawn instead of cutting it. */
const easeEnds = new Map();
/** The display time the rows were last checked against. */
let replannedAt = -Infinity;
@@ -543,7 +555,9 @@ export function createAircraftIcons({
state._icons?.dispose();
state._icons = null;
liveSet = null;
rotors.clear();
planFrom.clear();
easeEnds.clear();
replannedAt = -Infinity;
}
@@ -607,13 +621,19 @@ export function createAircraftIcons({
* Following the clock, a contact not there yet at the time drawn
* (`regime.unseen`) is not drawn until its warm-up begins.
* @param {string} icao24
* @param {{fromCourseDeg?: number|null, rewound?: boolean}} [options]
* @param {{fromCourseDeg?: number|null, rewound?: boolean,
* handover?: boolean}} [options]
* `fromCourseDeg`: nose to glide from when the row's own motion is not
* what was on screen (tracking handoff). `rewound`: the time drawn moved
* back before the row's motion; it is drawn where it was then, with no
* easing from where it is drawn now.
* easing from where it is drawn now. `handover`: the clock came back to
* live and this is the contact's first live fix: it eases from where it
* is drawn onto its live path, however its last plan ran out.
*/
function _planIcon(icao24, { fromCourseDeg, rewound = false } = {}) {
function _planIcon(
icao24,
{ fromCourseDeg, rewound = false, handover = false } = {},
) {
const icons = state._icons;
if (!icons?.has(icao24) || holdsPlan(icao24)) return;
const history = state._positionHistory.get(icao24);
@@ -628,7 +648,7 @@ export function createAircraftIcons({
// A host-supplied placement decides where a live contact is drawn; with
// none, or no answer for this contact, the layer's own motion below does.
if (_planPlaced(icao24, info, history, t)) return;
if (_planPlaced(icao24, info, history, t, handover)) return;
const regime = parts.motion._motionRegime(history, info, renderTime);
if (regime.unseen) {
@@ -745,7 +765,7 @@ export function createAircraftIcons({
fromCourseDeg == null &&
!rewound &&
icons.shown(icao24) &&
icons.expires(icao24) > t - RECOVER_STALE_PLAN_MS
(handover || icons.expires(icao24) > t - RECOVER_STALE_PLAN_MS)
) {
const prev = icons.item(icao24);
const drawn = motionPosition(prev.motion, prev.pos, t);
@@ -804,13 +824,21 @@ export function createAircraftIcons({
* @returns {boolean} False when there is no placement, the layer follows
* the world clock, or it has no answer for this contact.
*/
function _planPlaced(icao24, info, history, t) {
function _planPlaced(icao24, info, history, t, handover = false) {
if (!placeAt || followsClock()) return false;
const leadMs = displayDelay.currentMs;
const from = vec();
const start = placeAt(icao24, t + leadMs, info, history, from);
if (!start) return false;
const { courseDeg: course } = start;
// Back at live, or while an ease runs, it eases on from where it is drawn.
const easing = easeEnds.get(icao24) > t;
if (
(handover || easing) &&
_easePlaced(icao24, info, history, t, from, start)
)
return true;
easeEnds.delete(icao24);
const t1 = t + PLACED_PLAN_MS;
const to = vec();
const end = placeAt(icao24, t1 + leadMs, info, history, to);
@@ -835,6 +863,40 @@ export function createAircraftIcons({
return true;
}
/**
* Back at live, a placed contact still on screen eases from where it is
* drawn onto where it is placed, as the layer's own motion recovers (and a
* new answer while that ease runs eases on from where it is then): along
* the straight line to where the placement has it when the ease ends, nose
* along that line, unless it is nearer than a recovery or farther than a
* jump would be.
* @returns {boolean} Whether the contact was planned to ease.
*/
function _easePlaced(icao24, info, history, t, placed, start) {
const icons = state._icons;
if (!icons.shown(icao24)) return false;
const prev = icons.item(icao24);
const drawn = motionPosition(prev.motion, prev.pos, t);
const errorM = distance(drawn, placed);
if (!(errorM > RECOVER_MIN_M && errorM < RECOVER_SNAP_M)) return false;
const speed = start.speedMps ?? info?.velocity ?? 0;
const end = t + recoveryMs(errorM, speed);
const target = vec();
if (!placeAt(icao24, end + displayDelay.currentMs, info, history, target))
return false;
const motion = straightSegment(drawn, t, end, target);
const course = motionCourse(motion, undefined, t);
icons.setUnseen(icao24, false);
icons.update(
icao24,
{ pos: clone(drawn), course, motion, courseGlide: undefined },
{ expiresAt: end },
);
planFrom.set(icao24, t);
easeEnds.set(icao24, end);
return true;
}
/**
* Re-plan every row whose regime ended by `t` (epoch ms), and, following
* the clock, every row whose motion starts after `t` once the time drawn
@@ -906,26 +968,94 @@ export function createAircraftIcons({
* @returns {{image: string, imageLod: {near: string, switchPx: number},
* size: [number, number], scale: number, scaleByDistance: object}}
*/
function _fleetLook(icao24, info = state.records.data.get(icao24)) {
function _fleetLook(
icao24,
info = state.records.data.get(icao24),
frame = _rotorFrameOf(icao24, info, Date.now()),
) {
const rendering = parts.rendering;
return {
image: aircraftIcon(
rendering._iconKind(icao24, info?.klass),
FLEET_ICON_PX,
frame,
),
imageLod: {
near: aircraftIcon(
rendering._iconKind(icao24, info?.klass),
TRACKED_ICON_PX,
frame,
),
switchPx,
},
size: [FLEET_ICON_SIZE_PX, FLEET_ICON_SIZE_PX],
scale: rendering._fleetBillboardScale(icao24, info?.klass),
scale: rendering._fleetBillboardScale(icao24),
scaleByDistance: NORMAL_SCALE_BY_DISTANCE,
};
}
/**
* The rotor frame a contact draws at `nowMs` (`rotorFrames.js`): a
* helicopter's, which holds still on the ground unless it taxis; undefined
* for every other kind.
*/
function _rotorFrameOf(icao24, info, nowMs) {
if (parts.rendering._iconKind(icao24, info?.klass) !== 'helicopter')
return undefined;
return rotorFrame(icao24, nowMs, _rotorState(info));
}
/** What turns a contact's rotor: whether it is grounded, and its speed (m/s). */
function _rotorState(info) {
const speed = info?.velocity ?? info?.speedMps;
return {
onGround: info?.onGround === true,
speedMps: Number.isFinite(speed) ? speed : null,
};
}
/**
* Turn the rotors of the airborne helicopters in view: each one's images
* are written again only when its rotor frame changed (`ROTOR_FPS`, run
* from the fleet pass). One out of view, below the horizon, or hidden for
* its 3D model keeps its frame. The tracked one is drawn by the tracked
* icon, which is given its new images. With no airborne helicopter drawn
* this does nothing.
* @param {number} nowMs Epoch ms the frame is chosen at.
* @param {number} t The display instant, epoch ms (where icons are drawn).
* @param {((position: {x: number, y: number, z: number}) => boolean)|null}
* [inView] Whether a position is in the camera's view; none: all are.
*/
function _turnRotors(nowMs, t, inView = null) {
const icons = state._icons;
if (!rotors.size || !icons) return;
let occluder;
for (const [id, rotor] of rotors) {
const frame = rotorFrame(id, nowMs);
// Drawn at this frame, or already judged at it: nothing to do.
if (frame === rotor.drawn || frame === rotor.checked) continue;
rotor.checked = frame;
const tracked = id === state._trackedIcao;
if (!icons.has(id) || (!tracked && !icons.shown(id))) continue;
const position = icons.position(id, t);
if (!position) continue;
if (occluder === undefined) occluder = _occluder();
if (!_aboveHorizon(position, occluder)) continue;
if (inView && !inView(position)) continue;
rotor.drawn = frame;
if (tracked) {
parts.tracking?._syncTrackedBillboardImage?.();
continue;
}
const { image, imageLod } = _fleetLook(
id,
state.records.data.get(id),
frame,
);
icons.update(id, { image, imageLod });
}
}
/** Image, size, scale, tint and freshness for one row under the current
* normal/cockpit contract. Motion and course stay with `_planIcon`. */
function _applyIconPresentation(icao24) {
@@ -953,8 +1083,27 @@ export function createAircraftIcons({
color: rgba(rendering._fleetBillboardColor(icao24, info)),
rotationMode: 'course',
};
// A ground station's mast stands upright.
if (!cockpitDot && info?.klass === 'station') {
look.rotationMode = 'screen';
look.rotation = 0;
}
look.alpha = state.records.missingPolls.get(icao24) ? staleAlpha : 1;
icons.update(icao24, look);
// An airborne helicopter drawn as its glyph turns its rotor.
const frame = cockpitDot
? undefined
: _rotorFrameOf(icao24, info, Date.now());
if (frame === undefined || !rotorTurns(_rotorState(info))) {
// A tracked helicopter that lands shows the still frame at once.
if (rotors.delete(icao24) && tracked)
parts.tracking?._syncTrackedBillboardImage?.();
} else rotors.set(icao24, { drawn: frame, checked: frame });
}
/** Whether any airborne helicopter's rotor turns (`_turnRotors` has work). */
function _rotorsTurning() {
return rotors.size > 0;
}
/** Add a row for a new contact, hidden while it is the tracked one. */
@@ -990,7 +1139,9 @@ export function createAircraftIcons({
/** Drop a contact and everything the layer keeps for it. */
function _forgetContact(icao24) {
state._icons?.remove(icao24);
rotors.delete(icao24);
planFrom.delete(icao24);
easeEnds.delete(icao24);
parts.rendering._releaseModel(icao24);
state.records.forget(icao24);
// The host-supplied placement, if any, forgets it as well.
@@ -1025,6 +1176,8 @@ export function createAircraftIcons({
_focusIcons,
_applyIconPresentation,
_fleetLook,
_turnRotors,
_rotorsTurning,
_addIcon,
_forgetContact,
_iconIds,
+283 -1
View File
@@ -6,10 +6,12 @@ import {
createContactIcons,
floorCoastArc,
} from './aircraftIconLayer.js';
import { COAST_FLOOR_LIFT_M } from './motionModel.js';
import { COAST_FLOOR_LIFT_M, recoveryMs } from './motionModel.js';
import { fromDegrees, toCartographicRadians } from '../geo/ellipsoid.js';
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
import { createDisplayDelay } from './displayDelay.js';
import { aircraftIcon, FLEET_ICON_PX } from './aircraftIcons.js';
import { ROTOR_STILL_FRAME } from './rotorFrames.js';
const WORLD_MS = Date.UTC(2026, 10, 1, 12, 0);
@@ -199,3 +201,283 @@ test('a coast over known ground that never rises is planned once', () => {
'held on the ground where the coast stopped',
);
});
test('only airborne helicopters in view turn their rotor, written when the frame steps', (t) => {
t.mock.timers.enable({ apis: ['Date'], now: WORLD_MS });
const here = fromDegrees(0, 30, 300);
const away = fromDegrees(90, 30, 300);
const records = new Map([
['h1', { klass: 'helicopter', onGround: false }],
['h2', { klass: 'helicopter', onGround: true }],
['p1', { klass: 'airliner', onGround: false }],
['h3', { klass: 'helicopter', onGround: false }],
]);
const state = {
now: () => Date.now(),
_icons: createContactIcons(),
_positionHistory: new Map(),
_cockpitNearContacts: new Set(),
records: { data: records, missingPolls: new Map() },
};
const icons = createAircraftIcons({
state,
services: { focus: { focusPassIsNeeded: () => false } },
parts: {
rendering: {
_iconKind: (_id, klass) => klass,
_fleetBillboardColor: () => [1, 1, 1, 1],
_fleetBillboardScale: () => 1,
},
},
layerId: 'flights',
courseMaxDps: 3,
cockpitContactSizePx: 8,
});
for (const id of records.keys()) {
state._icons.put(
{
id,
pos: id === 'h3' ? away : here,
motion: { kind: 'hold', courseDeg: 0 },
size: [20, 20],
},
{ expiresAt: Infinity },
);
icons._applyIconPresentation(id);
}
const image = (id) => state._icons.item(id).image;
// The grounded helicopter holds the still frame.
assert.equal(
image('h2'),
aircraftIcon('helicopter', FLEET_ICON_PX, ROTOR_STILL_FRAME),
);
const h3Before = image('h3');
const writes = new Map();
const update = state._icons.update;
state._icons.update = (id, patch, options) => {
writes.set(id, (writes.get(id) ?? 0) + 1);
return update(id, patch, options);
};
// The fleet pass, every 80 ms for a second; h3 is out of view.
const inView = (p) => Math.abs(p.x - here.x) < 1;
const seen = new Set();
for (let step = 0; step <= 12; step++) {
if (step) t.mock.timers.tick(80);
icons._turnRotors(Date.now(), Date.now(), inView);
seen.add(image('h1'));
}
// Through every frame, written only on the steps its frame changed.
assert.equal(seen.size, 3);
for (const frame of [0, 1, 2])
assert.ok(seen.has(aircraftIcon('helicopter', FLEET_ICON_PX, frame)));
assert.ok(
writes.get('h1') >= 8 && writes.get('h1') <= 11,
`${writes.get('h1')} writes`,
);
assert.equal(writes.get('h2') ?? 0, 0, 'grounded: frozen');
assert.equal(writes.get('p1') ?? 0, 0, 'not a helicopter');
assert.equal(writes.get('h3') ?? 0, 0, 'out of view');
assert.equal(image('h3'), h3Before);
// Landing freezes it on the still frame.
records.get('h1').onGround = true;
icons._applyIconPresentation('h1');
const landed = writes.get('h1');
t.mock.timers.tick(400);
icons._turnRotors(Date.now(), Date.now(), inView);
assert.equal(writes.get('h1'), landed);
assert.equal(
image('h1'),
aircraftIcon('helicopter', FLEET_ICON_PX, ROTOR_STILL_FRAME),
);
});
/** An icon layer over helicopters `ids`, all at `here`, for the rotor tests. */
function rotorFixture(records, positions, tracking = {}) {
const state = {
now: () => Date.now(),
_icons: createContactIcons(),
_positionHistory: new Map(),
_cockpitNearContacts: new Set(),
records: { data: records, missingPolls: new Map() },
};
const icons = createAircraftIcons({
state,
services: { focus: { focusPassIsNeeded: () => false } },
parts: {
rendering: {
_iconKind: (_id, klass) => klass,
_fleetBillboardColor: () => [1, 1, 1, 1],
_fleetBillboardScale: () => 1,
},
tracking,
},
layerId: 'flights',
courseMaxDps: 3,
cockpitContactSizePx: 8,
});
for (const id of records.keys()) {
state._icons.put(
{
id,
pos: positions[id],
motion: { kind: 'hold', courseDeg: 0 },
size: [20, 20],
},
{ expiresAt: Infinity },
);
icons._applyIconPresentation(id);
}
return { state, icons };
}
test('a tracked helicopter that lands shows the still frame at once', (t) => {
t.mock.timers.enable({ apis: ['Date'], now: WORLD_MS });
const records = new Map([['h1', { klass: 'helicopter', onGround: false }]]);
let synced = 0;
const { state, icons } = rotorFixture(
records,
{ h1: fromDegrees(0, 30, 300) },
{ _syncTrackedBillboardImage: () => synced++ },
);
state._trackedIcao = 'h1';
assert.equal(icons._rotorsTurning(), true);
records.get('h1').onGround = true;
icons._applyIconPresentation('h1');
assert.equal(synced, 1, 'the tracked billboard is given its images again');
assert.equal(icons._rotorsTurning(), false);
assert.equal(
icons._fleetLook('h1').image,
aircraftIcon('helicopter', FLEET_ICON_PX, ROTOR_STILL_FRAME),
);
// Taxiing faster than 1 m/s, its rotor turns again, as the model's does.
records.get('h1').velocity = 5;
icons._applyIconPresentation('h1');
assert.equal(icons._rotorsTurning(), true);
records.get('h1').velocity = 0;
icons._applyIconPresentation('h1');
assert.equal(synced, 2);
assert.equal(icons._rotorsTurning(), false);
// An untracked one landing does not touch the tracked billboard.
records.get('h1').onGround = false;
icons._applyIconPresentation('h1');
state._trackedIcao = null;
records.get('h1').onGround = true;
icons._applyIconPresentation('h1');
assert.equal(synced, 2);
});
test('a helicopter out of view is judged once per rotor frame, not every pass', (t) => {
t.mock.timers.enable({ apis: ['Date'], now: WORLD_MS });
const records = new Map();
const positions = {};
for (let i = 0; i < 300; i++) {
const id = `h${i}`;
records.set(id, { klass: 'helicopter', onGround: false });
positions[id] = fromDegrees(90, 30, 300);
}
const { state, icons } = rotorFixture(records, positions);
let judged = 0;
const inView = () => {
judged++;
return false;
};
const writes = [];
const update = state._icons.update;
state._icons.update = (id, ...rest) => {
writes.push(id);
return update(id, ...rest);
};
// Passes 10 ms apart for 2 s: 200 passes over 300 helicopters, all out of
// view. Each is judged at most once per frame step (20 steps), and not on
// a step back onto the frame it is drawn at.
for (let pass = 0; pass < 200; pass++) {
t.mock.timers.tick(10);
icons._turnRotors(Date.now(), Date.now(), inView);
}
assert.ok(judged <= 300 * 21, `${judged} judgements`);
assert.ok(judged >= 300 * 10, `${judged} judgements`);
assert.equal(writes.length, 0, 'none in view: no image written');
});
test('back at live, a placed contact eases from where it is drawn over a recovery, nose along the way', (t) => {
t.mock.timers.enable({ apis: ['Date'], now: WORLD_MS });
const drawnAt = fromDegrees(0, 30, 3_000);
const SPEED = 200;
// The placement has it 2 km east of where it is drawn, flying east.
const placedAt = (wallMs) => {
const east = 2_000 + (SPEED * (wallMs - WORLD_MS)) / 1000;
return fromDegrees(east / (111_320 * Math.cos(Math.PI / 6)), 30, 3_000);
};
const plan = (handover, keep = {}) => {
const state = {
now: () => Date.now(),
_icons: createContactIcons(),
_positionHistory: new Map([['c', [{ epochMs: WORLD_MS }]]]),
records: { data: new Map([['c', {}]]) },
};
const icons = createAircraftIcons({
state,
services: { focus: { focusPassIsNeeded: () => false } },
parts: {
motion: { _displayTimeAt: (ms) => ms, _fixEpochMs: (f) => f.epochMs },
},
layerId: 'flights',
courseMaxDps: 3,
cockpitContactSizePx: 8,
placeAt: (_id, wallMs, _info, _history, out) => {
Object.assign(out, placedAt(wallMs));
return { courseDeg: 90, speedMps: SPEED };
},
});
state._icons.put(
{
id: 'c',
pos: drawnAt,
motion: { kind: 'hold', courseDeg: 0 },
course: 0,
size: [20, 20],
},
{ expiresAt: -Infinity },
);
icons._planIcon('c', handover ? { handover: true } : undefined);
keep.icons = icons;
return state._icons;
};
const metres = (a, b) => Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
const eased = plan(true);
const end = eased.expires('c');
assert.equal(end, WORLD_MS + recoveryMs(2_000, SPEED));
assert.ok(end - WORLD_MS > 1_000, 'longer than a placed plan');
assert.ok(metres(eased.position('c', WORLD_MS, {}), drawnAt) < 1);
assert.ok(metres(eased.position('c', end, {}), placedAt(end)) < 1);
// The nose points along the way from where it is drawn to where it goes.
assert.ok(Math.abs(eased.course('c', WORLD_MS) - 90) < 1);
const plain = plan(false);
assert.ok(
metres(plain.position('c', WORLD_MS, {}), placedAt(WORLD_MS)) < 1,
'without the handover it is drawn where it is placed',
);
// The next answer comes 15 s in, the ease still running: it eases on from
// where it is drawn then, not cut to where it is placed.
const keep = {};
const easing = plan(true, keep);
const firstEnd = easing.expires('c');
assert.ok(firstEnd - WORLD_MS > 15_000, 'an ease longer than a poll');
t.mock.timers.tick(15_000);
const at = Date.now();
const drawnThen = easing.position('c', at, {});
keep.icons._planIcon('c');
assert.ok(metres(easing.position('c', at, {}), drawnThen) < 1);
const reEnd = easing.expires('c');
assert.ok(reEnd > at + 1_000, 'eases on');
assert.ok(metres(easing.position('c', reEnd, {}), placedAt(reEnd)) < 1);
// Once it has caught up, the next answer draws it where it is placed.
t.mock.timers.tick(reEnd - at + 1);
keep.icons._planIcon('c');
assert.ok(
metres(easing.position('c', Date.now(), {}), placedAt(Date.now())) < 1,
);
});
+115 -28
View File
@@ -8,9 +8,9 @@
* width/height 20 (24 tracked) in flights.js / militaryFlights.js, so Cesium
* DOWN-samples this larger, higher-precision source to the same on-screen
* footprint — crisp anti-aliased edges instead of an upscaled 32px bitmap. The
* on-screen size is unchanged and CLASS_SCALE_2D is untouched (no scale
* compensation needed: the billboard's explicit width/height, not the SVG's,
* sets the pixel size — the intrinsic SVG size only controls raster fidelity).
* on-screen size is unchanged (the billboard's explicit width/height, not the
* SVG's, sets the pixel size — the intrinsic SVG size only controls raster
* fidelity).
*
* All glyphs are nose-up (nose toward -Y at rotation 0; the screen-projected
* rotation pipeline in iconOrientation.js spins the whole glyph). Fill is white
@@ -23,12 +23,19 @@
* quadjet/glider use the "bold" chart-symbol redraw; light/fastjet keep the
* original drawings. Raster fidelity doubled (192px source, same 96 coords).
*
* The helicopter is a top-down body under a four-blade rotor drawn in three
* frames (`aircraftIcon('helicopter', px, frame)`, turned by
* `rotorFrames.js`). Two kinds are not aircraft: `vehicle`, one sprite for
* every airport vehicle, and `station`, a mast for ground stations, drawn
* upright.
*
* Silhouette language follows skylight's type-aware glyphs (MIT,
* https://github.com/cpaczek/skylight): slender fuselages, swept wings for
* jets, long high-aspect wings for the glider, straight wings + prop discs for
* props, a rotor disc + tail boom + tail-rotor for the helicopter, and a delta
* for the fast jet. Each class has a DISTINCT planform so it reads at ~20px by
* shape, not just by footprint size.
* shape alone: every glyph is fitted to the same extent, so none is bigger
* than another.
*/
const VIEW = 96;
@@ -130,23 +137,6 @@ const BODIES = {
L -3,-25 C -3,-29 -2.4,-33 0,-35 Z" fill="white" ${STROKE_BOLD}/>
<rect x="-10.5" y="32.5" width="21" height="5" rx="1.5" fill="white" ${STROKE_BOLD}/>`,
// ── Helicopter: a SOLID translucent main-rotor disc (survives downscale as an
// obvious circle, unlike a thin ring) with a bold two-blade cross, a
// teardrop cabin, a tail boom, and a tail rotor. Unmistakable "disc on top"
// silhouette that never reads as a fixed-wing.
helicopter: `
<circle cx="0" cy="-6" r="31" fill="white" fill-opacity="0.22"/>
<g transform="rotate(45 0 -6)">
<rect x="-30.5" y="-8.2" width="61" height="4.4" rx="2.2" fill="white" fill-opacity="0.9"/>
<rect x="-30.5" y="-8.2" width="61" height="4.4" rx="2.2" fill="white" fill-opacity="0.9" transform="rotate(90 0 -6)"/>
</g>
<path d="M0,-22 C 8,-20 10.5,-13 10.5,-6 C 10.5,2 7.5,7 0,8.5
C -7.5,7 -10.5,2 -10.5,-6 C -10.5,-13 -8,-20 0,-22 Z" fill="white" ${STROKE}/>
<path d="M-2.6,8 L 2.6,8 L 1.8,32 L -1.8,32 Z" fill="white" ${STROKE}/>
<path d="M-8,27 L 8,27 L 8,30.6 L -8,30.6 Z" fill="white"/>
<circle cx="5.6" cy="35" r="6" fill="white" fill-opacity="0.6"/>
<circle cx="5.6" cy="35" r="2.1" fill="white"/>`,
// ── Fast jet: sharp delta/cropped-delta with a pointed nose, LERX root
// blend, and twin tail fins. Aggressive, all-wing.
fastjet: `
@@ -236,6 +226,87 @@ const BODIES = {
L -1.6,30 L -13,36 L -13,32 L -2.1,24
L -2.3,0 L -43,-2.5 L -43,-7 L -2.4,-12
L -4.4,-30 C -4.6,-35 -3.6,-40 0,-40 Z" fill="white" ${STROKE}/>`,
// ── Airport vehicle (type ZVEH, emitter C1/C2): one service van seen from
// above, front up, for every kind (fire truck, tug, car, de-icer). A
// boxy body, a dark windscreen band and a roof light bar; the layer
// tints it amber so it reads apart from aircraft.
vehicle: `
<path d="M-12,-39 L 12,-39 L 15,-36 L 15,38 L 13,40 L -13,40 L -15,38
L -15,-36 Z" fill="white" ${STROKE}/>
<path d="M-18.5,-25 h4 v3 h-4 Z M14.5,-25 h4 v3 h-4 Z" fill="white" ${STROKE}/>
<path d="M-13,-32 L 13,-32 L 12,-21 L -12,-21 Z" fill="rgba(0,0,0,0.62)"/>
<rect x="-10" y="-13" width="20" height="5" rx="1.5" fill="rgba(0,0,0,0.45)"/>`,
// ── Ground station or obstacle (type GRND, emitter C3–C5): a radio mast
// with two pairs of signal arcs, drawn upright on screen, never turned.
station: `
<path d="M7.1,-38.4 A 11 11 0 0 1 7.1,-21.6 M-7.1,-38.4 A 11 11 0 0 0 -7.1,-21.6
M12.2,-44.6 A 19 19 0 0 1 12.2,-15.4 M-12.2,-44.6 A 19 19 0 0 0 -12.2,-15.4"
fill="none" stroke="rgba(0,0,0,0.32)" stroke-width="5" stroke-linecap="round"/>
<path d="M7.1,-38.4 A 11 11 0 0 1 7.1,-21.6 M-7.1,-38.4 A 11 11 0 0 0 -7.1,-21.6
M12.2,-44.6 A 19 19 0 0 1 12.2,-15.4 M-12.2,-44.6 A 19 19 0 0 0 -12.2,-15.4"
fill="none" stroke="white" stroke-width="3.4" stroke-linecap="round"/>
<circle cx="0" cy="-30" r="4.5" fill="white" ${STROKE}/>
<path d="M-2.5,-25 L 2.5,-25 L 7,34 L 13,34 L 13,38 L -13,38 L -13,34
L -7,34 Z" fill="white" ${STROKE}/>`,
};
/**
* The helicopter, seen from above: a cabin, tail boom and tail plane under a
* four-blade main rotor. The rotor turns in {@link ROTOR_FRAMES} frames 30°
* apart; four blades repeat every 90°, so the third frame steps back onto
* the first and the loop is seamless. The middle frame (blades as an X) is
* the still one.
*/
const HELI_ROTOR_CENTRE_Y = -11.2;
const HELI_DISC = `<circle cx="0" cy="${HELI_ROTOR_CENTRE_Y}" r="32.8" fill="white" fill-opacity="0.22"/>`;
const HELI_BODY = `
<path d="M0,-33.4 L -2.3,-32.1 L -4.2,-28 L -4.3,-30.6 L -6.2,-30.6
L -6.2,0.2 L -4.3,0.2 L -4.2,-3.1 L -1.9,7.9 L -1.7,18.9
L -7.4,19.2 L -7.8,24 L -2.9,24.4 L -3.2,35.6 L -1.2,36
L 0,34.3 L 1.2,36 L 3.2,35.6 L 2.9,24.4 L 7.8,24 L 7.4,19.2
L 1.7,18.9 L 1.9,7.9 L 4.2,-3.1 L 4.3,0.2 L 6.2,0.2 L 6.2,-30.6
L 4.3,-30.6 L 4.2,-28 L 2.3,-32.1 Z" fill="white" ${STROKE}/>
<circle cx="0" cy="${HELI_ROTOR_CENTRE_Y}" r="3.2" fill="white" ${STROKE}/>`;
/** Main-rotor blade angle of each frame, degrees clockwise. */
const ROTOR_ANGLES_DEG = [15, 45, 75];
/** How many rotor frames the helicopter turns through. */
export const ROTOR_FRAMES = ROTOR_ANGLES_DEG.length;
/** The frame a helicopter holds when its rotor does not turn. */
export const ROTOR_STILL_FRAME = 1;
/** One rotor frame: the disc, two crossed blades at `angle`, the body over them. */
function helicopterBody(frame) {
const angle = ROTOR_ANGLES_DEG[frame] ?? ROTOR_ANGLES_DEG[ROTOR_STILL_FRAME];
const blade = (deg) =>
`<rect x="-32.2" y="${HELI_ROTOR_CENTRE_Y - 2.2}" width="64.4" height="4.4" rx="2.2" fill="white" fill-opacity="0.92" stroke="rgba(0,0,0,0.25)" stroke-width="0.8" transform="rotate(${deg} 0 ${HELI_ROTOR_CENTRE_Y})"/>`;
return `${HELI_DISC}${blade(angle)}${blade(angle + 90)}${HELI_BODY}`;
}
/**
* Every sprite draws at one size. The bodies were drawn at different spans
* (a light aircraft's half-extent is 32.8 units, a quadjet's 47), so each is
* scaled until its farthest painted edge, stroke included, sits
* {@link GLYPH_HALF_EXTENT} units from the centre. Values are each body's
* measured half-extent; aircraftIcons.test.mjs re-measures the rasters.
*/
const GLYPH_HALF_EXTENT = 44;
const BODY_HALF_EXTENT = {
airliner: 42.7,
widebody: 45.7,
quadjet: 47.0,
turboprop: 40.7,
light: 32.8,
glider: 46.0,
fastjet: 44.7,
bizjet: 42.7,
uav: 43.7,
helicopter: 44.0,
vehicle: 40.7,
station: 47.1,
tr3b: 40.8,
tr3bHot: 42.3,
};
const _iconCache = new Map();
@@ -259,16 +330,32 @@ export const FLEET_ICON_PX = FLEET_RASTER_PX;
* it stays crisp at its biggest on-screen sizes. */
const TRACKED_RASTER_PX = 192;
/** Data URI for a class silhouette (lazily built, cached per kind+size).
* Default size serves the fleet; pass `aircraftIcon(kind, TRACKED_ICON_PX)`
* (re-exported below) for the tracked billboard. */
/** Raster size of the tracked glyph and every glyph's near image. */
export const TRACKED_ICON_PX = TRACKED_RASTER_PX;
export function aircraftIcon(kind, px = FLEET_RASTER_PX) {
const k = BODIES[kind] ? kind : 'airliner';
const key = `${k}@${px}`;
/**
* Data URI for a class silhouette (lazily built, cached per kind, size and
* frame). The default size serves the fleet; pass
* `aircraftIcon(kind, TRACKED_ICON_PX)` for the near image.
* @param {string} kind A `classifyAircraft()` class, or a TR-3B kind.
* @param {number} [px] Raster size.
* @param {number} [frame] A helicopter's rotor frame, 0 to `ROTOR_FRAMES - 1`
* (the still frame by default); other kinds have one image.
* @returns {string}
*/
export function aircraftIcon(kind, px = FLEET_RASTER_PX, frame) {
const heli = kind === 'helicopter';
const k = heli || BODIES[kind] ? kind : 'airliner';
const f = heli
? Number.isInteger(frame) && frame >= 0 && frame < ROTOR_FRAMES
? frame
: ROTOR_STILL_FRAME
: 0;
const key = `${k}@${px}#${f}`;
let uri = _iconCache.get(key);
if (!uri) {
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${px}" height="${px}" viewBox="0 0 ${VIEW} ${VIEW}"><g transform="translate(${C},${C})">${BODIES[k]}</g></svg>`;
const body = heli ? helicopterBody(f) : BODIES[k];
const fit = +(GLYPH_HALF_EXTENT / BODY_HALF_EXTENT[k]).toFixed(4);
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${px}" height="${px}" viewBox="0 0 ${VIEW} ${VIEW}"><g transform="translate(${C},${C}) scale(${fit})">${body}</g></svg>`;
uri = 'data:image/svg+xml;base64,' + _b64(svg);
_iconCache.set(key, uri);
}
+57
View File
@@ -0,0 +1,57 @@
// src/data/aircraftIcons.test.mjs
import { test } from 'node:test';
import assert from 'node:assert/strict';
import sharp from 'sharp';
import { aircraftIcon, ROTOR_FRAMES } from './aircraftIcons.js';
const KINDS = [
'airliner',
'widebody',
'quadjet',
'turboprop',
'light',
'glider',
'fastjet',
'bizjet',
'uav',
'helicopter',
'vehicle',
'station',
'tr3b',
'tr3bHot',
];
const PX = 480;
/** Farthest painted pixel from the centre, in the 96-unit glyph space. */
async function halfExtent(uri) {
const svg = Buffer.from(uri.split(',')[1], 'base64');
const { data, info } = await sharp(svg)
.ensureAlpha()
.raw()
.toBuffer({ resolveWithObject: true });
let half = 0;
const c = info.width / 2;
for (let y = 0; y < info.height; y++) {
for (let x = 0; x < info.width; x++) {
if (data[(y * info.width + x) * 4 + 3] <= 8) continue;
half = Math.max(half, c - x, x + 1 - c, c - y, y + 1 - c);
}
}
return (half * 96) / info.width;
}
test('every sprite fills the same extent, whatever its class', async () => {
const extents = {};
for (const kind of KINDS) {
extents[kind] = await halfExtent(aircraftIcon(kind, PX));
}
for (let frame = 0; frame < ROTOR_FRAMES; frame++) {
extents[`helicopter#${frame}`] = await halfExtent(
aircraftIcon('helicopter', PX, frame),
);
}
for (const [kind, half] of Object.entries(extents)) {
assert.ok(Math.abs(half - 44) <= 0.6, `${kind}: ${half.toFixed(2)}`);
}
});
+190 -53
View File
@@ -14,7 +14,8 @@ import {
showModel,
} from './modelRecord.js';
import { modelDrawnScale } from './modelVisualAnchor.js';
import { fleetModelSet } from './fleetModels.js';
import { fleetModelSet, fleetPartTable } from './fleetModels.js';
import { aircraftLayerPartState } from './modelPartDrivers.js';
import { findCamera, findDraw, rendererOf } from '../render/rendererOf.js';
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
import {
@@ -225,10 +226,10 @@ export function createAircraftModels({
return sets ? [sets.fleet.id, sets.tracked.id] : [];
}
/** The FLEET's 3D-model regime: models3d enabled AND the camera zoomed in past the altitude
* ceiling. Since 2026-08-22 the toggle DEFAULTS ON in `proximity`, which is itself the
* budget: models only appear below MODEL_ALT_CEIL_M and only for the nearest MODEL_MAX in
* view. The toggle still OWNS the fleet — an operator who wants every in-view plane arms
/** The FLEET's 3D-model regime: models3d enabled AND the camera below the altitude ceiling,
* above which no contact can be within the model radius. Since 2026-08-22 the toggle DEFAULTS
* ON in `proximity`, which is itself the budget: models only appear within MODEL_ADD_M of the
* camera and only for the nearest MODEL_MAX. The toggle still OWNS the fleet — an operator who wants every in-view plane arms
* `all`, and one who wants none turns 3D off — this predicate is unchanged. The TRACKED
* contact routes through here too (`_trackedModelRegimeActive`), with its place in the
* fleet's cap, so selecting a contact never changes its form. */
@@ -254,20 +255,17 @@ export function createAircraftModels({
: mapCap;
}
/** Active ADD radius (m) — new planes inside this range get a model. Mode-aware: 'all' reaches far. */
/** ADD radius (m) — new planes inside this range get a model. Both modes
* share it; they differ by their caps. */
function _modelAddDistM() {
return state._models3dMode === 'all'
? policy.MODEL_ALL_ADD_M
: policy.MODEL_PROX_ADD_M;
return policy.MODEL_ADD_M;
}
/** Active KEEP radius (m) — a modeled plane keeps its model out to here (hysteresis vs ADD). */
/** KEEP radius (m) — a modeled plane keeps its model out to here (hysteresis vs ADD). */
function _modelKeepDistM() {
return state._models3dMode === 'all'
? policy.MODEL_ALL_KEEP_M
: policy.MODEL_PROX_KEEP_M;
return policy.MODEL_KEEP_M;
}
/** What a grounded model's ground sample sees through: the vertical sample
@@ -341,6 +339,54 @@ export function createAircraftModels({
record.tint = [base[0], base[1], base[2], alpha];
}
/** A finite number of the first of `values` that is one, else null. */
const _finite = (...values) =>
values.find((v) => typeof v === 'number' && Number.isFinite(v)) ?? null;
/**
* How high an aircraft flies above the ground under it: its render
* altitude over the cached ground floor there; null where that floor is
* not known (the gear then follows the approach rule instead).
*/
function _heightAboveGround(meta) {
const altitude = _finite(meta.renderAltitudeM);
const floor =
Number.isFinite(meta.rawLat) && Number.isFinite(meta.rawLon)
? services.groundFloor?.cachedGroundFloor?.(meta.rawLat, meta.rawLon)
: null;
return altitude !== null && Number.isFinite(floor)
? altitude - floor
: null;
}
/**
* The moving parts a contact's model is posed with, from its record
* (`aircraftLayerPartState`): gear, doors and flaps by its height and climb,
* fans, propellers and rotors while it flies or taxis. An airport vehicle
* is a road vehicle (`groundVehiclePartState`): its wheels roll with its
* speed. Undefined for a model without parts.
*/
function _partsOf(meta, spec) {
if (!meta) return undefined;
const table = fleetPartTable(fleetModelSet(), spec?.model);
if (!table) return undefined;
return aircraftLayerPartState(table, {
klass: meta.klass,
onGround: meta.onGround === true,
heightAboveGroundM: _heightAboveGround(meta),
altitudeM: _finite(meta.altitude, meta.altitudeM),
verticalRateMps: _finite(meta.verticalRate, meta.verticalRateMps),
speedMps: _finite(meta.velocity, meta.speedMps),
});
}
/** Pose a record's parts as its contact's record says, and key them for `_send`. */
function _poseParts(record, meta, spec) {
const pose = _partsOf(meta, spec);
record.parts = pose;
record.partsKey = pose ? JSON.stringify(pose) : '';
}
/** The record's item, as its set draws it. */
function _itemOf(id, record) {
return {
@@ -354,10 +400,11 @@ export function createAircraftModels({
minPixelSize: record.minPixelSize,
shading: _shadingOf(),
tint: record.tint ?? WHITE,
// The mesh's own colours, tinted while tracked or in an emergency;
// The mesh's own colours, tinted red in an emergency;
// the IR boost draws it flat white.
colorBlend: aircraftModelBlend(state._irBoost === true),
colorBlend: aircraftModelBlend(state._irBoost === true, record.tint),
environmentMap: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS.enabled,
...(record.parts ? { parts: record.parts } : {}),
show: record.show,
};
}
@@ -367,7 +414,7 @@ export function createAircraftModels({
if (!set) return;
const p = record.position;
const t = record.tint ?? WHITE;
const key = `${record.url}|${p.x},${p.y},${p.z}|${record.heading}|${record.scale}|${record.minPixelSize}|${t[0]},${t[1]},${t[2]},${t[3]}|${state._irBoost === true}|${record.show}`;
const key = `${record.url}|${p.x},${p.y},${p.z}|${record.heading}|${record.scale}|${record.minPixelSize}|${t[0]},${t[1]},${t[2]},${t[3]}|${state._irBoost === true}|${record.show}|${record.partsKey ?? ''}`;
if (key === record.sent) return;
record.sent = key;
const item = _itemOf(id, record);
@@ -426,6 +473,7 @@ export function createAircraftModels({
// Placed BEFORE the readiness test on purpose: a model can turn ready
// between ticks, and its first drawn frame must be at this placement.
placeModel(record, displayPos, _modelHeading(course, meta));
_poseParts(record, meta, spec);
if (!record.ready) {
showModel(record, false); // not loaded yet → keep the 2D icon, no half-model flash
_send(set, icao24, record, spec, out);
@@ -565,12 +613,11 @@ export function createAircraftModels({
state._lastFleetTickMs = 0;
}
/** Admit a fleet model for an aircraft; the icon shows until it is ready. */
/** Admit a fleet model for an aircraft; the icon shows until it is ready.
* The selected aircraft's is admitted too, and kept loaded but hidden
* while its tracked model draws it (`_keepTrackedFleetModel`). */
function _ensureModel(icao24) {
// Never model the TRACKED aircraft — it owns a separate entity billboard, and the fleet
// tick skips it, so a model here would be orphaned + double-rendered.
if (icao24 === state._trackedIcao) return;
onModelEligible(icao24);
if (state._models.has(icao24)) return;
// Without model sets (the renderer draws none) the icon stays.
@@ -585,7 +632,6 @@ export function createAircraftModels({
specKey: _specKeyFor(meta), // type-change sync compares against this
bellyM: spec.bellyM,
scale: spec.scale,
minPixelSize: policy.MODEL_MIN_PX,
});
record.url = resolveAsset(spec.url);
record.gltf = _gltfOf(spec);
@@ -676,24 +722,115 @@ export function createAircraftModels({
);
}
/** A fleet model still drawing the tracked contact (it was a model when
* it was selected) lets go once the tracked model draws, or once the
* contact is no longer drawn as a model at all. */
/** The tracked contact's fleet model lets go once the contact is no
* longer drawn as a model at all (out of range, 3D off, cockpit). */
function _releaseTrackedFleetModel() {
if (state._trackedIcao && state._models.has(state._trackedIcao))
_releaseModel(state._trackedIcao);
}
/** The tracked contact's fleet model (it was a model when it was
* selected, or was admitted since) stops drawing once the tracked model
* draws, or while the tracked icon carries the contact, but stays loaded:
* deselecting hands the contact straight back to it
* (`_handBackDeselected`), with no load and no icon in between. */
function _hideTrackedFleetModel() {
const icao24 = state._trackedIcao;
const record = icao24 ? state._models.get(icao24) : null;
if (!record?.show) return;
showModel(record, false);
_send(state._modelSets?.fleet, icao24, record, _modelSpec(_metaOf(icao24)));
}
/** Keep the tracked contact's fleet model loaded and placed where its icon
* is, one fleet tick at a time, so it is ready to take the contact back
* the moment it is deselected. It never shows here: it draws the contact
* only while the tracked model loads, as it did before the selection. */
function _keepTrackedFleetModel(icao24, position, course, out) {
_ensureModel(icao24);
const record = state._models.get(icao24);
if (!record) return;
const meta = _metaOf(icao24);
const set = state._modelSets?.fleet ?? null;
_retryFailedFleetModel(set, icao24, record);
const displayPos = _modelDisplayPosition(icao24, position);
if (displayPos) placeModel(record, displayPos, _modelHeading(course, meta));
else showModel(record, false); // nowhere safe to draw it
_send(set, icao24, record, _modelSpec(meta), out);
}
/**
* Hand a contact just deselected back to the fleet in the same frame: to
* its fleet model when one is loaded (kept while it was selected), placed
* where its icon is and shown, else to its icon. Runs once the contact no
* longer reads as tracked.
* @param {string} icao24
*/
function _handBackDeselected(icao24) {
const icons = state._icons;
const record = state._models.get(icao24);
if (!icons?.has(icao24)) {
if (record) _releaseModel(icao24);
return;
}
if (!record) {
icons.setShown(icao24, true);
return;
}
const pose = _pose();
if (!pose || !_modelRegimeActive(pose) || isTr3b(icao24)) {
_releaseModel(icao24); // the icon takes it back
return;
}
const t = parts.icons._displayMs();
const position = icons.position(icao24, t);
_driveFleetModelHandoff(
icao24,
record,
position,
icons.course(icao24, t),
() =>
_treatFleetModel(
icao24,
record,
distance(pose.position, position),
pose,
),
);
}
/** A fleet model's tint and alpha this tick: the contact's colour, faded
* as its icon is (focus, recession), or the IR boost's full-strength
* white. */
function _treatFleetModel(icao24, record, cameraDistanceM, pose) {
const icons = state._icons;
_treat(record, {
// IR boost must survive the per-tick treatment write — otherwise
// any alpha change would repaint the ordinary tint over the hot
// white. Boosted models also skip the recession fade: hot targets
// stay full-strength at any range (icons keep their normal
// fade — full-opacity glyph walls read as overwhelming).
base: state._irBoost ? WHITE : rgba(_modelColor(icao24)),
alpha: state._irBoost
? 1
: aircraftTreatmentAlpha({
baseAlpha: icons.alpha(icao24),
focusFactor: icons.focus(icao24),
cameraDistanceM,
cameraHeightM: pose.height,
}),
});
}
/** Per-frame driver for the standalone tracked model. Runs every preUpdate (not the 80 ms fleet
* cadence) so the centered plane moves smoothly. The tracked entity stays a pure billboard, so the
* follow-camera's bounding sphere is ALWAYS ready — toggling 3D, or tracking while already zoomed
* in, can never stall or freeze the centering (the old model-graphic-on-entity failure mode).
*
* The model draws exactly as the fleet would draw this contact: the same
* asset at the same scale and `minPixelSize` (`MODEL_MIN_PX`), only its
* tint the tracked colour; whether it draws at all is the fleet's rule too
* (`_trackedModelRegimeActive`). Selecting a contact changes its colour,
* never its size or form. */
* asset at the same scale (its true size) in the same colours; whether it
* draws at all is the fleet's rule too (`_trackedModelRegimeActive`).
* Selecting a contact changes neither its colour nor its size or form. */
function _updateTrackedModel() {
// A failed load is let go (the icon carries the contact); the budget
@@ -717,7 +854,7 @@ export function createAircraftModels({
parts.icons._iconPosition(state._trackedIcao);
if (!pos) {
_hideTrackedModel();
_releaseTrackedFleetModel();
_hideTrackedFleetModel();
return;
}
const icao24 = state._trackedIcao;
@@ -729,14 +866,13 @@ export function createAircraftModels({
// The icon carries it: after the load budget is spent, or until the
// fleet model set has loaded.
if (!_trackedModelLoadAllowed() || !spec.url) {
_releaseTrackedFleetModel();
_hideTrackedFleetModel();
return;
}
const record = createModelRecord({
specKey: _specKeyFor(meta), // type-change sync compares against this
bellyM: spec.bellyM,
scale: spec.scale,
minPixelSize: policy.MODEL_MIN_PX,
});
record.id = icao24;
record.url = resolveAsset(spec.url);
@@ -758,7 +894,7 @@ export function createAircraftModels({
const displayPos = _modelDisplayPosition(icao24, pos);
if (!displayPos) {
_hideTrackedModel(); // no ground evidence → the icon carries it
_releaseTrackedFleetModel();
_hideTrackedFleetModel();
return;
}
placeModel(
@@ -766,9 +902,10 @@ export function createAircraftModels({
displayPos,
_modelHeading(parts.motion._trackedDisplayCourse(), meta),
);
_poseParts(record, meta, spec);
showModel(record, record.ready);
_send(state._modelSets.tracked, icao24, record, spec);
if (record.ready) _releaseTrackedFleetModel();
if (record.ready) _hideTrackedFleetModel();
}
/**
@@ -841,6 +978,13 @@ export function createAircraftModels({
afterReplan(renderTime, t, nowMs, pose?.position ?? null);
const focusTarget = getFocusTarget();
parts.icons._focusIcons(t, nowMs, focusTarget);
// Airborne helicopters in view step their rotor frame (none: no work).
if (parts.icons._rotorsTurning?.())
parts.icons._turnRotors(
Date.now(),
t,
pose ? (position) => inView(pose, position) : null,
);
// 3D model regime: only when enabled AND the camera is zoomed in past the altitude ceiling.
// Drop all models the moment we leave it (toggled off / zoomed out) so icons resume.
@@ -920,8 +1064,6 @@ export function createAircraftModels({
const items = pendingItems;
for (const icao24 of modelEligible) {
if (isTr3b(icao24)) continue;
// The tracked contact's model is `_updateTrackedModel`'s.
if (icao24 === state._trackedIcao) continue;
if (!icons.has(icao24)) continue;
const position = icons.position(icao24, t);
if (
@@ -944,6 +1086,17 @@ export function createAircraftModels({
}
continue;
}
// The tracked contact draws as `_updateTrackedModel` says; its fleet
// model is only kept ready for when it is deselected.
if (icao24 === state._trackedIcao) {
_keepTrackedFleetModel(
icao24,
position,
icons.course(icao24, t),
items,
);
continue;
}
_ensureModel(icao24);
const record = state._models.get(icao24);
const cameraDistanceM = distance(camPos, position);
@@ -952,24 +1105,7 @@ export function createAircraftModels({
record,
position,
icons.course(icao24, t),
() => {
_treat(record, {
// IR boost must survive the per-tick treatment write — otherwise
// any alpha change would repaint the ordinary tint over the hot
// white. Boosted models also skip the recession fade: hot targets
// stay full-strength at any range (icons keep their normal
// fade — full-opacity glyph walls read as overwhelming).
base: state._irBoost ? WHITE : rgba(_modelColor(icao24)),
alpha: state._irBoost
? 1
: aircraftTreatmentAlpha({
baseAlpha: icons.alpha(icao24),
focusFactor: icons.focus(icao24),
cameraDistanceM,
cameraHeightM: pose.height,
}),
});
},
() => _treatFleetModel(icao24, record, cameraDistanceM, pose),
items,
);
}
@@ -997,6 +1133,7 @@ export function createAircraftModels({
_releaseModels,
_showReleasedIcon,
_releaseTrackedModel,
_handBackDeselected,
_updateTrackedModel,
_fleetTick,
};
+107 -20
View File
@@ -4,25 +4,18 @@ import { createAircraftModels } from './aircraftModelLayer.js';
import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
import { bindRenderer } from '../render/rendererOf.js';
import { fromDegrees } from '../geo/ellipsoid.js';
import * as flightsPolicy from '../layers/flights/policy.js';
// The flights layer's own model policy: its radii, ceiling and caps.
const POLICY = {
MODEL_ALT_CEIL_M: 800_000,
...flightsPolicy,
MODEL_MAX: 40,
MODEL_MAX_ALL: 350,
COCKPIT_MODEL_MAX: 60,
MODEL_PROX_ADD_M: 150_000,
MODEL_PROX_KEEP_M: 185_000,
MODEL_ALL_ADD_M: 400_000,
MODEL_ALL_KEEP_M: 450_000,
MODEL_MIN_PX: 24,
TRACKED_MODEL_MIN_PX: 48,
TRACKED_MODEL_MAX_PX: 600,
MODEL_HEADING_OFFSET_DEG: 0,
FLEET_DR_INTERVAL_MS: 80,
TRACKED_MODEL_MAX_LOAD_FAILS: 3,
TRACKED_MODEL_RETRY_BACKOFF_MS: 1500,
};
/** The eye's height (m): 1 km above the contacts. */
const EYE_M = 11_000;
const SPEC = {
url: 'plane.glb',
scale: 1,
@@ -34,9 +27,9 @@ const SPEC = {
/**
* A fleet of airborne contacts at `positions` (icao → ECEF), drawn by a
* models layer over a fake draw port whose fleet set can be told to fail a
* write. The eye sits above them at 30 km.
* write. The eye sits at `eyeM`, by default 1 km above them (`EYE_M`).
*/
function fleetFixture(positions) {
function fleetFixture(positions, { eyeM = EYE_M } = {}) {
const base = fakeDrawPort();
const removes = [];
let failNextUpsert = false;
@@ -67,7 +60,7 @@ function fleetFixture(positions) {
};
},
};
const eye = fromDegrees(-97.71, 30.21, 30_000);
const eye = fromDegrees(-97.71, 30.21, eyeM);
const viewer = {};
bindRenderer(viewer, {
draw,
@@ -79,7 +72,7 @@ function fleetFixture(positions) {
right: { x: 1, y: 0, z: 0 },
fovy: Math.PI / 3,
aspectRatio: 1,
height: 30_000,
height: eyeM,
}),
},
});
@@ -185,7 +178,10 @@ function fleetFixture(positions) {
};
}
const near = (k) => fromDegrees(-97.71 + k * 0.01, 30.21, 10_000);
// About 0.5 km apart, within 2 km of the eye.
const near = (k) => fromDegrees(-97.71 + k * 0.005, 30.21, 10_000);
/** A contact at the eye's height, `m` metres north of it. */
const north = (m) => fromDegrees(-97.71, 30.21 + m / 110_850, EYE_M);
const far = (k) => fromDegrees(-90 + k * 0.01, 30.21, 10_000);
test('the fleet tick hands contacts to ready models and back without a gap', () => {
@@ -326,7 +322,7 @@ test('fleet model alpha is worked out once a fleet tick from the camera then, as
const position = near(1);
const f = fleetFixture(new Map([['a1', position]]));
assert.equal(f.fleet().spec.recede ?? null, null, 'the set does not recede');
const eye = fromDegrees(-97.71, 30.21, 30_000);
const eye = fromDegrees(-97.71, 30.21, EYE_M);
const expected = (focusFactor) =>
aircraftTreatmentAlpha({
baseAlpha: 0.8,
@@ -336,7 +332,7 @@ test('fleet model alpha is worked out once a fleet tick from the camera then, as
eye.y - position.y,
eye.z - position.z,
),
cameraHeightM: 30_000,
cameraHeightM: EYE_M,
});
try {
// Recede from the eye on, so the haze is not 1 here.
@@ -389,3 +385,94 @@ test('a contact not there yet at the time drawn has its fleet model hidden, as o
f.tick();
assert.equal(f.fleet().items.get('a1').show, true, 'drawn again');
});
test('aircraft draw as models only within 3 km of the camera, in either mode', () => {
for (const mode of ['proximity', 'all']) {
const positions = new Map([
['inside', north(2_900)],
['outside', north(3_100)],
]);
const f = fleetFixture(positions);
f.state._models3dMode = mode;
f.tick();
for (const id of positions.keys())
if (f.fleet().items.has(id)) f.draw.ready(f.fleetId, id);
f.tick();
assert.equal(f.shown.get('inside'), false, `${mode}: a model at 2.9 km`);
assert.equal(f.fleet().items.get('inside').show, true);
assert.equal(f.shown.get('outside'), true, `${mode}: an icon at 3.1 km`);
assert.equal(f.fleet().items.has('outside'), false);
}
});
test('a model is kept out to about 3.6 km, then its icon takes over', () => {
const positions = new Map([['a1', north(2_000)]]);
const f = fleetFixture(positions);
f.tick();
f.draw.ready(f.fleetId, 'a1');
f.tick();
assert.equal(f.shown.get('a1'), false, 'a model at 2 km');
positions.set('a1', north(3_500));
f.tick();
assert.equal(f.shown.get('a1'), false, 'kept at 3.5 km');
assert.equal(f.fleet().items.get('a1').show, true);
positions.set('a1', north(3_700));
f.tick();
assert.equal(f.shown.get('a1'), true, 'released at 3.7 km');
assert.equal(f.fleet().items.has('a1'), false);
positions.set('a1', north(3_300));
f.tick();
assert.equal(
f.fleet().items.has('a1'),
false,
'not taken again until it is back within 3 km',
);
});
test('a camera high above the ground still models an aircraft within 3 km of it', () => {
// A plane at 30 km with the camera 2 km above it: the altitude ceiling
// sits above every contact's height plus the keep radius.
const plane = fromDegrees(-97.71, 30.21, 30_000);
const f = fleetFixture(new Map([['high', plane]]), { eyeM: 32_000 });
f.tick();
f.draw.ready(f.fleetId, 'high');
f.tick();
assert.equal(f.shown.get('high'), false, 'its model draws it');
assert.equal(
POLICY.MODEL_ALT_CEIL_M,
POLICY.MODEL_HIGHEST_CONTACT_M + POLICY.MODEL_KEEP_M,
);
});
test('models are drawn at their true size, with no minimum pixel size', () => {
const f = fleetFixture(new Map([['a1', near(1)]]));
f.tick();
assert.equal(f.fleet().items.get('a1').minPixelSize ?? 0, 0);
});
test('the selected contact keeps a loaded, hidden fleet model that takes it back on deselect', () => {
const positions = new Map([['a1', near(1)]]);
const f = fleetFixture(positions);
// Selected while an icon: the fleet pass admits its model all the same.
f.state._trackedIcao = 'a1';
f.shown.set('a1', false); // selecting it hides its icon
f.tick();
assert.ok(f.fleet().items.has('a1'), 'admitted and loading while selected');
f.draw.ready(f.fleetId, 'a1');
positions.set('a1', near(2));
f.tick();
const item = f.fleet().items.get('a1');
assert.equal(item.show, false, 'never drawn while selected');
assert.deepEqual(
item.pos,
{ x: near(2).x, y: near(2).y, z: near(2).z },
'placed where its icon is',
);
assert.equal(f.shown.get('a1'), false, 'the icon stays hidden');
// Deselected: its model draws it in the same frame, its icon never shows.
f.state._trackedIcao = null;
f.models._handBackDeselected('a1');
assert.equal(f.fleet().items.get('a1').show, true);
assert.equal(f.shown.get('a1'), false);
});
+20 -6
View File
@@ -17,15 +17,29 @@ export const AIRCRAFT_ENVIRONMENT_MAP_OPTIONS = Object.freeze({
const HIGHLIGHT = Object.freeze({ mode: 'highlight' });
const FLAT = Object.freeze({ mode: 'mix', amount: 1 });
/**
* How much of an emergency colour a model takes over its paint. Multiplying
* by a saturated tint zeroes every channel the tint lacks: a cyan tint (no
* red) draws a red helicopter black and a white Cessna flat cyan. Mixed in at
* this share, the paint stays readable and the colour still marks the model.
*/
export const AIRCRAFT_MODEL_TINT_MIX = 0.3;
const TINTED = Object.freeze({ mode: 'mix', amount: AIRCRAFT_MODEL_TINT_MIX });
/**
* How an aircraft model's colour meets its mesh, as a draw item's
* `colorBlend`. `highlight` multiplies, so white draws the mesh's own
* colours as built, and the tracked or emergency colour tints the mesh
* without hiding its paint. The IR boost draws the model flat white instead
* (`mix` at 1, unlit).
* `colorBlend`. White (no tint) multiplies (`highlight`), which draws the
* mesh's own colours as built. An emergency colour is mixed in at
* `AIRCRAFT_MODEL_TINT_MIX`, so it tints the mesh without hiding its paint.
* The IR boost draws the model flat white instead (`mix` at 1, unlit).
* @param {boolean} irBoost
* @param {ArrayLike<number>|null} [tint] The model's RGBA tint, 0..1; white
* or none draws the mesh's own colours.
* @returns {{mode: 'highlight'|'mix', amount?: number}}
*/
export function aircraftModelBlend(irBoost) {
return irBoost ? FLAT : HIGHLIGHT;
export function aircraftModelBlend(irBoost, tint = null) {
if (irBoost) return FLAT;
const white = !tint || (tint[0] >= 1 && tint[1] >= 1 && tint[2] >= 1);
return white ? HIGHLIGHT : TINTED;
}
+66 -1
View File
@@ -2,7 +2,12 @@ import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { readLayerSource } from '../testSupport/readLayerSource.mjs';
import { AIRCRAFT_ENVIRONMENT_MAP_OPTIONS } from './aircraftModelLighting.js';
import {
AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
aircraftModelBlend,
} from './aircraftModelLighting.js';
import * as flightsPolicy from '../layers/flights/policy.js';
import * as militaryPolicy from '../layers/military/policy.js';
/**
* Every aircraft model drawn in the scene skips the renderer's dynamic
@@ -48,3 +53,63 @@ test('localAdsb: its draw-port models skip the dynamic environment map', () => {
/\benvironmentMap:\s*AIRCRAFT_ENVIRONMENT_MAP_OPTIONS\.enabled\b/,
);
});
/**
* The colour a model draws in, as the renderer blends its tint over the
* shaded paint (`ModelItem.colorBlend`, Cesium's model colour stage): `mix`
* moves the paint toward the tint by `amount`; `highlight` multiplies.
*/
function blended(paint, tint, blend) {
if (blend.mode === 'mix')
return paint.map((c, i) => c + (tint[i] - c) * blend.amount);
if (blend.mode === 'highlight') return paint.map((c, i) => c * tint[i]);
return tint.slice(0, 3);
}
/** Paints the fleet models carry: a red helicopter, a white airliner, a dark blue tail. */
const PAINTS = {
red: [0.8, 0.05, 0.05],
white: [0.9, 0.9, 0.9],
blue: [0.05, 0.1, 0.5],
};
test('an untinted model draws its mesh in its own colours', () => {
for (const tint of [null, [1, 1, 1, 1], flightsPolicy.MODEL_WHITE]) {
const blend = aircraftModelBlend(false, tint);
for (const paint of Object.values(PAINTS))
assert.deepEqual(blended(paint, [1, 1, 1], blend), paint);
}
});
test('the emergency tints keep every paint, never black or one flat colour', () => {
const tints = {
emergency: flightsPolicy.EMERGENCY_TINT,
'military emergency': militaryPolicy.EMERGENCY_ICON_COLOR,
// Any saturated tint: one with no red once drew a red helicopter black.
cyan: [0, 1, 1, 1],
};
for (const [tintName, tint] of Object.entries(tints)) {
const blend = aircraftModelBlend(false, tint);
const drawn = {};
for (const [paintName, paint] of Object.entries(PAINTS)) {
const out = blended(paint, tint, blend);
drawn[paintName] = out;
// Multiplying by a tint with no red drew a red helicopter black.
paint.forEach((c, i) =>
assert.ok(
out[i] >= c * 0.6,
`${tintName} over ${paintName}: channel ${i} ${out[i].toFixed(2)} keeps most of ${c}`,
),
);
}
// Paints that differ still differ: the tint is not one flat colour.
const spread = (a, b) => Math.max(...a.map((c, i) => Math.abs(c - b[i])));
assert.ok(spread(drawn.red, drawn.white) > 0.4, `${tintName}: red and white apart`);
assert.ok(spread(drawn.blue, drawn.white) > 0.4, `${tintName}: blue and white apart`);
}
});
test('the IR boost draws every model flat white whatever its tint', () => {
for (const tint of [null, flightsPolicy.EMERGENCY_TINT])
assert.deepEqual(aircraftModelBlend(true, tint), { mode: 'mix', amount: 1 });
});
+30
View File
@@ -1473,6 +1473,36 @@ test('enable owns one grace timer and disable/re-enable starts a new session', a
}
});
test('the layer turns on and off when its feed fails', async () => {
const harness = installWireHarness(undefined, { enabled: false });
const priorFetch = globalThis.fetch;
const priorWarn = console.warn;
const clock = makeFakeAisRuntime();
_setAisRuntimeForTest(clock.runtime);
globalThis.fetch = async () => ({
ok: false,
status: 503,
json: async () => ({
status: 'missing-key',
error: 'AISSTREAM_API_KEY is not set',
}),
});
console.warn = () => {};
try {
// Turning it on succeeds; the failure is shown on the layer.
assert.notEqual(await aisLiveVesselsLayer.enable(harness.viewer), false);
const feed = _getVesselFeedStateForTest();
assert.equal(feed.status, 'unavailable');
assert.equal(feed.error, 'AISSTREAM_API_KEY not set');
assert.notEqual(aisLiveVesselsLayer.disable(), false);
} finally {
globalThis.fetch = priorFetch;
console.warn = priorWarn;
harness.cleanup();
_setAisRuntimeForTest();
}
});
test('vessel trail lifecycle: deselect clears the selected-vessel trail', () => {
const harness = installWireHarness(undefined);
try {
+15 -10
View File
@@ -70,19 +70,24 @@ for (const layer of LAYERS) {
'the tracked-model driver uses the cockpit-aware predicate');
});
test(`${layer.name}: Cockpit uses standard Proximity and All radii with a lower cap`, () => {
assert.equal(numericConstant(source, 'MODEL_PROX_ADD_M'), 150_000);
assert.equal(numericConstant(source, 'MODEL_PROX_KEEP_M'), 185_000);
assert.equal(numericConstant(source, 'MODEL_ALL_ADD_M'), 400_000);
assert.equal(numericConstant(source, 'MODEL_ALL_KEEP_M'), 450_000);
test(`${layer.name}: models draw within 3 km in both modes; Cockpit's AIR band keeps its own radii`, () => {
assert.equal(numericConstant(source, 'MODEL_ADD_M'), 3000);
assert.equal(numericConstant(source, 'MODEL_KEEP_M'), 3600);
assert.equal(numericConstant(source, 'COCKPIT_MODEL_MAX'), 60);
const add = /^([ \t]*)function _modelAddDistM\b[\s\S]*?\n\1\}/m.exec(source)?.[0];
const keep = /^([ \t]*)function _modelKeepDistM\b[\s\S]*?\n\1\}/m.exec(source)?.[0];
assert.match(add, /(?:(?:flightState|state)\.)?_models3dMode\s*===\s*'all'\s*\?\s*(?:policy\.)?MODEL_ALL_ADD_M\s*:\s*(?:policy\.)?MODEL_PROX_ADD_M/);
assert.match(keep, /(?:(?:flightState|state)\.)?_models3dMode\s*===\s*'all'\s*\?\s*(?:policy\.)?MODEL_ALL_KEEP_M\s*:\s*(?:policy\.)?MODEL_PROX_KEEP_M/);
assert.doesNotMatch(add, /COCKPIT_MODEL_ADD_M/);
assert.doesNotMatch(keep, /COCKPIT_MODEL_KEEP_M/);
assert.match(add, /return\s+(?:policy\.)?MODEL_ADD_M;/, 'Proximity and All share the add radius');
assert.match(keep, /return\s+(?:policy\.)?MODEL_KEEP_M;/, 'Proximity and All share the keep radius');
// The AIR silhouettes are icons, not models: their band stays mode-aware.
assert.equal(numericConstant(source, 'COCKPIT_AIR_PROX_ADD_M'), 150_000);
assert.equal(numericConstant(source, 'COCKPIT_AIR_PROX_KEEP_M'), 185_000);
assert.equal(numericConstant(source, 'COCKPIT_AIR_ALL_ADD_M'), 400_000);
assert.equal(numericConstant(source, 'COCKPIT_AIR_ALL_KEEP_M'), 450_000);
const near = /^([ \t]*)function _refreshCockpitNearContacts\b[\s\S]*?\n\1\}/m.exec(source)?.[0];
assert.match(near, /all\s*\?\s*COCKPIT_AIR_ALL_ADD_M\s*:\s*COCKPIT_AIR_PROX_ADD_M/);
assert.match(near, /all\s*\?\s*COCKPIT_AIR_ALL_KEEP_M\s*:\s*COCKPIT_AIR_PROX_KEEP_M/);
const cap = /^([ \t]*)function _modelCap\b[\s\S]*?\n\1\}/m.exec(source)?.[0];
assert.match(cap, /Math\.min\(\s*(?:policy\.)?COCKPIT_MODEL_MAX/,
@@ -97,7 +102,7 @@ for (const layer of LAYERS) {
// `_iconKind` is identity for every unconverted contact (see
// tr3bRegistry.test.mjs) — it only swaps the glyph for a contact the
// operator explicitly converted into a TR-3B.
assert.match(source, /aircraftIcon\(\s*(?:parts\.)?rendering\._iconKind\(icao24, info\?\.klass\),?\s*(?:FLEET_ICON_PX,?\s*)?\)/,
assert.match(source, /aircraftIcon\(\s*(?:parts\.)?rendering\._iconKind\(icao24, info\?\.klass\),?\s*(?:FLEET_ICON_PX,?\s*)?(?:frame,?\s*)?\)/,
'near contacts and model fallbacks retain the class-derived aircraft silhouette');
assert.match(source, /color: rgba\(rendering\._cockpitContactColor\(icao24, info\)\),\s*rotationMode: 'screen',/,
'far dots are reset to a rotation-free presentation');
+1 -1
View File
@@ -53,7 +53,7 @@ test('the echo bracket pulses outward from the contact bracket and fades', (t) =
assert.ok(half.spreadPx > echo.spreadPx * 0.5);
assert.ok(half.spreadPx < echo.spreadPx);
assert.ok(half.band < STEPS && half.band >= 1);
// The bracket's own dimming (keyhole fade, Cyber sonar sweep) carries
// The bracket's own dimming (keyhole fade, sonar sweep) carries
// over, and the echo is never drawn brighter than its bracket: a bracket
// too dim for even one band draws no echo.
assert.equal(at(arrival, 0.25).band, 2);
+4 -4
View File
@@ -941,13 +941,13 @@ test('a Global Context echo bracket is drawn outside its contact bracket and dim
}
});
test('under the Cyber sonar sweep an echo is never brighter than its own bracket', () => {
test('under the sonar sweep an echo is never brighter than its own bracket', () => {
const env = installEnvironment();
// The cyber theme with its HUD open turns the contact sonar on; its sweep
// dims brackets it is not passing over.
// Sonar on with its HUD open turns the contact sonar on; its sweep dims
// brackets it is not passing over.
env.document.documentElement = {
// The lowest sweep floor, so dimmed brackets drop a whole alpha band.
dataset: { uiTheme: 'cyber', cyberSonarOpacity: '35' },
dataset: { cyberSonar: 'on', cyberSonarOpacity: '35' },
style: { setProperty() {}, removeProperty() {} },
};
const hud = env.document.createElement('div');
+2 -3
View File
@@ -19,9 +19,8 @@
* marker the scene itself hides behind geometry. Everything else keeps its
* label exactly as before, which covers contacts high above the ground
* (aircraft, satellites): their markers are drawn on top of the scene by
* design, their 3D models can be scaled up to a minimum pixel size and so fill
* the very pixel being read, and a label that hid while its marker stayed on
* screen would be the worse mismatch.
* design, their 3D models can fill the very pixel being read, and a label
* that hid while its marker stayed on screen would be the worse mismatch.
*
* This file is plain arithmetic; it never touches the renderer.
*/
+2
View File
@@ -1285,6 +1285,8 @@ const AIRCRAFT_CLASS_NAMES = {
turboprop: msg('Turboprops'),
fastjet: msg('Fast jets'),
quadjet: msg('Four-engine jets'),
vehicle: msg('Airport vehicles'),
station: msg('Ground stations / obstacles'),
};
/**
+170
View File
@@ -30,6 +30,8 @@ import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
import { fakeGlobePort } from '../testSupport/fakeGlobePort.mjs';
import { bindRenderer } from '../render/rendererOf.js';
import { HEAT_REBUILD_MS } from '../layers/firms/policy.js';
import { registerStyleStages } from '../styles/styleStages.js';
import { sensorPickPosition } from '../input/sensorPick.js';
const LAYER_SOURCE = readLayerSource(
path.join(path.dirname(fileURLToPath(import.meta.url)), 'firmsHeatmap.js'),
@@ -836,6 +838,16 @@ test('far zoom drapes one heatmap and the hand-off cross-fades it with the marke
assert.equal(added[0].alpha, 0.5);
assert.equal(glow(1).alpha, 0.5, 'rebuilt markers get the fade');
// An application drawing the detections in their place hides both.
h.layer.setMarkerStandIn({ hitTest: () => null });
assert.equal(added[0].show, false, 'a stand-in hides the heatmap');
assert.equal(markers().show, false, 'and the markers');
h.layer._renderLodForTest('global');
assert.equal(added[0].show, false, 'through a rebuild too');
h.layer.setMarkerStandIn(null);
assert.equal(added[0].show, true);
assert.equal(markers().show, true);
h.layer.disable();
assert.equal(added[0].show, false, 'disable hides the heatmap');
@@ -847,3 +859,161 @@ test('far zoom drapes one heatmap and the hand-off cross-fades it with the marke
restoreDocument();
}
});
test('a click on a fire an application draws in place of the markers selects it as a marker click does', () => {
const fire = makeFire();
const other = makeFire({ index: 8, lat: 31.2, lon: -97.9, frp: 40 });
// The application's records come from the same source, adapted on their own.
let answer = { ...fire };
const asked = [];
const h = harness({ fires: [fire, other], picked: glowPick('firms-8') });
try {
h.layer.setMarkerStandIn({
hitTest: (screen) => {
asked.push(screen);
return answer;
},
});
assert.equal(h.icons().show, false, 'the glows are hidden');
h.published.length = 0;
h.click();
assert.deepEqual(asked, [{ x: 400, y: 300 }]);
assert.equal(h.requests.length, 1, 'the camera moves as for a marker');
assert.equal(h.requests[0].kind, 'fire');
assert.equal(
h.requests[0].id,
fireDetectionKey(fire),
'the stand-in decides, not the hidden glow under the click',
);
assert.equal('rangeM' in h.requests[0], false, 'the usual fire framing');
assert.equal(h.layer.getSelectedInfo().id, fireDetectionKey(fire));
assert.equal(getSelectedEntityContext().label, 'Fire · FRP 1520 MW');
assert.deepEqual(
h.published.map((entry) => entry.id),
[`selected-fire:${fireDetectionKey(fire)}`],
"only the selected fire's card shows",
);
// Nothing of the application's under the click: empty space.
answer = null;
h.click();
assert.equal(h.requests.length, 1, 'no camera move');
assert.equal(h.layer.getSelectedInfo(), null, 'the selection is cleared');
} finally {
h.cleanup();
}
});
test('a stand-in that draws a fire larger says how far the camera stands from it', () => {
const fire = makeFire();
const asked = [];
let range = 24_000;
const h = harness({ fires: [fire] });
try {
h.layer.setMarkerStandIn({
hitTest: () => ({ ...fire }),
focusRangeM: (record) => {
asked.push(fireDetectionKey(record));
return range;
},
});
h.click();
assert.deepEqual(asked, [fireDetectionKey(fire)]);
assert.equal(h.requests.at(-1).rangeM, 24_000);
// No range for this fire: the usual fire framing.
range = null;
h.click();
assert.equal(h.requests.length, 2);
assert.equal('rangeM' in h.requests.at(-1), false);
} finally {
h.cleanup();
}
});
test('a stand-in hit on a fire the layer does not show selects nothing', () => {
const fire = makeFire();
const h = harness({ fires: [fire] });
try {
h.layer.setMarkerStandIn({
hitTest: () => makeFire({ lat: 12.5, lon: 40.1 }),
});
h.click();
assert.equal(h.requests.length, 0);
assert.equal(h.layer.getSelectedInfo(), null);
} finally {
h.cleanup();
}
});
test('taking the stand-in away brings the markers and their cards back and keeps the selection', () => {
const fire = makeFire();
const h = harness({
fires: [fire],
// Near enough for the markers rather than the heatmap.
cameraPosition: Cesium.Cartesian3.fromDegrees(fire.lon, fire.lat, 500_000),
});
try {
h.layer.setMarkerStandIn({ hitTest: () => fire });
assert.equal(h.icons().show, false);
h.click();
h.layer.setMarkerStandIn(null);
assert.equal(h.icons().show, true);
assert.equal(h.layer.getSelectedInfo().id, fireDetectionKey(fire));
const ids = h.published.map((entry) => entry.id);
assert.ok(ids.includes(`selected-fire:${fireDetectionKey(fire)}`));
} finally {
h.cleanup();
}
});
test('the stand-in is asked where a marker is picked: the click as the sensor style draws it', () => {
const fire = makeFire();
const asked = [];
const h = harness({ fires: [fire] });
try {
registerStyleStages(h.viewer.scene, {
surveillance: {
enabled: true,
uniforms: { intensity: 1, pixelation: 4 },
},
});
h.layer.setMarkerStandIn({
hitTest: (screen) => {
asked.push(screen);
return fire;
},
});
h.click();
const expected = sensorPickPosition(
h.viewer.scene,
{ x: 400, y: 300 },
h.viewer.scene.canvas,
);
assert.notDeepEqual([expected.x, expected.y], [400, 300]);
assert.deepEqual([asked[0].x, asked[0].y], [expected.x, expected.y]);
} finally {
h.cleanup();
}
});
test("a sibling layer's item over a stand-in fire wins the click", () => {
const fire = makeFire();
let asked = 0;
registerPickOwner('flights', (pickedId) => pickedId === 'a1b2c3');
const h = harness({ fires: [fire], picked: { id: 'a1b2c3' } });
try {
h.layer.setMarkerStandIn({
hitTest: () => {
asked++;
return fire;
},
});
h.click();
assert.equal(asked, 0, 'the stand-in is not asked');
assert.equal(h.requests.length, 0, 'no camera move');
assert.equal(h.layer.getSelectedInfo(), null);
} finally {
h.cleanup();
unregisterPickOwner('flights');
}
});
+33
View File
@@ -0,0 +1,33 @@
/**
* How a fleet model's draw item is turned, stretched and coloured
* (`fleetModelInstances.js`): pure, no renderer, so it can be read without
* the draw port.
*/
/** Every fleet GLB is nose -X: opposite the draw contract's heading 0. */
export const FLEET_HEADING_OFFSET_DEG = 180;
/**
* A colour as the draw contract takes it: a CSS string or `[r, g, b, a]`
* as given, `{red, green, blue, alpha}` as an array; null for none.
*/
export function fleetColor(color) {
if (color === undefined || color === null) return null;
if (typeof color === 'string' || Array.isArray(color)) return color;
if (typeof color.red === 'number')
return [color.red, color.green, color.blue, color.alpha ?? 1];
return null;
}
/**
* The per-axis stretch a fleet spec draws with on top of its length scale,
* along the model's glTF axes (`x` its length, `y` its height, `z` its
* beam), or undefined when it keeps its proportions.
* @param {object} spec `fleetModelSpec`.
* @returns {[number, number, number]|undefined}
*/
export function fleetAxisScale(spec) {
const [length, beam, height] = spec?.scaleXYZ ?? [];
if (!(length > 0) || (beam === length && height === length)) return;
return [1, height / length, beam / length];
}
+35 -36
View File
@@ -1,6 +1,11 @@
import { selectModelEligible } from './modelEligibility.js';
import {
FLEET_HEADING_OFFSET_DEG,
fleetAxisScale,
fleetColor,
} from './fleetModelDraw.js';
import { AIRCRAFT_ENVIRONMENT_MAP_OPTIONS } from './aircraftModelLighting.js';
import { fleetModelSet } from './fleetModels.js';
import { fleetModelSet, fleetPartTable } from './fleetModels.js';
import { findCamera, findDraw } from '../render/rendererOf.js';
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
import { horizonFrom } from '../geo/horizon.js';
@@ -17,8 +22,11 @@ import {
* and Rail layers share.
*/
/** Every fleet GLB is nose -X: opposite the draw contract's heading 0. */
export const FLEET_HEADING_OFFSET_DEG = 180;
export {
FLEET_HEADING_OFFSET_DEG,
fleetAxisScale,
fleetColor,
} from './fleetModelDraw.js';
/** How long (ms) a model whose load failed waits before it loads again. */
const RETRY_MS = 5000;
@@ -26,31 +34,6 @@ const RETRY_MS = 5000;
/** A white tint: what a model under the NVG/FLIR styles draws with. */
const WHITE = Object.freeze([1, 1, 1, 1]);
/**
* A colour as the draw contract takes it: a CSS string or `[r, g, b, a]`
* as given, `{red, green, blue, alpha}` as an array; null for none.
*/
export function fleetColor(color) {
if (color === undefined || color === null) return null;
if (typeof color === 'string' || Array.isArray(color)) return color;
if (typeof color.red === 'number')
return [color.red, color.green, color.blue, color.alpha ?? 1];
return null;
}
/**
* The per-axis stretch a fleet spec draws with on top of its length scale,
* along the model's glTF axes (`x` its length, `y` its height, `z` its
* beam), or undefined when it keeps its proportions.
* @param {object} spec `fleetModelSpec`.
* @returns {[number, number, number]|undefined}
*/
export function fleetAxisScale(spec) {
const [length, beam, height] = spec?.scaleXYZ ?? [];
if (!(length > 0) || (beam === length && height === length)) return;
return [1, height / length, beam / length];
}
/**
* Whether `point` is inside the eye's view cone (`pose`), a metre's slack.
* @param {object} pose The camera port's pose.
@@ -111,10 +94,15 @@ let instances = 0;
* @param {object} options.viewer The scene host.
* @param {() => object|null} [options.display] `{models3d, models3dMode,
* irBoost}`.
* @param {object} options.policy `{altitudeCeilingM, minimumPixelSize,
* cap, capAll, addM, addAllM, keepM, keepAllM, intervalMs}`.
* @param {object} options.policy `{altitudeCeilingM, cap, capAll, addM,
* keepM, intervalMs}`: both 3D modes share the add/keep radii and differ
* by their caps. Models are drawn at their true size.
* @param {(url: string) => string} [options.resolveAsset]
* @param {boolean} [options.waterline] Clip each model at its waterline.
* @param {(item: object, table: object) => object|undefined} [options.partState]
* The moving parts a vehicle's model is posed with (`ModelItem.parts`),
* from its item and its model's part table (`modelPartDrivers.js`); asked
* only for a model that has a part table.
* @param {object} [options.draw] Stands in for the viewer's draw port (tests).
* @returns {object}
*/
@@ -124,6 +112,7 @@ export function createFleetModelLayer({
policy,
waterline = false,
resolveAsset = (url) => url,
partState = null,
draw,
}) {
const port = draw ?? findDraw(viewer);
@@ -202,8 +191,7 @@ export function createFleetModelLayer({
function refreshEligibility(items, prefs, eye) {
const all = prefs.models3dMode === 'all';
const cap = all ? policy.capAll : policy.cap;
const addM = all ? policy.addAllM : policy.addM;
const keepM = all ? policy.keepAllM : policy.keepM;
const { addM, keepM } = policy;
const candidates = [];
for (const [id, item] of items) {
if (!item.position || item.show === false || !item.spec?.url) continue;
@@ -230,8 +218,15 @@ export function createFleetModelLayer({
return fromDegrees(at.lon, at.lat, at.height + lift);
}
/** The part state an item's model is posed with, or undefined. */
function partsOf(item) {
if (!partState) return undefined;
const table = fleetPartTable(fleetModelSet(), item.spec?.model);
return table ? partState(item, table) : undefined;
}
/** The draw item for an admitted model, as the set draws it, at `at`. */
function itemOf(id, record, item, show, boost, at = placement(item)) {
function itemOf(id, record, item, show, boost, at, parts) {
const mask = item.spec.tinted && !boost ? fleetColor(item.tint) : null;
return {
id,
@@ -249,7 +244,6 @@ export function createFleetModelLayer({
...(fleetAxisScale(item.spec)
? { axisScale: fleetAxisScale(item.spec) }
: {}),
minPixelSize: policy.minimumPixelSize,
environmentMap: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS.enabled,
...(boost
? {
@@ -260,6 +254,7 @@ export function createFleetModelLayer({
: { shading: 'pbr' }),
...(mask ? { maskColor: mask } : {}),
...(waterline ? { clip: 'belowOrigin' } : {}),
...(parts ? { parts } : {}),
meta: item.pickId ?? id,
show,
};
@@ -276,6 +271,8 @@ export function createFleetModelLayer({
const heading = item.headingDeg || 0;
const mask = item.spec.tinted && !boost ? fleetColor(item.tint) : null;
const meta = item.pickId ?? id;
const parts = partsOf(item);
const partsKey = parts ? JSON.stringify(parts) : '';
const sent = record.sent;
if (
sent !== null &&
@@ -287,7 +284,8 @@ export function createFleetModelLayer({
sameColor(sent.mask, mask) &&
sent.boost === boost &&
sent.show === show &&
sent.meta === meta
sent.meta === meta &&
sent.partsKey === partsKey
)
return null;
const next = (record.sent ??= {});
@@ -301,7 +299,8 @@ export function createFleetModelLayer({
next.boost = boost;
next.show = show;
next.meta = meta;
return itemOf(id, record, item, show, boost, at);
next.partsKey = partsKey;
return itemOf(id, record, item, show, boost, at, parts);
}
return {
+36 -7
View File
@@ -19,6 +19,7 @@ import {
vesselModelSpec,
} from './fleetModels.js';
import { fetchPublicFile } from '../testSupport/fleetGlb.mjs';
import { FLEET_MODEL_POLICY } from '../layers/flights/policy.js';
import { bindFakeDraw } from '../testSupport/fakeDrawPort.mjs';
import { eastNorthUp } from '../geo/frames.js';
import { fromDegrees, toLonLatH } from '../geo/ellipsoid.js';
@@ -29,15 +30,11 @@ console.info = () => {};
const set = await loadFleetModelSet({ fetchImpl: fetchPublicFile });
console.info = realInfo;
// The layers' own policy (3 km add, about 3.6 km keep), with small caps.
const POLICY = Object.freeze({
altitudeCeilingM: 800_000,
minimumPixelSize: 16,
...FLEET_MODEL_POLICY,
cap: 2,
capAll: 4,
addM: 5_000,
addAllM: 20_000,
keepM: 6_000,
keepAllM: 24_000,
intervalMs: 80,
});
@@ -117,7 +114,7 @@ test('the icon stays the visual until the model is ready; only the nearest are d
);
const near = models.items.get('near');
assert.equal(near.scale, spec.scale, 'drawn life size');
assert.equal(near.minPixelSize, POLICY.minimumPixelSize);
assert.equal(near.minPixelSize ?? 0, 0, 'at its true size: no pixel floor');
assert.equal(near.meta, 'near', 'picked as its vehicle');
assert.equal(near.show, false, 'hidden until ready');
@@ -158,6 +155,38 @@ test('the icon stays the visual until the model is ready; only the nearest are d
assert.equal(models.disposed, true);
});
test('vehicles draw as models within 3 km in either mode, and keep them to about 3.6 km', () => {
// The camera 1 km up: a vehicle `metres` east is sqrt(1 km² + metres²) away.
const at = (km) => Math.sqrt(km * km - 1) * 1_000;
for (const mode of ['proximity', 'all']) {
const { viewer, draw } = fakeViewer();
const layer = createFleetModelLayer({
viewer,
display: () => ({ models3d: true, models3dMode: mode }),
policy: POLICY,
});
const spec = transitModelSpec(set, { mode: 'tram' });
const items = new Map([
['in', itemAt(at(2.9), spec, { pickId: 'in' })],
['out', itemAt(at(3.1), spec, { pickId: 'out' })],
]);
layer.frame(items, 0);
const models = modelSet(draw);
assert.deepEqual(
[...models.items.keys()],
['in'],
`${mode}: 2.9 km, not 3.1 km`,
);
items.set('in', itemAt(at(3.5), spec, { pickId: 'in' }));
layer.frame(items, 100);
assert.ok(models.items.has('in'), `${mode}: kept at 3.5 km`);
items.set('in', itemAt(at(3.7), spec, { pickId: 'in' }));
layer.frame(items, 200);
assert.equal(models.items.size, 0, `${mode}: released at 3.7 km`);
layer.destroy();
}
});
test('models stay off above the altitude ceiling', () => {
const { viewer, draw } = fakeViewer(POLICY.altitudeCeilingM + 1);
const layer = createFleetModelLayer({
+29
View File
@@ -20,6 +20,7 @@
*/
import { classifyAircraft } from './aircraftClass.js';
import { readPartTable } from '../render/modelParts.js';
import { FLEET_TRAIL_ANCHORS } from './fleetTrailAnchors.js';
import { isAidToNavigation } from './vesselTypes.js';
@@ -527,6 +528,34 @@ export function namedFleetModels(types) {
]);
}
/** Each loaded set's part tables by model name (null for a model without one). */
const partTables = new WeakMap();
/**
* The part table of model `name` in a loaded set, read once from its GLB:
* which moving parts it has (`render/modelParts.js`); null for a model
* without one, or whose GLB did not load.
* @param {{bytes?: Map<string, Uint8Array>}|null|undefined} set
* @param {string|null|undefined} name
* @returns {import('../render/modelParts').PartTable|null}
*/
export function fleetPartTable(set, name) {
const bytes = name ? set?.bytes?.get(name) : undefined;
if (!bytes) return null;
let tables = partTables.get(set);
if (!tables) partTables.set(set, (tables = new Map()));
if (!tables.has(name)) {
let table = null;
try {
table = readPartTable(bytes);
} catch {
// A malformed table: the model draws whole.
}
tables.set(name, table);
}
return tables.get(name);
}
let loading = null;
let loaded = null;
+3 -2
View File
@@ -1,6 +1,7 @@
import { msg } from '../i18n/marker.js';
// layers/installations/controls.js translates describeInstallationFeedback().
// installationFeedback() stays English for the analyst. ui/statusText.js and
// ui/shellFeedback.js (HUD) translate it: keep both in step with this wording.
const REASONS = Object.freeze({
rate_limited: msg('Overpass rate-limited'),
timeout: msg('Overpass timed out'),
@@ -19,7 +20,7 @@ const FALLBACK_REASON = msg('Overpass temporarily unavailable');
* @param {number} [now]
* @returns {{text: string, reason?: string, seconds?: number}|{count: number, km: ?number}}
*/
export function describeInstallationFeedback(stats = {}, now = Date.now()) {
function describeInstallationFeedback(stats = {}, now = Date.now()) {
const reason = REASONS[stats.failureReason] || FALLBACK_REASON;
if (stats.loading)
return {
+38
View File
@@ -1827,6 +1827,44 @@ export class LayerLifecycle {
await entry.toggleChain.catch(() => {});
}
/**
* Wait until a layer's lifecycle queue is idle, following any request that
* joins it while waiting, but no longer than `timeoutMs` or `signal` allows.
* @param {string} layerId Layer id.
* @param {{signal?: AbortSignal, timeoutMs?: number}} [options]
* @returns {Promise<boolean>} true once idle; false on timeout or abort.
*/
async waitForLayerIdle(layerId, { signal, timeoutMs = 30000 } = {}) {
const entry = this.layers.get(layerId);
if (!entry) return true;
if (signal?.aborted) return false;
let timer = null;
let onAbort = null;
const givenUp = new Promise((resolve) => {
timer = setTimeout(() => resolve(false), timeoutMs);
onAbort = () => resolve(false);
signal?.addEventListener('abort', onAbort, { once: true });
});
try {
let pending;
do {
pending = entry.toggleChain;
const idle = await Promise.race([
pending.then(
() => true,
() => true,
),
givenUp,
]);
if (!idle) return false;
} while (pending !== entry.toggleChain);
return true;
} finally {
clearTimeout(timer);
signal?.removeEventListener('abort', onAbort);
}
}
_reserveLayerParamsIntent(layerId, params, origin = 'programmatic') {
const entry = this.layers.get(layerId);
if (
@@ -0,0 +1 @@
{"rows":[["São Vicente",-7.442,-37.093,2601,"BR","Q120069910"]]}
@@ -0,0 +1 @@
{"rows":[["Acrelândia",-9.828,-66.883,14021,"BR","Q953086"],["Manoel Urbano",-8.839,-69.26,11996,"BR","Q1772688"]]}
@@ -0,0 +1 @@
{"rows":[["Rodrigues Alves",-7.742,-72.647,14938,"BR","Q1800776"],["Porto Walter",-8.269,-72.744,10735,"BR","Q1772588"],["Jordão",-9.434,-71.884,9222,"BR","Q1800793"],["Santa Rosa do Purus",-9.433,-70.493,6723,"BR","Q1772719"],["Esperanza",-9.799,-70.753,4405,"PE","Q3344870"],["Puerto Inca",-9.379,-74.964,2856,"PE","Q3348305"],["Tournavista",-8.934,-74.703,1472,"PE","Q137700491"],["Honoria",-8.769,-74.709,1422,"PE","Q137700481"],["Yuyapichis",-9.628,-74.975,1286,"PE","Q137700493"]]}
@@ -0,0 +1 @@
{"rows":[["San José de Sisa",-6.614,-76.694,14639,"PE","Q11034041"],["Soritor",-6.139,-77.104,14310,"PE","Q27194589"],["Saposoa",-6.936,-76.772,12951,"PE","Q3344065"],["Castillo Grande",-9.278,-76.009,12438,"PE","Q137700501"],["Cayaltí",-6.892,-79.562,12257,"PE","Q116762746"],["Bellavista",-7.067,-76.585,12117,"PE","Q3344055"],["Salaverry",-8.221,-78.976,11751,"PE","Q7403730"],["Lamas",-6.422,-76.516,11165,"PE","Q3139869"],["Ascope",-7.714,-79.108,10560,"PE","Q3344017"],["Namballe District",-5.003,-79.088,10492,"PE","Q6319417"],["Picsi",-6.718,-79.77,9251,"PE","Q49278067"],["Morropón",-5.187,-79.971,8949,"PE","Q6024431"],["Picota",-6.921,-76.33,8376,"PE","Q3344087"],["Yungay",-9.139,-77.744,8000,"PE","Q919678"],["Chongoyape",-6.637,-79.394,7842,"PE","Q5767159"],["Lagunas",-5.227,-75.675,7215,"PE","Q27194615"],["Mochumí",-6.548,-79.864,7188,"PE","Q27194530"],["Uchiza",-8.459,-76.463,6997,"PE","Q20621865"],["Tabalosos",-6.388,-76.634,6642,"PE","Q27194591"],["Pucalá",-6.781,-79.611,6445,"PE","Q106098771"],["Llata",-9.55,-76.817,6027,"PE","Q3344864"],["Naranjos",-5.739,-77.504,5913,"PE","Q137684978"],["Oyotún",-6.85,-79.304,5735,"PE","Q27557971"],["Chicama",-7.845,-79.145,5692,"PE","Q5095918"],["Pomabamba",-8.82,-77.461,5667,"PE","Q3322611"],["Orellana",-6.912,-75.157,5432,"PE","Q7101524"],["Pedro Ruiz Gallo",-5.946,-77.977,5361,"PE","Q27194454"],["Quiruvilca",-8.001,-78.31,5181,"PE","Q16623750"],["Huallanca",-9.899,-76.941,5064,"PE","Q5903856"],["Illimo",-6.474,-79.855,5037,"PE","Q17073502"],["Chocopeu",-7.792,-79.223,5037,"PE","Q5103685"],["Mendoza",-6.394,-77.486,4989,"PE","Q3305659"],["Panao",-9.901,-75.998,4848,"PE","Q3344024"],["Mocupe",-6.991,-79.622,4818,"PE","Q116763392"],["Chazuta",-6.571,-76.138,4595,"PE","Q49277326"],["Huicungo",-7.319,-76.776,4548,"PE","Q33446632"],["Pulán",-6.739,-78.92,4492,"PE","Q16623296"],["Zaña",-6.923,-79.584,4253,"PE","Q6171043"],["Pueblo Nuevo",-7.189,-79.514,4014,"PE","Q7258457"],["San Miguel de Pallaques",-7.001,-78.849,3989,"PE","Q11002429"],["Naranjillo",-9.249,-75.994,3945,"PE","Q2884961"],["Huacrachuco",-8.607,-77.149,3945,"PE","Q3344853"],["Moro",-9.139,-78.183,3926,"PE","Q130326439"],["Juan Guerra",-6.584,-76.324,3745,"PE","Q137684968"],["Pomacochas",-5.826,-77.969,3739,"PE","Q27194453"],["Santa Lucía",-8.345,-76.386,3636,"PE","Q137715155"],["Pacanga",-7.171,-79.486,3593,"PE","Q7121871"],["Calzada",-6.03,-77.067,3550,"PE","Q137684952"],["Nuevo Progreso",-8.451,-76.326,3532,"PE","Q130388430"],["Yuracyacu",-5.931,-77.226,3428,"PE","Q137684991"],["Buenos Aires",-5.267,-79.968,3418,"PE","Q49277301"],["Tembladera",-7.252,-79.13,3238,"PE","Q13190929"],["Jesús",-7.249,-78.38,3209,"PE","Q131323854"],["Chaglla",-9.845,-75.903,3108,"PE","Q137700471"],["Hualgayoc",-6.764,-78.607,3101,"PE","Q130336639"],["La Peca",-5.611,-78.437,3081,"PE","Q11982882"],["Jepelacio",-6.108,-76.915,3081,"PE","Q49277624"],["Cacatachi",-6.462,-76.451,3019,"PE","Q137684951"],["Salas",-6.274,-79.605,3008,"PE","Q107851677"],["Molino",-9.91,-76.016,2931,"PE","Q137700498"],["Lonya Grande",-6.096,-78.423,2896,"PE","Q131451947"],["Cátac",-9.802,-77.431,2776,"PE","Q1050130"],["Ripán",-9.829,-76.803,2755,"PE","Q13190560"],["Sócota",-6.315,-78.7,2698,"PE","Q131323944"],["San Martín",-6.514,-76.741,2644,"PE","Q137684992"],["Yaután",-9.512,-77.997,2446,"PE","Q130316672"],["La Jalca",-6.486,-77.816,2390,"PE","Q3374297"],["Chavín de Huántar",-9.589,-77.178,2384,"PE","Q17449251"],["Luya",-6.165,-77.945,2358,"PE","Q13189994"],["Roque",-6.356,-76.775,2339,"PE","Q137684944"],["Jequetepeque",-7.338,-79.563,2313,"PE","Q15229508"],["Chiriaco",-5.161,-78.286,2278,"PE","Q11963566"],["Julcán",-8.05,-78.5,2260,"PE","Q3344059"],["Piscobamba",-8.883,-77.35,2252,"PE","Q3319310"],["Samanco",-9.262,-78.496,2233,"PE","Q130327433"],["Bigote",-5.319,-79.786,2205,"PE","Q124738480"],["Piscoyacu",-6.981,-76.77,2181,"PE","Q137684979"],["San Fernando",-5.901,-77.269,2173,"PE","Q137684964"],["Barranquita",-6.252,-76.033,2163,"PE","Q137684949"],["Huipoca",-8.979,-75.445,2102,"PE","Q107569131"],["Yacus",-9.986,-76.505,2094,"PE","Q137700499"],["Santiago de Cao",-7.959,-79.242,2090,"PE","Q15275280"],["Santa María del Valle",-9.863,-76.17,2064,"PE","Q137700457"],["Chilete",-7.221,-78.84,2023,"PE","Q131323858"],["Acomayo",-9.802,-76.071,2012,"PE","Q135194231"],["Lámud",-6.139,-77.952,1996,"PE","Q2475775"],["Codo del Pozuzo",-9.67,-75.463,1988,"PE","Q20024777"],["Yorongos",-6.139,-77.144,1962,"PE","Q137684990"],["Shamboyacu",-7.024,-76.132,1914,"PE","Q137684984"],["Tres Unidos",-6.806,-76.233,1911,"PE","Q137684989"],["Copallín",-5.675,-78.423,1907,"PE","Q11964086"],["Lluchubamba",-7.519,-77.969,1896,"PE","Q130336589"],["Nepeña",-9.172,-78.359,1873,"PE","Q15919329"],["Cabana",-8.396,-78.016,1858,"PE","Q3305646"],["Malacasí",-5.344,-79.858,1850,"PE","Q125712172"],["Magdalena",-7.251,-78.659,1846,"PE","Q130336591"],["Cajaruro",-5.737,-78.43,1829,"PE","Q49277314"],["Llamellín",-9.101,-77.017,1817,"PE","Q3317415"],["ChontalLine truncated
@@ -0,0 +1 @@
{"rows":[["La Legua",-5.235,-80.658,8863,"PE","Q125828154"],["Mórrope",-6.542,-80.015,8680,"PE","Q27194532"],["La Matanza",-5.211,-80.088,6787,"PE","Q27194507"],["Vice",-5.422,-80.774,5972,"PE","Q49278395"],["Bernal",-5.463,-80.742,4007,"PE","Q49277262"],["Laynas",-5.232,-80.052,2493,"PE","Q130436047"],["Yacila",-5.133,-81.173,1690,"PE","Q27968636"],["Port of Bayóvar",-5.824,-81.035,1538,"PE","Q7231083"]]}
@@ -0,0 +1 @@
{"rows":[["Bula Atumba",-8.675,14.795,13454,"AO","Q979174"]]}
@@ -0,0 +1 @@
{"rows":[["Sindang Jaya",-6.903,107.68,14896,"ID","Q11175510"],["Sukawarna",-6.886,107.578,14324,"ID","Q11186629"],["Cipadung Kulon",-6.922,107.706,13997,"ID","Q11173868"],["Isola",-6.852,107.593,13513,"ID","Q11176203"],["Karasak",-6.95,107.608,13493,"ID","Q11174115"],["Sukarasa",-6.877,107.589,13442,"ID","Q11183012"],["Pasir Impun",-6.895,107.677,13333,"ID","Q12503577"],["Cibaduyut",-6.953,107.592,13265,"ID","Q11197161"],["Kebon Pisang",-6.919,107.617,12445,"ID","Q11182775"],["Margasuka",-6.954,107.575,12444,"ID","Q14641123"],["Cisaranten Bina Harapan",-6.914,107.684,12328,"ID","Q12479313"],["Cirangrang",-6.959,107.585,11777,"ID","Q11173692"],["Cipaganti",-6.89,107.604,11694,"ID","Q11175864"],["Ancol",-6.94,107.614,11628,"ID","Q12471984"],["Rancabolang",-6.964,107.692,11340,"ID","Q12507881"],["Cigereleng",-6.94,107.611,11233,"ID","Q12478819"],["Merdeka",-6.913,107.621,11222,"ID","Q12498194"],["Lebak Gede",-6.892,107.616,11063,"ID","Q13199701"],["Mekar Wangi",-6.955,107.606,10935,"ID","Q11174976"],["Ledeng",-6.863,107.599,10792,"ID","Q12494268"],["Situsaeur",-6.945,107.595,10720,"ID","Q11175419"],["Garuda",-6.912,107.576,10565,"ID","Q12483556"],["Cibaduyut Kidul",-6.961,107.592,9461,"ID","Q11190536"],["Pasirkaliki",-6.907,107.602,9148,"ID","Q12503629"],["Cibaduyut Wetan",-6.959,107.599,8630,"ID","Q12478700"],["Babakan Ciamis",-6.913,107.606,8501,"ID","Q11182550"],["Balong Gede",-6.925,107.607,8269,"ID","Q12473848"],["Pamoyanan",-6.903,107.593,7803,"ID","Q12502373"],["Pungkur",-6.93,107.608,7498,"ID","Q13200180"],["Babakan Penghulu",-6.941,107.692,7385,"ID","Q13544024"],["Pakemitan",-6.914,107.698,6481,"ID","Q13544023"],["Braga",-6.918,107.609,6155,"ID","Q11184258"],["Cipetir",-6.839,106.946,5716,"ID","Q11161898"],["Cihapit",-6.907,107.626,4058,"ID","Q12478837"],["Cipadung Wetan",-6.932,107.713,3583,"ID","Q12479213"],["Palugon",-7.237,108.671,2672,"ID","Q10969606"],["Citarum",-6.905,107.616,2250,"ID","Q12479343"]]}
@@ -0,0 +1 @@
{"rows":[["Wukirsari",-7.658,110.444,11500,"ID","Q12524899"],["Sambungmacan",-7.361,111.112,5009,"ID","Q4264536"],["Musi",-8.171,114.743,3085,"ID","Q18366899"],["Sumberejo",-7.93,110.861,2654,"ID","Q4208636"],["Tambong",-8.255,114.303,2579,"ID","Q12519030"],["Solor",-7.829,114.067,2527,"ID","Q12515858"],["Kecer",-6.95,113.802,2154,"ID","Q14634390"]]}
@@ -0,0 +1 @@
{"rows":[["Ubud",-8.497,115.263,10873,"ID","Q12522907"],["Kediri",-8.565,115.132,10353,"ID","Q20463891"],["Besakih",-8.375,115.45,7197,"ID","Q2899831"],["Canggu",-8.641,115.143,7088,"ID","Q2543000"],["Padangbai",-8.532,115.51,3294,"ID","Q1910262"],["Bengkala",-8.114,115.175,3000,"ID","Q13568788"],["Bengkel",-8.59,115.093,2390,"ID","Q13490146"]]}
@@ -0,0 +1 @@
{"rows":[["Pante Macassar",-9.2,124.383,8793,"TL","Q263005"],["Batugade",-8.959,124.951,3164,"TL","Q811044"],["Fatukoto",-9.709,124.216,2030,"ID","Q14627747"],["Inbate",-9.426,124.375,1187,"ID","Q12486427"],["Pulau Buaya",-8.176,124.373,1171,"ID","Q12506723"]]}
@@ -0,0 +1 @@
{"rows":[["Baucau",-8.467,126.45,14961,"TL","Q811130"],["Ermera",-8.752,125.397,13142,"TL","Q1355919"],["Lospalos",-8.517,127.033,12782,"TL","Q1017098"],["Turiscai",-8.823,125.707,11258,"TL","Q2460763"],["Manatuto",-8.517,126.017,9022,"TL","Q1011873"],["Suai",-9.3,125.25,8243,"TL","Q582712"],["Gleno",-8.723,125.435,8133,"TL","Q1018872"],["Bobonaro",-9.032,125.325,6110,"TL","Q55574072"],["Viqueque",-8.85,126.367,6078,"TL","Q1011863"],["Liquiçá",-8.594,125.327,5152,"TL","Q946959"],["Metinaro",-8.533,125.733,4316,"TL","Q18201468"],["Maubisse",-8.838,125.597,3370,"TL","Q1506450"],["Ainaro",-8.983,125.5,3085,"TL","Q108908310"],["Aileu",-8.717,125.567,2927,"TL","Q405087"],["Acanuno",-8.556,125.648,2562,"TL","Q22045079"],["Same",-9,125.65,2100,"TL","Q932640"]]}
@@ -0,0 +1 @@
{"rows":[["Daru",-9.083,143.2,12879,"PG","Q499375"],["Kiunga",-6.117,141.3,8265,"PG","Q985928"]]}
@@ -0,0 +1 @@
{"rows":[["Alexishaven",-5.083,145.8,10377,"PG","Q1626709"],["Wau",-7.339,146.717,9442,"PG","Q954956"],["Finschhafen",-6.6,147.85,1240,"PG","Q15217719"]]}
@@ -0,0 +1 @@
{"rows":[["Gizo",-8.1,156.85,7177,"SB","Q1236908"],["Munda",-8.328,157.271,4850,"SB","Q617069"],["Wagina Island",-7.439,157.767,1636,"SB","Q2713838"]]}
@@ -0,0 +1 @@
{"rows":[["Auki",-8.768,160.697,6811,"SB","Q538476"],["Burns Creek, Honiara",-9.423,160.024,5000,"SB","Q25042019"]]}
@@ -0,0 +1 @@
{"rows":[["Funafuti",-8.505,179.117,6025,"TV","Q34126"]]}
@@ -0,0 +1 @@
{"rows":[["Kaputa",-8.517,29.317,9210,"ZM","Q770286"],["Chienge",-8.774,29.08,9161,"ZM","Q996085"]]}
@@ -0,0 +1 @@
{"rows":[["Imalinyi",-9.183,34.633,10272,"TZ","Q10998287"],["Mdandu",-9.147,34.692,9497,"TZ","Q6802855"],["Lupata",-9.3,33.85,8552,"TZ","Q6704665"],["Matamba",-8.983,33.967,7505,"TZ","Q13123967"],["Lusungo",-9.5,33.983,7337,"TZ","Q6705340"],["Kabula",-9.267,33.767,6368,"TZ","Q6344457"],["Masukulu",-9.4,33.75,5521,"TZ","Q6785674"],["Wangama",-6.933,34.317,5387,"TZ","Q7967795"],["Ikama",-9.267,33.833,4732,"TZ","Q5995334"],["Ikolo",-9.65,33.9,4647,"TZ","Q5996092"],["Mwansanga",-8.767,33.533,2939,"TZ","Q6944690"]]}
@@ -0,0 +1 @@
{"rows":[["Makunduchi",-6.413,39.552,14728,"TZ","Q3843701"],["Mwaya",-8.917,36.833,12122,"TZ","Q6272943"],["Kalenga",-7.8,35.6,11491,"TZ","Q6352119"],["Ikondo, Njombe",-9.1,35.266,6655,"TZ","Q5996149"],["Mahanje",-9.933,35.333,6002,"TZ","Q35722686"],["Nyamisati",-7.795,39.275,1142,"TZ","Q10604328"]]}
@@ -0,0 +1 @@
{"rows":[["Tafuna",-14.336,-170.72,7988,"US","Q1019488"],["Vaitele",-13.82,-171.78,7972,"WS","Q9368101"],["Nuʻuuli",-14.319,-170.724,6345,"US","Q3879172"],["Pago Pago",-14.279,-170.701,3656,"US","Q51678"],["Faleniu",-14.332,-170.744,3426,"US","Q3738616"],["Leone",-14.344,-170.785,2902,"AS","Q1773774"],["'Ili'ili",-14.352,-170.747,2497,"US","Q3596207"],["Aua",-14.267,-170.65,2336,"US","Q609232"],["Afega",-13.8,-171.817,1998,"WS","Q2038921"],["Fagatogo",-14.283,-170.69,1445,"US","Q1257213"],["Lepa, Samoa",-14.033,-171.517,1429,"WS","Q2586194"],["Leulumoega",-13.817,-171.917,1184,"WS","Q1944685"],["Fagaʻalu",-14.296,-170.684,1122,"US","Q3738319"]]}
@@ -0,0 +1 @@
{"rows":[["Mata-Utu",-13.283,-176.174,1075,"FR","Q31002"]]}
@@ -0,0 +1 @@
{"rows":[["Historic Centre of Salvador da Bahia",-12.967,-38.5,2253,"BR","Q5572706"],["Maragogipinho",-13.054,-38.965,1720,"BR","Q61727521"]]}
@@ -0,0 +1 @@
{"rows":[["Alvorada",-12.48,-49.125,8802,"BR","Q22060164"]]}
@@ -0,0 +1 @@
{"rows":[["Costa Marques",-12.445,-64.227,12627,"BR","Q656758"],["Alto Alegre dos Parecis",-12.128,-61.851,11479,"BR","Q1802050"],["Cabixi",-13.498,-60.554,8174,"BR","Q940433"],["Pimenteiras do Oeste",-13.482,-61.047,2156,"BR","Q1803105"],["Baures",-13.583,-63.583,2127,"BO","Q811831"]]}
@@ -0,0 +1 @@
{"rows":[["Santa Ana del Yacuma",-13.744,-65.427,12783,"BO","Q1819433"],["Reyes",-14.296,-67.335,11478,"BO","Q913102"],["Capixaba",-10.573,-67.676,10392,"BR","Q1800737"],["Assis Brasil",-10.911,-69.582,8100,"BR","Q1754403"],["Sandia",-14.233,-69.433,8000,"PE","Q3344209"],["Usicayos",-14.125,-69.967,2409,"PE","Q130541387"],["Quilcapuncu",-14.893,-69.73,2280,"PE","Q130541411"],["San Buenaventura",-14.435,-67.541,2264,"BO","Q164003"],["Apolo",-14.716,-68.418,2123,"BO","Q2307341"],["Iñapari",-10.945,-69.577,1890,"PE","Q1899785"],["Muñani",-14.768,-69.953,1885,"PE","Q130541380"],["Putina Punco",-14.112,-69.048,1756,"PE","Q131399964"],["Ixiamas",-13.768,-68.126,1733,"BO","Q2068157"],["San Juan del Oro",-14.221,-69.154,1582,"PE","Q130541416"],["Limbani",-14.15,-69.691,1497,"PE","Q130541414"],["Phara",-14.152,-69.665,1306,"PE","Q130541419"],["Planchón",-12.278,-69.153,1297,"PE","Q107860650"],["Massiapo",-14.09,-69.243,1200,"PE","Q130541420"],["Cuyocuyo",-14.47,-69.537,1106,"PE","Q130541417"]]}
@@ -0,0 +1 @@
{"rows":[["Ascensión",-12.784,-74.978,14915,"PE","Q131451556"],["Atalaya",-10.733,-73.75,12946,"PE","Q3322627"],["Pichari",-12.52,-73.828,12050,"PE","Q7190625"],["Macusani",-14.069,-70.431,11707,"PE","Q3348229"],["Talavera de la Reyna",-13.654,-73.429,11691,"PE","Q9355344"],["Urcos",-13.686,-71.623,10614,"PE","Q2989619"],["Satipo",-11.254,-74.637,10052,"PE","Q3057885"],["Pampas",-12.399,-74.867,9973,"PE","Q2725364"],["Písac",-13.421,-71.85,9796,"PE","Q950398"],["Tamburco",-13.622,-72.873,9171,"PE","Q131187833"],["Puerto Bermúdez",-10.296,-74.938,6168,"PE","Q27213542"],["Kimbiri",-12.488,-73.842,5913,"PE","Q11687201"],["Mariscal Cáceres",-12.39,-74.858,5420,"PE","Q131176125"],["Río Negro",-11.208,-74.66,5262,"PE","Q130483344"],["Nuñoa",-14.478,-70.636,4641,"PE","Q27194667"],["Acomayo",-13.917,-71.681,4532,"PE","Q2582682"],["Paucartambo",-13.316,-71.592,4309,"PE","Q2989631"],["Chalhuanca",-14.295,-73.244,4297,"PE","Q879065"],["Tambobamba",-13.946,-72.175,4063,"PE","Q879051"],["Chinchero",-13.396,-72.06,3765,"PE","Q26764442"],["Palmapampa",-12.768,-73.656,3608,"PE","Q130369727"],["Coasa",-13.987,-70.018,3388,"PE","Q130541388"],["Yanaoca",-14.218,-71.432,3307,"PE","Q2989624"],["Churcampa",-12.723,-74.421,3306,"PE","Q3348281"],["Llochegua",-12.41,-73.906,3224,"PE","Q130369715"],["Chuquibambilla",-14.105,-72.708,3105,"PE","Q879071"],["Ollantaytambo",-13.258,-72.263,3050,"PE","Q916382"],["Antauta",-14.3,-70.292,2908,"PE","Q130541403"],["Maranganí",-14.357,-71.169,2887,"PE","Q13190024"],["Velille",-14.508,-71.886,2883,"PE","Q131399783"],["Santa Rosa",-14.607,-70.787,2858,"PE","Q131399949"],["Quichuas",-12.473,-74.767,2706,"PE","Q130371068"],["Ollachea",-13.794,-70.472,2700,"PE","Q130541390"],["Urubamba",-13.304,-72.117,2700,"PE","Q2304483"],["Ayapata",-13.777,-70.323,2622,"PE","Q130541385"],["Lucre",-13.635,-71.746,2612,"PE","Q13189987"],["Vilcashuamán",-13.653,-73.954,2577,"PE","Q2475760"],["Macari",-14.772,-70.903,2527,"PE","Q13190027"],["Huancabamba",-13.734,-73.35,2492,"PE","Q131187838"],["Quebrada Honda",-12.682,-72.278,2433,"PE","Q13191015"],["Boca Colorado",-12.619,-70.394,2252,"PE","Q107860921"],["Huancarama",-13.645,-73.086,2225,"PE","Q131451845"],["Pampa Cangallo",-13.558,-74.196,2115,"PE","Q130369697"],["Antabamba",-14.365,-72.878,2061,"PE","Q879057"],["Mantaro",-12.324,-73.94,2039,"PE","Q130492438"],["Ancahuasi",-13.457,-72.3,1921,"PE","Q130492417"],["Cabana",-14.289,-73.967,1891,"PE","Q131324820"],["Pillcopata",-12.911,-71.405,1858,"PE","Q21294423"],["Pucyura",-13.479,-72.112,1853,"PE","Q130492418"],["Huancarani",-13.503,-71.655,1842,"PE","Q130492443"],["Huaro",-13.69,-71.641,1833,"PE","Q20622303"],["Querobamba",-14.012,-73.839,1799,"PE","Q2918849"],["Chincheros",-13.518,-73.723,1797,"PE","Q878820"],["Quince Mil",-13.231,-70.754,1759,"PE","Q5573415"],["Paruro",-13.763,-71.849,1750,"PE","Q2989645"],["Huancapi",-13.75,-74.064,1748,"PE","Q950080"],["Maras",-13.333,-72.156,1730,"PE","Q1026235"],["Llalli",-14.933,-70.881,1709,"PE","Q130541405"],["Cachimayo",-13.477,-72.068,1673,"PE","Q130492416"],["Huyro",-13.007,-72.554,1619,"PE","Q130492433"],["Cotabambas",-13.747,-72.356,1604,"PE","Q13189891"],["Mollepata",-13.509,-72.528,1589,"PE","Q130489438"],["Lanlacuni Bajo",-13.439,-70.402,1572,"PE","Q130541389"],["Limatambo",-13.48,-72.443,1562,"PE","Q11161861"],["Huanoquite",-13.682,-72.018,1546,"PE","Q130492440"],["Poroy",-13.497,-72.043,1502,"PE","Q20619475"],["Quellouno",-12.636,-72.557,1496,"PE","Q130312712"],["San Pedro de Coris",-12.578,-74.412,1460,"PE","Q131176072"],["Huando",-12.564,-74.947,1447,"PE","Q131176078"],["Acopía",-14.057,-71.493,1440,"PE","Q13189157"],["Zurite",-13.456,-72.255,1437,"PE","Q130492420"],["El Descanso",-14.534,-71.307,1434,"PE","Q130492423"],["Colquemarca",-14.284,-72.04,1427,"PE","Q131399801"],["Canayre",-12.282,-74.023,1413,"PE","Q130369710"],["Livitaca",-14.313,-71.689,1407,"PE","Q130492427"],["Huamanguilla",-13.011,-74.173,1400,"PE","Q130369713"],["Ajoyani",-14.23,-70.224,1381,"PE","Q130541384"],["San Salvador",-13.492,-71.778,1372,"PE","Q20620856"],["Tawantinsuyo",-12.792,-73.622,1362,"PE","Q130492439"],["San Pedro de Hualla",-13.85,-73.951,1360,"PE","Q62779711"],["Sarhua",-13.667,-74.317,1322,"PE","Q13190743"],["Lucanas",-14.622,-74.233,1297,"PE","Q130369735"],["Acoria",-12.643,-74.862,1280,"PE","Q130312758"],["San José",-14.68,-70.16,1258,"PE","Q130541379"],["Huaccana",-13.388,-73.69,1246,"PE","Q131187855"],["Chuschi",-13.585,-74.352,1245,"PE","Q3655811"],["Accha",-13.971,-71.832,1217,"PE","Q96972647"],["Challabamba",-13.216,-71.648,1205,"PE","Q98550153"],["Villa Virgen",-13.002,-73.513,1155,"PE","Q130492435"],["Mara",-14.086,-72.102,1146,"PE","Q131187857"],["San Cristóbal",-14.743,-74.222,1125,"PE","Q130369740"],["Chirumpiari",-12.808,-73.604,1122,"PE","Q130492437"],["Progreso",-14.073,-72.476,1113,"PE","Q131187866"],["Julcamarca",-13.014,-74.445,1099,"PE","Q131451558"],["La Esmeralda",-12.683,-74.587,1063,"PE","Q131176066"],["Huachocolpa",-13.032,-74.947,1053,Line truncated
@@ -0,0 +1 @@
{"rows":[["Pucusana",-12.482,-76.798,14891,"PE","Q7258273"],["San Agustín",-11.972,-75.256,14310,"PE","Q49278126"],["Chilca",-12.519,-76.739,13920,"PE","Q16890238"],["Oxapampa",-10.58,-75.4,12826,"PE","Q1014523"],["Supe Puerto",-10.805,-77.743,12786,"PE","Q3504032"],["Supe",-10.797,-77.713,12492,"PE","Q33499647"],["San Jerónimo de Tunán",-11.949,-75.283,11601,"PE","Q33479561"],["Pativilca",-10.696,-77.774,11467,"PE","Q3368805"],["Yanahuanca",-10.491,-76.514,11333,"PE","Q3344095"],["Quilmaná",-12.95,-76.384,10491,"PE","Q27194717"],["Santa Eulalia",-11.897,-76.663,9941,"PE","Q33481268"],["Chupaca",-12.062,-75.287,9877,"PE","Q3344173"],["Santa Rosa de Sacco",-11.567,-75.956,8956,"PE","Q130483348"],["Yauyos",-11.781,-75.499,8637,"PE","Q130483296"],["Caleta de Carquín",-11.092,-77.627,8049,"PE","Q34789278"],["Ambo",-10.131,-76.205,7444,"PE","Q3317423"],["Huayllay",-11.001,-76.373,6736,"PE","Q13191218"],["Huamancaca Chico",-12.081,-75.242,6581,"PE","Q130483323"],["Aucallama",-11.562,-77.173,6504,"PE","Q137716780"],["Huayucachi",-12.138,-75.223,6477,"PE","Q49277584"],["Huariaca",-10.442,-76.19,6175,"PE","Q137708733"],["Saño",-11.957,-75.257,5491,"PE","Q130483293"],["Ricardo Palma",-11.924,-76.66,5358,"PE","Q33475284"],["Hualhuas",-11.972,-75.251,5251,"PE","Q130483291"],["Sayán",-11.133,-77.195,4422,"PE","Q33481992"],["Chongos Bajo",-12.134,-75.268,3764,"PE","Q131394414"],["San Mateo, Huarochirí Province",-11.761,-76.309,3669,"PE","Q27783597"],["Chiquián",-10.151,-77.156,3641,"PE","Q1074644"],["Matahuasi",-11.894,-75.344,3268,"PE","Q130483339"],["Ahuac",-12.086,-75.321,3137,"PE","Q27194427"],["Sausa",-11.794,-75.484,3060,"PE","Q131394441"],["Yauli",-11.666,-76.087,2993,"PE","Q130483360"],["Quilcas",-11.937,-75.259,2989,"PE","Q130483295"],["Palca",-11.346,-75.569,2724,"PE","Q115164510"],["Tres de Diciembre",-12.11,-75.246,2665,"PE","Q130483326"],["El Carmen",-13.5,-76.058,2639,"PE","Q28314364"],["Santa Ana de Tusi",-10.472,-76.354,2632,"PE","Q137708743"],["Lunahuaná",-12.963,-76.142,2617,"PE","Q1877336"],["Viques",-12.16,-75.232,2589,"PE","Q130483294"],["Tate de La Capilla",-14.156,-75.708,2544,"PE","Q33505671"],["San Pedro de Cajas",-11.251,-75.861,2495,"PE","Q25400021"],["Pucucho",-11.822,-75.392,2459,"PE","Q130483300"],["Ninacaca",-10.856,-76.113,2400,"PE","Q55129680"],["Muquiyauyo",-11.814,-75.454,2311,"PE","Q131394979"],["Pucará",-12.172,-75.145,2220,"PE","Q131395032"],["San Lorenzo",-11.847,-75.382,2165,"PE","Q130483315"],["San Rafael",-10.338,-76.182,2056,"PE","Q137700490"],["Santo Domingo del Prado",-11.898,-75.318,2023,"PE","Q130483338"],["Huácar",-10.16,-76.237,2019,"PE","Q137700482"],["Ocros",-10.404,-77.396,2000,"PE","Q3317427"],["Leticia",-11.377,-75.752,1999,"PE","Q119109056"],["Tomayquichua",-10.078,-76.213,1950,"PE","Q26980595"],["Churin",-10.817,-76.883,1834,"PE","Q5118292"],["Iscozacín",-10.184,-75.15,1814,"PE","Q137708750"],["Cauri",-10.142,-76.626,1704,"PE","Q113368834"],["Canta",-11.467,-76.624,1646,"PE","Q3322638"],["Tapuc",-10.455,-76.462,1644,"PE","Q137708744"],["Sincos",-11.892,-75.387,1454,"PE","Q131394982"],["Castrovirreyna",-13.278,-75.316,1449,"PE","Q3348254"],["Vicco",-10.841,-76.236,1400,"PE","Q42894269"],["Río Grande",-14.52,-75.201,1394,"PE","Q33476950"],["San Miguel",-12.015,-75.346,1387,"PE","Q130483331"],["Vilcabamba",-10.479,-76.447,1364,"PE","Q137708746"],["Margos",-10.005,-76.523,1324,"PE","Q137700452"],["Huancaní",-11.864,-75.414,1321,"PE","Q131395005"],["Goyllarisquizga",-10.475,-76.408,1320,"PE","Q137708737"],["Huáchac",-12.02,-75.341,1311,"PE","Q130483322"],["Pazos",-12.259,-75.07,1301,"PE","Q131176134"],["Huacrapuquio",-12.174,-75.219,1297,"PE","Q130483290"],["Huamalí",-11.807,-75.424,1290,"PE","Q130483306"],["Cajatambo",-10.473,-76.994,1275,"PE","Q2638247"],["Chontabamba",-10.603,-75.439,1221,"PE","Q137708736"],["Huachón",-10.636,-75.951,1221,"PE","Q137708738"],["Paccha",-11.473,-75.96,1213,"PE","Q130312656"],["Ticlacayán",-10.534,-76.164,1212,"PE","Q137708742"],["Aco",-11.958,-75.368,1209,"PE","Q130483333"],["Apata",-11.855,-75.354,1206,"PE","Q131394386"],["Asia",-12.779,-76.557,1198,"PE","Q126021564"],["Santa Rosa",-11.877,-75.295,1198,"PE","Q13190718"],["Pozuzo",-10.067,-75.533,1194,"PE","Q278871"],["San Antonio de Rancas",-10.69,-76.317,1193,"PE","Q137708741"],["Marca",-10.089,-77.474,1191,"PE","Q13190032"],["Huay-Huay",-11.723,-75.905,1130,"PE","Q130483346"],["Quichuay",-11.89,-75.286,1128,"PE","Q13190448"],["San Pedro de Pillao",-10.439,-76.495,1099,"PE","Q137708749"],["Jarpa",-12.126,-75.436,1073,"PE","Q131394496"],["Muqui",-11.833,-75.434,1013,"PE","Q130483302"],["Huancabamba",-10.426,-75.524,1012,"PE","Q137708739"],["Huaricolca",-11.512,-75.653,1011,"PE","Q115239543"],["Ataura",-11.803,-75.438,1006,"PE","Q131394405"]]}
@@ -0,0 +1 @@
{"rows":[["Flying Fish Cove",-10.422,105.678,1599,"AU","Q30980"]]}
@@ -0,0 +1 @@
{"rows":[["Wadeye",-14.233,129.517,2280,"AU","Q18028"]]}
@@ -0,0 +1 @@
{"rows":[["Darwin",-12.462,130.842,6464,"AU","Q5225948"],["Katherine",-14.467,132.267,5980,"AU","Q17980"],["Howard Springs",-12.492,131.053,5132,"AU","Q5920924"],["Karama",-12.401,130.917,4944,"AU","Q6368250"],["Leanyer",-12.379,130.898,4597,"AU","Q6509883"],["Humpty Doo",-12.575,131.102,4380,"AU","Q17966"],["Rosebery",-12.505,130.992,4218,"AU","Q7368077"],["Stuart Park",-12.449,130.842,4149,"AU","Q7626934"],["Zuccoli",-12.512,131.003,4131,"AU","Q30694176"],["Larrakeyah",-12.459,130.822,3943,"AU","Q6489783"],["Nightcliff",-12.383,130.849,3884,"AU","Q7033778"],["Durack",-12.475,130.973,3730,"AU","Q5316121"],["Muirhead",-12.358,130.896,3689,"AU","Q6933244"],["Gray",-12.492,130.979,3288,"AU","Q5598128"],["Rapid Creek",-12.381,130.862,3282,"AU","Q7294152"],["Woodroffe",-12.499,130.981,3233,"AU","Q8033152"],["Katherine East",-14.466,132.285,3114,"AU","Q6376354"],["Bakewell",-12.499,130.993,3091,"AU","Q4849343"],["Moulden",-12.51,130.976,3053,"AU","Q6918971"],["Coconut Grove",-12.399,130.852,3050,"AU","Q5139826"],["Malak",-12.393,130.904,3013,"AU","Q6741113"],["Driver",-12.485,130.973,2884,"AU","Q5307982"],["Fannie Bay",-12.425,130.836,2875,"AU","Q5433948"],["Parap",-12.421,130.844,2819,"AU","Q7135606"],["Gunn",-12.489,130.992,2664,"AU","Q5618901"],["Millner",-12.391,130.863,2576,"AU","Q6859897"],["Tiwi",-12.363,130.88,2562,"AU","Q7810475"],["Maningrida",-12.05,134.217,2518,"AU","Q17988"],["Wulagi",-12.384,130.893,2510,"AU","Q8039143"],["Bellamack",-12.521,130.98,2458,"AU","Q4883440"],["Johnston",-12.486,131.01,2386,"AU","Q6268601"],["Anula",-12.393,130.89,2385,"AU","Q4777772"],["Lyons",-12.379,130.888,2302,"AU","Q6709756"],["Wagaman",-12.383,130.885,2163,"AU","Q7959471"],["Alawa",-12.38,130.873,2127,"AU","Q4708892"],["Moil",-12.389,130.879,2000,"AU","Q6894595"],["Nakara",-12.369,130.878,1978,"AU","Q6960299"],["Holtze",-12.461,130.984,1940,"AU","Q5884778"],["Wanguri",-12.373,130.888,1876,"AU","Q7967917"],["Jingili",-12.387,130.875,1841,"AU","Q6202323"],["Virginia",-12.548,131.017,1836,"AU","Q7934081"],["Ludmilla",-12.43,130.852,1743,"AU","Q6698920"],["Herbert",-12.542,131.157,1730,"AU","Q5733379"],["Bayview",-12.44,130.86,1702,"AU","Q4874996"],["Girraween",-12.524,131.092,1668,"AU","Q5564818"],["Farrar",-12.478,130.991,1650,"AU","Q5436240"],["Wurrumiyanga",-11.759,130.635,1563,"AU","Q18034"],["Marrara",-12.398,130.88,1549,"AU","Q6772795"],["Katherine South",-14.469,132.259,1507,"AU","Q18165876"],["Cossack",-14.447,132.176,1293,"AU","Q31203555"],["Brinkin",-12.37,130.867,1268,"AU","Q4968417"],["Milingimbi",-12.103,134.921,1225,"AU","Q1934778"],["Berrimah",-12.434,130.923,1199,"AU","Q4894715"],["Gunbalanya",-12.317,133.05,1177,"AU","Q18002"],["Ngukurr",-14.73,134.731,1149,"AU","Q21074864"],["Jabiru",-12.667,132.833,1081,"AU","Q17969"]]}
@@ -0,0 +1 @@
{"rows":[["Nhulunbuy",-12.182,136.782,3350,"AU","Q17996"],["Galiwinku",-12.024,135.566,2206,"AU","Q30400333"],["East Arnhem",-12.635,135.84,1194,"AU","Q31230672"]]}
@@ -0,0 +1 @@
{"rows":[["Weipa",-12.643,141.864,4097,"AU","Q1026439"],["Thursday Island",-10.579,142.22,2805,"AU","Q20669958"],["Rocky Point",-12.619,141.886,2214,"AU","Q31202450"],["Aurukun",-13.35,141.717,1269,"AU","Q1879882"],["Bamaga",-10.883,142.383,1186,"AU","Q3604590"]]}
@@ -0,0 +1 @@
{"rows":[["Sola",-13.88,167.55,1065,"VU","Q1423143"]]}
@@ -0,0 +1 @@
{"rows":[["Manyinga",-13.419,24.331,12760,"ZM","Q123174109"],["Lukulu",-14.408,23.267,10575,"ZM","Q1629398"],["Zambezi",-13.55,23.117,10299,"ZM","Q145470"],["Kabompo",-13.583,24.231,9865,"ZM","Q1001226"],["Chavuma",-13.075,22.688,4652,"ZM","Q1022152"]]}
@@ -0,0 +1 @@
{"rows":[["Mpongwe",-13.513,28.155,14979,"ZM","Q996118"],["Lubwe",-11.114,29.647,12643,"ZM","Q132861372"],["Luwingu",-10.262,29.927,10766,"ZM","Q1878272"],["Kasempa",-13.461,25.839,10700,"ZM","Q1734917"],["Mufumbwe",-13.139,25.006,9576,"ZM","Q996108"],["Chibombo",-14.664,28.078,4310,"ZM","Q1071771"],["Chilubi",-11.15,29.917,4295,"ZM","Q1022154"]]}
@@ -0,0 +1 @@
{"rows":[["Ntcheu",-14.817,34.633,14642,"MW","Q1022517"],["Monkey Bay",-14.083,34.917,14591,"MW","Q1944901"],["Nyoni, Tanzania",-11.084,34.919,12899,"TZ","Q65331304"],["Litembo",-10.967,34.85,12432,"TZ","Q6647539"],["Mungwi",-10.167,31.367,7831,"ZM","Q1952800"],["Chama",-11.208,33.158,7029,"ZM","Q1060403"],["Nyimba",-14.443,31.087,6821,"ZM","Q162131"],["Chadiza",-14.064,32.435,5670,"ZM","Q1058666"]]}
@@ -0,0 +1 @@
{"rows":[["Kigonsera",-10.8,35.067,13323,"TZ","Q6405967"],["Lilambo",-10.683,35.549,12642,"TZ","Q6547546"],["Maposeni",-10.583,35.4,4670,"TZ","Q13123938"]]}
@@ -0,0 +1 @@
{"rows":[["Tsimbeo",-12.2,44.467,12472,"KM","Q1885248"],["Ongoujou",-12.312,44.508,11736,"KM","Q3120986"],["Adda-Douéni",-12.3,44.5,11165,"KM","Q2824136"],["Sima",-12.199,44.274,11000,"KM","Q3110104"],["Ouani",-12.135,44.428,10000,"KM","Q3143004"],["Bazimini",-12.179,44.449,9205,"KM","Q548071"],["Iconi",-11.745,43.233,8817,"KM","Q3120964"],["Ivémbéni-Bandasamoulini",-11.478,43.318,8786,"KM","Q3156386"],["Moya",-12.3,44.433,8475,"KM","Q786648"],["Mkazi",-11.732,43.267,8438,"KM","Q939788"],["Dindri",-12.214,44.453,8037,"KM","Q3028292"],["Mbéni",-11.5,43.383,7725,"KM","Q3121010"],["Mitsamiouli",-11.382,43.3,7235,"KM","Q3109029"],["Koni-Djodjo",-12.23,44.482,7232,"KM","Q3119166"],["Barakani",-12.136,44.432,6854,"KM","Q2883788"],["Chandra",-12.2,44.467,6354,"KM","Q2956006"],["Chezani",-11.428,43.388,6250,"KM","Q2963196"],["Ngandzalé",-12.27,44.51,6097,"KM","Q3339276"],["Foumbouni",-11.867,43.483,5331,"KM","Q3043023"],["Mbambao Mtsanga",-12.31,44.44,5067,"KM","Q3303484"],["Mitsoudjé",-11.817,43.267,5004,"KM","Q3317188"],["Dembéni",-11.877,43.406,4723,"KM","Q3022078"],["Moidja",-11.468,43.287,4441,"KM","Q17076248"],["Hahaya-Aéroport",-11.537,43.271,4005,"KM","Q3125727"],["Hajoho",-12.117,44.483,3873,"KM","Q3125818"],["Ntsaweni",-11.466,43.263,3846,"KM","Q3345984"],["Bandracouni",-11.86,43.404,3309,"KM","Q2878564"],["Djoièzi",-12.297,43.773,3271,"KM","Q3033049"],["Djomani-Mchenazi",-11.43,43.259,3029,"KM","Q3033054"],["Daji",-12.333,44.483,3012,"KM","Q14525823"],["Itsinkoundi",-11.584,43.376,2859,"KM","Q2399910"],["Boungoueni",-12.2,44.3,2775,"KM","Q2922202"],["Bandra Lamahalé",-12.147,44.499,2771,"KM","Q2882377"],["Heroumbili",-11.544,43.38,2745,"KM","Q3134319"],["Chironkamba",-12.191,44.352,2692,"KM","Q2963954"],["Dzidri-I",-12.22,44.45,2675,"KM","Q3042208"],["Chouani",-11.819,43.284,2615,"KM","Q2964567"],["Singani",-11.847,43.328,2552,"KM","Q3484935"],["Bangoi-Hamtsaha-Madjeoué",-11.717,43.368,2514,"KM","Q2882482"],["Djoumoichongo-Nyoumbadjou",-11.807,43.286,2478,"KM","Q3033071"],["Chiroroni",-12.377,44.501,2395,"KM","Q2963964"],["Hantsindzi",-11.429,43.402,2290,"KM","Q507363"],["Idjinkoundzi",-11.711,43.414,2241,"KM","Q3147877"],["Akibani",-12.193,44.362,2170,"KM","Q2829022"],["Boeni ya Bambao",-11.631,43.352,2077,"KM","Q601473"],["Batsa",-11.628,43.26,2075,"KM","Q2891632"],["Bandajou",-12.183,44.283,2044,"KM","Q2882134"],["Hamchako",-12.371,44.513,2036,"KM","Q2384497"],["Douniani",-11.421,43.289,2031,"KM","Q3038137"],["Dzahadjou",-11.848,43.34,2002,"KM","Q3042177"],["Bandamadji-Ladomba",-11.784,43.444,1995,"KM","Q2882144"],["Dziani",-12.183,44.483,1974,"KM","Q3042198"],["Harembo",-12.15,44.5,1911,"KM","Q3127418"],["Héléindjé-Salimani-Zounda",-11.437,43.305,1757,"KM","Q3144897"],["Chindini",-11.921,43.481,1680,"KM","Q2963751"],["Hachimpenda",-12.2,44.256,1657,"KM","Q3125454"],["Dimadjou",-11.474,43.364,1655,"KM","Q3028026"],["Dzahani",-11.657,43.276,1587,"KM","Q3042180"],["Itsandzéni",-11.473,43.384,1578,"KM","Q3155989"],["Bambadjani",-11.479,43.377,1549,"KM","Q923118"],["Hantsambou",-11.66,43.256,1542,"KM","Q2385256"],["Bahani",-11.64,43.284,1454,"KM","Q2879261"],["Bandrani",-12.073,44.471,1377,"KM","Q4854696"],["Dzahadjou Lamzandé",-11.853,43.349,1349,"KM","Q3042179"],["Chamlé",-11.445,43.267,1345,"KM","Q2948523"],["Antsahé",-12.356,44.523,1328,"KM","Q2857608"],["Bouni",-11.492,43.398,1261,"KM","Q2922203"],["Assimpao",-12.233,44.32,1252,"KM","Q2867178"],["Hoani",-12.25,43.667,1245,"KM","Q3138871"],["Bandar Salama",-12.29,43.759,1232,"KM","Q2882147"],["Chitrouni",-12.186,44.336,1218,"KM","Q2964025"],["Bambani",-12.233,44.32,1214,"KM","Q4853332"],["Hadjambou",-11.736,43.233,1202,"KM","Q3125556"],["Founga-Anihani",-11.411,43.295,1112,"KM","Q3079943"],["Dar-Salama",-12.251,44.388,1089,"KM","Q3015900"],["Ifoundihé Chamboini",-11.9,43.412,1085,"KM","Q3148105"],["Bada la Djandza",-12.299,44.497,1040,"KM","Q2878567"],["Bangoi-Mafousa Nkoa",-11.717,43.368,1015,"KM","Q2882481"],["Dimadjou-Mdé",-11.476,43.374,1010,"KM","Q3028029"]]}
@@ -0,0 +1 @@
{"rows":[["Handrema",-12.681,45.1,1829,"FR","Q5647547"],["Mtsangamboua",-12.69,45.11,1304,"FR","Q6930490"]]}
@@ -0,0 +1 @@
{"rows":[["Jamestown",-15.925,-5.718,1516,"SH","Q30970"]]}
@@ -0,0 +1 @@
{"rows":[["Bora Bora",-16.498,-151.736,10605,"FR","Q183113"],["Vaitape",-16.506,-151.749,4927,"FR","Q3498189"],["Opoa",-16.836,-151.365,1205,"FR","Q39483295"]]}
@@ -0,0 +1 @@
{"rows":[["Neiafu",-18.651,-173.983,6000,"TO","Q1025393"],["Pangai",-19.803,-174.349,2000,"TO","Q1027037"]]}
@@ -0,0 +1 @@
{"rows":[["Trancoso",-16.593,-39.103,11006,"BR","Q938536"]]}
@@ -0,0 +1 @@
{"rows":[["Vera Cruz de Minas",-19.698,-44.05,4208,"BR","Q10389767"],["Lapinha",-19.571,-43.953,3921,"BR","Q61767236"],["Cocais",-19.865,-43.457,2803,"BR","Q62128689"],["Fidalgo (Pedro Leopoldo)",-19.534,-43.966,2595,"BR","Q61767099"],["Senador Mourão",-17.808,-43.419,2390,"BR","Q10370003"],["Brejaubinha",-18.776,-42.216,2328,"BR","Q18464151"],["Boa Vista da Serra",-19.929,-44.402,2305,"BR","Q61793444"],["Desembargador Otoni",-17.695,-43.333,2102,"BR","Q10265519"],["Hematita",-19.502,-43.009,1992,"BR","Q10294609"],["São João da Chapada",-18.088,-43.741,1581,"BR","Q10375812"],["Tabajara",-19.586,-41.769,1558,"BR","Q10377696"],["São Gonçalo do Rio das Pedras",-18.415,-43.495,1479,"BR","Q10267312"],["Planalto de Minas",-17.651,-43.322,1318,"BR","Q10350224"]]}
@@ -0,0 +1 @@
{"rows":[["Cana-Brava",-17.393,-45.834,3107,"BR","Q62032011"],["Luislândia do Oeste",-17.987,-45.607,3017,"BR","Q62030713"],["Canoeiros",-18.041,-45.521,1662,"BR","Q62032111"]]}
@@ -0,0 +1 @@
{"rows":[["Porto Esperidião",-15.853,-58.46,10204,"BR","Q2012385"],["Paradero",-18.992,-57.791,2022,"BO","Q1149273"]]}
@@ -0,0 +1 @@
{"rows":[["Zudáñez",-19.119,-64.701,13694,"BO","Q228153"],["Villa Vaca Guzmán",-19.894,-63.75,13282,"BO","Q842347"],["Pampagrande",-18.097,-64.116,10500,"BO","Q931053"],["Charagua",-19.792,-63.201,6780,"BO","Q1712242"],["San Javier",-16.275,-62.507,6048,"BO","Q281844"],["Rivas Palacio Colony",-18.171,-63.029,5728,"BO","Q134127576"],["Concepción",-16.132,-62.026,5586,"BO","Q751077"],["San Miguel de Velasco",-16.699,-60.968,4484,"BO","Q473144"],["Puerto Rico",-18.008,-63.393,4219,"BO","Q2117446"],["Nueva Esperanza Colony",-17.457,-60.57,3925,"BO","Q141708152"],["Mairana",-18.119,-63.956,3884,"BO","Q1003511"],["Entre Ríos",-17.197,-64.535,3796,"BO","Q1345127"],["Kansas Colony",-19.859,-63.059,3750,"BO","Q141635808"],["Pinondi",-19.771,-63.014,3139,"BO","Q141698923"],["Campanero",-17.734,-62.951,3020,"BO","Q1030202"],["Swift Current",-18.067,-63.043,2925,"BO","Q134127632"],["Durango Colony",-19.823,-62.848,2917,"BO","Q141706678"],["Villa Serrano",-19.123,-64.324,2877,"BO","Q842355"],["Valle Hermoso (Schöntal) Colony",-17.52,-61.111,2569,"BO","Q141708189"],["Belize Colony",-17.532,-62.113,2502,"BO","Q141708284"],["California Colony",-17.402,-61.448,2462,"BO","Q141708294"],["Tarabuco",-19.183,-64.915,2442,"BO","Q1982115"],["Abapó",-18.906,-63.399,2386,"BO","Q305531"],["Canadiense II Colony",-17.888,-62.577,2300,"BO","Q31838708"],["Valle Nuevo Colony",-17.817,-62.338,2262,"BO","Q56293233"],["El Dorado (Gnadenhof) Colony",-18.395,-63.024,2247,"BO","Q141680563"],["Manitoba Colony",-17.398,-61.974,2208,"BO","Q16888523"],["Santa Rita Colony",-17.948,-62.894,2194,"BO","Q141680520"],["Nuevo Mexico Colony",-17.576,-61,2150,"BO","Q141708170"],["Valle Esperanza",-17.178,-62.513,2121,"BO","Q141618235"],["Valle Esperanza Colony",-17.178,-62.513,2121,"BO","Q141711326"],["Santa Anita",-16.115,-64.828,2100,"BO","Q111770581"],["Pucará",-18.715,-64.184,2076,"BO","Q1563343"],["San Rafael de Velasco",-16.787,-60.674,2057,"BO","Q746773"],["La Honda Colony",-17.738,-60.29,1990,"BO","Q141707819"],["Berlin Colony",-17.562,-60.431,1943,"BO","Q141707821"],["Chihuahua Colony",-17.21,-62.117,1811,"BO","Q141618380"],["La Milagrosa Colony",-18.083,-62.014,1713,"BO","Q141710895"],["Tajibo (Nordenheim) Colony",-16.18,-61.341,1431,"BO","Q141706918"],["Valle de Merced",-16.325,-61.548,1396,"BO","Q141621054"],["El Tinto Colony",-17.774,-61.544,1332,"BO","Q141708249"],["Del Norte Colony",-17.112,-62.476,1290,"BO","Q141619105"],["Valle Roca Colony",-16.175,-61.59,1280,"BO","Q141706826"],["Yanahigua Colony",-17.003,-62.356,1262,"BO","Q141711319"],["Casa Grande",-19.708,-62.897,1229,"BO","Q141635833"],["Porvenir Oriente (Nordenhof) Colony",-16.214,-61.478,1197,"BO","Q141706910"],["Primavera Colony",-17.817,-61.247,1085,"BO","Q141708226"],["Oriente Colony",-17.826,-62.208,1063,"BO","Q105211245"]]}
@@ -0,0 +1 @@
{"rows":[["San Benito",-17.523,-65.894,13562,"BO","Q1416961"],["Chulumani",-16.41,-67.525,13204,"BO","Q1766619"],["Yunguyo",-16.244,-69.093,12625,"PE","Q2306609"],["Colquencha",-16.934,-68.249,12490,"BO","Q491521"],["Torotoro",-18.134,-65.763,10535,"BO","Q1001951"],["Achocalla",-16.568,-68.171,10369,"BO","Q340576"],["Achacachi",-16.044,-68.685,8857,"BO","Q1553175"],["Aiquile",-18.167,-65.167,7381,"BO","Q1617416"],["Colquiri",-17.397,-67.131,6610,"BO","Q1014448"],["Lahuachaca",-17.377,-67.675,5874,"BO","Q1800652"],["Uncía",-18.468,-66.565,5709,"BO","Q1642052"],["Betanzos",-19.553,-65.454,5021,"BO","Q830983"],["Ironcollo",-17.358,-66.284,4778,"BO","Q916733"],["Yucumo",-15.146,-67.034,4693,"BO","Q1646153"],["Santiago de Machaca",-17.067,-69.193,4593,"BO","Q1002013"],["Villa Porvenir",-16.826,-65.347,4258,"BO","Q21044734"],["Santuario de Quillacas",-19.233,-66.942,3983,"BO","Q2223784"],["Guanay",-15.498,-67.879,3890,"BO","Q959746"],["Sica Sica",-17.333,-67.739,3831,"BO","Q494377"],["Colomi",-17.338,-65.868,3699,"BO","Q990698"],["Arani",-17.573,-65.768,3512,"BO","Q1026281"],["Huara",-19.967,-69.767,3510,"CL","Q13081"],["Tarata",-17.611,-66.023,3323,"BO","Q1016289"],["Irpa Irpa",-17.717,-66.283,2721,"BO","Q1673170"],["Tipuani",-15.561,-67.983,2563,"BO","Q1026260"],["Huacullani",-16.63,-69.322,2466,"PE","Q130541392"],["Moho",-15.361,-69.5,2365,"PE","Q934450"],["Coroico",-16.189,-67.728,2319,"BO","Q1026263"],["Sorata",-15.774,-68.649,2217,"BO","Q1428069"],["Tolata",-17.534,-65.963,2207,"BO","Q590883"],["Ocurí",-18.843,-65.796,2200,"BO","Q2014005"],["German Busch",-16.994,-65.255,2000,"BO","Q130482643"],["Senda III",-16.995,-65.182,1980,"BO","Q106944598"],["Collana",-16.904,-68.284,1936,"BO","Q1108876"],["Coro Coro",-17.177,-68.454,1884,"BO","Q1353228"],["Irupana",-16.466,-67.455,1882,"BO","Q1014423"],["Colquechaca",-18.7,-66.004,1816,"BO","Q338235"],["Taraco",-15.298,-69.978,1804,"PE","Q130541372"],["Santa Rosa Eñe",-17.078,-65.223,1800,"BO","Q116908135"],["Amarete",-15.239,-68.984,1741,"BO","Q454982"],["Taquile Island",-15.777,-69.684,1700,"PE","Q1761551"],["Colchane",-19.275,-68.64,1649,"CL","Q3839"],["Totora",-17.736,-65.191,1597,"BO","Q2038566"],["Anzaldo",-17.833,-65.917,1576,"BO","Q614151"],["Apillapampa",-17.861,-66.257,1523,"BO","Q618627"],["Senda F",-16.874,-65.132,1511,"BO","Q106939562"],["Zepita",-16.497,-69.103,1503,"PE","Q8069335"],["Teoponte",-15.496,-67.819,1421,"BO","Q1026231"],["Santiváñez",-17.55,-66.25,1400,"BO","Q990723"],["Cojata",-15.015,-69.365,1378,"PE","Q130541369"],["Huatasani",-15.06,-69.802,1358,"PE","Q130541370"],["Camiña",-19.3,-69.417,1250,"CL","Q3731"],["Pisacoma",-16.908,-69.371,1225,"PE","Q130541391"],["Anapia",-16.314,-68.853,1207,"PE","Q130541422"],["Tacachi",-17.641,-65.806,1198,"BO","Q1516800"],["Palca",-16.561,-67.953,1180,"BO","Q1001975"],["Pilcuyo",-16.111,-69.554,1155,"PE","Q130541395"],["Puerto Acosta",-15.533,-69.252,1123,"BO","Q1866555"],["San Pedro de Buena Vista",-18.271,-65.981,1100,"BO","Q1001985"],["Paractito",-17.012,-65.456,1030,"BO","Q104878856"]]}
@@ -0,0 +1 @@
{"rows":[["Camaná",-16.624,-72.711,13304,"PE","Q1028011"],["Characato",-16.469,-71.484,12411,"PE","Q131412532"],["Tiabaya",-16.45,-71.591,10870,"PE","Q131412534"],["La Pampa",-16.614,-72.699,9194,"PE","Q17075166"],["Samegua",-17.182,-70.9,7950,"PE","Q137709489"],["Santa Rita de Siguas",-16.494,-72.094,6119,"PE","Q130598977"],["Cocachacra",-17.089,-71.759,5477,"PE","Q5775805"],["Islay",-17.002,-72.105,5132,"PE","Q27995444"],["Chivay",-15.633,-71.6,5000,"PE","Q2351933"],["Caravelí",-15.773,-73.366,5000,"PE","Q968765"],["San Gregorio",-16.573,-72.716,4532,"PE","Q130598988"],["Pueblo Nuevo",-17.612,-71.34,4437,"PE","Q137709501"],["Sabandia",-16.457,-71.495,3771,"PE","Q130598979"],["El Algarrobal",-17.617,-71.317,3694,"PE","Q5350720"],["Omate",-16.674,-70.97,3158,"PE","Q3322634"],["Estación de Pucará",-15.034,-70.338,3028,"PE","Q130541377"],["Bella Unión",-15.45,-74.658,2882,"PE","Q130598995"],["Aplao",-16.083,-72.5,2860,"PE","Q2423691"],["Mañazo",-15.801,-70.343,2658,"PE","Q130541434"],["La Curva",-17.144,-71.821,2536,"PE","Q130598984"],["Deustua",-15.642,-70.35,2231,"PE","Q130541439"],["Laraqueri",-16.15,-70.064,2202,"PE","Q130541429"],["Pucará",-15.042,-70.368,1832,"PE","Q11286696"],["Cotahuasi",-15.213,-72.888,1529,"PE","Q2638258"],["Arapa",-15.139,-70.11,1502,"PE","Q130541374"],["Yauca",-15.662,-74.527,1468,"PE","Q129209417"],["Pampacolca",-15.714,-72.574,1438,"PE","Q131412525"],["Lomas",-15.57,-74.851,1402,"PE","Q130598993"],["Jaquí",-15.479,-74.444,1400,"PE","Q130598997"],["Ocoña",-16.432,-73.105,1365,"PE","Q130598989"],["Huancarqui",-16.096,-72.472,1256,"PE","Q130599002"],["Uchumayo",-16.425,-71.673,1244,"PE","Q27500860"],["Vítor",-16.466,-71.935,1126,"PE","Q130598982"],["Viraco",-15.658,-72.525,1102,"PE","Q131412527"],["Cabanilla",-15.62,-70.346,1098,"PE","Q27831775"],["San José",-16.62,-72.736,1090,"PE","Q130598986"],["Chumpi",-15.095,-73.748,1080,"PE","Q131324815"]]}
@@ -0,0 +1 @@
{"rows":[["Outapi",-17.503,14.986,13664,"NA","Q1758215"],["Opuwo",-18.061,13.84,12331,"NA","Q1024089"],["Ruacana",-17.433,14.35,5939,"NA","Q1013946"],["Kamanjab",-19.629,14.845,3915,"NA","Q1699191"],["Eheke",-17.833,14.867,1115,"NA","Q5348569"]]}
@@ -0,0 +1 @@
{"rows":[["Broome",-17.962,122.236,14660,"AU","Q606294"],["Cable Beach",-17.933,122.214,5730,"AU","Q55819367"],["Djugun",-17.941,122.231,3291,"AU","Q31436896"],["Derby",-17.311,123.635,3222,"AU","Q1018373"],["Bilingurr",-17.925,122.234,1540,"AU","Q31440680"],["St George Ranges",-18.795,124.166,1240,"AU","Q31431747"]]}
@@ -0,0 +1 @@
{"rows":[["Kununurra",-15.774,128.739,5494,"AU","Q1110973"],["Halls Creek",-18.23,127.67,1605,"AU","Q992686"],["Fitzroy Crossing",-18.178,125.591,1297,"AU","Q1421393"]]}
@@ -0,0 +1 @@
{"rows":[["Tennant Creek",-19.647,134.19,3080,"AU","Q18015"]]}
@@ -0,0 +1 @@
{"rows":[["Lumina",-16.225,137.123,2558,"","Q104434355"],["Doomadgee",-17.942,138.828,1405,"AU","Q2022784"],["Wellesley Islands",-16.573,139.349,1136,"AU","Q1756163"],["Gununa",-16.666,139.181,1022,"AU","Q13365146"]]}
@@ -0,0 +1 @@
{"rows":[["Normanton",-17.676,141.084,1391,"AU","Q1021888"],["Kowanyama",-15.477,141.744,1079,"AU","Q6435007"]]}
Loaded 100 of 1337 files, more files were not shown because too many files have changed in this diff. Show more