In this section
- Pilot Vicinity geodesy · cosmic / tools/explore/theme/pilot-vicinity.js lines 1–497
- Pilot render · cosmic / tools/explore/theme/pilot.css lines 1–93
- Pilot render · cosmic / tools/explore/theme/pilot.html lines 1–57
Pilot Vicinity
A JavaScript module in the theme folder of Cosmic that maps grid substations and the Renewable Energy Planning Database (REPD) register, using haversine, and uses data from the GridAtlas repository.
geodesycosmic / tools/explore/theme/pilot-vicinity.js · lines 1–497 of 497 · Entry point · pattern destinationCirclePoints (shared by 2 files)
- What it does
- It maps grid substations and the REPD register. Defines 40 functions or classes, including destinationCirclePoints, circleVertexCount, nearest, radiusKm, bandColour. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain terms in the code: the REPD register, 220kV, 33kV, 25kV.
- Inputs & outputs
- In: GeoJSON file grid_substations.geojson; form fields (user input). Voltage levels named: 220kV, 33kV, 25kV.
- Downstream impact
- Used directly by 1 file: Pilot (cosmic, https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html).
- What it achieves
- It parses lat lon (`parseLatLon`), parses subs (`parseSubs`) and loads subs (`loadSubs`). Pilot vicinity (W07, RADIAL-38): deploy the Ventus Grid Engine at any point and list the nearest real assets with straight-line distances and bearings, drawn in the flight view as a radius ring and links. Its code works with 220 kV, 25 kV and 33 kV. It responds to click, submit and input events.
- Why it matters
- Loaded by the Pilot page at https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html.
- Application
- cosmic · tools/explore/theme · JavaScript module
- VEDIC
- TRACE GEODESIC CIRCLE (GG2050-VEDIC-000103): Ventus Grid Engine / Geometry · Mathematics / Spherical geometry. lon, lat, radiusKm, n, earthRadiusKm → Open ring of n [lon, lat] degree pairs evenly spaced in bearing around the centre.
- Uses
- Pilot Estate (require), GridAtlas — Index Page (estate URL)
- Used by
- loaded by Pilot (script src)
- Produces
- destinationCirclePoints, circleVertexCount, nearest, radiusKm, bandColour, compass, fmtKm, fmtDistBrg, fmtBearing, validPoint, parseLatLon, parseSubs
- Defines here
- destinationCirclePoints, circleVertexCount, nearest, radiusKm, bandColour, compass, fmtKm, fmtDistBrg, fmtBearing, validPoint, parseLatLon, parseSubs, normItem, dedupe, model, replyState, loadSubs, hasModule, ask, finish, gather, done, setRing, allRows, deploy, undeploy, panelHtml, q, renderStatus, emptyText
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/theme/pilot-vicinity.js:1-497 · blob 03d8d1bce751a8db723fcab1b05edd1625916b41 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
/* Pilot vicinity (W07, RADIAL-38): deploy the Ventus Grid Engine at any point and list the nearest real assets
with straight-line distances and bearings, drawn in the flight view as a radius ring and links.
Screening only, in GridAtlas's words: "Vicinity only. Not connection, route or capacity assessment."
Reused from Ventusltd/ventus-grid-engine@ad566356a44e006682e956483d569f31ddbb9630 (Apache-2.0); bodies transliterated
to ES5 (const -> var, ** -> Math.pow), otherwise unchanged, except nearest() which is ADAPTED (below):
- engine/v9-geodesy.js distanceKm (R_ATLAS 6378.137 km, atan2 form), destinationPoint, initialBearingDeg
- engine/geo-shapes.js destinationCirclePoints, circleVertexCount
- engine/v9-nearest-search.js index().nearest, ADAPTED: input {lat, lon, kv[]}, maxKm and bearing added, and
points with no declared voltage are KEPT when minimumKv is 0 (the engine always skips them), so unlabelled
substations still appear. OSM voltage tags are read with the engine's voltagesKv (PILOT.estate).
From Ventusltd/gridatlas@f944f8dcbc09cd09c0895f0126682ec241cd576f (Apache-2.0): atlas/modules/202611180026-grid-vicinity.js radius rule (whole km 1-50, default 10)
and voltage-band colours; atlas/modules/202612012118-secondary-vicinity-engine.js screening wording, 30 nearest,
REPD sites within 40 km.
Assets come from the layer modules through events (grid:query W05, ukpn:query W04, repd:query W06). If the grid
module does not answer, 33 kV+ substations are streamed once, on first deploy, from GridAtlas's published atlas-v9
release (OpenStreetMap, ODbL). Nothing is copied into cosmic and no location is invented. */
(function () {
'use strict';
var W = typeof window !== 'undefined' ? window : null;
// ---- distance maths: the ONE shared geodesy, PILOT.estate.geo (pilot-estate.js, grid-distance-maths@8e91b07 vendored
// verbatim; same atan2 haversine and R_ATLAS 6378.137 km as engine/v9-geodesy.js). Lon-first, as the estate.
var ESTATE = (W && W.PILOT && W.PILOT.estate) || (typeof require === 'function' ? require('./pilot-estate.js') : null);
var EARTH_RADIUS_KM = ESTATE.geo.R_ATLAS;
var DEG = Math.PI / 180;
var distanceKm = ESTATE.geo.distanceKm, destinationPoint = ESTATE.geo.destinationPoint, initialBearingDeg = ESTATE.geo.initialBearingDeg;
// ---- ventus-grid-engine engine/geo-shapes.js (verbatim bodies)
function destinationCirclePoints(lon, lat, radiusKm, n, earthRadiusKm) {
var R = earthRadiusKm === undefined ? EARTH_RADIUS_KM : earthRadiusKm, D = Math.PI / 180;
var ad = radiusKm / R;
var lat1 = lat * D;
return Array.from({ length: n }, function (_, i) {
var b = (i / n) * 2 * Math.PI;
var lat2 = Math.asin(Math.sin(lat1) * Math.cos(ad) + Math.cos(lat1) * Math.sin(ad) * Math.cos(b));
var lon2 = lon * D + Math.atan2(Math.sin(b) * Math.sin(ad) * Math.cos(lat1), Math.cos(ad) - Math.sin(lat1) * Math.sin(lat2));
return [lon2 / D, lat2 / D];
});
}
function circleVertexCount(radiusKm) { return radiusKm > 5000 ? 128 : radiusKm > 500 ? 96 : 64; }
// ---- ventus-grid-engine engine/v9-nearest-search.js nearest(), on {lat, lon, kv[]} points; maxKm added
function nearest(points, lat, lon, options) {
var minimumKv = (options && options.minimumKv) || 0;
var limit = (options && options.limit) || 1;
var maxKm = options && options.maxKm > 0 ? options.maxKm : Infinity;
var found = [];
for (var i = 0; i < (points || []).length; i++) {
var p = points[i];
if (minimumKv) { var v = p.kv || []; if (!v.length || Math.max.apply(null, v) < minimumKv) continue; }
var km = distanceKm(lon, lat, p.lon, p.lat);
if (km <= maxKm) found.push({ point: p, km: km, i: i });
}
found.sort(function (a, b) { return a.km - b.km || a.i - b.i; });
found.forEach(function (f) { f.brg = initialBearingDeg(lon, lat, f.point.lon, f.point.lat); delete f.i; });
return limit === 1 ? (found[0] || null) : found.slice(0, limit);
}
// ---- gridatlas 202611180026-grid-vicinity.js radiusKm() (same rule and messages)
function radiusKm(value) {
if (typeof value !== 'number' && typeof value !== 'string') throw new Error('Choose a whole-kilometre radius from 1 to 50 km.');
if (typeof value === 'string' && !value.trim()) throw new Error('Choose a radius from 1 to 50 km.');
var n = Number(value);
if (!Number.isInteger(n) || n < 1 || n > 50) throw new Error('Choose a whole-kilometre radius from 1 to 50 km.');
return n;
}
// voltage bands exactly as Ventusltd/gridatlas@f944f8dcbc09cd09c0895f0126682ec241cd576f tools/vicinity/src/model.mjs VOLTAGE_BANDS
// (Apache-2.0): a band only on an exact voltage match; any other stated voltage (220 kV, 25 kV...) is grey 'other'.
var BANDS = [[400, '#ff5555'], [275, '#ff8a3d'], [132, '#ffd84d'], [66, '#8be28b'], [33, '#48d8df'], [11, '#b8b8ed']];
function bandColour(kv) { if (!kv) return '#8b9ca0'; for (var i = 0; i < BANDS.length; i++) if (kv === BANDS[i][0]) return BANDS[i][1]; return '#e6e6e6'; }
var KIND_COLOUR = { ukpn: '#b8b8ed', repd: '#39d98a' };
var COMPASS = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
function compass(deg) { return COMPASS[Math.round(((deg % 360) + 360) % 360 / 45) % 8]; }
function fmtKm(km) { return km < 1 ? Math.round(km * 1000) + ' m' : km < 10 ? km.toFixed(2) + ' km' : km.toFixed(1) + ' km'; }
function fmtDistBrg(km, deg) { return km < 0.005 ? 'here' : fmtKm(km) + ' ' + compass(deg); }
function fmtBearing(deg) { return Math.round(((deg % 360) + 360) % 360) + '° ' + compass(deg); }
function validPoint(lat, lon) {
return typeof lat === 'number' && typeof lon === 'number' && isFinite(lat) && isFinite(lon)
&& Math.abs(lat) <= 90 && Math.abs(lon) <= 180 && !(Math.abs(lat) < 1e-9 && Math.abs(lon) < 1e-9);
}
function parseLatLon(text) {
var m = String(text || '').trim().match(/^([+-]?\d+(?:\.\d+)?)\s*[,\s]\s*([+-]?\d+(?:\.\d+)?)$/);
if (!m) return null;
var lat = +m[1], lon = +m[2];
return validPoint(lat, lon) ? [lat, lon] : null;
}
// The engine's own voltagesKv (via PILOT.estate, pilot-estate.js).
var voltagesKv = ESTATE.voltagesKv;
var UNNAMED = 'Substation (unnamed in OSM)';
function parseSubs(gj) {
var out = [];
((gj && gj.features) || []).forEach(function (f, i) {
var g = f && f.geometry, c = g && g.type === 'Point' && g.coordinates, p = (f && f.properties) || {};
if (!c || !validPoint(+c[1], +c[0])) return;
out.push({ name: p.name ? String(p.name) : UNNAMED, kv: voltagesKv({ voltage: p.voltage }), lat: +c[1], lon: +c[0], id: f.id || 'grid_substations:' + i, operator: p.operator || '' });
});
return out;
}
// normalise a reply item from any module into {kind, name, kv[], lat, lon, id, sub, credit}
var KIND_NAME = { grid: 'Substation', ukpn: 'UKPN secondary', repd: 'REPD site' };
function normItem(kind, it) {
if (!it || typeof it !== 'object') return null;
var lat = +(it.lat != null ? it.lat : it.latitude), lon = +(it.lon != null ? it.lon : it.lng != null ? it.lng : it.longitude);
if (!validPoint(lat, lon)) return null;
var name = it.name || it.title || it.floc || it.ref || it.id || KIND_NAME[kind];
// module replies: kv / voltages_kv are kilovolts; a bare OSM voltage tag is volts (engine voltagesKv)
var kvx = it.kv != null ? it.kv : it.voltages_kv;
var kv = kvx != null ? voltagesKv({ kv: kvx }) : voltagesKv({ voltage: it.voltage });
var sub = [];
if (it.tech) sub.push(String(it.tech));
if (+it.mw > 0) sub.push((+it.mw).toLocaleString('en-GB') + ' MW');
if (it.status) sub.push(String(it.status));
if (it.operator) sub.push(String(it.operator));
return { kind: kind, name: String(name).slice(0, 160), kv: kv, lat: lat, lon: lon, id: it.id != null ? String(it.id) : it.ref != null ? String(it.ref) : '', sub: sub.join(' · ').slice(0, 200), credit: it.credit || '' };
}
// merge items of one kind: drop duplicates within 10 m of each other with the same name
function dedupe(items) {
var out = [];
items.forEach(function (a) {
for (var i = 0; i < out.length; i++) { var b = out[i]; if (b.name === a.name && distanceKm(a.lon, a.lat, b.lon, b.lat) < 0.01) return; }
out.push(a);
});
return out;
}
var LIMIT = 30, REPD_MAX_KM = 40, WAIT_MS = 1500;
// the result model for one kind: up to 30 nearest within the radius (REPD capped at 40 km as GridAtlas)
// capped: the source returned a full page (LIMIT) so more may exist; count is then "at least", never a total.
function model(kind, items, lat, lon, rKm, capped) {
var maxKm = kind === 'repd' ? Math.min(rKm, REPD_MAX_KM) : rKm;
var all = nearest(dedupe(items), lat, lon, { limit: Infinity, maxKm: maxKm });
return { kind: kind, count: Math.min(all.length, LIMIT), capped: !!capped || all.length > LIMIT, maxKm: maxKm, rows: all.slice(0, LIMIT) };
}
// Query contract (v2, CONTRACT.md section 12): every <kind>:query carries radiusM in metres; reply(list, meta) where
// meta.state is 'ok' | 'notloaded' | 'error' (meta.error text). A bare string meta is read as an error.
function replyState(answered, list, meta) {
if (!answered) return meta && meta.timeout ? 'timeout' : 'absent';
if (typeof meta === 'string') return 'error';
meta = meta || {};
if (meta.state === 'error' || meta.error) return 'error';
if (meta.loaded === false || meta.state === 'notloaded') return 'notloaded';
return 'ok';
}
var core = {
EARTH_RADIUS_KM: EARTH_RADIUS_KM, distanceKm: distanceKm, destinationPoint: destinationPoint, initialBearingDeg: initialBearingDeg,
destinationCirclePoints: destinationCirclePoints, circleVertexCount: circleVertexCount, nearest: nearest, radiusKm: radiusKm,
compass: compass, fmtKm: fmtKm, fmtDistBrg: fmtDistBrg, fmtBearing: fmtBearing, validPoint: validPoint, parseLatLon: parseLatLon, voltagesKv: voltagesKv,
parseSubs: parseSubs, normItem: normItem, dedupe: dedupe, model: model, replyState: replyState, bandColour: bandColour, LIMIT: LIMIT, WAIT_MS: WAIT_MS
};
if (typeof module !== 'undefined' && module.exports) module.exports = core;
if (!W || !W.PILOT) return;
var P = W.PILOT, D = W.document;
P.module('vicinity', { version: '1', owner: 'W07' });
var esc = P.esc || function (s) { return String(s).replace(/[&<>"']/g, function (c) { return '&#' + c.charCodeAt(0) + ';'; }); };
var TEST = /[?&]victest=1/.test(location.search);
// ---- data source for the fallback (photon rule: streamed, lazy, once)
var GA = P.data && P.data.GA || 'https://ventusltd.github.io/gridatlas/';
(function () { // ?ga= override for local tests: same origin or localhost only
var m = location.search.match(/[?&]ga=([^&]+)/); if (!m) return;
try { var u = new URL(decodeURIComponent(m[1]), location.href);
if (u.origin === location.origin || /^(localhost|127\.0\.0\.1)$/.test(u.hostname)) GA = u.href.replace(/\/?$/, '/'); } catch (e) {}
})();
var SUBS_URL = GA + 'atlas/releases/202608300453-atlas-v9/data/grid_substations.geojson';
var SUBS_CREDIT = 'Substations: Data © OpenStreetMap contributors (ODbL), via GridAtlas atlas-v9';
// Screening limits shown beside every result (review finding 3): the canonical STRAIGHT_LINE_CAVEAT from
// grid-distance-maths (via PILOT.geo) plus the earth-model note.
var CAPTION = 'Vicinity only. Not connection, route or capacity assessment. '
+ (P.geo ? P.geo.caveatText(['distance', 'substation', 'coverage']) + ' ' + P.geo.EARTH_NOTE : 'Straight-line distances.');
var subsP = null;
function loadSubs() {
if (P.offline) return Promise.reject(new Error('offline'));
if (!subsP) subsP = P.data.fetchJSON(SUBS_URL).then(function (gj) { var s = parseSubs(gj); if (!s.length) throw new Error('no substations in file'); return s; })
.catch(function (e) { subsP = null; throw e; });
return subsP;
}
// ---- query broker: ask each registered layer module, wait up to 1.5 s for the ones that exist
var KINDS = ['grid', 'ukpn', 'repd'];
function hasModule(name) { try { return (P.modules() || []).some(function (m) { return m.name === name; }); } catch (e) { return false; } }
function ask(kind, lat, lon, rKm) {
return new Promise(function (resolve) {
var done = false, timer = null;
function finish(list, meta) {
if (done) return; done = true; if (timer) clearTimeout(timer);
var answered = !!list, st = replyState(answered, list, meta);
resolve({ answered: answered, state: st, list: list || [], error: typeof meta === 'string' ? meta : (meta && meta.error) || '' });
}
if (!hasModule(kind)) return finish(null);
timer = setTimeout(function () { finish(null, { timeout: true }); }, WAIT_MS);
var rM = rKm * 1000;
try { P.emit(kind + ':query', { lat: lat, lon: lon, n: LIMIT, radiusM: rM, maxM: rM, minKv: 0, reply: function (list, meta) { finish(Array.isArray(list) ? list : [], meta); } }); }
catch (e) { finish([], { state: 'error', error: String(e && e.message || e) }); }
});
}
// Each kind is asked and finished on its own; onPartial(out) fires as each arrives, so the nearest substations show
// as soon as they are known and never wait for optional UKPN / REPD enrichment (CVAA grid-first critical path).
function gather(lat, lon, rKm, onPartial) {
var out = {};
function done(k, v) { out[k] = v; if (onPartial) onPartial(out, k); }
return Promise.all(KINDS.map(function (k) {
return ask(k, lat, lon, rKm).then(function (a) {
var answeredWithData = a.state === 'ok' && a.list.length;
if (k === 'grid' && !answeredWithData) { // fallback: stream the substations once
return loadSubs().then(function (subs) {
done('grid', { status: 'ok', via: 'fallback', model: model('grid', subs.map(function (s) { return { kind: 'grid', name: s.name, kv: s.kv, lat: s.lat, lon: s.lon, id: s.id, sub: s.operator, credit: SUBS_CREDIT }; }), lat, lon, rKm) });
if (P.credit) P.credit('vicinity-subs', SUBS_CREDIT);
}, function (e) { done('grid', { status: P.offline ? 'offline' : 'failed', error: String(e && e.message || e) }); });
}
if (a.state !== 'ok') { done(k, { status: a.state, error: a.error }); return null; }
var items = a.list.map(function (it) { return normItem(k, it); }).filter(Boolean);
done(k, { status: 'ok', via: 'module', model: model(k, items, lat, lon, rKm, a.list.length >= LIMIT) });
return null;
});
})).then(function () { return out; });
}
// ---- state
var S = { origin: null, rKm: 10, result: null, lastTap: null, follow: false, busy: 0, deploys: 0, tab: 'grid', serial: 0, errors: [] };
var ring = [], links = [], drawn = { ring: 0, links: 0, labels: 0 };
function setRing() {
ring = S.origin ? destinationCirclePoints(S.origin.lon, S.origin.lat, S.rKm, circleVertexCount(S.rKm)).map(function (p) { return [p[1], p[0]]; }) : [];
}
function allRows() {
var r = [];
if (!S.result) return r;
KINDS.forEach(function (k) { var x = S.result[k]; if (x && x.model) r = r.concat(x.model.rows); });
return r.sort(function (a, b) { return a.km - b.km; });
}
function deploy(lat, lon, opts) {
opts = opts || {};
if (!validPoint(lat, lon)) return Promise.reject(new Error('A valid located point is required; no coordinates were inferred.'));
var r = radiusKm(opts.radiusKm != null ? opts.radiusKm : S.rKm);
var my = ++S.serial;
S.origin = { lat: lat, lon: lon, label: String(opts.label || ''), source: String(opts.source || 'point') };
S.rKm = r; S.deploys++; S.busy++;
setRing(); links = [];
if (P.hash && !opts.noHash) P.hash('vic', lat.toFixed(5) + ',' + lon.toFixed(5) + ',' + r);
P.emit('vicinity:deploy', { lat: lat, lon: lon, radiusKm: r, source: S.origin.source });
renderStatus('Deploying the engine at ' + lat.toFixed(5) + ', ' + lon.toFixed(5) + ' (' + r + ' km)…');
var t0 = Date.now();
return gather(lat, lon, r, function (partial) { // show each kind as it lands; a stale deploy's replies are dropped
if (my !== S.serial) return;
S.result = partial; links = allRows().slice(0, 10); renderResults(); renderHud();
}).then(function (res) {
S.busy--;
if (my !== S.serial) return S.result; // a newer deploy superseded this one
S.result = res; S.ms = Date.now() - t0;
links = allRows().slice(0, 10);
renderResults(); renderHud();
if (TEST && W.console) console.log('[victest]', JSON.stringify({ ms: S.ms, counts: KINDS.map(function (k) { var x = res[k]; return k + ':' + (x.model ? x.model.count : x.status); }) }));
return res;
}, function (e) { S.busy--; S.errors.push(String(e && e.message || e)); renderStatus('Engine failed: ' + (e && e.message || e)); throw e; });
}
function undeploy() {
S.origin = null; S.result = null; S.serial++; ring = []; links = [];
if (P.hash) P.hash('vic', null);
P.emit('vicinity:clear', {});
renderResults(); renderHud();
}
// ---- panel
var body = null;
var TABS = [['grid', 'Substations'], ['ukpn', 'UKPN secondary'], ['repd', 'REPD']];
function panelHtml() {
return '<div class="p-vicinity">'
+ '<p class="p-vicinity-lede">Deploy the Ventus Grid Engine at any point to list the nearest real assets with straight-line distances.</p>'
+ '<div class="p-vicinity-actions">'
+ '<button type="button" class="p-vicinity-btn" data-vic="here">Deploy here</button>'
+ '<button type="button" class="p-vicinity-btn" data-vic="tap" disabled title="Tap the ground first">Deploy at tapped point</button>'
+ '<button type="button" class="p-vicinity-btn" data-vic="clear" disabled>Clear</button></div>'
+ '<form class="p-vicinity-form" data-vic="form"><label for="p-vicinity-ll">Lat, lon</label>'
+ '<input id="p-vicinity-ll" class="p-vicinity-input" inputmode="decimal" autocomplete="off" placeholder="52.0, -0.9" spellcheck="false">'
+ '<button type="submit" class="p-vicinity-btn">Deploy</button></form>'
+ '<label class="p-vicinity-range" for="p-vicinity-r">Radius <output id="p-vicinity-rv">' + S.rKm + ' km</output></label>'
+ '<input id="p-vicinity-r" class="p-vicinity-slider" type="range" min="1" max="50" step="1" value="' + S.rKm + '">'
+ '<label class="p-vicinity-check"><input type="checkbox" id="p-vicinity-follow"> Follow camera while flying</label>'
+ '<p class="p-vicinity-status" role="status" aria-live="polite"></p>'
+ '<div class="p-vicinity-tabs" role="tablist">' + TABS.map(function (t) { return '<button type="button" role="tab" class="p-vicinity-tab" data-tab="' + t[0] + '" aria-selected="' + (t[0] === S.tab) + '">' + t[1] + ' <span></span></button>'; }).join('') + '</div>'
+ '<p class="p-vicinity-count" aria-live="polite"></p><ol class="p-vicinity-list"></ol>'
+ '<p class="p-vicinity-cap">' + esc(CAPTION) + '</p></div>';
}
function q(sel) { return body && body.querySelector(sel); }
function renderStatus(text) { var e = q('.p-vicinity-status'); if (e) e.textContent = text || ''; }
function emptyText(k, x) {
if (!S.origin) return 'Deploy the engine to list assets.';
if (!x) return 'Working…';
if (x.status === 'absent') return k === 'grid' ? 'Substation data unavailable.' : 'No ' + (k === 'ukpn' ? 'UKPN' : 'REPD') + ' data module loaded.';
if (x.status === 'notloaded') return 'Turn on the ' + (k === 'ukpn' ? 'UKPN secondary substations' : 'REPD') + ' layer to include these.';
if (x.status === 'offline') return 'Vicinity needs the network for asset data.';
if (x.status === 'timeout') return (KIND_NAME[k] || k) + ' did not answer within ' + (WAIT_MS / 1000) + ' s, so nothing is listed. This is not the same as none nearby. Deploy again to retry.';
if (x.status === 'error') return 'Could not load ' + (KIND_NAME[k] || k) + ' data' + (x.error ? ' (' + x.error + ')' : '') + '. This is not the same as none nearby.';
if (x.status === 'failed') return 'Could not load substation data (offline?).';
return 'None within ' + x.model.maxKm + ' km (data loaded).';
}
function rowHtml(r, idx) {
var a = r.point, kv = a.kv && a.kv.length ? ' · ' + a.kv.join('/') + ' kV' : '';
var navOk = !!(P.nav && typeof P.nav.button === 'function') || hasModule('nav');
return '<li><button type="button" class="p-vicinity-row" data-row="' + idx + '"><span class="p-vicinity-dot" style="background:' + linkColour(a) + '"></span>'
+ '<b>' + esc(a.name) + '</b><span class="p-vicinity-meta">' + esc(KIND_NAME[a.kind] + kv + (a.sub ? ' · ' + a.sub : '')) + '</span>'
+ '<span class="p-vicinity-km">' + esc(fmtDistBrg(r.km, r.brg)) + '</span></button>'
+ (navOk ? '<button type="button" class="p-vicinity-btn p-vicinity-route" data-route="' + idx + '" aria-label="Route to ' + esc(a.name) + '">Route</button>' : '') + '</li>';
}
function renderResults() {
if (!body) return;
var res = S.result;
TABS.forEach(function (t) {
var b = q('[data-tab="' + t[0] + '"]'); if (!b) return;
var x = res && res[t[0]];
b.querySelector('span').textContent = x && x.model ? '(' + x.model.count + (x.model.capped ? '+' : '') + ')' : x && x.status !== 'ok' && S.origin ? '(!)' : '';
b.setAttribute('aria-selected', String(t[0] === S.tab));
});
var x = res && res[S.tab], ol = q('.p-vicinity-list');
var rows = x && x.model ? x.model.rows : [];
var cnt = q('.p-vicinity-count');
if (cnt) cnt.textContent = x && x.model && rows.length ? 'Nearest ' + rows.length + ' within ' + x.model.maxKm + ' km' + (x.model.capped ? ' (capped at ' + LIMIT + '; more may exist, not a total)' : '') : '';
ol.innerHTML = rows.length ? rows.map(rowHtml).join('') : '<li class="p-vicinity-empty">' + esc(emptyText(S.tab, x)) + '</li>';
q('[data-vic="clear"]').disabled = !S.origin;
if (!S.origin) renderStatus('');
else if (res) {
var g = res.grid, failed = g && g.status === 'failed';
renderStatus((S.origin.label ? S.origin.label + ' · ' : '') + S.origin.lat.toFixed(5) + ', ' + S.origin.lon.toFixed(5) + ' · ' + S.rKm + ' km');
if (failed) { var st = q('.p-vicinity-status'); st.insertAdjacentHTML('beforeend', ' <button type="button" class="p-vicinity-btn" data-vic="retry">Retry</button>'); }
}
}
function currentRows() { var x = S.result && S.result[S.tab]; return x && x.model ? x.model.rows : []; }
function flyRow(r) {
var a = r.point;
return P.flyTo(a.lat, a.lon, { label: a.name, source: 'vicinity', id: a.id }).catch(function () {});
}
function routeRow(r) {
var a = r.point, dest = { lat: a.lat, lon: a.lon, name: a.name, source: 'vicinity:' + a.kind, id: a.id };
if (P.nav && typeof P.nav.button === 'function') { try { var b = P.nav.button(dest); if (b && b.click) { b.click(); return; } } catch (e) {} }
P.emit('nav:route', dest);
}
function wirePanel() {
body.addEventListener('click', function (ev) {
var t = ev.target.closest('button'); if (!t || !body.contains(t)) return;
var act = t.getAttribute('data-vic');
if (act === 'here') { var c = P.camLL(); deploy(c.lat, c.lon, { source: 'camera', label: 'Camera' }).catch(note); }
else if (act === 'tap' && S.lastTap) deploy(S.lastTap.lat, S.lastTap.lon, { source: 'tap', label: 'Tapped point' }).catch(note);
else if (act === 'clear') undeploy();
else if (act === 'retry' && S.origin) deploy(S.origin.lat, S.origin.lon, { source: S.origin.source, label: S.origin.label }).catch(note);
else if (t.hasAttribute('data-tab')) { S.tab = t.getAttribute('data-tab'); renderResults(); }
else if (t.hasAttribute('data-row')) { var r = currentRows()[+t.getAttribute('data-row')]; if (r) flyRow(r); }
else if (t.hasAttribute('data-route')) { var r2 = currentRows()[+t.getAttribute('data-route')]; if (r2) routeRow(r2); }
});
body.querySelector('[data-vic="form"]').addEventListener('submit', function (ev) {
ev.preventDefault();
var ll = parseLatLon(q('#p-vicinity-ll').value);
if (!ll) { renderStatus('Type a latitude and longitude, e.g. 52.0, -0.9'); return; }
deploy(ll[0], ll[1], { source: 'typed', label: 'Typed point' }).catch(note);
});
var sl = q('#p-vicinity-r');
sl.addEventListener('input', function () { q('#p-vicinity-rv').textContent = sl.value + ' km'; });
sl.addEventListener('change', function () { S.rKm = radiusKm(sl.value); if (S.origin) deploy(S.origin.lat, S.origin.lon, { source: S.origin.source, label: S.origin.label }).catch(note); });
q('#p-vicinity-follow').addEventListener('change', function (ev) { S.follow = !!ev.target.checked; followT = 0; });
}
function note(e) { var m = String(e && e.message || e); S.errors.push(m); renderStatus(m); if (P.note) P.note(m, 3500); }
// ---- HUD line
function renderHud() {
if (!P.hud) return;
var r = allRows()[0];
P.hud('status:vicinity', S.origin && r ? '<span class="p-vicinity-hud">VGE ' + esc(r.point.name) + ' ' + esc(fmtDistBrg(r.km, r.brg)) + '</span>' : null);
}
// ---- flight-view layer: ring, pin, links
function linkColour(a) { return a.kind === 'grid' ? bandColour(a.kv && a.kv[0]) : KIND_COLOUR[a.kind] || '#e6e6e6'; }
function inBox(b, lat, lon, padDeg) { return !b || (lat >= b.s - padDeg && lat <= b.n + padDeg && lon >= b.w - padDeg && lon <= b.e + padDeg); }
var layer = {
id: 'vicinity', title: 'Vicinity (Ventus Grid Engine)', order: 60, visible: true,
credit: 'Vicinity maths: Ventus Grid Engine (Apache-2.0); straight-line screening only',
_drawn: drawn,
draw: function (g, v, now) {
drawn.ring = drawn.links = drawn.labels = 0;
if (!S.origin) return;
var o = S.origin, pad = S.rKm / 111 + 0.05;
g.save();
try {
if (inBox(v.bbox, o.lat, o.lon, pad)) { // ring
g.beginPath();
for (var i = 0; i < ring.length; i++) { var a = ring[i], b = ring[(i + 1) % ring.length]; v.line([a[0], a[1], null], [b[0], b[1], null]); }
g.strokeStyle = 'rgba(61,123,255,.25)'; g.lineWidth = 6; g.stroke();
g.strokeStyle = '#8fb4ff'; g.lineWidth = 1.8; g.stroke();
drawn.ring = ring.length;
}
var po = v.project(o.lat, o.lon, null);
// links
var labels = [];
for (var k = 0; k < links.length; k++) {
var r = links[k], p = r.point;
g.beginPath(); v.line([o.lat, o.lon, null], [p.lat, p.lon, null]);
var col = linkColour(p);
g.globalAlpha = 0.18; g.strokeStyle = col; g.lineWidth = 7; g.setLineDash([]); g.stroke();
g.globalAlpha = Math.max(0.35, 0.95 - k * 0.06); g.lineWidth = 1.6;
if (!v.reduced && !P.reduced) { g.setLineDash([6, 10]); g.lineDashOffset = -((now || 0) / 40) % 16; }
g.stroke(); g.setLineDash([]); g.globalAlpha = 1;
drawn.links++;
var sp = v.project(p.lat, p.lon, null);
if (sp) {
g.fillStyle = col; g.beginPath(); g.arc(sp.x, sp.y, 4, 0, 6.2832); g.fill();
if (k < 5 && sp.x > 0 && sp.y > 0 && sp.x < v.w && sp.y < v.h) labels.push([sp, fmtKm(r.km) + ' · ' + p.name.slice(0, 28)]);
}
}
g.font = '11px ui-monospace, monospace'; g.textAlign = 'center'; g.textBaseline = 'bottom';
var boxes = [];
labels.forEach(function (l) {
var w = g.measureText(l[1]).width + 8, x0 = Math.max(0, Math.min(v.w - w, l[0].x - w / 2)), y0 = l[0].y - 22;
for (var j = 0; j < boxes.length; j++) { var bx = boxes[j]; if (x0 < bx[0] + bx[2] && x0 + w > bx[0] && y0 < bx[1] + 15 && y0 + 15 > bx[1]) return; }
boxes.push([x0, y0, w]); l[0] = { x: x0 + w / 2, y: l[0].y };
g.fillStyle = 'rgba(2,8,9,.78)'; g.fillRect(l[0].x - w / 2, l[0].y - 22, w, 15);
g.fillStyle = '#d6e4ff'; g.fillText(l[1], l[0].x, l[0].y - 8); drawn.labels++;
});
if (po) { // origin pin, as the GridAtlas pin
g.beginPath(); g.arc(po.x, po.y, 11, 0, 6.2832); g.strokeStyle = 'rgba(61,123,255,.35)'; g.lineWidth = 6; g.stroke();
g.beginPath(); g.arc(po.x, po.y, 11, 0, 6.2832); g.strokeStyle = '#8fb4ff'; g.lineWidth = 1.8; g.stroke();
g.beginPath(); g.arc(po.x, po.y, 3, 0, 6.2832); g.fillStyle = '#8fb4ff'; g.fill();
}
} finally { g.restore(); }
},
pick: function (sx, sy, v) {
if (!S.origin) return null;
var best = null, bd = 22 * 22;
links.forEach(function (r) {
var sp = v.project(r.point.lat, r.point.lon, null); if (!sp) return;
var d = (sp.x - sx) * (sp.x - sx) + (sp.y - sy) * (sp.y - sy); if (d < bd) { bd = d; best = r; }
});
if (best) {
var a = best.point;
return { title: a.name, id: a.id, lat: a.lat, lon: a.lon, cap: 'VICINITY · ' + KIND_NAME[a.kind].toUpperCase(),
html: '<p>' + esc(KIND_NAME[a.kind] + (a.kv.length ? ' · ' + a.kv.join('/') + ' kV' : '') + (a.sub ? ' · ' + a.sub : '')) + '</p>'
+ '<p>' + esc(fmtKm(best.km) + ' from the deployed point, bearing ' + fmtBearing(best.brg)) + '</p>'
+ '<p class="dim">' + esc((a.credit || '') + (a.credit ? ' · ' : '') + CAPTION) + '</p>' };
}
var po = v.project(S.origin.lat, S.origin.lon, null);
if (po && (po.x - sx) * (po.x - sx) + (po.y - sy) * (po.y - sy) < 22 * 22) {
var n = allRows()[0];
return { title: 'Ventus Grid Engine deployed', lat: S.origin.lat, lon: S.origin.lon, cap: 'VICINITY',
html: '<p>' + esc(S.origin.lat.toFixed(5) + ', ' + S.origin.lon.toFixed(5) + ' · radius ' + S.rKm + ' km') + '</p>'
+ (n ? '<p>' + esc('Nearest: ' + n.point.name + ', ' + fmtKm(n.km) + ' ' + compass(n.brg)) + '</p>' : '')
+ '<p class="dim">' + esc(CAPTION) + '</p>' };
}
return null;
}
};
P.addLayer(layer);
// ---- follow camera (off by default): re-deploy every 2 s if moved > 250 m
var followT = 0;
P.onFrame(function (dt) {
if (!S.follow) return;
followT += dt || 0; if (followT < 2) return; followT = 0;
var c = P.camLL(); if (!c || !validPoint(c.lat, c.lon)) return;
if (S.origin && distanceKm(c.lon, c.lat, S.origin.lon, S.origin.lat) < 0.25) return;
if (S.busy) return;
deploy(c.lat, c.lon, { source: 'follow', label: 'Camera', noHash: true }).catch(function () {});
});
// ---- events
P.on('tap', function (e) {
if (!e || !validPoint(e.lat, e.lon)) return;
S.lastTap = { lat: e.lat, lon: e.lon };
var b = q('[data-vic="tap"]'); if (b) { b.disabled = false; b.title = e.lat.toFixed(5) + ', ' + e.lon.toFixed(5); }
});
P.on('vicinity:request', function (e) {
if (!e || !validPoint(+e.lat, +e.lon)) return;
deploy(+e.lat, +e.lon, { label: e.label, source: e.source || 'request', radiusKm: e.radiusKm }).catch(note);
if (P.openPanel) P.openPanel('vicinity');
});
body = P.panel('vicinity', panelHtml(), { title: 'Vicinity', icon: 'VGE', open: false });
if (body) wirePanel();
if (P.offline) renderStatus('Offline: vicinity needs the network for asset data.');
// ---- deep link #vic=lat,lon,r
P.ready(function () {
var h = P.hash && P.hash('vic'); if (!h) return;
var m = String(h).split(','), lat = +m[0], lon = +m[1], r = m[2];
if (!validPoint(lat, lon)) return;
var rk = 10; try { rk = radiusKm(r != null ? r : 10); } catch (e) {}
var sl = q('#p-vicinity-r'); if (sl) { sl.value = rk; q('#p-vicinity-rv').textContent = rk + ' km'; }
deploy(lat, lon, { radiusKm: rk, source: 'link', label: 'Linked point', noHash: true }).catch(note);
});
P.vicinity = { core: core, deploy: deploy, undeploy: undeploy, state: function () { return S; }, rows: allRows, layer: layer, SUBS_URL: SUBS_URL };
})();Pilot
A style sheet in the theme folder of Cosmic.
rendercosmic / tools/explore/theme/pilot.css · lines 1–93 of 93 · Entry point
- What it does
- Side effects: changes the web page (DOM).
- Downstream impact
- Used directly by 1 file: Pilot (cosmic, https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html).
- What it achieves
- Explore Code Pilot (HOTBAR-36). Look: Energy Transition Simulator / site-world menu tokens (`mod/menu-style.js`).
- Why it matters
- Loaded by the page of the same name at https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html.
- Application
- cosmic · tools/explore/theme · style sheet
- Uses
- none found
- Used by
- loaded by Pilot (stylesheet)
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/theme/pilot.css:1-93 · blob d8a0cc297ac9ef45dd7632c2a839cdf4fa06984c · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
/* Explore Code Pilot (HOTBAR-36). Look: Energy Transition Simulator / site-world menu tokens (mod/menu-style.js). */
:root { --bg: #000; --panel: rgba(11, 14, 20, .86); --line: #2f343d; --sky: #9cdbff; --text: #fff; --dim: #a6adbb; --acc: #00ffff; --warn: #ffae00; --link: #66ccff; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; font: 12px/1.45 ui-monospace, Menlo, Consolas, monospace; }
#pv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
a { color: var(--link); }
.pbtn { font: 12px ui-monospace, Menlo, monospace; color: var(--sky); background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
min-height: 44px; min-width: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.pbtn:active, .pbtn:hover { color: #fff; border-color: var(--acc); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px;
background: linear-gradient(#000c, #0000); pointer-events: none; }
#hud > * { pointer-events: auto; }
.tape { position: relative; flex: 1 1 160px; min-width: 0; overflow: hidden; white-space: nowrap; text-align: center; color: var(--acc); border-bottom: 1px solid #00ffff55; padding: 2px 0; letter-spacing: .05em; }
.tape i { position: absolute; left: 50%; bottom: -1px; width: 0; height: 0; border: 5px solid transparent; border-bottom-color: var(--acc); transform: translateX(-50%); }
.read { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; }
.read div { display: flex; gap: 6px; } .read dt { color: var(--dim); letter-spacing: .1em; } .read dd { margin: 0; color: #fff; white-space: nowrap; }
.read .wide dd { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
#h-sat { border: 1px solid; border-radius: 3px; padding: 1px 6px; } #h-sat.ok { color: #00ff88; } #h-sat.off { color: var(--warn); }
.reticle { position: fixed; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; z-index: 3; pointer-events: none;
border: 1px solid #00ffff88; border-radius: 50%; }
.reticle::before, .reticle::after { content: ''; position: absolute; background: #00ffffaa; }
.reticle::before { left: -18px; right: -18px; top: 50%; height: 1px; } .reticle::after { top: -10px; bottom: -10px; left: 50%; width: 1px; }
#card { position: fixed; z-index: 6; left: 8px; right: 8px; bottom: calc(118px + env(safe-area-inset-bottom, 0px)); max-height: 34vh; overflow: auto;
background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; backdrop-filter: blur(3px); }
#card::before { content: ''; position: absolute; top: -1px; left: -1px; width: 12px; height: 12px; border-top: 2px solid var(--acc); border-left: 2px solid var(--acc); }
#card.min > :not(h1):not(.cap) { display: none; }
#card h1 { font-size: 15px; margin: 2px 0; color: var(--acc); overflow-wrap: anywhere; }
.cap { margin: 0; font-size: 10px; letter-spacing: .14em; color: var(--dim); }
.dim { color: var(--dim); }
#card p { margin: 4px 0; }
#c-files { margin: 4px 0; padding-left: 20px; }
#c-files li { margin: 4px 0; }
#c-files code { display: block; font-size: 10px; color: var(--sky); overflow-wrap: anywhere; opacity: .85; }
#note { position: fixed; z-index: 7; left: 50%; top: 64px; transform: translateX(-50%); max-width: min(92vw, 560px); background: #05070b; border: 1px solid var(--warn); color: #fff; padding: 8px 12px; border-radius: 4px; }
#joy { position: fixed; z-index: 6; left: 14px; bottom: calc(129px + 34vh); width: 112px; height: 112px; border-radius: 50%; background: rgba(255, 255, 255, .06); border: 1px solid rgba(156, 219, 255, .4); touch-action: none; display: none; }
#knob { position: absolute; left: 36px; top: 36px; width: 40px; height: 40px; border-radius: 50%; background: rgba(156, 219, 255, .55); box-shadow: 0 0 10px #00ffff66; pointer-events: none; }
#pad { position: fixed; z-index: 6; left: 0; right: 0; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 6px; }
#pad .pbtn { padding: 0 2px; min-width: 0; font-size: 11px; }
#keys { display: none; position: fixed; z-index: 4; right: 10px; bottom: 26px; max-width: 520px; text-align: right; margin: 0; }
#credit { position: fixed; z-index: 7; left: 0; right: 0; bottom: 0; min-height: 20px; padding: 2px 8px calc(2px + env(safe-area-inset-bottom, 0px)); font-size: 10px; color: var(--dim); background: #000c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
@media (pointer: coarse) { #joy { display: block; } }
@media (min-width: 900px) {
#card { left: 10px; right: auto; top: 70px; bottom: auto; width: 360px; max-height: calc(100vh - 160px); }
#pad { left: auto; right: 10px; bottom: 60px; width: 470px; }
#keys { display: block; bottom: 110px; }
#joy { left: auto; right: 24px; bottom: 120px; }
@media (pointer: coarse) { #keys { display: none; } }
}
@media (min-width: 900px) and (pointer: coarse) { #pad { bottom: 26px; } #joy { bottom: 100px; } }
/* ---- Pilot-200 W01 core (ALTIMETER-58): FAST button, HUD slots, panel dock, card extras, credits */
#p-fast { position: fixed; z-index: 6; right: 14px; bottom: calc(150px + 34vh); width: 64px; height: 64px; border-radius: 50%; font-weight: bold; letter-spacing: .04em; }
#p-fast[aria-pressed="true"] { color: #000; background: var(--acc); border-color: #fff; box-shadow: 0 0 14px #00ffffaa; }
#p-fast[data-level="3"] { background: var(--warn); box-shadow: 0 0 18px #ffae00cc; }
.p-hud { position: fixed; z-index: 6; display: flex; flex-direction: column; gap: 4px; pointer-events: none; box-sizing: border-box; }
.p-hud > * { pointer-events: auto; }
.p-hud-sub { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; overflow-wrap: anywhere; max-width: 100%; box-sizing: border-box; }
.p-hud-status, .p-hud-top, .p-hud-bottom { left: 8px; right: 8px; align-items: center; }
.p-hud-status .p-hud-sub { background: none; border: 0; padding: 0; color: var(--dim); font-size: 11px; text-align: center; }
.p-hud-left { left: 8px; max-width: 44vw; align-items: flex-start; }
.p-hud-right { right: 8px; max-width: 44vw; align-items: flex-end; }
@media (max-width: 899px) { .p-hud-right { right: 86px; max-width: calc(100vw - 230px); } } /* phones: keep right-slot buttons clear of FAST (UI review) */
/* phones: the stick and FAST sit just above the collapsed place card, below the top HUD stack (goto, modes, ticker,
dark rows can grow it); the card, when opened for reading, may cover them until it is collapsed again. */
@media (max-width: 899px) { #joy, #p-fast { bottom: calc(212px + env(safe-area-inset-bottom, 0px)); } }
#p-tabs { position: fixed; z-index: 7; left: 6px; right: 6px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
#p-tabs::-webkit-scrollbar { display: none; }
#p-tabs:empty { display: none; }
#p-tabs .pbtn { flex: 0 0 auto; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
@media (max-width: 899px) { #p-tabs { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 28px; } }
#p-tabs .pbtn[aria-expanded="true"] { color: #000; background: var(--acc); border-color: #fff; }
body.p-has-tabs #card { bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }
#p-sheet { position: fixed; z-index: 8; left: 6px; right: 6px; bottom: calc(128px + env(safe-area-inset-bottom, 0px)); max-height: 52vh; overflow: auto; overscroll-behavior: contain;
background: rgba(11, 14, 20, .96); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px 10px; box-sizing: border-box; }
#p-sheet[hidden] { display: none; }
#p-sheet > header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(11, 14, 20, .98); padding: 4px 0; }
#p-sheet h2 { margin: 0; font-size: 13px; color: var(--acc); letter-spacing: .06em; overflow-wrap: anywhere; }
@media (max-width: 899px) { body.p-panel-open #card { display: none; } }
#c-x:empty { display: none; }
#c-x .pbtn { margin-top: 6px; }
#credit { cursor: pointer; }
#credit.open { white-space: normal; max-height: 40vh; overflow: auto; }
@media (min-width: 900px) {
#p-fast { right: 488px; bottom: 60px; width: 64px; height: 56px; border-radius: 6px; }
#p-tabs { left: auto; right: 10px; top: 70px; bottom: auto; width: 470px; flex-wrap: wrap; overflow: visible; }
#p-sheet { left: auto; right: 10px; top: 120px; bottom: 124px; width: 470px; max-height: none; }
body.p-has-tabs #card { bottom: auto; }
.p-hud-left, .p-hud-right { max-width: 340px; }
.p-hud-left { left: 380px; }
.p-hud-top, .p-hud-status, .p-hud-bottom { left: 380px; right: 490px; }
body.p-has-tabs .p-hud-right { right: 490px; }
body.p-panel-open #keys { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }Pilot
A web page in the theme folder of Cosmic that draws places and the Renewable Energy Planning Database (REPD) register. Published at https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html.
rendercosmic / tools/explore/theme/pilot.html · lines 1–57 of 57 · Entry point
- What it does
- It draws places and the REPD register. Side effects: changes the web page (DOM).
- Why it exists in the grid workflow
- Domain terms in the code: the REPD register. README: "When `theme/pilot.html` exists, the Pilot page files go to `/pilot/`."
- Inputs & outputs
- In: JSON file places.json. Out: web page.
- Downstream impact
- It is itself an entry point, published at https://ventusltd.github.io/cosmic/tools/explore/theme/pilot.html.
- What it achieves
- Fly over real coordinates written in the GlobalGrid2050 estate.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- cosmic · tools/explore/theme · page
- Uses
- Pilot (stylesheet), Pilot Goto (stylesheet), Pilot Modes (stylesheet), Pilot UKPN (stylesheet), Pilot Grid (stylesheet), Pilot Renewable Energy Planning Database (REPD) (stylesheet), Pilot Vicinity (stylesheet), Pilot Lightning (stylesheet), and 20 more
- Used by
- none found
- Produces
- none declared
- Defines here
- none
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- cosmic@51bebf892d63a617408bc5e25b270b9f893e9c03 tools/explore/theme/pilot.html:1-57 · blob 4af04615bce9badb2a91ddff1b2463fe6daae11d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: unknown · users: none · canonical: unknown
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>Drone View — fly over the places the code names — GlobalGrid2050 Explore Code</title>
<meta name="description" content="Fly over real coordinates written in the GlobalGrid2050 estate's code, with the grid lines, pylons and substations around them, and the files that name each place.">
<link rel="stylesheet" href="pilot.css"><!--pilot-module-css--><link rel="stylesheet" href="pilot-goto.css"><link rel="stylesheet" href="pilot-modes.css"><link rel="stylesheet" href="pilot-ukpn.css"><link rel="stylesheet" href="pilot-grid.css"><link rel="stylesheet" href="pilot-repd.css"><link rel="stylesheet" href="pilot-vicinity.css"><link rel="stylesheet" href="pilot-lightning.css"><link rel="s … [line shortened here: 646 characters; full line on GitHub]
<canvas id="pv" aria-label="Flight view over the selected place" role="img"></canvas>
<header id="hud" aria-live="off">
<a id="b-back" class="pbtn" href="../index.html" aria-label="Back to Explore Code">‹ Code</a>
<div class="tape" aria-hidden="true"><span id="h-tape"></span><i></i></div>
<dl class="read">
<div><dt>HDG</dt><dd id="h-hdg">—</dd></div>
<div><dt>ALT</dt><dd id="h-alt">—</dd></div>
<div><dt>SPD</dt><dd id="h-spd">—</dd></div>
<div class="wide"><dt>NEAREST</dt><dd id="h-near">—</dd></div>
<div class="wide"><dt>POS</dt><dd id="h-pos">—</dd></div>
</dl>
<span id="h-sat" class="off">GRID</span>
</header>
<div class="reticle" aria-hidden="true"></div>
<section id="card" aria-label="Place card">
<p class="cap">PLACE NAMED IN CODE</p>
<h1 id="c-name">Pilot</h1>
<p id="c-ll" class="dim"></p>
<p id="c-n"></p>
<ol id="c-files"></ol>
<p id="c-ctx" class="dim"></p>
<noscript><p>Pilot needs JavaScript to fly. The places it flies to are listed with their source files and keys in <a href="places.json">places.json</a>; every section page reads fully without it. <a href="../index.html">Back to Explore Code</a>.</p></noscript>
</section>
<p id="note" role="status" hidden></p>
<div id="joy" aria-label="Flight stick: drag to turn and pitch" role="application"><div id="knob"></div></div>
<nav id="pad" aria-label="Flight controls">
<button type="button" class="pbtn" id="b-prev" aria-label="Previous place">‹ Place</button>
<button type="button" class="pbtn" data-hold="thr:1" aria-label="Throttle up">Thr +</button>
<button type="button" class="pbtn" data-hold="thr:-1" aria-label="Throttle down">Thr −</button>
<button type="button" class="pbtn" data-hold="lift:1" aria-label="Climb">Up</button>
<button type="button" class="pbtn" data-hold="lift:-1" aria-label="Descend">Down</button>
<button type="button" class="pbtn" id="b-card" aria-label="Show or hide the place card">Card</button>
<button type="button" class="pbtn" id="b-next" aria-label="Next place">Place ›</button>
</nav>
<p id="keys" class="dim">W/S throttle · A/D or ←/→ turn · ↑/↓ pitch · E/Space climb · Q/Shift descend · drag to look · wheel speed · N/P or ]/[ next/previous place · H card · Esc back</p>
<footer id="credit"></footer>
<script src="pilot.js"></script>
<!--pilot-module-js-->
<script src="pilot-estate.js"></script>
<script src="pilot-goto.js"></script>
<script src="pilot-modes.js"></script>
<script src="pilot-ukpn.js"></script>
<script src="pilot-grid.js"></script>
<script src="pilot-repd.js"></script>
<script src="pilot-vicinity.js"></script>
<script src="pilot-lightning.js"></script>
<script src="pilot-nav.js"></script>
<script src="pilot-lidar.js"></script>
<script src="pilot-dark.js"></script>
<script src="pilot-darkfx.js"></script>
<script src="pilot-ticker.js"></script>
<script src="pilot-subfind.js"></script>
</body></html>