Offline-Karten Runde 4: Minimal-Speicher-Modell (Modell Rene)

Funkloch-Gedaechtnis = Quelle der Wahrheit, Kacheln = ableitbarer Cache:
- Ephemeres Vorausladen: Prefetch-Kacheln werden bei Aufzeichnungsende
  geloescht, wenn die Runde kein Funkloch hatte (nur neue Keys)
- Netz-Probe bei Aufzeichnung (~2min, 6s-Timeout): erkennt Funkloecher auch
  in bereits gespeicherten Gebieten (dort kein Remote-Miss als Signal)
- clear() behaelt Zonen (filled=false) -> naechster Online-Start laedt
  Funkloch-Gebiete automatisch neu, auch nach 'Alles loeschen'
- Start-Check mit Position: nur Zonen im 50-km-Umkreis, naechste zuerst,
  Coverage-Verify (faengt Eviction ab); Pfote Segment 5 = alle Zonen gefuellt
- Coverage-Layer zweifarbig: Funkloch orange, manuell blau + Modal-Legende
- Stub-Tests Runde 4 (Prune/Probe/clear/Naehe/Verify/Faerbung) bestanden
Bump v1230
This commit is contained in:
rene 2026-06-06 12:46:12 +02:00
parent 763108fa7c
commit 53bc27faa3
10 changed files with 221 additions and 74 deletions

View file

@ -2235,14 +2235,16 @@ window.Page_map = (() => {
}
const gj = await MapOffline.coverage().catch(() => null);
if (!gj || !gj.features.length) { UI.toast.info('Noch keine Offline-Bereiche gespeichert.'); return false; }
// Funkloch-Gebiete orange, manuell gespeicherte blau (Wunsch René 2026-06-08).
const covColor = ['match', ['get', 'kind'], 'funkloch', '#f59e0b', '#3b82f6'];
if (_map.getSource('by-off-cov')) {
_map.getSource('by-off-cov').setData(gj);
} else {
_map.addSource('by-off-cov', { type: 'geojson', data: gj });
_map.addLayer({ id: 'by-off-cov', type: 'fill', source: 'by-off-cov',
paint: { 'fill-color': '#3b82f6', 'fill-opacity': 0.15 } });
paint: { 'fill-color': covColor, 'fill-opacity': 0.15 } });
_map.addLayer({ id: 'by-off-cov-line', type: 'line', source: 'by-off-cov',
paint: { 'line-color': '#3b82f6', 'line-opacity': 0.35, 'line-width': 0.5 } });
paint: { 'line-color': covColor, 'line-opacity': 0.35, 'line-width': 0.5 } });
}
_covOn = true;
return true;
@ -2268,6 +2270,10 @@ window.Page_map = (() => {
<button class="btn btn-primary" id="off-dl">${UI.icon('download-simple')} Dieses Gebiet speichern (~5 MB)</button>
<button class="btn btn-secondary" id="off-bbox">${UI.icon('squares-four')} Sichtbaren Ausschnitt speichern</button>
<button class="btn btn-secondary" id="off-cov">${UI.icon('stack')} Gespeicherte Bereiche ${_covOn ? 'ausblenden' : 'anzeigen'}</button>
<p style="font-size:var(--text-xs);color:var(--c-text-muted);margin:0;text-align:center">
<span style="color:#3b82f6"></span> manuell gespeichert &nbsp;·&nbsp;
<span style="color:#f59e0b"></span> Funkloch (automatisch)
</p>
${regions.length ? `<button class="btn btn-secondary" id="off-clear" style="color:var(--c-danger)">${UI.icon('trash')} Alles löschen</button>` : ''}
</div>
`,
@ -2286,7 +2292,7 @@ window.Page_map = (() => {
await MapOffline.clear().catch(() => {});
_setCoverage(false);
UI.modal.close();
UI.toast.success('Offline-Karten gelöscht.');
UI.toast.success('Offline-Karten gelöscht. Bekannte Funkloch-Gebiete werden beim nächsten Start automatisch neu geladen.');
window.OfflineIndicator?.refresh();
});
}