mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-11 13:52:19 +00:00
fix(satellites): a hidden class stays out of analyst and voice answers; the tracked satellite still answers
This commit is contained in:
1 parent
b59eb8b18c
commit
7dcf671b2e
3 files changed
+62
-1
No files matched your search
@@ -152,3 +152,52 @@ test('satellite getAnalystRecords: core rows beat dense extras under the cap', (
|
|||||||
_clearDenseCatalogStateForTest();
|
_clearDenseCatalogStateForTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('satellite getAnalystRecords: a hidden class stays out, the tracked one stays in', () => {
|
||||||
|
const satrec = twoline2satrec(ISS_L1, ISS_L2);
|
||||||
|
const at = (lon, alt) => ({
|
||||||
|
position: Cesium.Cartesian3.fromDegrees(lon, 10, alt),
|
||||||
|
});
|
||||||
|
_setTrackedSatelliteRefreshStateForTest({
|
||||||
|
noradId: ISS_NORAD,
|
||||||
|
name: 'ISS (ZARYA)',
|
||||||
|
satrec,
|
||||||
|
entity: {},
|
||||||
|
point: at(-97, 420_000),
|
||||||
|
viewer: {},
|
||||||
|
now: () => Date.now(),
|
||||||
|
satelliteClass: 'stations',
|
||||||
|
classes: {
|
||||||
|
stations: false,
|
||||||
|
imaging: true,
|
||||||
|
telecom: false,
|
||||||
|
starlink: false,
|
||||||
|
probes: true,
|
||||||
|
debris: true,
|
||||||
|
},
|
||||||
|
neighbours: [
|
||||||
|
{
|
||||||
|
noradId: 24876,
|
||||||
|
name: 'GPS BIIR-2',
|
||||||
|
group: 'gps-ops',
|
||||||
|
satelliteClass: 'telecom',
|
||||||
|
point: at(-100, 20_200_000),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
noradId: 90001,
|
||||||
|
name: 'TEST IMAGER',
|
||||||
|
group: 'resource',
|
||||||
|
satelliteClass: 'imaging',
|
||||||
|
point: at(-80, 700_000),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
assert.deepEqual(
|
||||||
|
satellitesLayer.getAnalystRecords(10).map((r) => r.noradId),
|
||||||
|
['25544', '90001'],
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
_clearDenseCatalogStateForTest();
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -86,6 +86,12 @@ export function createRecords({ state, parts }) {
|
|||||||
const result = [];
|
const result = [];
|
||||||
const emit = (noradId, sat) => {
|
const emit = (noradId, sat) => {
|
||||||
if (result.length >= limit) return false;
|
if (result.length >= limit) return false;
|
||||||
|
// A class the user hid stays out of answers too; the tracked one stays.
|
||||||
|
if (
|
||||||
|
noradId !== state._trackedNorad &&
|
||||||
|
parts.controls?._classVisible?.(noradId) === false
|
||||||
|
)
|
||||||
|
return true;
|
||||||
const pos = analystGeo(noradId, sat, now);
|
const pos = analystGeo(noradId, sat, now);
|
||||||
if (!pos) return true;
|
if (!pos) return true;
|
||||||
result.push(
|
result.push(
|
||||||
|
|||||||
@@ -26,10 +26,14 @@ export function createTesting({ state: layerState, services, parts, source }) {
|
|||||||
// Extra catalog/point rows so a test can exercise a docked cluster (and a
|
// Extra catalog/point rows so a test can exercise a docked cluster (and a
|
||||||
// control satellite that must NOT be treated as part of it).
|
// control satellite that must NOT be treated as part of it).
|
||||||
neighbours = [],
|
neighbours = [],
|
||||||
|
// Optional class of the tracked satellite and class visibility, e.g.
|
||||||
|
// { telecom: false }.
|
||||||
|
satelliteClass = undefined,
|
||||||
|
classes = null,
|
||||||
}) {
|
}) {
|
||||||
layerState._viewer = viewer;
|
layerState._viewer = viewer;
|
||||||
layerState._catalog = new Map([
|
layerState._catalog = new Map([
|
||||||
[noradId, { name, satrec, group: 'stations' }],
|
[noradId, { name, satrec, group: 'stations', satelliteClass }],
|
||||||
]);
|
]);
|
||||||
layerState._points = new Map([[noradId, point]]);
|
layerState._points = new Map([[noradId, point]]);
|
||||||
for (const neighbour of neighbours) {
|
for (const neighbour of neighbours) {
|
||||||
@@ -37,6 +41,7 @@ export function createTesting({ state: layerState, services, parts, source }) {
|
|||||||
name: neighbour.name,
|
name: neighbour.name,
|
||||||
satrec: neighbour.satrec || satrec,
|
satrec: neighbour.satrec || satrec,
|
||||||
group: neighbour.group || 'stations',
|
group: neighbour.group || 'stations',
|
||||||
|
satelliteClass: neighbour.satelliteClass,
|
||||||
});
|
});
|
||||||
layerState._points.set(neighbour.noradId, neighbour.point);
|
layerState._points.set(neighbour.noradId, neighbour.point);
|
||||||
}
|
}
|
||||||
@@ -51,6 +56,7 @@ export function createTesting({ state: layerState, services, parts, source }) {
|
|||||||
catalog: 'core',
|
catalog: 'core',
|
||||||
showPoints: false,
|
showPoints: false,
|
||||||
showOrbits: false,
|
showOrbits: false,
|
||||||
|
...(classes ? { classes } : {}),
|
||||||
};
|
};
|
||||||
layerState._enabled = true;
|
layerState._enabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user