Improve cadastral GPS reliability and mobile overlays

This commit is contained in:
livio committed 2026-10-02 08:38:14 +02:00
1 parent 29c3848a22
commit 5ea424b46c
7 files changed
+243 -30

No files matched your search

+41 -5
View File
@@ -109,13 +109,18 @@
</section>
}
<div class="gps-overlay @(ActiveTab == "search" ? "search-open" : null)">
<div class="gps-overlay @(ActiveTab == "search" ? "search-open" : null) @(GpsOverlayCollapsed ? "is-collapsed" : null)">
<div class="gps-state">
<span id="gpsState">GPS non attivo</span>
<strong id="parcelState">Nessuna particella selezionata</strong>
</div>
<button class="gps-main" @onclick="ToggleGps">@(GpsActive ? "Ferma GPS" : "Avvia GPS")</button>
<button class="gps-center" @onclick="CenterOnGps" aria-label="Centra posizione">Centra</button>
<div class="gps-actions">
<button class="gps-main" @onclick="ToggleGps">@(GpsActive ? "Ferma GPS" : "Avvia GPS")</button>
<button class="gps-center" @onclick="CenterOnGps" aria-label="Centra posizione GPS">Centra</button>
</div>
<button class="gps-collapse" @onclick="ToggleGpsOverlay" aria-label="@(GpsOverlayCollapsed ? "Espandi pannello GPS" : "Riduci pannello GPS")" title="@(GpsOverlayCollapsed ? "Espandi pannello GPS" : "Riduci pannello GPS")">
<span aria-hidden="true">@(GpsOverlayCollapsed ? "+" : "−")</span>
</button>
</div>
@if (ActiveTab is not "map" and not "search")
@@ -553,6 +558,11 @@
Trasparenza catasto
<input type="range" min="0" max="1" step="0.05" value="@CadastralOpacity.ToString(System.Globalization.CultureInfo.InvariantCulture)" @onchange="ChangeCadastreOpacity" />
</label>
<label>
Durata messaggi mappa (secondi)
<input type="number" min="0" max="30" step="1" @bind="MapMessageTimeoutSeconds" @bind:after="ApplyMapMessageOptions" />
</label>
<small class="field-help">Imposta 0 per lasciare i messaggi visibili fino alla chiusura manuale.</small>
</section>
<section class="panel-section">
@@ -689,7 +699,10 @@
</aside>
}
<div id="mapInfo" class="map-info">Pronto</div>
<div id="mapInfo" class="map-info" role="status" aria-live="polite">
<span id="mapInfoText" class="map-info-text">Pronto</span>
<button type="button" class="map-info-close" onclick="window.lmeMap.hideInfo()" aria-label="Chiudi messaggio" title="Chiudi messaggio">×</button>
</div>
<div id="wmsPreview" class="wms-preview" hidden>
<section class="wms-preview-dialog" role="dialog" aria-modal="true" aria-labelledby="wmsPreviewTitle">
@@ -743,8 +756,10 @@
private string CatalogMessage { get; set; } = string.Empty;
private double? CatalogFraction { get; set; }
private double CadastralOpacity { get; set; } = 0.75;
private int MapMessageTimeoutSeconds { get; set; } = 3;
private bool CatalogBusy { get; set; }
private bool GpsActive { get; set; }
private bool GpsOverlayCollapsed { get; set; }
private bool ShowGpsPosition { get; set; } = true;
private bool ShowSelectedParcels { get; set; } = true;
private bool ShowImportedData { get; set; } = true;
@@ -1305,7 +1320,7 @@
Interlocked.Exchange(ref LastGpsLookupAt, now);
try
{
var radius = Math.Clamp(location.Accuracy ?? 5, 2, 25);
var radius = Math.Clamp(location.Accuracy ?? 12, 12, 30);
var xml = await OfficialCadastreService.GetParcelsNearAsync(
location.Latitude,
location.Longitude,
@@ -2094,6 +2109,12 @@
private Task CenterOnGps() => JS.InvokeVoidAsync("lmeMap.centerOnGps").AsTask();
private void ToggleGpsOverlay()
{
GpsOverlayCollapsed = !GpsOverlayCollapsed;
SaveFlagPreferences();
}
private string L(string key) => L10n.T(key);
private bool CanUse(string feature) => Entitlements.CanUse(feature);
@@ -2356,6 +2377,11 @@
OfflineExtraZoomLevels = Preferences.Default.Get($"{FlagPreferencePrefix}offline_zoom_levels", 2);
GpsProximityEnabled = GetFlagPreference("gps_proximity", true);
GpsBoundaryAlertEnabled = GetFlagPreference("gps_boundary_alert", false);
GpsOverlayCollapsed = GetFlagPreference("gps_overlay_collapsed", false);
MapMessageTimeoutSeconds = Math.Clamp(
Preferences.Default.Get($"{FlagPreferencePrefix}map_message_timeout", 3),
0,
30);
foreach (var layer in CadastralLayers)
{
@@ -2391,6 +2417,8 @@
Preferences.Default.Set($"{FlagPreferencePrefix}offline_zoom_levels", OfflineExtraZoomLevels);
SetFlagPreference("gps_proximity", GpsProximityEnabled);
SetFlagPreference("gps_boundary_alert", GpsBoundaryAlertEnabled);
SetFlagPreference("gps_overlay_collapsed", GpsOverlayCollapsed);
Preferences.Default.Set($"{FlagPreferencePrefix}map_message_timeout", MapMessageTimeoutSeconds);
foreach (var layer in CadastralLayers)
{
@@ -2400,6 +2428,7 @@
private async Task ApplyFlagPreferencesToMapAsync()
{
await JS.InvokeVoidAsync("lmeMap.setInfoTimeout", MapMessageTimeoutSeconds);
await JS.InvokeVoidAsync("lmeMap.setIncludeKmlSheetLayer", IncludeKmlSheetLayer);
await JS.InvokeVoidAsync("lmeMap.setImportedLayerVisible", ShowImportedData);
await JS.InvokeVoidAsync("lmeMap.setImportedSheetLayerVisible", ShowImportedSheetLayer);
@@ -2416,6 +2445,13 @@
}
}
private async Task ApplyMapMessageOptions()
{
MapMessageTimeoutSeconds = Math.Clamp(MapMessageTimeoutSeconds, 0, 30);
SaveFlagPreferences();
await JS.InvokeVoidAsync("lmeMap.setInfoTimeout", MapMessageTimeoutSeconds);
}
private async Task ApplyAdvancedOptions()
{
SaveFlagPreferences();