diff --git a/www/app.js b/www/app.js index d20fbfc..f1b9ebf 100644 --- a/www/app.js +++ b/www/app.js @@ -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; diff --git a/www/buildings.js b/www/buildings.js index 7754eeb..0b0e6c4 100644 --- a/www/buildings.js +++ b/www/buildings.js @@ -9,7 +9,7 @@ // dans la même projection locale que l'app (équirectangulaire, LAT0 = 50,6°). import * as THREE from 'three'; -import { withClearZone } from './terrain.js?v=46'; +import { withClearZone } from './terrain.js?v=47'; const TILE = 1000; // m diff --git a/www/index.html b/www/index.html index 178dfe4..3e765da 100644 --- a/www/index.html +++ b/www/index.html @@ -10,7 +10,7 @@ Boucle du Hainaut : ouvrons les yeux - + + diff --git a/www/lidar.js b/www/lidar.js index ae1fed9..07ec4a2 100644 --- a/www/lidar.js +++ b/www/lidar.js @@ -5,7 +5,7 @@ // Les hauteurs sont posées sur le relief du terrain (terrain.js) : y = altitude du sol + hauteur. import * as THREE from 'three'; -import { withClearZone } from './terrain.js?v=46'; +import { withClearZone } from './terrain.js?v=47'; const TILE = 1000; // m diff --git a/www/offline.js b/www/offline.js index eb21439..7c421cf 100644 --- a/www/offline.js +++ b/www/offline.js @@ -74,7 +74,11 @@ export async function clearOffline() { await caches.delete(DATA); } -// Taille annoncée d'une source (pour l'afficher dans les réglages) +// Taille annoncée d'une source (pour l'afficher dans les réglages). +// { missing: true } si la source n'est pas publiée sur ce site (HTTP 404, ex. pas de « Très précis » +// sur un hébergement à place limitée) ; null si inconnue (pas de réseau…). export async function sourceSize(src) { - try { const j = await tileIndex(src); return { bytes: j.bytes || 0, tiles: j.tiles.length }; } catch (e) { return null; } + try { const j = await tileIndex(src); return { bytes: j.bytes || 0, tiles: j.tiles.length }; } catch (e) { + return /HTTP 404/.test(e.message) ? { missing: true } : null; + } } diff --git a/www/sw.js b/www/sw.js index 771435e..fe8c448 100644 --- a/www/sw.js +++ b/www/sw.js @@ -4,11 +4,11 @@ // Réglages › « Télécharger tout pour hors-ligne » (cache DATA, conservé entre les versions). // À chaque nouvelle version de l'app, changer VERSION (et les ?v= dans index.html). -const VERSION = 'v46'; +const VERSION = 'v47'; const SHELL = `bdh-shell-${VERSION}`; const DATA = 'bdh-data-v1'; const SHELL_FILES = [ - './', 'index.html', `app.js?v=46`, `pylon.js?v=46`, `buildings.js?v=46`, `offline.js?v=46`, `lidar.js?v=46`, `terrain.js?v=46`, `style.css?v=46`, + './', 'index.html', `app.js?v=47`, `pylon.js?v=47`, `buildings.js?v=47`, `offline.js?v=47`, `lidar.js?v=47`, `terrain.js?v=47`, `style.css?v=47`, 'lib/three.module.js', 'lib/three.core.js', 'lib/locar.es.js', 'lib/lines/LineSegments2.js', 'lib/lines/LineSegmentsGeometry.js', 'lib/lines/LineMaterial.js', 'data/trace.json', 'manifest.json', 'icon.svg', 'icon-192.png', 'icon-512.png',