mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +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]>
66 lines
2.3 KiB
JavaScript
66 lines
2.3 KiB
JavaScript
import { TRAFFIC_TIMING_ENABLED } from './policy.js';
|
|
import { createStyle } from './style.js';
|
|
import { createTiming } from './timing.js';
|
|
import { createModel } from './model.js';
|
|
import { createIngestion } from './ingestion.js';
|
|
import { createAnimation } from './animation.js';
|
|
import { createViewport } from './viewport.js';
|
|
import { createFlow } from './flow.js';
|
|
import { createRendering } from './rendering.js';
|
|
import { createControls } from './controls.js';
|
|
import { createLifecycle } from './lifecycle.js';
|
|
import { createRetention } from './retention.js';
|
|
import { createState } from './state.js';
|
|
|
|
/** Construct one layer with its own scene state and supplied application services. */
|
|
export function createTrafficLayer({ services, source }) {
|
|
if (
|
|
![
|
|
'requestRoads',
|
|
'getStatus',
|
|
'fetchFlowForBounds',
|
|
'getFlowSessionStats',
|
|
'resetFlowTileCache',
|
|
].every((key) => typeof source?.[key] === 'function')
|
|
)
|
|
throw new TypeError('A traffic source is required');
|
|
const state = createState({ services });
|
|
const parts = {};
|
|
const context = { state, services, parts, source };
|
|
parts.style = createStyle(context);
|
|
parts.timing = createTiming(context);
|
|
parts.model = createModel(context);
|
|
parts.ingestion = createIngestion(context);
|
|
parts.animation = createAnimation(context);
|
|
parts.viewport = createViewport(context);
|
|
parts.flow = createFlow(context);
|
|
parts.retention = createRetention(context);
|
|
parts.rendering = createRendering(context);
|
|
parts.controls = createControls(context);
|
|
parts.lifecycle = createLifecycle(context);
|
|
state._parseRoads = TRAFFIC_TIMING_ENABLED
|
|
? (data, trace) =>
|
|
trace
|
|
? parts.timing.parseRoadsTimed(data, trace)
|
|
: parts.model.parseRoads(data)
|
|
: parts.model.parseRoads;
|
|
|
|
state._loadRoadsForBounds = TRAFFIC_TIMING_ENABLED
|
|
? parts.timing.loadRoadsForBoundsTimed
|
|
: parts.ingestion.loadRoadsForBounds;
|
|
|
|
return Object.assign(
|
|
{},
|
|
parts.controls.methods,
|
|
parts.lifecycle.methods,
|
|
parts.ingestion?.methods,
|
|
{
|
|
getTrafficTimingDiagnostics: parts.timing.getTrafficTimingDiagnostics,
|
|
deriveTrafficFlowError: parts.flow.deriveTrafficFlowError,
|
|
trafficFeedPresentation: parts.model.trafficFeedPresentation,
|
|
},
|
|
);
|
|
}
|
|
|
|
export { createTrafficSource } from './source.js';
|