Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b642afe2d | ||
|
|
342935d99d |
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
@inject PreciseLocationService LocationService
|
@inject PreciseLocationService LocationService
|
||||||
@inject CadastralCatalogService CatalogService
|
@inject CadastralCatalogService CatalogService
|
||||||
@inject OfficialCadastreService OfficialCadastreService
|
@inject OfficialCadastreService OfficialCadastreService
|
||||||
|
@inject FiducialPointService FiducialPointService
|
||||||
@inject LocationSearchService LocationSearchService
|
@inject LocationSearchService LocationSearchService
|
||||||
@inject NetworkLocationService NetworkLocationService
|
@inject NetworkLocationService NetworkLocationService
|
||||||
@inject AzureMapsService AzureMapsService
|
@inject AzureMapsService AzureMapsService
|
||||||
@@ -46,6 +47,7 @@
|
|||||||
<button @onclick='() => SelectTab("map")'>@L("menu.map")</button>
|
<button @onclick='() => SelectTab("map")'>@L("menu.map")</button>
|
||||||
<button @onclick='() => SelectTab("search")'>@L("menu.search")</button>
|
<button @onclick='() => SelectTab("search")'>@L("menu.search")</button>
|
||||||
<button @onclick='() => SelectTab("cadastre")'>@L("menu.cadastre")</button>
|
<button @onclick='() => SelectTab("cadastre")'>@L("menu.cadastre")</button>
|
||||||
|
<button @onclick='() => SelectTab("fiducials")'>Punti fiduciali</button>
|
||||||
<button @onclick='() => SelectTab("data")'>@L("menu.data")</button>
|
<button @onclick='() => SelectTab("data")'>@L("menu.data")</button>
|
||||||
<button @onclick='() => SelectTab("projects")'>@L("menu.projects")</button>
|
<button @onclick='() => SelectTab("projects")'>@L("menu.projects")</button>
|
||||||
<button @onclick='() => SelectTab("save")'>@L("menu.export")</button>
|
<button @onclick='() => SelectTab("save")'>@L("menu.export")</button>
|
||||||
@@ -201,6 +203,84 @@
|
|||||||
<MenuHelp Topic="cadastre" />
|
<MenuHelp Topic="cadastre" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
else if (ActiveTab == "fiducials")
|
||||||
|
{
|
||||||
|
<section class="panel-content">
|
||||||
|
@if (!CanUse(AppFeatures.FiducialPoints))
|
||||||
|
{
|
||||||
|
<div class="service-note protected-service">
|
||||||
|
<strong>Funzione LME Pro</strong>
|
||||||
|
<p>La ricerca dei Punti Fiduciali e delle monografie ufficiali è disponibile con abbonamento Pro o chiave manuale valida.</p>
|
||||||
|
<button class="primary-command" @onclick='() => SelectTab("settings")'>Apri abbonamento Pro</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<label>
|
||||||
|
Provincia
|
||||||
|
<select value="@SelectedFiducialProvinceCode" @onchange="OnFiducialProvinceChanged" disabled="@FiducialBusy">
|
||||||
|
<option value="">Seleziona provincia</option>
|
||||||
|
@foreach (var province in FiducialProvinces)
|
||||||
|
{
|
||||||
|
<option value="@province.Code">@province.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Comune catastale
|
||||||
|
<select value="@SelectedFiducialMunicipalityCode" @onchange="OnFiducialMunicipalityChanged" disabled="@(FiducialMunicipalities.Count == 0 || FiducialBusy)">
|
||||||
|
<option value="">Seleziona comune</option>
|
||||||
|
@foreach (var municipality in FiducialMunicipalities)
|
||||||
|
{
|
||||||
|
<option value="@municipality.Code">@municipality.Name (@municipality.Code)</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label>
|
||||||
|
Foglio
|
||||||
|
<select @bind="SelectedFiducialSheet" disabled="@(FiducialSheets.Count == 0 || FiducialBusy)">
|
||||||
|
<option value="">Seleziona foglio</option>
|
||||||
|
@foreach (var sheet in FiducialSheets)
|
||||||
|
{
|
||||||
|
<option value="@sheet.Code">@sheet.Name</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<button class="primary-command" @onclick="SearchFiducials" disabled="@(string.IsNullOrWhiteSpace(SelectedFiducialSheet) || FiducialBusy)">
|
||||||
|
@(FiducialBusy ? "Ricerca..." : "Cerca Punti Fiduciali")
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (!string.IsNullOrWhiteSpace(FiducialMessage))
|
||||||
|
{
|
||||||
|
<div class="catalog-progress"><span>@FiducialMessage</span></div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (FiducialPoints.Count > 0)
|
||||||
|
{
|
||||||
|
<section class="panel-section">
|
||||||
|
<h2>Punti trovati (@FiducialPoints.Count)</h2>
|
||||||
|
<div class="fiducial-list">
|
||||||
|
@foreach (var point in FiducialPoints)
|
||||||
|
{
|
||||||
|
<article class="fiducial-item">
|
||||||
|
<strong>@point.Identifier</strong>
|
||||||
|
<button class="secondary-command" @onclick="() => DownloadFiducialMonograph(point)">Scarica PDF monografia</button>
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="service-note">
|
||||||
|
<strong>Fonte ufficiale Agenzia delle Entrate</strong>
|
||||||
|
<p>L'elenco e i PDF arrivano dal servizio pubblico delle monografie. Il layer sulla mappa sarà abilitato soltanto quando sono disponibili coordinate geografiche trasformate e verificabili.</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
}
|
||||||
else if (ActiveTab == "data")
|
else if (ActiveTab == "data")
|
||||||
{
|
{
|
||||||
<section class="panel-content">
|
<section class="panel-content">
|
||||||
@@ -745,6 +825,11 @@
|
|||||||
private string MonthlyPrice { get; set; } = string.Empty;
|
private string MonthlyPrice { get; set; } = string.Empty;
|
||||||
private string YearlyPrice { get; set; } = string.Empty;
|
private string YearlyPrice { get; set; } = string.Empty;
|
||||||
private bool BillingBusy { get; set; }
|
private bool BillingBusy { get; set; }
|
||||||
|
private bool FiducialBusy { get; set; }
|
||||||
|
private string SelectedFiducialProvinceCode { get; set; } = string.Empty;
|
||||||
|
private string SelectedFiducialMunicipalityCode { get; set; } = string.Empty;
|
||||||
|
private string SelectedFiducialSheet { get; set; } = string.Empty;
|
||||||
|
private string FiducialMessage { get; set; } = string.Empty;
|
||||||
private string Status { get; set; } = "online";
|
private string Status { get; set; } = "online";
|
||||||
private string SelectedBaseLayer { get; set; } = "satellite";
|
private string SelectedBaseLayer { get; set; } = "satellite";
|
||||||
private string GoogleMapsApiKey { get; set; } = string.Empty;
|
private string GoogleMapsApiKey { get; set; } = string.Empty;
|
||||||
@@ -821,6 +906,10 @@
|
|||||||
private IReadOnlyList<MunicipalityOption> Municipalities { get; set; } = [];
|
private IReadOnlyList<MunicipalityOption> Municipalities { get; set; } = [];
|
||||||
private IReadOnlyList<string> Sheets { get; set; } = [];
|
private IReadOnlyList<string> Sheets { get; set; } = [];
|
||||||
private IReadOnlyList<ParcelOption> Parcels { get; set; } = [];
|
private IReadOnlyList<ParcelOption> Parcels { get; set; } = [];
|
||||||
|
private IReadOnlyList<FiducialAreaOption> FiducialProvinces { get; set; } = [];
|
||||||
|
private IReadOnlyList<FiducialAreaOption> FiducialMunicipalities { get; set; } = [];
|
||||||
|
private IReadOnlyList<FiducialAreaOption> FiducialSheets { get; set; } = [];
|
||||||
|
private IReadOnlyList<FiducialPointEntry> FiducialPoints { get; set; } = [];
|
||||||
private IReadOnlyList<MapProjectSummary> Projects { get; set; } = [];
|
private IReadOnlyList<MapProjectSummary> Projects { get; set; } = [];
|
||||||
private IReadOnlyList<MapProjectVersion> ProjectVersions { get; set; } = [];
|
private IReadOnlyList<MapProjectVersion> ProjectVersions { get; set; } = [];
|
||||||
private MapProjectSummary? SelectedProject => Projects.FirstOrDefault(item => item.Id == SelectedProjectId);
|
private MapProjectSummary? SelectedProject => Projects.FirstOrDefault(item => item.Id == SelectedProjectId);
|
||||||
@@ -834,6 +923,7 @@
|
|||||||
private string PanelTitle => ActiveTab switch
|
private string PanelTitle => ActiveTab switch
|
||||||
{
|
{
|
||||||
"cadastre" => "Ricerca catastale",
|
"cadastre" => "Ricerca catastale",
|
||||||
|
"fiducials" => "Punti fiduciali",
|
||||||
"data" => "Dati e disegni",
|
"data" => "Dati e disegni",
|
||||||
"projects" => "Archivio progetti",
|
"projects" => "Archivio progetti",
|
||||||
"save" => "Salvataggio ed esportazione",
|
"save" => "Salvataggio ed esportazione",
|
||||||
@@ -845,6 +935,7 @@
|
|||||||
private string PanelEyebrow => ActiveTab switch
|
private string PanelEyebrow => ActiveTab switch
|
||||||
{
|
{
|
||||||
"cadastre" => "Regione, Comune, Foglio, Particella",
|
"cadastre" => "Regione, Comune, Foglio, Particella",
|
||||||
|
"fiducials" => "Monografie ufficiali AdE",
|
||||||
"data" => "File GIS, misure e POI",
|
"data" => "File GIS, misure e POI",
|
||||||
"projects" => "Salva, apri e visualizza i tuoi lavori",
|
"projects" => "Salva, apri e visualizza i tuoi lavori",
|
||||||
"save" => "Esporta file GIS",
|
"save" => "Esporta file GIS",
|
||||||
@@ -1056,6 +1147,10 @@
|
|||||||
{
|
{
|
||||||
await RefreshProjectsAsync();
|
await RefreshProjectsAsync();
|
||||||
}
|
}
|
||||||
|
if (tab == "fiducials" && CanUse(AppFeatures.FiducialPoints) && FiducialProvinces.Count == 0)
|
||||||
|
{
|
||||||
|
await LoadFiducialProvincesAsync();
|
||||||
|
}
|
||||||
await Task.Delay(30);
|
await Task.Delay(30);
|
||||||
await JS.InvokeVoidAsync("lmeMap.resize");
|
await JS.InvokeVoidAsync("lmeMap.resize");
|
||||||
if (LayerPanelOpen)
|
if (LayerPanelOpen)
|
||||||
@@ -1135,6 +1230,132 @@
|
|||||||
: await CatalogService.GetMunicipalitiesAsync(SelectedRegionFile);
|
: await CatalogService.GetMunicipalitiesAsync(SelectedRegionFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task LoadFiducialProvincesAsync()
|
||||||
|
{
|
||||||
|
FiducialBusy = true;
|
||||||
|
FiducialMessage = "Carico l'elenco delle province...";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FiducialProvinces = await FiducialPointService.GetProvincesAsync();
|
||||||
|
FiducialMessage = string.Empty;
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
FiducialMessage = $"Servizio monografie non disponibile: {error.GetBaseException().Message}";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
FiducialBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFiducialProvinceChanged(ChangeEventArgs args)
|
||||||
|
{
|
||||||
|
SelectedFiducialProvinceCode = args.Value?.ToString() ?? string.Empty;
|
||||||
|
SelectedFiducialMunicipalityCode = string.Empty;
|
||||||
|
SelectedFiducialSheet = string.Empty;
|
||||||
|
FiducialMunicipalities = [];
|
||||||
|
FiducialSheets = [];
|
||||||
|
FiducialPoints = [];
|
||||||
|
if (string.IsNullOrWhiteSpace(SelectedFiducialProvinceCode))
|
||||||
|
{
|
||||||
|
FiducialMessage = string.Empty;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FiducialBusy = true;
|
||||||
|
FiducialMessage = "Carico i Comuni catastali...";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FiducialMunicipalities = await FiducialPointService.GetMunicipalitiesAsync(SelectedFiducialProvinceCode);
|
||||||
|
FiducialMessage = string.Empty;
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
FiducialMessage = $"Comuni non disponibili: {error.GetBaseException().Message}";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
FiducialBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFiducialMunicipalityChanged(ChangeEventArgs args)
|
||||||
|
{
|
||||||
|
SelectedFiducialMunicipalityCode = args.Value?.ToString() ?? string.Empty;
|
||||||
|
SelectedFiducialSheet = string.Empty;
|
||||||
|
FiducialSheets = [];
|
||||||
|
FiducialPoints = [];
|
||||||
|
if (string.IsNullOrWhiteSpace(SelectedFiducialMunicipalityCode))
|
||||||
|
{
|
||||||
|
FiducialMessage = string.Empty;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FiducialBusy = true;
|
||||||
|
FiducialMessage = "Carico i fogli disponibili...";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FiducialSheets = await FiducialPointService.GetSheetsAsync(
|
||||||
|
SelectedFiducialProvinceCode,
|
||||||
|
SelectedFiducialMunicipalityCode);
|
||||||
|
FiducialMessage = string.Empty;
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
FiducialMessage = $"Fogli non disponibili: {error.GetBaseException().Message}";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
FiducialBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SearchFiducials()
|
||||||
|
{
|
||||||
|
var province = FiducialProvinces.FirstOrDefault(item => item.Code == SelectedFiducialProvinceCode);
|
||||||
|
var municipality = FiducialMunicipalities.FirstOrDefault(item => item.Code == SelectedFiducialMunicipalityCode);
|
||||||
|
if (province is null || municipality is null || string.IsNullOrWhiteSpace(SelectedFiducialSheet))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FiducialBusy = true;
|
||||||
|
FiducialPoints = [];
|
||||||
|
FiducialMessage = "Interrogo il servizio ufficiale delle monografie...";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FiducialPoints = await FiducialPointService.GetFiducialsAsync(
|
||||||
|
province.Name,
|
||||||
|
municipality.Name,
|
||||||
|
municipality.Code,
|
||||||
|
SelectedFiducialSheet);
|
||||||
|
FiducialMessage = FiducialPoints.Count == 0
|
||||||
|
? "Nessun Punto Fiduciale pubblicato per il foglio selezionato."
|
||||||
|
: $"Trovati {FiducialPoints.Count} Punti Fiduciali.";
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
FiducialMessage = $"Ricerca PF non riuscita: {error.GetBaseException().Message}";
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
FiducialBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DownloadFiducialMonograph(FiducialPointEntry point)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Launcher.Default.OpenAsync(new Uri(point.MonographUrl));
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
FiducialMessage = $"Impossibile aprire la monografia: {error.GetBaseException().Message}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task OnMunicipalityChanged(ChangeEventArgs args)
|
private async Task OnMunicipalityChanged(ChangeEventArgs args)
|
||||||
{
|
{
|
||||||
SelectedMunicipalityCode = args.Value?.ToString() ?? string.Empty;
|
SelectedMunicipalityCode = args.Value?.ToString() ?? string.Empty;
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
<ApplicationId>it.liviomerola.lmemappecatastali.pro</ApplicationId>
|
<ApplicationId>it.liviomerola.lmemappecatastali.pro</ApplicationId>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>1.0.10</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0.12</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>110</ApplicationVersion>
|
<ApplicationVersion>112</ApplicationVersion>
|
||||||
<Version>$(ApplicationDisplayVersion)</Version>
|
<Version>$(ApplicationDisplayVersion)</Version>
|
||||||
|
|
||||||
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
|
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public static class MauiProgram
|
|||||||
builder.Services.AddSingleton<PreciseLocationService>();
|
builder.Services.AddSingleton<PreciseLocationService>();
|
||||||
builder.Services.AddSingleton<CadastralCatalogService>();
|
builder.Services.AddSingleton<CadastralCatalogService>();
|
||||||
builder.Services.AddSingleton<OfficialCadastreService>();
|
builder.Services.AddSingleton<OfficialCadastreService>();
|
||||||
|
builder.Services.AddSingleton<FiducialPointService>();
|
||||||
builder.Services.AddSingleton<LocationSearchService>();
|
builder.Services.AddSingleton<LocationSearchService>();
|
||||||
builder.Services.AddSingleton<NetworkLocationService>();
|
builder.Services.AddSingleton<NetworkLocationService>();
|
||||||
builder.Services.AddSingleton<AzureMapsService>();
|
builder.Services.AddSingleton<AzureMapsService>();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
- Nome: LME Mappe Catastali Pro.
|
- Nome: LME Mappe Catastali Pro.
|
||||||
- Package name Android: `it.liviomerola.lmemappecatastali.pro`.
|
- Package name Android: `it.liviomerola.lmemappecatastali.pro`.
|
||||||
- Versione corrente da pubblicare: `1.0.10` / version code `110`.
|
- Versione corrente da pubblicare: `1.0.11` / version code `111`.
|
||||||
- Formato Release Android: Android App Bundle (`.aab`).
|
- Formato Release Android: Android App Bundle (`.aab`).
|
||||||
- Target SDK Release: Android 16 / API 36.
|
- Target SDK Release: Android 16 / API 36.
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,11 @@ public class MainActivity : MauiAppCompatActivity
|
|||||||
{
|
{
|
||||||
if (view is null || insets is null) return insets;
|
if (view is null || insets is null) return insets;
|
||||||
var systemBars = insets.GetInsets(WindowInsetsCompat.Type.SystemBars());
|
var systemBars = insets.GetInsets(WindowInsetsCompat.Type.SystemBars());
|
||||||
view.SetPadding(_left, _top, _right, systemBars?.Bottom ?? 0);
|
view.SetPadding(
|
||||||
|
_left,
|
||||||
|
systemBars?.Top ?? _top,
|
||||||
|
_right,
|
||||||
|
systemBars?.Bottom ?? 0);
|
||||||
return insets;
|
return insets;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,12 @@ App .NET MAUI Blazor Hybrid per Android, iOS, Mac Catalyst e Windows, pensata pe
|
|||||||
|
|
||||||
Informativa privacy: [PRIVACY_POLICY.md](PRIVACY_POLICY.md).
|
Informativa privacy: [PRIVACY_POLICY.md](PRIVACY_POLICY.md).
|
||||||
|
|
||||||
|
## Versione Pro 1.0.11 test
|
||||||
|
|
||||||
|
- Il flag Fogli catastali mostra il WMS di tutti i fogli agli zoom panoramici e, in dettaglio, il confine ufficiale WFS del foglio corrente anche senza dati caricati.
|
||||||
|
- Se il foglio corrente e gia presente in un progetto o in un'importazione, l'overlay di navigazione non ne crea un duplicato.
|
||||||
|
- La toolbar superiore rispetta l'area occupata dalla barra di stato e dalle notifiche Android.
|
||||||
|
|
||||||
## Versione Pro 1.0.10 test
|
## Versione Pro 1.0.10 test
|
||||||
|
|
||||||
- Migliora la compatibilita del servizio catastale AdE sui dispositivi Android meno recenti con HTTP/1.1, tentativi automatici e una ricerca GPS piu tollerante.
|
- Migliora la compatibilita del servizio catastale AdE sui dispositivi Android meno recenti con HTTP/1.1, tentativi automatici e una ricerca GPS piu tollerante.
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ public sealed class EntitlementService(
|
|||||||
AppFeatures.CloudSync,
|
AppFeatures.CloudSync,
|
||||||
AppFeatures.OfflineMaps,
|
AppFeatures.OfflineMaps,
|
||||||
AppFeatures.AdvancedGeometry,
|
AppFeatures.AdvancedGeometry,
|
||||||
AppFeatures.GpsTrail
|
AppFeatures.GpsTrail,
|
||||||
|
AppFeatures.FiducialPoints
|
||||||
};
|
};
|
||||||
|
|
||||||
public bool IsGoogleProActive { get; private set; }
|
public bool IsGoogleProActive { get; private set; }
|
||||||
@@ -185,4 +186,5 @@ public static class AppFeatures
|
|||||||
public const string OfflineMaps = "offline-maps";
|
public const string OfflineMaps = "offline-maps";
|
||||||
public const string AdvancedGeometry = "advanced-geometry";
|
public const string AdvancedGeometry = "advanced-geometry";
|
||||||
public const string GpsTrail = "gps-trail";
|
public const string GpsTrail = "gps-trail";
|
||||||
|
public const string FiducialPoints = "fiducial-points";
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
using System.Net;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace LMEMappeCatastaliApp.Services;
|
||||||
|
|
||||||
|
public sealed partial class FiducialPointService
|
||||||
|
{
|
||||||
|
private const string ServiceBaseUrl = "https://www1.agenziaentrate.gov.it/servizi/Monografie/";
|
||||||
|
private readonly HttpClient _httpClient = new() { Timeout = TimeSpan.FromSeconds(30) };
|
||||||
|
|
||||||
|
public FiducialPointService()
|
||||||
|
{
|
||||||
|
_httpClient.DefaultRequestHeaders.UserAgent.ParseAdd("LMEMappeCatastali/1.0 (Android)");
|
||||||
|
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/html"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyList<FiducialAreaOption>> GetProvincesAsync(
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var html = await GetHtmlAsync("ricerca.php", cancellationToken);
|
||||||
|
return ParseOptions(html, "provincia");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyList<FiducialAreaOption>> GetMunicipalitiesAsync(
|
||||||
|
string provinceCode,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var code = NormalizeCode(provinceCode);
|
||||||
|
var html = await GetHtmlAsync($"ricerca.php?level=1&prov={Uri.EscapeDataString(code)}", cancellationToken);
|
||||||
|
return ParseOptions(html, "co");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyList<FiducialAreaOption>> GetSheetsAsync(
|
||||||
|
string provinceCode,
|
||||||
|
string municipalityCode,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var province = NormalizeCode(provinceCode);
|
||||||
|
var municipality = NormalizeCode(municipalityCode);
|
||||||
|
var path = $"ricerca.php?level=2&prov={Uri.EscapeDataString(province)}";
|
||||||
|
var html = await PostFormAsync(path, new Dictionary<string, string> { ["co"] = municipality }, cancellationToken);
|
||||||
|
return ParseOptions(html, "foglio");
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyList<FiducialPointEntry>> GetFiducialsAsync(
|
||||||
|
string provinceName,
|
||||||
|
string municipalityName,
|
||||||
|
string municipalityCode,
|
||||||
|
string sheet,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var code = NormalizeCode(municipalityCode);
|
||||||
|
var normalizedSheet = sheet.Trim();
|
||||||
|
var query = string.Join("&",
|
||||||
|
[
|
||||||
|
$"provincia={Uri.EscapeDataString(provinceName.Trim())}",
|
||||||
|
$"comune={Uri.EscapeDataString(municipalityName.Trim())}",
|
||||||
|
$"co={Uri.EscapeDataString(code)}"
|
||||||
|
]);
|
||||||
|
var html = await PostFormAsync(
|
||||||
|
$"risultato.php?{query}",
|
||||||
|
new Dictionary<string, string> { ["foglio"] = normalizedSheet },
|
||||||
|
cancellationToken);
|
||||||
|
|
||||||
|
return DownloadLinkRegex().Matches(html)
|
||||||
|
.Select(match =>
|
||||||
|
{
|
||||||
|
var relativeUrl = WebUtility.HtmlDecode(match.Groups["url"].Value);
|
||||||
|
var fileName = WebUtility.HtmlDecode(match.Groups["name"].Value);
|
||||||
|
return new FiducialPointEntry(
|
||||||
|
FormatIdentifier(fileName),
|
||||||
|
new Uri(new Uri(ServiceBaseUrl), relativeUrl).AbsoluteUri);
|
||||||
|
})
|
||||||
|
.DistinctBy(item => item.Identifier, StringComparer.OrdinalIgnoreCase)
|
||||||
|
.OrderBy(item => item.Identifier, StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> GetHtmlAsync(string relativeUrl, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
using var response = await _httpClient.GetAsync(ServiceBaseUrl + relativeUrl, cancellationToken);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
return await response.Content.ReadAsStringAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<string> PostFormAsync(
|
||||||
|
string relativeUrl,
|
||||||
|
IReadOnlyDictionary<string, string> values,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
using var content = new FormUrlEncodedContent(values);
|
||||||
|
using var response = await _httpClient.PostAsync(ServiceBaseUrl + relativeUrl, content, cancellationToken);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
|
return await response.Content.ReadAsStringAsync(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IReadOnlyList<FiducialAreaOption> ParseOptions(string html, string selectId)
|
||||||
|
{
|
||||||
|
var select = SelectRegex().Matches(html)
|
||||||
|
.LastOrDefault(match => string.Equals(match.Groups["id"].Value, selectId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (select is null)
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return OptionRegex().Matches(select.Groups["body"].Value)
|
||||||
|
.Select(match => new FiducialAreaOption(
|
||||||
|
WebUtility.HtmlDecode(match.Groups["value"].Value).Trim(),
|
||||||
|
WebUtility.HtmlDecode(StripTagsRegex().Replace(match.Groups["label"].Value, string.Empty)).Trim()))
|
||||||
|
.Where(item => !string.IsNullOrWhiteSpace(item.Code) && !string.IsNullOrWhiteSpace(item.Name))
|
||||||
|
.DistinctBy(item => item.Code, StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string NormalizeCode(string value)
|
||||||
|
{
|
||||||
|
var normalized = value.Trim().ToUpperInvariant();
|
||||||
|
if (normalized.Length is < 2 or > 4 || normalized.Any(character => !char.IsLetterOrDigit(character)))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("Codice territoriale non valido.", nameof(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return normalized;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FormatIdentifier(string fileName)
|
||||||
|
{
|
||||||
|
var parts = fileName.Split('-', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||||
|
return parts.Length == 3 ? $"PF{parts[2]}/{parts[1]}/{parts[0]}" : fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
[GeneratedRegex("<select\\b[^>]*(?:id|name)=[\\\"'](?<id>[^\\\"']+)[\\\"'][^>]*>(?<body>[\\s\\S]*?)</select>", RegexOptions.IgnoreCase, matchTimeoutMilliseconds: 2000)]
|
||||||
|
private static partial Regex SelectRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex("<option\\b[^>]*value=[\\\"'](?<value>[^\\\"']*)[\\\"'][^>]*>(?<label>[\\s\\S]*?)</option>", RegexOptions.IgnoreCase, matchTimeoutMilliseconds: 2000)]
|
||||||
|
private static partial Regex OptionRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex("href=[\\\"'](?<url>download\\.php\\?[^\\\"']*namefile=(?<name>[A-Z0-9-]+))[^\\\"']*[\\\"']", RegexOptions.IgnoreCase, matchTimeoutMilliseconds: 2000)]
|
||||||
|
private static partial Regex DownloadLinkRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex("<[^>]+>", RegexOptions.None, 2000)]
|
||||||
|
private static partial Regex StripTagsRegex();
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed record FiducialAreaOption(string Code, string Name);
|
||||||
|
|
||||||
|
public sealed record FiducialPointEntry(string Identifier, string MonographUrl);
|
||||||
@@ -1247,6 +1247,9 @@ input[type="checkbox"] {
|
|||||||
|
|
||||||
.gps-overlay.is-collapsed {
|
.gps-overlay.is-collapsed {
|
||||||
grid-template-columns: auto;
|
grid-template-columns: auto;
|
||||||
|
right: auto;
|
||||||
|
width: 48px;
|
||||||
|
max-width: 48px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1255,6 +1258,28 @@ input[type="checkbox"] {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fiducial-list {
|
||||||
|
display: grid;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fiducial-item {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-bottom: 1px solid #d9e0e3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fiducial-item strong {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fiducial-item .secondary-command {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.gps-overlay.search-open {
|
.gps-overlay.search-open {
|
||||||
top: 140px;
|
top: 140px;
|
||||||
}
|
}
|
||||||
@@ -1318,6 +1343,21 @@ input[type="checkbox"] {
|
|||||||
height: 38px;
|
height: 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cadastral-sheet-label {
|
||||||
|
width: auto !important;
|
||||||
|
height: auto !important;
|
||||||
|
border: 1px solid #9a5b00;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 3px 6px;
|
||||||
|
background: rgba(255, 251, 235, 0.94);
|
||||||
|
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
|
||||||
|
color: #713f12;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
line-height: 1.2;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.lme-drawing-scope-actions a[aria-disabled="true"] {
|
.lme-drawing-scope-actions a[aria-disabled="true"] {
|
||||||
opacity: 0.45;
|
opacity: 0.45;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
@@ -1866,6 +1906,12 @@ footer {
|
|||||||
top: 136px;
|
top: 136px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gps-overlay.is-collapsed {
|
||||||
|
right: auto;
|
||||||
|
width: 48px;
|
||||||
|
max-width: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
.leaflet-top.leaflet-right {
|
.leaflet-top.leaflet-right {
|
||||||
top: 174px;
|
top: 174px;
|
||||||
right: 0;
|
right: 0;
|
||||||
@@ -1921,6 +1967,17 @@ footer {
|
|||||||
grid-template-columns: minmax(0, 1fr) auto auto;
|
grid-template-columns: minmax(0, 1fr) auto auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gps-overlay.is-collapsed {
|
||||||
|
grid-template-columns: auto;
|
||||||
|
right: auto;
|
||||||
|
width: 48px;
|
||||||
|
max-width: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fiducial-item {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
.gps-main,
|
.gps-main,
|
||||||
.gps-center {
|
.gps-center {
|
||||||
min-width: 86px;
|
min-width: 86px;
|
||||||
|
|||||||
+166
-7
@@ -14,8 +14,14 @@ const lmeState = {
|
|||||||
"cadastre"
|
"cadastre"
|
||||||
],
|
],
|
||||||
cadastre: null,
|
cadastre: null,
|
||||||
|
cadastreZoning: null,
|
||||||
cadastreLayers: ["CP.CadastralParcel", "codice_plla", "CP.CadastralZoning", "fabbricati"],
|
cadastreLayers: ["CP.CadastralParcel", "codice_plla", "CP.CadastralZoning", "fabbricati"],
|
||||||
cadastreOpacity: 0.75,
|
cadastreOpacity: 0.75,
|
||||||
|
navigationSheetLayer: null,
|
||||||
|
navigationSheetFeature: null,
|
||||||
|
navigationSheetLabel: null,
|
||||||
|
navigationSheetRefreshTimer: null,
|
||||||
|
navigationSheetRequestId: 0,
|
||||||
imported: null,
|
imported: null,
|
||||||
importedVisible: true,
|
importedVisible: true,
|
||||||
importedSheets: null,
|
importedSheets: null,
|
||||||
@@ -305,6 +311,13 @@ function init(dotNetReference) {
|
|||||||
lmeState.drawingMeasurements = L.layerGroup().addTo(lmeState.map);
|
lmeState.drawingMeasurements = L.layerGroup().addTo(lmeState.map);
|
||||||
lmeState.selectedParcelsLayer = L.featureGroup().addTo(lmeState.map);
|
lmeState.selectedParcelsLayer = L.featureGroup().addTo(lmeState.map);
|
||||||
lmeState.gpsParcelLayer = L.featureGroup().addTo(lmeState.map);
|
lmeState.gpsParcelLayer = L.featureGroup().addTo(lmeState.map);
|
||||||
|
const navigationSheetPane = lmeState.map.createPane("navigationSheetPane");
|
||||||
|
navigationSheetPane.style.zIndex = "465";
|
||||||
|
navigationSheetPane.style.pointerEvents = "none";
|
||||||
|
const cadastreZoningPane = lmeState.map.createPane("cadastreZoningPane");
|
||||||
|
cadastreZoningPane.style.zIndex = "455";
|
||||||
|
cadastreZoningPane.style.pointerEvents = "none";
|
||||||
|
lmeState.navigationSheetLayer = L.layerGroup().addTo(lmeState.map);
|
||||||
lmeState.gpsTrail = L.polyline([], {
|
lmeState.gpsTrail = L.polyline([], {
|
||||||
pane: "gpsTrailPane",
|
pane: "gpsTrailPane",
|
||||||
color: "#f97316",
|
color: "#f97316",
|
||||||
@@ -339,6 +352,7 @@ function init(dotNetReference) {
|
|||||||
lmeState.map.on("moveend", () => {
|
lmeState.map.on("moveend", () => {
|
||||||
void updateAzureAttribution();
|
void updateAzureAttribution();
|
||||||
scheduleMeasurementRefresh();
|
scheduleMeasurementRefresh();
|
||||||
|
scheduleNavigationSheetRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById("closeWmsPreview")?.addEventListener("click", closeCadastrePreview);
|
document.getElementById("closeWmsPreview")?.addEventListener("click", closeCadastrePreview);
|
||||||
@@ -5387,6 +5401,9 @@ function setCadastreOpacity(value) {
|
|||||||
if (lmeState.cadastre) {
|
if (lmeState.cadastre) {
|
||||||
lmeState.cadastre.setOpacity(lmeState.cadastreOpacity);
|
lmeState.cadastre.setOpacity(lmeState.cadastreOpacity);
|
||||||
}
|
}
|
||||||
|
if (lmeState.cadastreZoning) {
|
||||||
|
lmeState.cadastreZoning.setOpacity(Math.max(0.8, lmeState.cadastreOpacity));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleCadastreLayer(layer, enabled) {
|
function toggleCadastreLayer(layer, enabled) {
|
||||||
@@ -5398,6 +5415,13 @@ function toggleCadastreLayer(layer, enabled) {
|
|||||||
lmeState.cadastreLayers = lmeState.cadastreLayers.filter(item => item !== layer);
|
lmeState.cadastreLayers = lmeState.cadastreLayers.filter(item => item !== layer);
|
||||||
}
|
}
|
||||||
refreshCadastreLayer();
|
refreshCadastreLayer();
|
||||||
|
if (layer === "CP.CadastralZoning") {
|
||||||
|
if (enabled) {
|
||||||
|
scheduleNavigationSheetRefresh(true);
|
||||||
|
} else {
|
||||||
|
clearNavigationSheetOutline();
|
||||||
|
}
|
||||||
|
}
|
||||||
const layerNames = {
|
const layerNames = {
|
||||||
"CP.CadastralParcel": "Confini particelle",
|
"CP.CadastralParcel": "Confini particelle",
|
||||||
codice_plla: "Numeri particelle",
|
codice_plla: "Numeri particelle",
|
||||||
@@ -5413,17 +5437,131 @@ function toggleCadastreLayer(layer, enabled) {
|
|||||||
setInfo(`${layerNames[layer] || layer}: ${enabled ? "attivo" : "nascosto"}.`);
|
setInfo(`${layerNames[layer] || layer}: ${enabled ? "attivo" : "nascosto"}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scheduleNavigationSheetRefresh(immediate = false) {
|
||||||
|
window.clearTimeout(lmeState.navigationSheetRefreshTimer);
|
||||||
|
if (!lmeState.map
|
||||||
|
|| !lmeState.dotNetReference
|
||||||
|
|| !lmeState.cadastreLayers.includes("CP.CadastralZoning")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lmeState.map.getZoom() < 15) {
|
||||||
|
clearNavigationSheetOutline();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lmeState.navigationSheetRefreshTimer = window.setTimeout(
|
||||||
|
() => void refreshNavigationSheetOutline(),
|
||||||
|
immediate ? 0 : 650);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refreshNavigationSheetOutline() {
|
||||||
|
if (!lmeState.map
|
||||||
|
|| !lmeState.dotNetReference
|
||||||
|
|| !lmeState.cadastreLayers.includes("CP.CadastralZoning")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const center = lmeState.map.getCenter();
|
||||||
|
const point = [center.lng, center.lat];
|
||||||
|
if (loadedCadastralSheetAt(point)) {
|
||||||
|
clearNavigationSheetOutline();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (lmeState.navigationSheetFeature?.geometry
|
||||||
|
&& geometryContainsPoint(lmeState.navigationSheetFeature.geometry, point)) {
|
||||||
|
lmeState.navigationSheetLabel?.setLatLng(center);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestId = ++lmeState.navigationSheetRequestId;
|
||||||
|
try {
|
||||||
|
const xml = await lmeState.dotNetReference.invokeMethodAsync(
|
||||||
|
"GetOfficialCadastralSheetsNear",
|
||||||
|
center.lat,
|
||||||
|
center.lng);
|
||||||
|
if (requestId !== lmeState.navigationSheetRequestId
|
||||||
|
|| !lmeState.cadastreLayers.includes("CP.CadastralZoning")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const candidates = gmlParcelsToGeoJson(xml).features || [];
|
||||||
|
const sheet = findContainingPolygon(point, { type: "FeatureCollection", features: candidates })
|
||||||
|
|| candidates[0];
|
||||||
|
if (!sheet) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const reference = String(sheet.properties?.NATIONALCADASTRALZONINGREFERENCE
|
||||||
|
|| sheet.properties?.LABEL
|
||||||
|
|| "").trim();
|
||||||
|
const previousReference = String(
|
||||||
|
lmeState.navigationSheetFeature?.properties?.NATIONALCADASTRALZONINGREFERENCE
|
||||||
|
|| lmeState.navigationSheetFeature?.properties?.LABEL
|
||||||
|
|| "").trim();
|
||||||
|
lmeState.navigationSheetFeature = sheet;
|
||||||
|
lmeState.navigationSheetLayer.clearLayers();
|
||||||
|
L.geoJSON(sheet, {
|
||||||
|
pane: "navigationSheetPane",
|
||||||
|
interactive: false,
|
||||||
|
style: {
|
||||||
|
color: "#f59e0b",
|
||||||
|
weight: 4,
|
||||||
|
opacity: 0.95,
|
||||||
|
dashArray: "10 6",
|
||||||
|
fillColor: "#fbbf24",
|
||||||
|
fillOpacity: 0.055
|
||||||
|
}
|
||||||
|
}).addTo(lmeState.navigationSheetLayer);
|
||||||
|
lmeState.navigationSheetLabel = L.marker(center, {
|
||||||
|
pane: "navigationSheetPane",
|
||||||
|
interactive: false,
|
||||||
|
icon: L.divIcon({
|
||||||
|
className: "cadastral-sheet-label",
|
||||||
|
html: escapeHtml(reference ? `Foglio ${reference}` : "Foglio catastale")
|
||||||
|
})
|
||||||
|
}).addTo(lmeState.navigationSheetLayer);
|
||||||
|
if (reference && reference !== previousReference) {
|
||||||
|
setInfo(`Confine del foglio catastale ${reference} caricato.`);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
if (requestId === lmeState.navigationSheetRequestId) {
|
||||||
|
setInfo("Confine del foglio catastale non disponibile dal servizio AdE. Riprovo al prossimo spostamento.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearNavigationSheetOutline() {
|
||||||
|
window.clearTimeout(lmeState.navigationSheetRefreshTimer);
|
||||||
|
lmeState.navigationSheetRequestId++;
|
||||||
|
lmeState.navigationSheetFeature = null;
|
||||||
|
lmeState.navigationSheetLabel = null;
|
||||||
|
lmeState.navigationSheetLayer?.clearLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadedCadastralSheetAt(point) {
|
||||||
|
const features = [
|
||||||
|
...(lmeState.importedSheets?.toGeoJSON?.()?.features || []),
|
||||||
|
...(lmeState.imported?.toGeoJSON?.()?.features || [])
|
||||||
|
].filter(feature => ["Polygon", "MultiPolygon"].includes(feature?.geometry?.type)
|
||||||
|
&& (feature.properties?._lmeOfficialSheet
|
||||||
|
|| feature.properties?.NATIONALCADASTRALZONINGREFERENCE
|
||||||
|
|| isSheetOrOverlayFeature(feature)));
|
||||||
|
return findContainingPolygon(point, { type: "FeatureCollection", features });
|
||||||
|
}
|
||||||
|
|
||||||
function refreshCadastreLayer() {
|
function refreshCadastreLayer() {
|
||||||
if (lmeState.cadastre) {
|
if (lmeState.cadastre) {
|
||||||
lmeState.map.removeLayer(lmeState.cadastre);
|
lmeState.map.removeLayer(lmeState.cadastre);
|
||||||
}
|
}
|
||||||
|
if (lmeState.cadastreZoning) {
|
||||||
const layers = activeCadastreLayers();
|
lmeState.map.removeLayer(lmeState.cadastreZoning);
|
||||||
lmeState.cadastre = null;
|
|
||||||
if (!layers.length) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const zoningEnabled = lmeState.cadastreLayers.includes("CP.CadastralZoning");
|
||||||
|
const layers = activeCadastreLayers().filter(layer => layer !== "CP.CadastralZoning");
|
||||||
|
lmeState.cadastre = null;
|
||||||
|
lmeState.cadastreZoning = null;
|
||||||
|
|
||||||
|
if (layers.length) {
|
||||||
const cadastreLayer = L.tileLayer.wms(cadastreUrl(), {
|
const cadastreLayer = L.tileLayer.wms(cadastreUrl(), {
|
||||||
pane: "cadastrePane",
|
pane: "cadastrePane",
|
||||||
layers: layers.join(","),
|
layers: layers.join(","),
|
||||||
@@ -5435,7 +5573,30 @@ function refreshCadastreLayer() {
|
|||||||
opacity: lmeState.cadastreOpacity,
|
opacity: lmeState.cadastreOpacity,
|
||||||
attribution: "Agenzia delle Entrate - CC BY 4.0"
|
attribution: "Agenzia delle Entrate - CC BY 4.0"
|
||||||
});
|
});
|
||||||
|
attachCadastreTileRecovery(cadastreLayer);
|
||||||
|
lmeState.cadastre = cadastreLayer.addTo(lmeState.map);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zoningEnabled) {
|
||||||
|
const zoningLayer = L.tileLayer.wms(cadastreUrl(), {
|
||||||
|
pane: "cadastreZoningPane",
|
||||||
|
layers: "CP.CadastralZoning",
|
||||||
|
format: "image/png",
|
||||||
|
transparent: true,
|
||||||
|
version: "1.1.1",
|
||||||
|
crs: cadastreCrs,
|
||||||
|
minZoom: 8,
|
||||||
|
maxZoom: 14,
|
||||||
|
opacity: Math.max(0.8, lmeState.cadastreOpacity),
|
||||||
|
attribution: "Agenzia delle Entrate - CC BY 4.0"
|
||||||
|
});
|
||||||
|
attachCadastreTileRecovery(zoningLayer);
|
||||||
|
lmeState.cadastreZoning = zoningLayer.addTo(lmeState.map);
|
||||||
|
scheduleNavigationSheetRefresh(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function attachCadastreTileRecovery(cadastreLayer) {
|
||||||
let errorShown = false;
|
let errorShown = false;
|
||||||
cadastreLayer.on("tileerror", event => {
|
cadastreLayer.on("tileerror", event => {
|
||||||
const tile = event?.tile;
|
const tile = event?.tile;
|
||||||
@@ -5459,8 +5620,6 @@ function refreshCadastreLayer() {
|
|||||||
cadastreLayer.on("load", () => {
|
cadastreLayer.on("load", () => {
|
||||||
errorShown = false;
|
errorShown = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
lmeState.cadastre = cadastreLayer.addTo(lmeState.map);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function activeCadastreLayers() {
|
function activeCadastreLayers() {
|
||||||
|
|||||||
Reference in new issue
Block a user