GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / youengineer-code-review / civilisation-atlas-v8

Ventus Corev8engine and 4 more files

A JavaScript file in Youengineer Code Review that maps civilisation atlas visible layers and satellite. Served with the page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.

676 lines of JavaScript and CSS from youengineer-code-review, in 5 files. Topic: Maps, GIS and field navigation. Section 727 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Ventus Corev8engine render · youengineer-code-review / civilisation-atlas-v8/ventus-corev8engine.js lines 1–392
  2. Ventus v8 render · youengineer-code-review / civilisation-atlas-v8/ventusv8.css lines 1–67
  3. Atlas Helpers geodesy · youengineer-code-review / civilisation-atlas/atlas-helpers.js lines 1–38
  4. Atlas Map render · youengineer-code-review / civilisation-atlas/atlas-map.js lines 1–164
  5. Atlas State render · youengineer-code-review / civilisation-atlas/atlas-state.js lines 1–15

Ventus Corev8engine

A JavaScript file in Youengineer Code Review that maps civilisation atlas visible layers and satellite. Served with the page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.

renderyouengineer-code-review / civilisation-atlas-v8/ventus-corev8engine.js · lines 1–392 of 392 · Entry point · pattern getVisibleFeatures (shared by 2 files)

What it does
It maps civilisation atlas visible layers and satellite. Defines 22 functions or classes, including escapeHTML, getName, getSummary, updateClock, sourceId. Side effects: changes the web page (DOM); makes network requests.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Inputs & outputs
In: JSON file style.json. Out: CSV file civilisation_atlas_visible_layers.csv; downloaded file civilisation_atlas_visible_layers.csv; interactive map.
Downstream impact
Used directly by 1 file: Youengineer Code Review — Civilisation Atlas V8 Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/). Reached from 2 other entry points, including Civilisation Map (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-map.html); Youengineer Code Review — Index Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/). It is itself an entry point, published at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
What it achieves
It gets name (`getName`), gets summary (`getSummary`) and updates clock (`updateClock`). Defines `escapeHTML`, `getName`, `getSummary` and 19 more. It responds to change, click and keydown events.
Why it matters
Loaded by the Civilisation Atlas V8 page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
Application
youengineer-code-review · civilisation-atlas-v8 · script
Uses
none found
Used by
loaded by Youengineer Code Review — Civilisation Atlas V8 Page (script src)
Produces
escapeHTML, getName, getSummary, updateClock, sourceId, layerId, addSatelliteLayer, setSatelliteMode, toggleSatelliteMode, buildPointPaint, addLayerToMap, ensureLayerLoaded
Defines here
escapeHTML, getName, getSummary, updateClock, sourceId, layerId, addSatelliteLayer, setSatelliteMode, toggleSatelliteMode, buildPointPaint, addLayerToMap, ensureLayerLoaded, setLayerVisibility, updateLayerStatus, renderLayerControls, getVisibleFeatures, popupCoordinates, openFeaturePopup, runSearch, exportVisibleCSV, clearLayers, resetView
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas-v8/ventus-corev8engine.js:1-392 · blob 81cf037c01de5d2b092965d2875f6993e6e32d1b · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
'use strict';

window.initVentusMap = function({ config, center, zoom }) {
    if (typeof maplibregl === 'undefined') {
        document.getElementById('fatal-banner').style.display = 'block';
        throw new Error('CRITICAL: MapLibre failed to load.');
    }

    function escapeHTML(value) {
        return String(value ?? '')
            .replace(/&/g, '&')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;')
            .replace(/"/g, '&quot;')
            .replace(/'/g, '&#39;');
    }

    function getName(properties) {
        return properties.name || properties.Name || properties.title || properties.site || 'Unnamed site';
    }

    function getSummary(properties) {
        return properties.summary || properties.description || properties.notes || 'No summary supplied.';
    }

    const GRID_CONFIG = Object.freeze(config);
    const layerConfigById = new Map(GRID_CONFIG.flatMap(group => group.layers).map(layer => [layer.id, layer]));
    const loadedGeoJSON = new Map();
    const runtime = {};
    let activePopup = null;
    let satelliteActive = false;

    GRID_CONFIG.forEach(group => group.layers.forEach(layer => {
        runtime[layer.id] = { loading: false, loaded: false, visible: false, count: 0 };
    }));

    const map = new maplibregl.Map({
        container: 'map',
        style: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
        center,
        zoom,
        attributionControl: false
    });

    map.addControl(new maplibregl.NavigationControl({ visualizePitch: true }), 'top-left');

    function updateClock() {
        const now = new Date();
        document.getElementById('clock').textContent = now.toLocaleTimeString('en-GB');
        document.getElementById('date').textContent = now.toLocaleDateString('en-GB', {
            weekday: 'short', day: '2-digit', month: 'short', year: 'numeric'
        });
        const active = Object.values(runtime).filter(item => item.visible).length;
        const mode = satelliteActive ? 'SAT' : 'MAP';
        document.getElementById('days').textContent = active === 0 ? `${mode} · ZERO LAYERS` : `${mode} · ${active} LAYER${active === 1 ? '' : 'S'}`;
    }

    setInterval(updateClock, 1000);
    updateClock();

    function sourceId(layerId) { return `src-${layerId}`; }
    function layerId(layerId) { return `lyr-${layerId}`; }

    function addSatelliteLayer() {
        if (map.getSource('satellite-source')) return;
        map.addSource('satellite-source', {
            type: 'raster',
            tiles: ['https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'],
            tileSize: 256,
            attribution: 'Satellite imagery © Esri'
        });
        map.addLayer({
            id: 'satellite-layer',
            type: 'raster',
            source: 'satellite-source',
            layout: { visibility: 'none' },
            paint: { 'raster-opacity': 0.92 }
        });
    }

    function setSatelliteMode(active) {
        satelliteActive = active;
        const button = document.getElementById('btn-satellite');
        if (map.getLayer('satellite-layer')) {
            map.setLayoutProperty('satellite-layer', 'visibility', active ? 'visible' : 'none');
        }
        if (button) {
            button.classList.toggle('active', active);
            button.textContent = active ? '◩ Map Mode' : '◩ Satellite';
        }
        updateClock();
    }

    function toggleSatelliteMode() {
        setSatelliteMode(!satelliteActive);
    }

    function buildPointPaint(layer) {
        return {
            'circle-color': layer.color,
            'circle-radius': layer.radius || 6,
            'circle-stroke-color': '#000000',
            'circle-stroke-width': 1.5,
            'circle-opacity': 0.95
        };
    }

    function addLayerToMap(layer, data) {
        const sid = sourceId(layer.id);
        const lid = layerId(layer.id);

        if (!map.getSource(sid)) {
            map.addSource(sid, { type: 'geojson', data });
        } else {
            map.getSource(sid).setData(data);
        }

        if (map.getLayer(lid)) return;

        if (layer.type === 'line') {
            map.addLayer({
                id: lid,
                type: 'line',
                source: sid,
                paint: {
                    'line-color': layer.color,
                    'line-width': layer.width || 2,
                    'line-opacity': 0.9
                },
                layout: { visibility: 'none' }
            });
        } else if (layer.type === 'fill') {
            map.addLayer({
                id: lid,
                type: 'fill',
                source: sid,
                paint: {
                    'fill-color': layer.color,
                    'fill-opacity': 0.22
                },
                layout: { visibility: 'none' }
            });
        } else {
            map.addLayer({
                id: lid,
                type: 'circle',
                source: sid,
                paint: buildPointPaint(layer),
                layout: { visibility: 'none' }
            });
        }

        map.on('click', lid, event => {
            const feature = event.features && event.features[0];
            if (!feature) return;
            openFeaturePopup(feature, layer);
        });
        map.on('mouseenter', lid, () => map.getCanvas().style.cursor = 'pointer');
        map.on('mouseleave', lid, () => map.getCanvas().style.cursor = '');
    }

    async function ensureLayerLoaded(layer) {
        if (runtime[layer.id].loaded || runtime[layer.id].loading) return;
        runtime[layer.id].loading = true;
        updateLayerStatus(layer.id, 'LOAD');

        try {
            const response = await fetch(layer.url);
            if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
            const data = await response.json();
            loadedGeoJSON.set(layer.id, data);
            runtime[layer.id].loaded = true;
            runtime[layer.id].count = Array.isArray(data.features) ? data.features.length : 0;
            addLayerToMap(layer, data);
            updateLayerStatus(layer.id, `${runtime[layer.id].count}`);
        } catch (error) {
            console.error(`Layer ${layer.id} failed`, error);
            updateLayerStatus(layer.id, 'ERR');
        } finally {
            runtime[layer.id].loading = false;
        }
    }

    async function setLayerVisibility(layerIdValue, visible) {
        const layer = layerConfigById.get(layerIdValue);
        if (!layer) return;

        if (visible) await ensureLayerLoaded(layer);

        const lid = layerId(layerIdValue);
        if (map.getLayer(lid)) {
            map.setLayoutProperty(lid, 'visibility', visible ? 'visible' : 'none');
        }

        runtime[layerIdValue].visible = visible;
        updateClock();
    }

    function updateLayerStatus(layerIdValue, text) {
        const elements = document.querySelectorAll(`[data-status="${layerIdValue}"]`);
        elements.forEach(element => { element.textContent = text; });
    }

    function renderLayerControls(containerId) {
        const container = document.getElementById(containerId);
        container.innerHTML = '';

        GRID_CONFIG.forEach(group => {
            const groupDiv = document.createElement('div');
            groupDiv.className = 'key-group';

            const title = document.createElement('div');
            title.className = 'key-title';
            title.textContent = group.group;
            groupDiv.appendChild(title);

            group.layers.forEach(layer => {
                const row = document.createElement('label');
                row.className = 'key-item';

                const input = document.createElement('input');
                input.type = 'checkbox';
                input.checked = false;
                input.addEventListener('change', () => {
                    document.querySelectorAll(`input[data-layer-toggle="${layer.id}"]`).forEach(other => {
                        if (other !== input) other.checked = input.checked;
                    });
                    setLayerVisibility(layer.id, input.checked);
                });
                input.dataset.layerToggle = layer.id;

                const dot = document.createElement('span');
                dot.className = 'key-dot';
                dot.style.backgroundColor = layer.color;
                dot.style.color = layer.color;

                const label = document.createElement('span');
                label.textContent = layer.label;

                const status = document.createElement('span');
                status.className = 'key-status';
                status.dataset.status = layer.id;
                status.textContent = 'OFF';

                row.appendChild(input);
                row.appendChild(dot);
                row.appendChild(label);
                row.appendChild(status);
                groupDiv.appendChild(row);
            });

            container.appendChild(groupDiv);
        });
    }

    function getVisibleFeatures() {
        const features = [];
        loadedGeoJSON.forEach((data, id) => {
            if (!runtime[id].visible) return;
            const layer = layerConfigById.get(id);
            (data.features || []).forEach(feature => features.push({ feature, layer }));
        });
        return features;
    }

    function popupCoordinates(feature) {
        if (feature.geometry.type === 'Point') return feature.geometry.coordinates;
        const flat = feature.geometry.coordinates.flat(Infinity);
        return flat.length >= 2 ? [flat[0], flat[1]] : map.getCenter().toArray();
    }

    function openFeaturePopup(feature, layer) {
        const props = feature.properties || {};
        const coords = popupCoordinates(feature);

        if (activePopup) activePopup.remove();
        activePopup = new maplibregl.Popup({ maxWidth: '340px' })
            .setLngLat(coords)
            .setHTML(`
                <div style="margin-bottom:5px;color:${layer.color};font-weight:bold;font-size:13px;text-transform:uppercase;">${escapeHTML(layer.label)}</div>
                <div class="popup-row"><span>Name:</span><span class="popup-val">${escapeHTML(getName(props))}</span></div>
                <div class="popup-row"><span>Civilisation:</span><span class="popup-val">${escapeHTML(props.civilisation || props.culture || 'Unknown')}</span></div>
                <div class="popup-row"><span>Period:</span><span class="popup-val">${escapeHTML(props.period || 'Unknown')}</span></div>
                <div class="popup-row"><span>Region:</span><span class="popup-val">${escapeHTML(props.region || 'Unknown')}</span></div>
                <div style="margin-top:8px;color:#aaa;line-height:1.4;">${escapeHTML(getSummary(props))}</div>
                ${props.quest ? `<div style="margin-top:8px;color:#ffae00;line-height:1.4;"><b>QUEST:</b> ${escapeHTML(props.quest)}</div>` : ''}
            `)
            .addTo(map);
    }

    function runSearch() {
        const term = document.getElementById('search-input').value.trim().toLowerCase();
        const results = document.getElementById('search-results');
        results.innerHTML = '';

        if (!term) {
            results.style.display = 'none';
            return;
        }

        const matches = getVisibleFeatures()
            .filter(({ feature }) => {
                const props = feature.properties || {};
                return [props.name, props.civilisation, props.period, props.region, props.summary, props.quest]
                    .join(' ').toLowerCase().includes(term);
            })
            .slice(0, 25);

        if (!matches.length) {
            results.innerHTML = '<div class="search-no-results">No loaded visible layer match. Turn on layers first.</div>';
            results.style.display = 'block';
            return;
        }

        matches.forEach(({ feature, layer }) => {
            const props = feature.properties || {};
            const item = document.createElement('div');
            item.className = 'search-result-item';
            item.innerHTML = `<b>${escapeHTML(getName(props))}</b><br>${escapeHTML(props.civilisation || layer.label)} · ${escapeHTML(props.region || '')}`;
            item.addEventListener('click', () => {
                if (feature.geometry.type === 'Point') map.flyTo({ center: feature.geometry.coordinates, zoom: 15, speed: 0.9 });
                openFeaturePopup(feature, layer);
                results.style.display = 'none';
            });
            results.appendChild(item);
        });

        results.style.display = 'block';
    }

    function exportVisibleCSV() {
        const rows = [['layer','name','civilisation','period','region','longitude','latitude','summary']];
        getVisibleFeatures().forEach(({ feature, layer }) => {
            const props = feature.properties || {};
            const coords = feature.geometry.type === 'Point' ? feature.geometry.coordinates : ['', ''];
            rows.push([layer.label, getName(props), props.civilisation || '', props.period || '', props.region || '', coords[0], coords[1], getSummary(props)]);
        });

        const csv = rows.map(row => row.map(value => `"${String(value ?? '').replace(/"/g, '""')}"`).join(',')).join('\n');
        const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
        const url = URL.createObjectURL(blob);
        const a = document.createElement('a');
        a.href = url;
        a.download = 'civilisation_atlas_visible_layers.csv';
        a.click();
        URL.revokeObjectURL(url);
    }

    function clearLayers() {
        GRID_CONFIG.forEach(group => group.layers.forEach(layer => {
            const lid = layerId(layer.id);
            if (map.getLayer(lid)) map.setLayoutProperty(lid, 'visibility', 'none');
            runtime[layer.id].visible = false;
            updateLayerStatus(layer.id, runtime[layer.id].loaded ? `${runtime[layer.id].count}` : 'OFF');
        }));
        document.querySelectorAll('.key-item input[type="checkbox"]').forEach(input => input.checked = false);
        updateClock();
    }

    function resetView() {
        map.flyTo({ center, zoom, speed: 0.9 });
    }

    window.enterFullscreen = function() {
        document.body.classList.add('fs-active');
        setTimeout(() => map.resize(), 50);
    };

    window.exitFullscreen = function() {
        document.body.classList.remove('fs-active', 'fs-curtain-open');
        setTimeout(() => map.resize(), 50);
    };

    map.on('load', () => {
        addSatelliteLayer();
        renderLayerControls('scada-ui-container');
        renderLayerControls('fs-curtain-keys');

        document.getElementById('search-btn').addEventListener('click', runSearch);
        document.getElementById('search-input').addEventListener('keydown', event => { if (event.key === 'Enter') runSearch(); });
        document.getElementById('search-input').addEventListener('input', runSearch);
        document.getElementById('btn-satellite').addEventListener('click', toggleSatelliteMode);
        document.getElementById('btn-export').addEventListener('click', exportVisibleCSV);
        document.getElementById('btn-clear').addEventListener('click', clearLayers);
        document.getElementById('btn-reset').addEventListener('click', resetView);
        document.getElementById('fs-curtain-tab').addEventListener('click', () => document.body.classList.toggle('fs-curtain-open'));

        GRID_CONFIG.flatMap(group => group.layers).filter(layer => layer.preload).forEach(layer => ensureLayerLoaded(layer));
    });

    map.on('error', event => console.error('MapLibre error:', event && event.error ? event.error : event));
};

Ventus v8

A style sheet in Youengineer Code Review. Served with the page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.

renderyouengineer-code-review / civilisation-atlas-v8/ventusv8.css · lines 1–67 of 67 · Entry point

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Downstream impact
Used directly by 1 file: Youengineer Code Review — Civilisation Atlas V8 Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/). Reached from 2 other entry points, including Civilisation Map (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/civilisation-map.html); Youengineer Code Review — Index Page (youengineer-code-review, https://ventusltd.github.io/youengineer-code-review/). It is itself an entry point, published at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Loaded by the Civilisation Atlas V8 page at https://ventusltd.github.io/youengineer-code-review/civilisation-atlas-v8/.
Application
youengineer-code-review · civilisation-atlas-v8 · style sheet
Uses
none found
Used by
loaded by Youengineer Code Review — Civilisation Atlas V8 Page (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
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas-v8/ventusv8.css:1-67 · blob cc07c5c82cc622d40905150133949580e314224b · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unknown
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background: #000; font-family: 'Courier New', monospace; color: white; overflow: hidden; }
.dashboard { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100vw; padding: 4px; gap: 4px; box-sizing: border-box; }
#fatal-banner { display: none; position: fixed; top: 0; left: 0; width: 100%; background: #ff0000; color: #fff; text-align: center; padding: 10px; font-weight: bold; z-index: 9999; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; }
.hud-header { background: #0a0a0a; border: 1px solid #333; border-radius: 6px; padding: 6px 12px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.hud-val { font-size: 16px; font-weight: bold; color: #00ffff; text-shadow: 0 0 5px #00ffff; }
.ventus-brand { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; max-width: 42vw; }
.ventus-main { font-family: -apple-system, sans-serif; font-size: 14px; font-weight: 800; color: #fff; letter-spacing: 2.4px; text-transform: uppercase; margin-bottom: 2px; white-space: nowrap; }
.ventus-sub { font-family: -apple-system, sans-serif; font-size: 6.8px; color: #888; letter-spacing: 2.4px; text-transform: uppercase; white-space: nowrap; }
.map-container { position: relative; flex-grow: 1; min-height: 0; border: 1px solid #222; border-radius: 6px; overflow: hidden; background: #0b0e14; }
#map { width: 100%; height: 100%; }
.podcast-shoutout { position: absolute; bottom: 6px; right: 8px; font-family: -apple-system, sans-serif; font-size: 8px; color: #fff; opacity: 0.5; text-align: right; text-transform: uppercase; letter-spacing: 1px; pointer-events: none; z-index: 10; text-shadow: 1px 1px 2px #000; }
.scada-wrapper { background: #050505; border: 1px solid #444; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; flex-shrink: 0; max-height: 38vh; }
.scada-brand { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #222; flex-shrink: 0; }
.scada-brand-main { font-family: -apple-system, sans-serif; font-size: 11px; font-weight: 800; color: #fff; letter-spacing: 2.4px; text-transform: uppercase; }
.scada-brand-sub { font-family: -apple-system, sans-serif; font-size: 6px; color: #555; letter-spacing: 2px; text-transform: uppercase; }
.scada-brand-tag { margin-left: auto; font-family: 'Courier New', monospace; font-size: 7px; color: #333; text-transform: uppercase; letter-spacing: 1px; }
.scada-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; overflow-y: auto; padding-bottom: 5px; }
.key-group { border-left: 2px solid #333; padding-left: 10px; margin-bottom: 4px; }
.key-title { font-size: 10px; color: #66ccff; text-transform: uppercase; margin-bottom: 6px; font-weight: bold; }
.key-item { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; cursor: pointer; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; flex: 0 0 auto; }
.key-status { color: #555; font-size: 9px; margin-left: auto; }
input[type="checkbox"], input[type="radio"] { transform: scale(1.3); margin-right: 4px; accent-color: #00ffff; }
.maplibregl-popup-content { background: #000; color: #00ffff; border: 1px solid #444; font-family: monospace; font-size: 12px; padding: 8px; }
.disclaimer-box { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; text-align: justify; font-size: 9px; line-height: 1.5; color: #666; margin-top: 10px; padding-top: 10px; border-top: 1px solid #222; user-select: none; pointer-events: none; flex-shrink: 0; content-visibility: auto; }
.custom-map-attrib { position: absolute; top: 10px; left: 10px; background: rgba(5, 5, 5, 0.7); color: #888; font-family: 'Courier New', monospace; font-size: 9px; border-radius: 4px; padding: 4px 8px; z-index: 10; border: 1px solid #333; pointer-events: auto; max-width: calc(100% - 60px); line-height: 1.6; }
.custom-map-attrib a { color: #00ffff; text-decoration: none; }
.custom-map-attrib a:hover { text-decoration: underline; }
body.fs-active .custom-map-attrib { top: 44px; }
.search-bar-wrapper { position: absolute; top: 72px; right: 10px; z-index: 20; display: flex; gap: 6px; }
body.fs-active .search-bar-wrapper { top: 100px; }
.search-input { background: rgba(5,5,5,0.85); border: 1px solid #444; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 10px; width: 220px; outline: none; }
.search-input::placeholder { color: #444; }
.search-input:focus { border-color: #00ffff; }
.search-btn { background: #0a0a0a; border: 1px solid #00ffff; border-radius: 4px; color: #00ffff; font-family: 'Courier New', monospace; font-size: 11px; padding: 5px 10px; cursor: pointer; }
.search-btn:hover { background: #00ffff; color: #000; }
.search-results { position: absolute; top: 36px; right: 0; background: #050505; border: 1px solid #333; border-radius: 4px; width: 300px; max-height: 220px; overflow-y: auto; z-index: 21; display: none; }
.search-result-item { padding: 7px 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #888; cursor: pointer; border-bottom: 1px solid #111; line-height: 1.5; }
.search-result-item:hover { background: #111; color: #00ffff; }
.search-result-item b { color: #ffcc00; }
.search-no-results { padding: 8px 10px; font-family: 'Courier New', monospace; font-size: 10px; color: #444; }
.map-controls { position: absolute; bottom: 30px; left: 10px; z-index: 20; display: flex; flex-direction: column; gap: 4px; }
.map-mode-controls { position: absolute; top: 10px; right: 54px; z-index: 20; display: flex; gap: 8px; }
.map-ctrl-btn, .map-toggle-btn { background: rgba(5,5,5,0.85); border: 1px solid #333; border-radius: 4px; color: #888; font-family: 'Courier New', monospace; font-size: 9px; padding: 5px 8px; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.map-toggle-btn { font-size: 11px; font-weight: bold; padding: 6px 12px; }
.map-ctrl-btn:hover, .map-toggle-btn:hover { border-color: #00ffff; color: #00ffff; }
.map-ctrl-btn.active, .map-toggle-btn.active { border-color: #00ffff; color: #00ffff; background: rgba(0,255,255,0.08); }
#btn-fullscreen { position: absolute; top: 10px; right: 10px; z-index: 20; background: rgba(5,5,5,0.85); border: 1px solid #333; border-radius: 4px; color: #888; font-size: 18px; width: 34px; height: 30px; cursor: pointer; line-height: 1; }
#btn-fullscreen:hover { color: #00ffff; border-color: #00ffff; }
#btn-fullscreen-exit { display: none; position: fixed; top: 8px; left: 8px; z-index: 511; background: #0a0a0a; color: #ff4444; border: 1px solid #ff4444; border-radius: 4px; padding: 6px 10px; font-family: monospace; cursor: pointer; }
#fs-letterhead { display: none; position: fixed; top: 8px; right: 12px; z-index: 512; text-align: right; pointer-events: none; }
#fs-curtain-tab { display: none; position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 512; background: rgba(5,5,5,0.94); color: #00ffff; border: 1px solid #333; border-bottom: none; border-radius: 8px 8px 0 0; padding: 5px 18px; font-family: monospace; font-size: 11px; cursor: pointer; }
#fs-curtain { display: none; position: fixed; left: 0; right: 0; bottom: 0; max-height: 42vh; overflow: auto; background: rgba(5,5,5,0.96); border-top: 1px solid #333; z-index: 511; padding: 12px; box-sizing: border-box; }
body.fs-active .dashboard { padding: 0; }
body.fs-active .hud-header, body.fs-active .scada-wrapper { display: none; }
body.fs-active .map-container { border: none; border-radius: 0; height: 100vh; }
body.fs-active #btn-fullscreen { display: none; }
body.fs-active .map-mode-controls { top: 44px; right: 12px; }
body.fs-active #btn-fullscreen-exit, body.fs-active #fs-letterhead, body.fs-active #fs-curtain-tab { display: block; }
body.fs-active.fs-curtain-open #fs-curtain { display: block; }
.status-legend { display: flex; flex-wrap: wrap; gap: 12px; color: #888; font-size: 10px; margin-bottom: 8px; }
.status-dot { display: flex; align-items: center; gap: 5px; }
.status-dot span { display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.popup-row { display: grid; grid-template-columns: 92px 1fr; gap: 8px; margin: 3px 0; }
.popup-row span:first-child { color: #888; }
.popup-val { color: #fff; }
@media (max-width: 720px) { .scada-keys { grid-template-columns: 1fr; } .search-bar-wrapper { top: 58px; right: 8px; } .search-input { width: 170px; } .status-legend { display: none; } .ventus-main { font-size: 13px; letter-spacing: 2px; } .map-mode-controls { top: 46px; right: 8px; } .map-toggle-btn { font-size: 9px; padding: 5px 8px; } }

Atlas Helpers

A JavaScript file in the civilisation atlas folder of Youengineer Code Review that formats coordinates (`formatCoordinates`), makes SVG element (`makeSvgElement`) and draws SVG graphics.

geodesyyouengineer-code-review / civilisation-atlas/atlas-helpers.js · lines 1–38 of 38 · Not reached from any entry point (candidate for review)

What it does
It lists and searches its content. Defines 7 functions or classes, including $, normalise, uniqueSorted, lonLatToPoint, formatCoordinates. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Inputs & outputs
Out: SVG drawing.
What it achieves
It formats coordinates (`formatCoordinates`) and makes SVG element (`makeSvgElement`). Defines `normalise`, `uniqueSorted`, `lonLatToPoint` and 3 more.
Why it matters
No other file in the estate was found to import it.
Application
youengineer-code-review · civilisation-atlas · script
Uses
none found
Used by
none found
Produces
$, normalise, uniqueSorted, lonLatToPoint, formatCoordinates, featureText, makeSvgElement
Defines here
$, normalise, uniqueSorted, lonLatToPoint, formatCoordinates, featureText, makeSvgElement
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas/atlas-helpers.js:1-38 · blob 768d36bdaad417afa6a561568d31f2a7f642d00f · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
"use strict";

const $ = (id) => document.getElementById(id);

function normalise(value) {
  return String(value || "").toLowerCase().trim();
}

function uniqueSorted(values) {
  return [...new Set(values.filter(Boolean))].sort((a, b) => a.localeCompare(b));
}

function lonLatToPoint(coordinates) {
  const [lon, lat] = coordinates;
  const x = ((lon + 180) / 360) * 1000;
  const y = ((90 - lat) / 180) * 520;
  return { x, y };
}

function formatCoordinates(coordinates) {
  const [lon, lat] = coordinates;
  const latSuffix = lat >= 0 ? "N" : "S";
  const lonSuffix = lon >= 0 ? "E" : "W";
  return `${Math.abs(lat).toFixed(3)}°${latSuffix}, ${Math.abs(lon).toFixed(3)}°${lonSuffix}`;
}

function featureText(feature) {
  const p = feature.properties || {};
  return [p.name, p.civilisation, p.region, p.period, p.summary, p.quest].join(" ");
}

function makeSvgElement(tagName, attributes = {}) {
  const element = document.createElementNS("http://www.w3.org/2000/svg", tagName);
  Object.entries(attributes).forEach(([key, value]) => {
    element.setAttribute(key, value);
  });
  return element;
}

Atlas Map

A JavaScript file in the civilisation atlas folder of Youengineer Code Review that draws graticule (`drawGraticule`) and land hints (`drawLandHints`) and draws routes (`drawRoutes`).

renderyouengineer-code-review / civilisation-atlas/atlas-map.js · lines 1–164 of 164 · Not reached from any entry point (candidate for review) · pattern drawGraticule (shared by 2 files)

What it does
It draws its content. Defines 8 functions or classes, including drawGraticule, drawLandHints, drawRoutes, getMarkerClass, drawSites. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
What it achieves
It draws graticule (`drawGraticule`), draws land hints (`drawLandHints`) and draws routes (`drawRoutes`). Defines `drawGraticule`, `drawLandHints`, `drawRoutes` and 5 more. It responds to click and keydown events.
Why it matters
No other file in the estate was found to import it.
Application
youengineer-code-review · civilisation-atlas · script
Uses
none found
Used by
none found
Produces
drawGraticule, drawLandHints, drawRoutes, getMarkerClass, drawSites, drawLegend, renderMap, initialiseMap
Defines here
drawGraticule, drawLandHints, drawRoutes, getMarkerClass, drawSites, drawLegend, renderMap, initialiseMap
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas/atlas-map.js:1-164 · blob 1ec411ef2bd8cfbdb696eb133ce4db0806a125b6 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
"use strict";

const LAND_HINTS = [
  "M 120 132 C 155 92 250 82 325 118 C 380 145 365 190 315 205 C 250 225 160 205 115 178 Z",
  "M 448 108 C 520 72 640 78 760 132 C 835 165 858 230 790 260 C 705 300 575 268 500 236 C 442 210 395 150 448 108 Z",
  "M 500 246 C 555 248 598 300 585 375 C 565 455 498 442 465 370 C 436 305 445 260 500 246 Z",
  "M 630 296 C 704 278 800 310 820 370 C 845 445 745 454 690 422 C 642 394 595 322 630 296 Z",
  "M 245 250 C 308 252 344 304 330 380 C 310 462 248 505 214 445 C 182 390 186 300 245 250 Z",
  "M 186 178 C 224 178 258 210 250 252 C 238 315 184 330 156 270 C 132 222 148 184 186 178 Z",
  "M 826 184 C 864 172 904 184 918 214 C 930 250 900 278 850 265 C 812 252 792 200 826 184 Z",
  "M 493 42 C 535 28 585 38 606 68 C 564 76 523 75 493 42 Z"
];

function drawGraticule() {
  const graticuleLayer = $("graticuleLayer");
  graticuleLayer.innerHTML = "";

  for (let lon = -180; lon <= 180; lon += 30) {
    const start = lonLatToPoint([lon, -80]);
    const end = lonLatToPoint([lon, 80]);
    graticuleLayer.appendChild(makeSvgElement("line", {
      class: "graticule",
      x1: start.x,
      y1: start.y,
      x2: end.x,
      y2: end.y
    }));
  }

  for (let lat = -60; lat <= 60; lat += 30) {
    const start = lonLatToPoint([-180, lat]);
    const end = lonLatToPoint([180, lat]);
    graticuleLayer.appendChild(makeSvgElement("line", {
      class: "graticule",
      x1: start.x,
      y1: start.y,
      x2: end.x,
      y2: end.y
    }));
  }
}

function drawLandHints() {
  const landHintLayer = $("landHintLayer");
  landHintLayer.innerHTML = "";
  LAND_HINTS.forEach((path) => {
    landHintLayer.appendChild(makeSvgElement("path", {
      class: "land-hint",
      d: path
    }));
  });
}

function drawRoutes() {
  const routeLayer = $("routeLayer");
  routeLayer.innerHTML = "";

  if (!atlasState.filters.showQuests) {
    return;
  }

  (window.ATLAS_ROUTES || []).forEach((route) => {
    const points = route.coordinates.map((coordinates) => lonLatToPoint(coordinates));
    const d = points.map((point, index) => `${index === 0 ? "M" : "L"} ${point.x.toFixed(2)} ${point.y.toFixed(2)}`).join(" ");
    routeLayer.appendChild(makeSvgElement("path", {
      class: "route-line",
      d,
      "aria-label": route.name
    }));
  });
}

function getMarkerClass(feature) {
  const p = feature.properties || {};
  if (p.layer === "heritage") {
    return "marker-heritage";
  }
  if (atlasState.filters.showQuests) {
    return "marker-quest";
  }
  return "marker-classical";
}

function drawSites() {
  const siteLayer = $("siteLayer");
  siteLayer.innerHTML = "";

  atlasState.filteredFeatures.forEach((feature) => {
    const p = feature.properties || {};
    const point = lonLatToPoint(feature.geometry.coordinates);
    const group = makeSvgElement("g", {
      class: `marker-group ${p.id === atlasState.selectedFeatureId ? "active" : ""}`,
      tabindex: "0",
      role: "button",
      "aria-label": p.name
    });

    const marker = makeSvgElement("circle", {
      class: `site-marker ${getMarkerClass(feature)} ${p.id === atlasState.selectedFeatureId ? "active" : ""}`,
      cx: point.x,
      cy: point.y,
      r: p.layer === "heritage" ? 6 : 5,
      "data-site-id": p.id
    });

    const label = makeSvgElement("text", {
      class: "site-label",
      x: point.x + 9,
      y: point.y - 9
    });
    label.textContent = p.name;

    group.appendChild(marker);
    group.appendChild(label);

    group.addEventListener("click", () => selectFeature(p.id));
    group.addEventListener("keydown", (event) => {
      if (event.key === "Enter" || event.key === " ") {
        event.preventDefault();
        selectFeature(p.id);
      }
    });

    siteLayer.appendChild(group);
  });
}

function drawLegend() {
  const legend = $("legend");
  legend.innerHTML = "";

  const items = [
    { label: "Classical starter site", className: "marker-classical" },
    { label: "UNESCO-tagged starter", className: "marker-heritage" },
    { label: "Quest layer active", className: "marker-quest" }
  ];

  items.forEach((item) => {
    const row = document.createElement("div");
    row.className = "legend-item";

    const dot = document.createElement("span");
    dot.className = `legend-dot ${item.className}`;

    const text = document.createElement("span");
    text.textContent = item.label;

    row.appendChild(dot);
    row.appendChild(text);
    legend.appendChild(row);
  });
}

function renderMap() {
  drawRoutes();
  drawSites();
  drawLegend();
}

function initialiseMap() {
  drawGraticule();
  drawLandHints();
  renderMap();
}

Atlas State

A JavaScript file in the civilisation atlas folder of Youengineer Code Review.

renderyouengineer-code-review / civilisation-atlas/atlas-state.js · lines 1–15 of 15 · Not reached from any entry point (candidate for review)

What it does
Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'atlas'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name. Described from its file name only (a candidate, not yet checked against the code).
Why it matters
No other file in the estate was found to import it.
Application
youengineer-code-review · civilisation-atlas · script
Uses
none found
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
youengineer-code-review@929a6d4a955524122e4fd18bd3c85ceaf1a86c56 civilisation-atlas/atlas-state.js:1-15 · blob f1a09d2b77535f81fbfb719dfda9673c139f4cc0 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: unreached_review
"use strict";

window.atlasState = {
  currentGeoJSON: window.ATLAS_GEOJSON || { type: "FeatureCollection", features: [] },
  filteredFeatures: [],
  selectedFeatureId: null,
  filters: {
    search: "",
    civilisation: "All",
    region: "All",
    showClassical: true,
    showHeritage: true,
    showQuests: true
  }
};