mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Sprites for helicopters, ground vehicles, stations and vessel types; history to live without an empty map; model parts in Cesium
Aircraft icons are one size; helicopters turn a three-frame rotor while airborne or moving; ADS-B ground vehicles share one amber sprite and stations/obstacles one mast; vessels get hull sprites by type and one buoy. Going live keeps contacts until the first live answer and replaces them by id; fast playback holds before the loaded positions end and prefetches ahead. Cesium models move their parts from the optional model part state.
This commit is contained in:
1 parent
624c229bc2
commit
7186f720df
97 files changed
+6586
-343
No files matched your search
@@ -38,6 +38,29 @@ function courseBetween(from, to) {
|
||||
return (toDegrees(Math.atan2(y, x)) + 360) % 360;
|
||||
}
|
||||
|
||||
/**
|
||||
* Where in `fixes` (in time order) the fixes to make begin: the last at or
|
||||
* before the newest a contact holds, so the held run goes on into the new
|
||||
* one and its seam is made again from the new run (its course heads where
|
||||
* the new run goes, at the new record's height), and those after it. 0
|
||||
* unless `history` is its own fixes around a time (`timeline` entries) and
|
||||
* `fixes` starts at or before the newest of them and reaches it.
|
||||
* @param {object[]|undefined} history
|
||||
* @param {Array<{atMs: number}>} fixes
|
||||
* @returns {number}
|
||||
*/
|
||||
function heldThrough(history, fixes) {
|
||||
const newest = history?.[history.length - 1];
|
||||
if (!newest || history[0].timeline !== true || newest.timeline !== true)
|
||||
return 0;
|
||||
const heldMs = newest.epochMs;
|
||||
if (!(fixes[0].atMs <= heldMs && fixes[fixes.length - 1].atMs >= heldMs))
|
||||
return 0;
|
||||
let index = 0;
|
||||
while (index < fixes.length && fixes[index].atMs <= heldMs) index++;
|
||||
return index - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* An aircraft's motion history with the fixes its record carries at a time
|
||||
* (`observation.fixes`, see src/time/timelineFixes.js) merged in, so the
|
||||
@@ -65,7 +88,12 @@ export function mergeAircraftTimelineFixes(
|
||||
const baroM = Number.isFinite(observation.baroAltitudeM)
|
||||
? observation.baroAltitudeM
|
||||
: null;
|
||||
const entries = fixes.map((fix, index) => {
|
||||
// Playing on, the next snapshot's fixes mostly repeat those held: when its
|
||||
// run reaches back into the held fixes, those stay as they are and only
|
||||
// the seam and the fixes past it are made and added.
|
||||
const from = heldThrough(history, fixes);
|
||||
const entries = fixes.slice(from).map((fix, offset) => {
|
||||
const index = from + offset;
|
||||
const course =
|
||||
index + 1 < fixes.length
|
||||
? courseBetween(fix, fixes[index + 1])
|
||||
|
||||
Reference in new issue
Block a user