synchro du labo (0bf0da65) : app.blade.php, README.md

This commit is contained in:
cloudion
2026-11-03 22:41:23 +00:00
parent 33c723055d
commit 3ee5733f66
2 changed files with 123 additions and 2 deletions

View File

@@ -1,3 +1,21 @@
# ploxion-globe
# 🌍 Globe
PLOXION · Le globe 3D du xerboxion (CesiumJS auto-hébergé, le moteur de gods-eye-view) : fonds satellite sans clé, Google 3D photoréaliste et Cesium ion avec tes clés, couches vivantes enregistrées par les bions de veille, clic sur une entité, vol vers un lieu, jour/nuit. Bion jOSGlobe = même contrat de couches que la carte. · fournit: globe, 3d, carte, veille, satellite, cesium
Le globe 3D du xerboxion (CesiumJS auto-hébergé, le moteur de gods-eye-view) : fonds satellite sans clé, Google 3D photoréaliste et Cesium ion avec tes clés, couches vivantes enregistrées par les bions de veille, clic sur une entité, vol vers un lieu, jour/nuit. Bion jOSGlobe = même contrat de couches que la carte.
| | |
| --- | --- |
| id | `globe` |
| fournit | `globe` `3d` `carte` `veille` `satellite` `cesium` |
| bions qu'il nomme | `jOSApi` `jOSApps` `jOSCarte` `jOSGlobe` `jOSPorts` `jOSVeille` `jOSVeilleSources` `jOSXui` |
| fichiers | `app.blade.php` |
| dans le labo | `resources/views/ploxions/globe/` (dépôt `my_website2`) |
## Contribuer
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=globe — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
- **Dans VS Code** : `xb prendre globe` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
© 2026 chill-tekk · ne pas nuire

103
app.blade.php Normal file
View File

@@ -0,0 +1,103 @@
{{-- PL0XI0N globe 🌍 — LE GLOBE 3D (moteur CesiumJS, le même que gods-eye-view, auto-hébergé). Vue sur
jOSGlobe : fonds (Sentinel-2 / OSM / Esri sans clé ; ion / Google 3D avec clés du Coffre), les couches
enregistrées (jOSGlobe.register — les bions de veille s'y branchent), position caméra en HUD, voler vers
un lieu (géocodage jOSCarte si présent, sinon lat,lng), ma position, nuit/jour, clic sur une entité →
fiche + bus ploxion.globe.pick. describe() = caméra + couches. Mobile-first, WebGL requis.
VEILLE (spec docs/plans/veille-gods-eye-v1.md §3) : après create() → jOSVeille.attach('globe', api) (la
vue devient pilotable par le god's eye ; les sources jOSVeilleSources.get(id) se sont enregistrées dans
jOSGlobe.register et s'allument par les chips) ; fiche via jOSVeille.fiche(e) quand e.src (actions =
boutons jOSXui.act → bus, jamais un callback) ; describe() ajoute la stat « veille » = jOSVeille.count().
Les sources fetchent par jOSApi.get (/px/api même-origine : la mention charge _api_bions sur /px/globe, détection non transitive).
Tout est OFF par défaut : sans jOSVeille chargé, rien ne change. --}}
<style>
.gl{position:relative;height:100%;min-height:0;background:#000;color:#e7f0ff;font-family:var(--xr-font-ui,system-ui);overflow:hidden}
.gl *{box-sizing:border-box}
.gl__view{position:absolute;inset:0} .gl__view .cesium-viewer-bottom{display:none}
.gl__hud{position:absolute;left:10px;top:10px;z-index:3;display:flex;gap:6px;flex-wrap:wrap;max-width:calc(100% - 20px)}
.gl__chip{display:inline-flex;align-items:center;gap:5px;padding:6px 10px;border-radius:999px;background:rgba(8,17,27,.72);border:1px solid rgba(63,224,208,.45);color:#e7f0ff;font:12px system-ui;cursor:pointer;backdrop-filter:blur(6px);min-height:32px}
.gl__chip.on{background:rgba(63,224,208,.9);color:#08111b;border-color:#3fe0d0;font-weight:700} .gl__chip.dim{opacity:.5}
.gl__cam{position:absolute;left:10px;bottom:calc(10px + env(safe-area-inset-bottom));z-index:3;font:11px ui-monospace,monospace;color:#9fd8ff;background:rgba(8,17,27,.7);padding:6px 9px;border-radius:9px;border:1px solid rgba(63,224,208,.3)}
.gl__search{position:absolute;right:10px;top:10px;z-index:3;display:flex;gap:6px}
.gl__search input{width:min(46vw,240px);padding:7px 10px;border-radius:999px;border:1px solid rgba(63,224,208,.45);background:rgba(8,17,27,.8);color:#e7f0ff;font:13px system-ui;outline:none}
.gl__fiche{position:absolute;right:10px;bottom:calc(10px + env(safe-area-inset-bottom));z-index:4;max-width:min(80vw,320px);background:rgba(8,17,27,.92);border:1px solid #3fe0d0;border-radius:12px;padding:10px 12px;font-size:.82rem;line-height:1.45}
.gl__fiche b{display:block;color:#3fe0d0;margin-bottom:3px} .gl__fiche .x{position:absolute;right:6px;top:4px;cursor:pointer;border:0;background:transparent;color:#e7f0ff;font-size:16px}
.gl__fiche dl{margin:6px 0 0;display:grid;grid-template-columns:auto 1fr;gap:2px 8px} .gl__fiche dt{color:#8aa0c0} .gl__fiche dd{margin:0;overflow:hidden;text-overflow:ellipsis}
.gl__fiche .acts{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.gl__msg{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;text-align:center;padding:24px;color:#8aa0c0;z-index:2;background:#05060c}
.gl__layers{position:absolute;left:10px;top:52px;z-index:3;display:flex;flex-direction:column;gap:4px;max-height:50%;overflow:auto}
</style>
<script>
(function () {
var ID = 'globe';
function esc(s) { return window.jOSb.esc(s); }
var LIVE = null;
function mount(container, ctx) {
container.classList.add('gl');
container.innerHTML = '<div class="gl__view" data-view></div><div class="gl__msg" data-msg>🌍 chargement du globe (Cesium, 6 Mo, une fois)…</div>';
var G = window.jOSGlobe, view = container.querySelector('[data-view]'), msg = container.querySelector('[data-msg]'), api = null, dead = false, camIv = null, ro = null, vue = null, ficheActs = [];
if (!G) { msg.textContent = 'bion jOSGlobe absent'; return { unmount: function () { container.classList.remove('gl'); container.innerHTML = ''; } }; }
var params = (ctx && ctx.params) || {}; try { var q = new URLSearchParams(location.search); ['lat', 'lng', 'alt', 'basemap'].forEach(function (k) { if (q.get(k) && params[k] == null) params[k] = q.get(k); }); } catch (e) {}
function chrome() {
var bases = Object.keys(G.basemaps).map(function (id) { var b = G.basemaps[id], ok = G.available(id); return '<button class="gl__chip ' + (api && api.basemapId() === id ? 'on' : '') + (ok ? '' : ' dim') + '" data-base="' + id + '" title="' + esc(b.name + (ok ? '' : ' — clé « ' + b.cle + ' » dans le Coffre')) + '">' + b.icon + '</button>'; }).join('');
var layers = G.layers().map(function (d) { var L = api && api.layers()[d.id]; var on = L ? L.visible() : d.enabled !== false; return '<button class="gl__chip ' + (on ? 'on' : '') + '" data-layer="' + esc(d.id) + '">' + esc(d.icon || '▣') + ' ' + esc(d.name || d.id) + (L ? ' <small>' + L.count() + '</small>' : '') + '</button>'; }).join('');
var track = (api && api.tracking && api.tracking()) ? '<button class="gl__chip on" data-track-off title="arrêter le suivi">⌖ ' + esc(api.tracking()) + ' ✕</button>' : '';
var h = '<div class="gl__hud">' + bases + '<button class="gl__chip" data-me title="ma position">📍</button><button class="gl__chip" data-night title="éclairage jour/nuit">🌗</button>' + track + '</div>'
+ '<div class="gl__layers" data-layers>' + layers + '</div>'
+ '<div class="gl__search"><input data-q placeholder="lieu, ou lat,lng" inputmode="search"></div><div class="gl__cam" data-cam>—</div>';
container.querySelectorAll('.gl__hud,.gl__layers,.gl__search,.gl__cam').forEach(function (e) { e.remove(); });
container.insertAdjacentHTML('beforeend', h);
}
function cam() { if (!api) return; var c = api.look(), el = container.querySelector('[data-cam]'); if (el) el.textContent = c.lat.toFixed(3) + ', ' + c.lng.toFixed(3) + ' · ' + (c.alt > 5000 ? Math.round(c.alt / 1000) + ' km' : Math.round(c.alt) + ' m') + ' · ' + Math.round(c.heading) + '°'; }
// fiche : entité veille (e.src) → jOSVeille.fiche(e) = {title, sub, rows:[[k,v]], actions:[{label, act:{port,payload}}]}
// (actions = boutons → jOSXui.act → bus) ; sinon la fiche générique depuis meta
function fiche(p) {
var old = container.querySelector('.gl__fiche'); if (old) old.remove(); ficheActs = []; if (!p || !p.e) return;
var e = p.e, f = null, title, sub, rows, acts = '';
if (e.src && window.jOSVeille && typeof jOSVeille.fiche === 'function') { try { f = jOSVeille.fiche(e); } catch (er) { f = null; } }
if (f && typeof f === 'object') {
title = f.title || ((e.icon || '') + ' ' + (e.label || e.id)); sub = f.sub || (e.src + ' · ' + (+e.lat).toFixed(4) + ', ' + (+e.lng).toFixed(4));
rows = (f.rows || []).slice(0, 12).map(function (r) { return '<dt>' + esc(r && r[0]) + '</dt><dd>' + esc(r && r[1]) + '</dd>'; }).join('');
ficheActs = (f.actions || []).filter(function (a) { return a && a.act && typeof a.act.port === 'string'; }).slice(0, 6);
acts = ficheActs.length ? '<div class="acts">' + ficheActs.map(function (a, i) { return '<button class="gl__chip" data-act="' + i + '">' + esc(a.label || 'action') + '</button>'; }).join('') + '</div>' : '';
} else {
var m = e.meta || {}; title = (e.icon || '') + ' ' + (e.label || e.id); sub = p.layer + ' · ' + (+e.lat).toFixed(4) + ', ' + (+e.lng).toFixed(4) + (e.alt ? ' · ' + Math.round(e.alt) + ' m' : '');
rows = Object.keys(m).slice(0, 8).map(function (k) { return '<dt>' + esc(k) + '</dt><dd>' + esc(m[k]) + '</dd>'; }).join('');
}
container.insertAdjacentHTML('beforeend', '<div class="gl__fiche"><button class="x" data-x>✕</button><b>' + esc(title) + '</b><small>' + esc(sub) + '</small><dl>' + rows + '</dl>' + acts + '</div>');
}
G.create(view, { basemap: params.basemap || null, eco: !!(window.matchMedia && matchMedia('(pointer:coarse)').matches) }).then(function (a) {
if (dead) { a.destroy(); return; } api = a; LIVE = api; msg.remove(); chrome();
if (params.lat && params.lng) api.fly(+params.lat, +params.lng, params.alt ? +params.alt : 8e5, { duration: 0 }); else api.fly(46.8, 8.2, 2.2e6, { duration: 0 });
// la vue s'attache au god's eye (pilote, bbox des sources mode 'view', focus/track par le bus) — si le bion est là
try { if (window.jOSVeille && typeof jOSVeille.attach === 'function') vue = jOSVeille.attach('globe', api) || null; } catch (e) { vue = null; }
api.pick(fiche); camIv = setInterval(function () { cam(); if (document.visibilityState === 'visible') { var l = container.querySelector('[data-layers]'); if (l && Math.random() < 0.34) { chrome(); } } }, 2000); cam();
try { ro = new ResizeObserver(function () { api.resize(); }); ro.observe(container); } catch (e) {}
try { if (window.jOSPorts) jOSPorts.emit(ID, 'ready', { basemap: api.basemapId() }); } catch (e) {}
}).catch(function (e) { msg.innerHTML = '🌍 globe indisponible : ' + esc(e && e.message) + '<br><small>WebGL requis ; /vendor/cesium doit être servi.</small>'; });
container.addEventListener('click', function (e) {
var b;
if ((b = e.target.closest('[data-base]')) && api) { api.basemap(b.getAttribute('data-base')).then(function (ok) { if (!ok) { try { window.jOSb && jOSb.toast && jOSb.toast('clé manquante dans le Coffre'); } catch (er) {} } chrome(); }); return; }
// chip de couche : show() suffit — le bion appelle load() au 1er allumage et le hook onToggle démarre/arrête le poll
if ((b = e.target.closest('[data-layer]')) && api) { var L = api.layer(b.getAttribute('data-layer')); L.show(!L.visible()); chrome(); return; }
if ((b = e.target.closest('[data-act]'))) { var act = ficheActs[+b.getAttribute('data-act')]; if (act) { try { if (window.jOSXui && jOSXui.act) jOSXui.act(act); else { var mm = /^ploxion\.([^.]+)\.(.+)$/.exec(act.act.port); if (mm && window.jOSPorts) jOSPorts.emit(mm[1], mm[2], act.act.payload || {}); } } catch (er) {} } return; }
if (e.target.closest('[data-track-off]') && api) { api.track(null); chrome(); return; }
if (e.target.closest('[data-me]') && api) { try { navigator.geolocation.getCurrentPosition(function (p) { api.fly(p.coords.latitude, p.coords.longitude, 3000); }, function () {}, { enableHighAccuracy: false, timeout: 8000 }); } catch (er) {} return; }
if (e.target.closest('[data-night]') && api) { api.night(!api.viewer.scene.globe.enableLighting); return; }
if (e.target.closest('[data-x]')) { fiche(null); return; }
});
container.addEventListener('keydown', function (e) { if (e.key !== 'Enter' || !e.target.matches('[data-q]') || !api) return; var v = e.target.value.trim(); if (!v) return; var m = /^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/.exec(v); if (m) { api.fly(+m[1], +m[2], 5000); return; } try { if (window.jOSCarte && jOSCarte.geocode) { Promise.resolve(jOSCarte.geocode(v)).then(function (r) { var hit = Array.isArray(r) ? r[0] : r; if (hit && hit.lat != null) api.fly(+hit.lat, +(hit.lng != null ? hit.lng : hit.lon), 6000); }); } } catch (er) {} });
// port entrant ploxion.globe.cmd : fly | basemap | layer (allume VRAIMENT la source grâce au hook) | track {id|null} | style {id}
try { window.jOSPorts && jOSPorts.on && jOSPorts.on('ploxion.globe.cmd', function (p) { p = p || {}; if (!api) return; if (p.cmd === 'fly' && p.lat != null) api.fly(+p.lat, +p.lng, p.alt != null ? +p.alt : 5000, p); else if (p.cmd === 'basemap' && p.id) api.basemap(p.id).then(chrome); else if (p.cmd === 'layer' && p.id) { var L = api.layer(p.id); L.show(p.on !== false); chrome(); } else if (p.cmd === 'track') { api.track(p.id == null ? null : p.id); chrome(); } else if (p.cmd === 'style') { api.style(p.id || 'none'); } }); } catch (e) {}
return { unmount: function () { dead = true; clearInterval(camIv); try { ro && ro.disconnect(); } catch (e) {} try { vue && vue.detach && vue.detach(); } catch (e) {} vue = null; if (api) { try { api.destroy(); } catch (e) {} } if (LIVE === api) LIVE = null; container.classList.remove('gl'); container.innerHTML = ''; } };
}
function describe() {
var G = window.jOSGlobe; var c = LIVE ? LIVE.look() : null; var ls = G ? G.layers() : [];
var items = [{ p: 1, kind: 'stat', label: 'caméra', value: c ? c.lat.toFixed(1) + ',' + c.lng.toFixed(1) : '—' }, { p: 2, kind: 'stat', label: 'couches', value: ls.length }];
try { if (window.jOSVeille && typeof jOSVeille.count === 'function') items.push({ p: 2, kind: 'stat', label: 'veille', value: jOSVeille.count() }); } catch (e) {} // contacts veille dans le registre
items.push({ p: 2, kind: 'list', label: 'couches', items: ls.slice(0, 7).map(function (d) { var L = LIVE && LIVE.layers()[d.id]; return { label: (d.icon || '') + ' ' + (d.name || d.id), value: L ? L.count() : '', act: { port: 'ploxion.globe.cmd', payload: { cmd: 'layer', id: d.id, on: !(L && L.visible()) } } }; }) });
items.push({ p: 3, kind: 'action', label: 'chez moi', act: { port: 'ploxion.globe.cmd', payload: { cmd: 'fly', lat: 46.8, lng: 8.2, alt: 2.2e6 } } });
return { v: 1, id: ID, title: 'Globe', icon: '🌍', items: items };
}
window.jOSApps = window.jOSApps || {}; window.jOSApps[ID] = { manifest: { id: ID, name: 'Globe', icon: '🌍' }, mount: mount, describe: describe };
})();
</script>