mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Draw no buoy for a virtual aid to navigation
A virtual aid (AIS message 21's VirtualAtoN flag) is a mark broadcast where nothing physical stands, so drawing it as a buoy showed a mark that is not there. The vessel source record now carries `virtual` (false unless a source says true; any source may set it), AISStream sets it from VirtualAtoN, and the vessel layer keeps such an aid's disc: vesselModelSpec returns null for it and the layer gathers no model item for it. Its card, selected card and readout add VIRTUAL after its kind.
This commit is contained in:
1 parent
9ae121c7c0
commit
52507a0755
31 files changed
+160
-18
No files matched your search
@@ -536,6 +536,29 @@ test('an aid to navigation is drawn as a disc, a vessel as its chevron', async (
|
||||
return atob(primitive.image.split(',')[1]);
|
||||
};
|
||||
assert.match(svgOf('993672001'), /<circle/);
|
||||
// The source's virtual flag reaches the layer's record.
|
||||
const recordOf = (id) => [...primitives].find((p) => p.id?.id === id).id;
|
||||
assert.equal(recordOf('993672001').virtual, false);
|
||||
assert.equal(recordOf('366999002').virtual, false);
|
||||
assert.doesNotMatch(svgOf('993672001'), /<path/);
|
||||
assert.match(svgOf('366999002'), /<path/);
|
||||
});
|
||||
|
||||
test('a virtual aid to navigation keeps its disc and its virtual flag', async () => {
|
||||
const aid = {
|
||||
...observation('993672009'),
|
||||
mmsi: '993672009',
|
||||
type: 'Isolated danger',
|
||||
virtual: true,
|
||||
};
|
||||
const { layer, primitives } = setup({
|
||||
async getSnapshot() {
|
||||
return snapshot([aid]);
|
||||
},
|
||||
});
|
||||
await layer.update();
|
||||
const primitive = [...primitives].find((p) => p.id?.id === '993672009');
|
||||
assert.ok(primitive);
|
||||
assert.equal(primitive.id.virtual, true);
|
||||
assert.match(atob(primitive.image.split(',')[1]), /<circle/);
|
||||
});
|
||||
Reference in new issue
Block a user