Add mapped Pro fiducial point layer
This commit is contained in:
1 parent
7b642afe2d
commit
85e1c93d8a
4 files changed
+360
-19
No files matched your search
+101
-15
@@ -96,6 +96,16 @@
|
||||
<small>Particelle e geometrie verdi di file e progetti</small>
|
||||
</span>
|
||||
</label>
|
||||
@if (CanUse(AppFeatures.FiducialPoints))
|
||||
{
|
||||
<label class="map-layer-option">
|
||||
<input type="checkbox" @bind="ShowFiducialPoints" @bind:after="ApplyFiducialVisibility" />
|
||||
<span>
|
||||
<strong>Punti fiduciali</strong>
|
||||
<small>PF georiferiti caricati nella ricerca Pro</small>
|
||||
</span>
|
||||
</label>
|
||||
}
|
||||
<section class="layer-tree-section">
|
||||
<header>
|
||||
<strong>Ordine livelli e oggetti</strong>
|
||||
@@ -253,21 +263,35 @@
|
||||
@(FiducialBusy ? "Ricerca..." : "Cerca Punti Fiduciali")
|
||||
</button>
|
||||
|
||||
<label class="toggle-line">
|
||||
<input type="checkbox" @bind="ShowFiducialPoints" @bind:after="ApplyFiducialVisibility" />
|
||||
<span>Mostra i PF sulla mappa</span>
|
||||
</label>
|
||||
<label>
|
||||
Colore PF
|
||||
<input type="color" @bind="FiducialColor" @bind:after="ApplyFiducialColor" />
|
||||
</label>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(FiducialMessage))
|
||||
{
|
||||
<div class="catalog-progress"><span>@FiducialMessage</span></div>
|
||||
}
|
||||
|
||||
@if (FiducialPoints.Count > 0)
|
||||
@if (MappedFiducialPoints.Count > 0)
|
||||
{
|
||||
<section class="panel-section">
|
||||
<h2>Punti trovati (@FiducialPoints.Count)</h2>
|
||||
<h2>Punti cartografici (@MappedFiducialPoints.Count)</h2>
|
||||
<button class="secondary-command" @onclick="FitFiducialPoints">Inquadra tutti i PF</button>
|
||||
<div class="fiducial-list">
|
||||
@foreach (var point in FiducialPoints)
|
||||
@foreach (var point in MappedFiducialPoints)
|
||||
{
|
||||
<article class="fiducial-item">
|
||||
<strong>@point.Identifier</strong>
|
||||
<button class="secondary-command" @onclick="() => DownloadFiducialMonograph(point)">Scarica PDF monografia</button>
|
||||
<small>Nord/X: @FormatCoordinate(point.CadastralNorth) · Est/Y: @FormatCoordinate(point.CadastralEast)</small>
|
||||
@if (!string.IsNullOrWhiteSpace(point.MonographUrl))
|
||||
{
|
||||
<button class="secondary-command" @onclick="() => DownloadFiducialMonograph(point.MonographUrl)">Scarica PDF monografia</button>
|
||||
}
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
@@ -275,8 +299,8 @@
|
||||
}
|
||||
|
||||
<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>
|
||||
<strong>Monografie ufficiali, posizione sperimentale</strong>
|
||||
<p>Elenco e PDF provengono dall'Agenzia delle Entrate; il posizionamento sperimentale usa il servizio cartografico GloboGIS. Le coordinate sono un ausilio: verificale prima di qualsiasi uso topografico o professionale.</p>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
@@ -830,6 +854,7 @@
|
||||
private string SelectedFiducialMunicipalityCode { get; set; } = string.Empty;
|
||||
private string SelectedFiducialSheet { get; set; } = string.Empty;
|
||||
private string FiducialMessage { get; set; } = string.Empty;
|
||||
private string FiducialColor { get; set; } = "#dc2626";
|
||||
private string Status { get; set; } = "online";
|
||||
private string SelectedBaseLayer { get; set; } = "satellite";
|
||||
private string GoogleMapsApiKey { get; set; } = string.Empty;
|
||||
@@ -847,6 +872,7 @@
|
||||
private bool GpsOverlayCollapsed { get; set; }
|
||||
private bool ShowGpsPosition { get; set; } = true;
|
||||
private bool ShowSelectedParcels { get; set; } = true;
|
||||
private bool ShowFiducialPoints { get; set; } = true;
|
||||
private bool ShowImportedData { get; set; } = true;
|
||||
private bool DrawToolsVisible { get; set; }
|
||||
private bool TrailEnabled { get; set; }
|
||||
@@ -910,6 +936,7 @@
|
||||
private IReadOnlyList<FiducialAreaOption> FiducialMunicipalities { get; set; } = [];
|
||||
private IReadOnlyList<FiducialAreaOption> FiducialSheets { get; set; } = [];
|
||||
private IReadOnlyList<FiducialPointEntry> FiducialPoints { get; set; } = [];
|
||||
private IReadOnlyList<MappedFiducialPoint> MappedFiducialPoints { get; set; } = [];
|
||||
private IReadOnlyList<MapProjectSummary> Projects { get; set; } = [];
|
||||
private IReadOnlyList<MapProjectVersion> ProjectVersions { get; set; } = [];
|
||||
private MapProjectSummary? SelectedProject => Projects.FirstOrDefault(item => item.Id == SelectedProjectId);
|
||||
@@ -1257,6 +1284,7 @@
|
||||
FiducialMunicipalities = [];
|
||||
FiducialSheets = [];
|
||||
FiducialPoints = [];
|
||||
MappedFiducialPoints = [];
|
||||
if (string.IsNullOrWhiteSpace(SelectedFiducialProvinceCode))
|
||||
{
|
||||
FiducialMessage = string.Empty;
|
||||
@@ -1286,6 +1314,7 @@
|
||||
SelectedFiducialSheet = string.Empty;
|
||||
FiducialSheets = [];
|
||||
FiducialPoints = [];
|
||||
MappedFiducialPoints = [];
|
||||
if (string.IsNullOrWhiteSpace(SelectedFiducialMunicipalityCode))
|
||||
{
|
||||
FiducialMessage = string.Empty;
|
||||
@@ -1322,17 +1351,50 @@
|
||||
|
||||
FiducialBusy = true;
|
||||
FiducialPoints = [];
|
||||
FiducialMessage = "Interrogo il servizio ufficiale delle monografie...";
|
||||
MappedFiducialPoints = [];
|
||||
FiducialMessage = "Recupero monografie e coordinate dei PF...";
|
||||
try
|
||||
{
|
||||
FiducialPoints = await FiducialPointService.GetFiducialsAsync(
|
||||
province.Name,
|
||||
municipality.Name,
|
||||
string? monographError = null;
|
||||
try
|
||||
{
|
||||
FiducialPoints = await FiducialPointService.GetFiducialsAsync(
|
||||
province.Name,
|
||||
municipality.Name,
|
||||
municipality.Code,
|
||||
SelectedFiducialSheet);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
monographError = error.GetBaseException().Message;
|
||||
}
|
||||
|
||||
var mapped = await FiducialPointService.GetMappedFiducialsAsync(
|
||||
municipality.Code,
|
||||
SelectedFiducialSheet);
|
||||
FiducialMessage = FiducialPoints.Count == 0
|
||||
? "Nessun Punto Fiduciale pubblicato per il foglio selezionato."
|
||||
: $"Trovati {FiducialPoints.Count} Punti Fiduciali.";
|
||||
var monographs = FiducialPoints.ToDictionary(
|
||||
item => item.Identifier,
|
||||
item => item.MonographUrl,
|
||||
StringComparer.OrdinalIgnoreCase);
|
||||
var currentMappedPoints = monographs.Count == 0
|
||||
? mapped
|
||||
: mapped.Where(point => monographs.ContainsKey(point.Identifier)).ToArray();
|
||||
MappedFiducialPoints = currentMappedPoints
|
||||
.Select(point => point with
|
||||
{
|
||||
MonographUrl = monographs.GetValueOrDefault(point.Identifier, string.Empty)
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
await JS.InvokeVoidAsync(
|
||||
"lmeMap.setFiducialPoints",
|
||||
MappedFiducialPoints,
|
||||
FiducialColor,
|
||||
ShowFiducialPoints);
|
||||
FiducialMessage = MappedFiducialPoints.Count == 0
|
||||
? "Nessun Punto Fiduciale georiferito per il foglio selezionato."
|
||||
: $"Trovati {MappedFiducialPoints.Count} PF cartografici e {FiducialPoints.Count} monografie ufficiali."
|
||||
+ (monographError is null ? string.Empty : " Le monografie non sono al momento raggiungibili.");
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
@@ -1344,11 +1406,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DownloadFiducialMonograph(FiducialPointEntry point)
|
||||
private async Task DownloadFiducialMonograph(string monographUrl)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Launcher.Default.OpenAsync(new Uri(point.MonographUrl));
|
||||
await Launcher.Default.OpenAsync(new Uri(monographUrl));
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
@@ -1356,6 +1418,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ApplyFiducialVisibility()
|
||||
{
|
||||
SaveFlagPreferences();
|
||||
await JS.InvokeVoidAsync("lmeMap.setFiducialPointsVisible", ShowFiducialPoints);
|
||||
}
|
||||
|
||||
private async Task ApplyFiducialColor()
|
||||
{
|
||||
SaveFlagPreferences();
|
||||
await JS.InvokeVoidAsync("lmeMap.setFiducialColor", FiducialColor);
|
||||
}
|
||||
|
||||
private async Task FitFiducialPoints() =>
|
||||
await JS.InvokeVoidAsync("lmeMap.fitFiducialPoints");
|
||||
|
||||
private static string FormatCoordinate(double? value) =>
|
||||
value?.ToString("0.000", System.Globalization.CultureInfo.InvariantCulture) ?? "-";
|
||||
|
||||
private async Task OnMunicipalityChanged(ChangeEventArgs args)
|
||||
{
|
||||
SelectedMunicipalityCode = args.Value?.ToString() ?? string.Empty;
|
||||
@@ -2581,6 +2661,8 @@
|
||||
DrawToolsVisible = GetFlagPreference("draw_tools_visible", false);
|
||||
ShowGpsPosition = GetFlagPreference("show_gps_position", true);
|
||||
ShowSelectedParcels = GetFlagPreference("show_selected_parcels", true);
|
||||
ShowFiducialPoints = GetFlagPreference("show_fiducial_points", true);
|
||||
FiducialColor = Preferences.Default.Get($"{FlagPreferencePrefix}fiducial_color", "#dc2626");
|
||||
TrailEnabled = GetFlagPreference("trail_enabled", false);
|
||||
ExportImported = GetFlagPreference("export_imported", true);
|
||||
ExportImportedSheets = GetFlagPreference("export_imported_sheets", true);
|
||||
@@ -2621,6 +2703,8 @@
|
||||
SetFlagPreference("draw_tools_visible", DrawToolsVisible);
|
||||
SetFlagPreference("show_gps_position", ShowGpsPosition);
|
||||
SetFlagPreference("show_selected_parcels", ShowSelectedParcels);
|
||||
SetFlagPreference("show_fiducial_points", ShowFiducialPoints);
|
||||
Preferences.Default.Set($"{FlagPreferencePrefix}fiducial_color", FiducialColor);
|
||||
SetFlagPreference("trail_enabled", TrailEnabled);
|
||||
SetFlagPreference("export_imported", ExportImported);
|
||||
SetFlagPreference("export_imported_sheets", ExportImportedSheets);
|
||||
@@ -2658,6 +2742,8 @@
|
||||
await JS.InvokeVoidAsync("lmeMap.setDrawToolsVisible", DrawToolsVisible);
|
||||
await JS.InvokeVoidAsync("lmeMap.setGpsPositionVisible", ShowGpsPosition);
|
||||
await JS.InvokeVoidAsync("lmeMap.setSelectedParcelsVisible", ShowSelectedParcels);
|
||||
await JS.InvokeVoidAsync("lmeMap.setFiducialColor", FiducialColor);
|
||||
await JS.InvokeVoidAsync("lmeMap.setFiducialPointsVisible", ShowFiducialPoints);
|
||||
await JS.InvokeVoidAsync("lmeMap.toggleTrail", TrailEnabled);
|
||||
|
||||
foreach (var layer in CadastralLayers)
|
||||
|
||||
Reference in new issue
Block a user