Persist the ground elevation profile with the mission
The Mini-Altitude-Profile terrain data only ever lived in TerrainNotifier's in-memory state (one slot, keyed by route). Every app restart, or every switch away from and back to a mission, forced a full re-fetch of all AWS Terrarium elevation tiles for the route - the noticeably slow load the user reported for some missions was this happening on every visit, not just once. Adds a nullable terrainProfileJson column to the missions table (schema v6->v7) and a saveTerrainProfile() repository method, kept separate from the regular waypoint upsert() so an ordinary autosave never clobbers an already-cached profile. TerrainNotifier persists a profile right after a successful fetch (fire-and-forget) and gains restore(), called from CurrentMissionMetaNotifier whenever a mission is loaded/ started so a previously fetched profile is available immediately - ensureFor() still validates its routeKey before use, so a stale restored profile is never shown for a route that has since changed. Also included in mission export/import (MissionExportData/ ParsedMissionImport) so sharing a mission carries its terrain cache along instead of forcing the recipient to refetch it. Sample-count/resolution stays as-is for now (still fixed 30m spacing, 10-2000 samples) - adapting the sampling density to terrain variance (e.g. coarser sampling over flat ground) is a separate follow-up. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
4e94102861
commit
35351140ae
@@ -7,6 +7,7 @@ import 'current_mission_provider.dart';
|
||||
import 'database_provider.dart';
|
||||
import 'follow_drone_provider.dart';
|
||||
import 'map_controller_provider.dart';
|
||||
import 'terrain_provider.dart';
|
||||
|
||||
/// Metadaten der aktuell in Bearbeitung befindlichen Mission - ergaenzt
|
||||
/// currentMissionProvider (das nur die Wegpunkte haelt) um Name/Ort und die
|
||||
@@ -58,6 +59,7 @@ class CurrentMissionMetaNotifier extends Notifier<MissionMeta> {
|
||||
ref.read(currentMissionProvider.notifier).replaceAll(loaded.waypoints);
|
||||
_suppressAutosave = false;
|
||||
state = MissionMeta(id: missionId, name: loaded.name, placeName: loaded.placeName);
|
||||
ref.read(terrainProvider.notifier).restore(loaded.terrainProfile);
|
||||
_fitMapToWaypoints(loaded.waypoints);
|
||||
}
|
||||
|
||||
@@ -77,6 +79,7 @@ class CurrentMissionMetaNotifier extends Notifier<MissionMeta> {
|
||||
ref.read(currentMissionProvider.notifier).replaceAll(const []);
|
||||
_suppressAutosave = false;
|
||||
state = newState;
|
||||
ref.read(terrainProvider.notifier).restore(null);
|
||||
await ref.read(appSettingsRepositoryProvider).setCurrentMissionId(null);
|
||||
}
|
||||
|
||||
@@ -89,6 +92,7 @@ class CurrentMissionMetaNotifier extends Notifier<MissionMeta> {
|
||||
ref.read(currentMissionProvider.notifier).replaceAll(loaded.waypoints);
|
||||
_suppressAutosave = false;
|
||||
state = MissionMeta(id: id, name: loaded.name, placeName: loaded.placeName);
|
||||
ref.read(terrainProvider.notifier).restore(loaded.terrainProfile);
|
||||
_fitMapToWaypoints(loaded.waypoints);
|
||||
await ref.read(appSettingsRepositoryProvider).setCurrentMissionId(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user