mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
fix(cockpit): the bridge radar matches the view out of the window
The radar centred on the ship's last AIS fix while the camera rode that fix dead-reckoned up to 180 s ahead: at 20 kn about a nautical mile apart, so a ship already passed still showed ahead. Own ship now sits where the camera rides and each contact is dead-reckoned to the same moment; the query reaches past the range for ships that have since moved into it. Ships with no MMSI each get a key of their own instead of all sharing an empty one on the scope.
This commit is contained in:
1 parent
18c15d0352
commit
052731202d
9 files changed
+154
-29
No files matched your search
@@ -91,6 +91,11 @@ test('radar contacts are within range, nearest first and capped', () => {
|
||||
type: '70',
|
||||
color: vesselTypeCss('70'),
|
||||
stale: false,
|
||||
motionCourse: 45,
|
||||
velocityMps: 10 * 0.514444,
|
||||
fixEpochMs: null,
|
||||
receivedAtMs: null,
|
||||
feedEpochMs: null,
|
||||
});
|
||||
assert.equal(contacts[1].course, null);
|
||||
assert.equal(contacts[1].heading, null);
|
||||
@@ -112,6 +117,17 @@ test('the ship whose bridge the Cockpit rides is not its own contact', () => {
|
||||
assert.equal(layer.getRadarContacts(54.5, 10.2, 6 * 1852).length, 2);
|
||||
});
|
||||
|
||||
test('ships with no MMSI each keep a key of their own', () => {
|
||||
const layer = layerWith([
|
||||
record('', 1, { name: 'A' }),
|
||||
record('', 2, { name: 'B' }),
|
||||
]);
|
||||
const ids = layer.getRadarContacts(54.5, 10.2, 6 * 1852).map((c) => c.id);
|
||||
assert.equal(ids.length, 2);
|
||||
assert.equal(new Set(ids).size, 2, ids.join(', '));
|
||||
assert.ok(ids.every((id) => id.startsWith('unkeyed:')));
|
||||
});
|
||||
|
||||
test('a disabled layer has no radar contacts', () => {
|
||||
const layer = layerWith([record('1', 1)], { enabled: false });
|
||||
assert.deepEqual(layer.getRadarContacts(54.5, 10.2, 6 * 1852), []);
|
||||
|
||||
Reference in new issue
Block a user