mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Settle a line outline's width as the whole outline, half on each side
A solid line's outline.widthPx is the outline in all, half on each side and inside the line's width, as Cesium draws it. The range ring's pulse fronts pass their halo width whole again, so they keep main's look, and the conformance check draw.lines.outline pins the width. The lines scene's outlined line keeps its 2 px edge each side and its references are re-recorded.
This commit is contained in:
1 parent
94138d9698
commit
149f8aad4d
12 files changed
+94
-16
No files matched your search
@@ -5798,7 +5798,7 @@ silently demoting every later lookup for the session.
|
||||
- On activation it focuses the nearest currently observed aircraft across the civilian and military feeds, with military winning an exact distance tie; if none are available, it focuses an observed AIS vessel. The aircraft search is deliberately uncapped and one refresh-tick retry handles initially empty feeds. This is an attention-priority navigation shortcut, not a high-risk, affiliation, or threat classification.
|
||||
- A selected aircraft, AIS vessel, or mapped installation gets a 250 km **context window** with nearby cohort counts, nearest examples, source labels, and stale/unavailable reasons. It emits `NEARBY` or `UNKNOWN`; no detection, engagement, affiliation, or sensor-activity conclusion is calculated.
|
||||
- Contacts rows and the Cockpit Contact counts name each cohort's provider: the source of the last snapshot, marked `FALLBACK` or `STALE` as its layer row would be. A poll in flight keeps the mark, where the layer row shows `LOADING`. A flight snapshot from the adsb.lol regional fallback reads `adsb.lol · FALLBACK`, not `OpenSky`.
|
||||
- The window's edge is drawn on the globe as a 250 km range ring: a 4 px polyline with a 2 px Context-blue core inside a 1 px dark halo on each side, 2.5 km above the ellipsoid (`AWARENESS_RANGE_RING_STYLE` in `src/layers/awareness/policy.js`). The halo keeps it legible over bright desert and snow, dark ocean and forest, and under the FLIR, NVG and CRT styles, where the earlier 1 px ellipse outline disappeared. It is one outlined line in an unpickable draw-port line set (`src/layers/awareness/rangeRing.js`), so a click or tap on its edge reaches the contact underneath; the halo is the line's own outline, so the translucent core and halo never darken where they meet; it moves when the subject moves. Three dim sonar pulses (3 px with a dark edge half a pixel wide on each side, same colours, at most 60% opacity), each an outlined line in the same set, grow slowly from the subject at constant speed, one every 3 s and each taking 9 s, and arrive at the ring at about a third of that. Behind each pulse a radial gradient in the same blue fades inward over 35% of the radius: one unpickable flat ellipse 2.5 km up with 270 km semi-axes, filled with a 256-pixel canvas painted with the band (two canvases in turn, each under a new key). The ellipse stands until the subject has moved 20 km from where it was built, the canvas keeping the band concentric with the subject meanwhile, and not at all while the pulses rest. Fronts and band are fixed in the world, so they step every 80 ms however many frames are drawn and look the same whether the camera moves or not; crossing the 2.5 km rim height shows or hides them at once. While the camera is below the band's 2.5 km height, where it would sweep across the sky, the pulses rest: the band and fronts are hidden and there is no ring flash, no echo and no frame request. Terrain or 3D tiles higher than 2.5 km (the Alps, Andes, Rockies) still cut through the band and the ring when seen from above, as the ring alone already did; the height check uses the camera's height above the ellipsoid, not above the ground. While pulses run, the ring dims to 40% and flashes to full strength as each pulse reaches it, fading over 1.8 s. As a pulse front crosses a flight, military aircraft or AIS vessel, the detection overlay draws a second bracket around that contact's own bracket, in the pulse blue on the default detection style and in the style's own line colour under NVG, FLIR and CRT, which spreads outward as it fades over 1.4 s (`AWARENESS_RANGE_ECHO`, read through `src/awarenessEcho.js`; no layer's icon is restyled, and mapped installations have no detection bracket). Pulses are born 5 km out, so the subject itself and anything nearer never echo. Pulses run for 9 s (three ring flashes) after a selection or a camera move, fading in and out over 1.2 s, then rest: the ring stays on screen at full strength, the pulses, gradient and echoes are hidden, and nothing asks for frames, so a parked Contacts view is quiet again. Only a camera move within 1.5 s of the user handling the map (pointer, wheel or touch on the Cesium canvas, which covers a drag's inertia, and a drag or touch begun there keeps counting until its last finger or button lifts, even outside the canvas, unless the window loses focus or the page is hidden first; keys typed elsewhere do not count, nor does input while Cesium's camera controls are off, as in the cockpit view, and a gesture still pending when the cockpit or another owner takes the camera is dropped) wakes them; a moving subject and the app's own camera moves (a tracked aircraft, the cockpit view, an orbit, a fly-to) do not, since they move on every refresh. While they run they never hold continuous rendering: each drawn frame arms one step 80 ms later (the Cyber sonar cadence, `CYBER_SONAR_RENDER_INTERVAL_MS`) whose changes ask for the frame that draws them, so a parked view repaints at about 12.5 fps, one frame a step, and never beats the detection lane's 80 ms gate. Under `prefers-reduced-motion`, or on a renderer without frame hooks, there are no pulses or echoes and the ring stays on screen; changing the preference mid-session rebuilds the ring. The ring follows a moving subject once it has moved 250 m.
|
||||
- The window's edge is drawn on the globe as a 250 km range ring: a 4 px polyline whose outer 1 px, half a pixel on each side, is a dark halo around a 3 px Context-blue core, 2.5 km above the ellipsoid (`AWARENESS_RANGE_RING_STYLE` in `src/layers/awareness/policy.js`). The halo keeps it legible over bright desert and snow, dark ocean and forest, and under the FLIR, NVG and CRT styles, where the earlier 1 px ellipse outline disappeared. It is one outlined line in an unpickable draw-port line set (`src/layers/awareness/rangeRing.js`), so a click or tap on its edge reaches the contact underneath; the halo is the line's own outline, so the translucent core and halo never darken where they meet; it moves when the subject moves. Three dim sonar pulses (3 px with a dark edge half a pixel wide on each side, same colours, at most 60% opacity), each an outlined line in the same set, grow slowly from the subject at constant speed, one every 3 s and each taking 9 s, and arrive at the ring at about a third of that. Behind each pulse a radial gradient in the same blue fades inward over 35% of the radius: one unpickable flat ellipse 2.5 km up with 270 km semi-axes, filled with a 256-pixel canvas painted with the band (two canvases in turn, each under a new key). The ellipse stands until the subject has moved 20 km from where it was built, the canvas keeping the band concentric with the subject meanwhile, and not at all while the pulses rest. Fronts and band are fixed in the world, so they step every 80 ms however many frames are drawn and look the same whether the camera moves or not; crossing the 2.5 km rim height shows or hides them at once. While the camera is below the band's 2.5 km height, where it would sweep across the sky, the pulses rest: the band and fronts are hidden and there is no ring flash, no echo and no frame request. Terrain or 3D tiles higher than 2.5 km (the Alps, Andes, Rockies) still cut through the band and the ring when seen from above, as the ring alone already did; the height check uses the camera's height above the ellipsoid, not above the ground. While pulses run, the ring dims to 40% and flashes to full strength as each pulse reaches it, fading over 1.8 s. As a pulse front crosses a flight, military aircraft or AIS vessel, the detection overlay draws a second bracket around that contact's own bracket, in the pulse blue on the default detection style and in the style's own line colour under NVG, FLIR and CRT, which spreads outward as it fades over 1.4 s (`AWARENESS_RANGE_ECHO`, read through `src/awarenessEcho.js`; no layer's icon is restyled, and mapped installations have no detection bracket). Pulses are born 5 km out, so the subject itself and anything nearer never echo. Pulses run for 9 s (three ring flashes) after a selection or a camera move, fading in and out over 1.2 s, then rest: the ring stays on screen at full strength, the pulses, gradient and echoes are hidden, and nothing asks for frames, so a parked Contacts view is quiet again. Only a camera move within 1.5 s of the user handling the map (pointer, wheel or touch on the Cesium canvas, which covers a drag's inertia, and a drag or touch begun there keeps counting until its last finger or button lifts, even outside the canvas, unless the window loses focus or the page is hidden first; keys typed elsewhere do not count, nor does input while Cesium's camera controls are off, as in the cockpit view, and a gesture still pending when the cockpit or another owner takes the camera is dropped) wakes them; a moving subject and the app's own camera moves (a tracked aircraft, the cockpit view, an orbit, a fly-to) do not, since they move on every refresh. While they run they never hold continuous rendering: each drawn frame arms one step 80 ms later (the Cyber sonar cadence, `CYBER_SONAR_RENDER_INTERVAL_MS`) whose changes ask for the frame that draws them, so a parked view repaints at about 12.5 fps, one frame a step, and never beats the detection lane's 80 ms gate. Under `prefers-reduced-motion`, or on a renderer without frame hooks, there are no pulses or echoes and the ring stays on screen; changing the preference mid-session rebuilds the ring. The ring follows a moving subject once it has moved 250 m.
|
||||
- For a selected live aircraft or vessel, the context window refreshes from the existing tracker/feed position every 750 ms, so nearest distances and cohort counts follow the subject without introducing a duplicate poll loop.
|
||||
- Aircraft cohort membership uses every locally loaded, selectable contact inside the 250 km window, including a plane hidden only by horizon culling or because its 3D model owns the visual. Counts and navigation therefore do not change with the current camera angle or billboard/model handoff.
|
||||
- Nearby examples in the context panel are focus controls: they use their owning layer's existing selection/tracking path, then frame that contact. Static-installation distances use ellipsoidal surface distance so the count matches the ground-projected context disk.
|
||||
|
||||
@@ -81,6 +81,10 @@ optional, so a renderer written before it still conforms:
|
||||
- A line item's `depthFail` style, solid or dashed, draws the parts behind
|
||||
the surface (the Draw tool's rubber band is dashed there too); without one
|
||||
they are hidden.
|
||||
- A solid line's `outline.widthPx` is the outline's whole width, half on
|
||||
each side, inside the line's own width: an 8 px line with a 4 px outline
|
||||
is 2 px of outline, 4 px of colour and 2 px of outline, as Cesium draws
|
||||
it. The check `draw.lines.outline` pins it.
|
||||
- A shape's `lit` chooses shading by the renderer's fixed light (true) or a
|
||||
flat colour (false); omitted, extruded shapes and boxes are lit and the
|
||||
rest flat, as before. The Cesium port lights unclamped shapes only
|
||||
|
||||
@@ -49,7 +49,8 @@ export const CONTEXT_RIM_HEIGHT_M = 2500;
|
||||
* the FLIR, NVG and CRT styles. A bright core inside a dark halo keeps
|
||||
* luminance contrast on light and dark ground alike, and luminance is what
|
||||
* the monochrome styles keep. The core is the Context panel's blue; the halo
|
||||
* is the map-card ink. Widths are screen pixels; `outlineWidth` is per side.
|
||||
* is the map-card ink. Widths are screen pixels; `outlineWidth` is the
|
||||
* halo's width in all, half on each side.
|
||||
* It is drawn as an unpickable primitive, so clicks on its edge reach the
|
||||
* contacts underneath.
|
||||
* While the sonar pulses run, the ring dims to `restOpacity` and flashes
|
||||
|
||||
@@ -189,8 +189,9 @@ function rgba(css) {
|
||||
const faded = ([r, g, b, a], alpha) => [r, g, b, a * alpha];
|
||||
|
||||
/**
|
||||
* A haloed line as the draw port draws it: `widthPx` wide, its outer
|
||||
* `haloPx` on each side in the halo's colour, the rest in the core's.
|
||||
* A haloed line as the draw port draws it: `widthPx` wide, an outer
|
||||
* `haloPx` in all (half on each side) in the halo's colour, the rest in the
|
||||
* core's.
|
||||
* @returns {object} The line item.
|
||||
*/
|
||||
const haloedLine = (id, positions, { core, halo, widthPx, haloPx, show }) => ({
|
||||
@@ -561,8 +562,7 @@ export function createRangeRing({
|
||||
core: faded(core, state.alpha * level),
|
||||
halo: faded(halo, state.alpha * level),
|
||||
widthPx: pulse.width,
|
||||
// The fronts' `outlineWidth` is both sides together.
|
||||
haloPx: pulse.outlineWidth / 2,
|
||||
haloPx: pulse.outlineWidth,
|
||||
show: level > 0,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -363,10 +363,10 @@ test('the ring core and halo contrast on light and dark ground', () => {
|
||||
const ratio = (luminance(core) + 0.05) / (luminance(halo) + 0.05);
|
||||
assert.ok(ratio >= 4.5, `core:halo contrast ${ratio.toFixed(2)}`);
|
||||
assert.ok(core.alpha >= 0.9 && halo.alpha >= 0.7);
|
||||
// A visible halo on each side of a core at least 2 px wide.
|
||||
// A visible halo, half on each side, around a core at least 2 px wide.
|
||||
const { width, outlineWidth } = AWARENESS_RANGE_RING_STYLE;
|
||||
assert.ok(outlineWidth >= 1);
|
||||
assert.ok(width - 2 * outlineWidth >= 2);
|
||||
assert.ok(width - outlineWidth >= 2);
|
||||
});
|
||||
|
||||
test('renderVisual draws the ring as a haloed line in an unpickable set, never an entity', (t) => {
|
||||
@@ -1126,9 +1126,10 @@ test('the band is one flat unpickable ellipse at the rim, drawn anew each step a
|
||||
assert.equal(core.show, true);
|
||||
assert.equal(core.widthPx, AWARENESS_RANGE_PULSE.width);
|
||||
assert.equal(halo.style.color.length, 4);
|
||||
// The outline is the halo's width in all, half on each side.
|
||||
assert.equal(
|
||||
core.style.outline.widthPx,
|
||||
AWARENESS_RANGE_PULSE.outlineWidth / 2,
|
||||
AWARENESS_RANGE_PULSE.outlineWidth,
|
||||
);
|
||||
const pulse = awarenessPulseState(at, index);
|
||||
const ground = Cesium.Cartesian3.fromDegrees(3, 27, 0);
|
||||
|
||||
@@ -47,6 +47,7 @@ export const CESIUM_CHECKS = new Set([
|
||||
'draw.lines.depthFail',
|
||||
'draw.lines.settled',
|
||||
'draw.lines.styles',
|
||||
'draw.lines.outline',
|
||||
'draw.lines.drape',
|
||||
'draw.lines.segments',
|
||||
'draw.ids',
|
||||
|
||||
@@ -2004,6 +2004,73 @@ export function portChecks() {
|
||||
lines.dispose();
|
||||
},
|
||||
),
|
||||
check(
|
||||
'draw.lines.outline',
|
||||
'a solid line’s outline is `widthPx` in all, half on each side, inside the line’s width',
|
||||
async (h, r) => {
|
||||
await overAustin(h, r);
|
||||
const lines = r.draw.lines({ id: 'conf:line-outline' });
|
||||
const at = (dLon) =>
|
||||
h.toEcef({ lon: AUSTIN.lon + dLon, lat: AUSTIN.lat, height: 200 });
|
||||
// 20 px wide with an outline of 8: 4 px of red each side of 12 px
|
||||
// of green. Read as 8 px each side, it would leave 4 px of green.
|
||||
lines.set([
|
||||
{
|
||||
id: 'l',
|
||||
positions: [at(-0.004), at(0.004)],
|
||||
widthPx: 20,
|
||||
mode: '3d',
|
||||
style: {
|
||||
kind: 'solid',
|
||||
color: '#00ff00',
|
||||
outline: { color: '#ff0000', widthPx: 8 },
|
||||
},
|
||||
},
|
||||
]);
|
||||
await drawn(h, r);
|
||||
await settled(r);
|
||||
r.frame.renderNow();
|
||||
const s = r.query.project(at(0));
|
||||
ok(s, 'the line projects');
|
||||
const half = 30;
|
||||
const image = r.readPixels({
|
||||
crop: {
|
||||
x: Math.round(s.x) - 2,
|
||||
y: Math.round(s.y) - half,
|
||||
width: 5,
|
||||
height: 2 * half + 1,
|
||||
},
|
||||
});
|
||||
// The middle column, top to bottom: r(ed), g(reen) or - (neither).
|
||||
let column = '';
|
||||
for (let row = 0; row < image.height; row++) {
|
||||
const i = (row * image.width + 2) * 4;
|
||||
const [red, green, blue] = image.data.slice(i, i + 3);
|
||||
column +=
|
||||
red > 160 && green < 100 && blue < 100
|
||||
? 'r'
|
||||
: green > 160 && red < 100 && blue < 100
|
||||
? 'g'
|
||||
: '-';
|
||||
}
|
||||
lines.dispose();
|
||||
if (!column.includes('g') && !column.includes('r'))
|
||||
return { skip: 'this renderer draws no line pixels' };
|
||||
const runs = column.match(/r+|g+/g) ?? [];
|
||||
const sides = runs.filter((run) => run[0] === 'r');
|
||||
const core = runs.find((run) => run[0] === 'g') ?? '';
|
||||
equal(sides.length, 2, `an outline each side (${column})`);
|
||||
for (const side of sides)
|
||||
ok(
|
||||
side.length >= 3 && side.length <= 5,
|
||||
`4 px of outline each side, not ${side.length} (${column})`,
|
||||
);
|
||||
ok(
|
||||
core.length >= 10 && core.length <= 14,
|
||||
`12 px of line between them, not ${core.length} (${column})`,
|
||||
);
|
||||
},
|
||||
),
|
||||
check(
|
||||
'draw.lines.drape',
|
||||
'draped glow, dash and arrow lines draw and pick; a revealed line draws only its first part; a draped line and a clamped point that move every frame are drawn where they now are in the next frame',
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -192,7 +192,8 @@ export const REFERENCE_SCENES = Object.freeze([
|
||||
style: { kind: 'solid', color: '#ff3b30' },
|
||||
},
|
||||
{
|
||||
// A bright core inside a dark edge 2 px wide on each side.
|
||||
// A bright core inside a dark edge 4 px wide in all, 2 px on
|
||||
// each side.
|
||||
id: 'outlined',
|
||||
positions: row(800),
|
||||
widthPx: 8,
|
||||
@@ -200,7 +201,7 @@ export const REFERENCE_SCENES = Object.freeze([
|
||||
style: {
|
||||
kind: 'solid',
|
||||
color: '#30d158',
|
||||
outline: { color: '#000000', widthPx: 2 },
|
||||
outline: { color: '#000000', widthPx: 4 },
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Vendored
+5
-3
@@ -196,9 +196,11 @@ export type LineStyle =
|
||||
kind: 'solid';
|
||||
color: Color;
|
||||
/**
|
||||
* A band `widthPx` wide each side, inside the line's width, drawn in
|
||||
* the same pass as the line: a translucent halo that does not darken
|
||||
* where it meets the line. Its colour changes in place.
|
||||
* An edge `widthPx` wide in all, half of it on each side, inside the
|
||||
* line's width (a line 8 px wide with an outline of 4 has 2 px of
|
||||
* outline each side and 4 px of `color` between), drawn in the same
|
||||
* pass as the line: a translucent edge does not darken where it meets
|
||||
* the line. Its colour changes in place.
|
||||
*/
|
||||
outline?: { color: Color; widthPx: number };
|
||||
}
|
||||
|
||||
@@ -19,11 +19,12 @@ test('the stub passes the conformance suite', async () => {
|
||||
const skipped = report.results
|
||||
.filter((r) => r.status === 'skip')
|
||||
.map((r) => r.id);
|
||||
// It draws only models into pixels, so the sweep's pixels go unread; its
|
||||
// camera takes no user gestures: the drag and wheel scripts are for a
|
||||
// It draws only models into pixels, so the sweep's and a line outline's
|
||||
// pixels go unread; its camera takes no user gestures: the drag and wheel scripts are for a
|
||||
// camera that does (a controller over it, say).
|
||||
assert.deepEqual(skipped, [
|
||||
'effects.screenModulation.pixels',
|
||||
'draw.lines.outline',
|
||||
...CAMERA_SCRIPTS.filter(usesInput).map((s) => `camera.trace.${s.name}`),
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user