mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Traffic roads come from OpenFreeMap vector tiles, or TomTom flow tiles with a key (Hybrid by default). Military areas use OpenFreeMap polygons with a bundled worldwide name index; wide views show named points. ALPR reads an hourly OpenStreetMap extract. Cockpit place context and country, state and US county outlines use bundled Natural Earth and US Census data. Overpass is used only when an operator configures their own endpoint. Also: camera arrivals no longer land below ground, keyless terrain retries on 429, bounded relation geometry for configured Overpass, one shared OpenStreetMap credit, and separate tile and API transports for embedders. Co-authored-by: theGaryLarson <[email protected]> Co-authored-by: Milan Khanal <[email protected]>
This commit is contained in:
200 files changed
+26665
-1977
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import { createQueries } from './queries.js';
|
||||
import { createSubject } from './subject.js';
|
||||
import { createControls } from '../installations/controls.js';
|
||||
import { createModel } from '../installations/model.js';
|
||||
import { summarizeAwarenessCohort } from '../../data/militaryAwarenessEngine.js';
|
||||
|
||||
test('Contacts excludes square corners and measures from the current moving subject', () => {
|
||||
const records = [
|
||||
{ id: 'corner', kind: 'installation', latitude: 90 / 111.195, longitude: 90 / 111.195 },
|
||||
{ id: 'east', kind: 'installation', latitude: 0, longitude: 90 / 111.195 },
|
||||
{ id: 'west', kind: 'installation', latitude: 0, longitude: -90 / 111.195 },
|
||||
];
|
||||
const installationState = { records, contextAnchor: { latitude: 0, longitude: 0 },
|
||||
lastUpdate: 1, status: 'ready', coverage: { kind: 'subject', radiusM: 100000 },
|
||||
distanceEndpointScratch: new Cesium.Cartographic(),
|
||||
distanceGeodesicScratch: new Cesium.EllipsoidGeodesic(),
|
||||
};
|
||||
const installationParts = { rendering: { installationSurfaceHeightM: () => 0 } };
|
||||
installationParts.model = createModel({ state: installationState, parts: installationParts });
|
||||
const installations = createControls({ state: installationState, parts: installationParts }).methods;
|
||||
const services = { installations, flights: { getNearby: () => [] },
|
||||
military: { getNearby: () => [] }, vessels: { getNearby: () => [] } };
|
||||
const parts = { navigation: { summarizeAwarenessCohortForNavigation: (items, source) =>
|
||||
summarizeAwarenessCohort(items, source) } };
|
||||
parts.queries = createQueries({ state: {}, services, parts });
|
||||
const subjectOwner = createSubject({ state: {}, services, parts });
|
||||
const states = Object.fromEntries(['flights', 'military', 'ais-live-vessels', 'military-installations']
|
||||
.map((id) => [id, { available: true, stats: {} }]));
|
||||
states['military-installations'].stats.coverage = { kind: 'subject', radiusM: 100000 };
|
||||
const evaluate = (lon) => subjectOwner.evaluateSubject({
|
||||
id: 'moving', layerId: 'flights', position: Cesium.Cartesian3.fromDegrees(lon, 0, 10000),
|
||||
}, states).cohorts[3].summary;
|
||||
installations.setContextAnchor({ latitude: 0, longitude: 0 });
|
||||
const first = evaluate(0);
|
||||
assert.equal(first.count, 2);
|
||||
assert.ok(!first.nearest.some((item) => item.id === 'corner'), '90 km N + 90 km E is outside the disk');
|
||||
assert.equal(installations.getStats().count, 2);
|
||||
assert.equal(installations.getStats().statusMessage, '2 mapped sites within 100 km of the contact');
|
||||
installations.setContextAnchor({ latitude: 0, longitude: 19 / 111.195 });
|
||||
const moved = evaluate(19 / 111.195);
|
||||
assert.equal(installations.getStats().count, 1);
|
||||
assert.equal(installations.getStats().statusMessage, '1 mapped site within 100 km of the contact');
|
||||
assert.equal(moved.count, 1, 'west site leaves the radius before the fetch anchor refreshes');
|
||||
assert.equal(moved.nearest[0].id, 'east');
|
||||
assert.equal(moved.reason, 'mapped matches within 100 km of the subject');
|
||||
assert.deepEqual(installationState.contextAnchor, { latitude: 0, longitude: 0 });
|
||||
});
|
||||
Reference in new issue
Block a user