v47 : masquer une précision absente du site (ex. « Très précis » sur OVH)

Si data/lidar/<précision>/index.json renvoie 404, le choix disparaît des
réglages, d'Expert et de la fenêtre de téléchargement, et l'app revient à
« Moyen ». Permet de publier sans la précision 1 m (83 Mo) sur un
hébergement à place limitée.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mathieuandClaude Opus 5.5 committed 2026-11-15 22:48:28 +01:00
1 parent 3662fd4993
commit a00af81443
6 files changed
+28 -15

No files matched your search

+15 -6
View File
@@ -3,16 +3,16 @@
import * as THREE from 'three';
import * as LocAR from 'locar';
import { PYLON_TYPES } from './pylon.js?v=46';
import { BuildingOccluders } from './buildings.js?v=46';
import { LidarOccluders } from './lidar.js?v=46';
import { Terrain, TerrainOccluders } from './terrain.js?v=46';
import { registerServiceWorker, offlineSupported, offlineStatus, downloadAll, clearOffline, sourceSize } from './offline.js?v=46';
import { PYLON_TYPES } from './pylon.js?v=47';
import { BuildingOccluders } from './buildings.js?v=47';
import { LidarOccluders } from './lidar.js?v=47';
import { Terrain, TerrainOccluders } from './terrain.js?v=47';
import { registerServiceWorker, offlineSupported, offlineStatus, downloadAll, clearOffline, sourceSize } from './offline.js?v=47';
import { LineSegments2 } from './lib/lines/LineSegments2.js';
import { LineSegmentsGeometry } from './lib/lines/LineSegmentsGeometry.js';
import { LineMaterial } from './lib/lines/LineMaterial.js';
const APP_VERSION = 'v46'; // affichée à gauche de l'indication « Tourne à… »
const APP_VERSION = 'v47'; // affichée à gauche de l'indication « Tourne à… »
// ---------------------------------------------------------------------------
// Configuration
@@ -1207,11 +1207,20 @@ occlSel.addEventListener('change', () => setOcclSrc(occlSel.value));
const clearIn = document.getElementById('clear-r'), clearOut = document.getElementById('clear-out');
clearIn.value = clearOut.textContent = clearRadius;
clearIn.addEventListener('input', () => { clearRadius = +clearIn.value; clearOut.textContent = clearRadius; savePref('bdh-clear2', clearRadius); });
// Précision non publiée sur ce site (ex. « Très précis », 83 Mo, absent de l'hébergement principal) :
// on retire le choix partout et on revient à « Moyen » s'il était sélectionné.
function hideOcclSource(k) {
document.querySelector(`input[name="occl-prec"][value="${k}"]`)?.closest('label')?.remove();
[...occlSel.options].find((o) => o.value === k)?.remove();
document.querySelector(`#dl-choices button[data-src="${k}"]`)?.remove();
if (occlSrc === k) setOcclSrc('lidar2');
}
// Tailles de téléchargement complet affichées à côté de chaque choix
// (relief du terrain 3,8 Mo toujours compris ; avec le LiDAR, + bâtiments OSM)
Promise.all([sourceSize(TERRAIN_SRC), ...Object.entries(OCCL_SOURCES).map(async ([k, s]) => [k, await sourceSize(s)])]).then(([tsz, ...list]) => {
const osmBytes = list.find(([k]) => k === 'osm')?.[1]?.bytes || 0;
for (const [k, sz] of list) {
if (sz?.missing) { hideOcclSource(k); continue; }
const txt = sz ? fmtMB(sz.bytes + (tsz?.bytes || 0) + (k === 'osm' ? 0 : osmBytes)) : 'indisponible';
const el = document.getElementById(`size-${k}`);
if (el) el.textContent = txt;