Fix KMZ overlays and add map export
This commit is contained in:
1 parent
32a36c98ec
commit
78af860493
8 files changed
+495
-29
No files matched your search
+101
-3
@@ -7,6 +7,7 @@
|
||||
@inject NetworkLocationService NetworkLocationService
|
||||
@inject AzureMapsService AzureMapsService
|
||||
@inject ProjectStorageService ProjectStorageService
|
||||
@inject MapExportService MapExportService
|
||||
@implements IAsyncDisposable
|
||||
|
||||
<PageTitle>LME Mappe Catastali</PageTitle>
|
||||
@@ -208,6 +209,52 @@
|
||||
else if (ActiveTab == "projects")
|
||||
{
|
||||
<section class="panel-content">
|
||||
<section class="panel-section">
|
||||
<h2>Esporta contenuto mappa</h2>
|
||||
<label>
|
||||
Nome file
|
||||
<input @bind="ExportFileName" @bind:event="oninput" placeholder="Es. Rilievo San Nicola" maxlength="80" />
|
||||
</label>
|
||||
<label>
|
||||
Formato
|
||||
<select @bind="ExportFormat">
|
||||
<option value="geojson">GeoJSON</option>
|
||||
<option value="kml">KML</option>
|
||||
<option value="kmz">KMZ compresso</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="export-options" role="group" aria-label="Oggetti da esportare">
|
||||
<label class="toggle-line project-save-option">
|
||||
<input type="checkbox" @bind="ExportImported" />
|
||||
<span>Particelle e dati GIS importati</span>
|
||||
</label>
|
||||
<label class="toggle-line project-save-option">
|
||||
<input type="checkbox" @bind="ExportImportedSheets" />
|
||||
<span>Cornici, fogli e riquadri KMZ</span>
|
||||
</label>
|
||||
<label class="toggle-line project-save-option">
|
||||
<input type="checkbox" @bind="ExportCadastral" />
|
||||
<span>Particelle catastali rosse e GPS</span>
|
||||
</label>
|
||||
<label class="toggle-line project-save-option">
|
||||
<input type="checkbox" @bind="ExportDrawings" />
|
||||
<span>Disegni, aree, linee e cerchi</span>
|
||||
</label>
|
||||
<label class="toggle-line project-save-option">
|
||||
<input type="checkbox" @bind="ExportPoi" />
|
||||
<span>Punti di interesse</span>
|
||||
</label>
|
||||
<label class="toggle-line project-save-option">
|
||||
<input type="checkbox" @bind="ExportTrail" />
|
||||
<span>Traccia GPS registrata</span>
|
||||
</label>
|
||||
</div>
|
||||
<button class="primary-command" @onclick="ExportMapFile" disabled="@(ExportBusy || string.IsNullOrWhiteSpace(ExportFileName))">
|
||||
@(ExportBusy ? "Preparazione file..." : "Esporta e salva file")
|
||||
</button>
|
||||
<small class="field-help">KML e KMZ sono compatibili con Google Earth. Gli sfondi satellitari e il WMS non vengono incorporati nel file vettoriale.</small>
|
||||
</section>
|
||||
|
||||
<section class="panel-section">
|
||||
<h2>Salva progetto</h2>
|
||||
<label>
|
||||
@@ -338,7 +385,7 @@
|
||||
<button class="@(ActiveTab == "map" || ActiveTab == "search" ? "active" : null)" @onclick='() => SelectTab("map")'>Mappa</button>
|
||||
<button class="@(ActiveTab == "cadastre" ? "active" : null)" @onclick='() => SelectTab("cadastre")'>Catasto</button>
|
||||
<button class="@(ActiveTab == "data" ? "active" : null)" @onclick='() => SelectTab("data")'>Dati</button>
|
||||
<button class="@(ActiveTab == "projects" ? "active" : null)" @onclick='() => SelectTab("projects")'>Progetti</button>
|
||||
<button class="@(ActiveTab == "projects" ? "active" : null)" @onclick='() => SelectTab("projects")'>Salvataggio</button>
|
||||
<button class="@(ActiveTab == "settings" ? "active" : null)" @onclick='() => SelectTab("settings")'>Impostazioni</button>
|
||||
</nav>
|
||||
</section>
|
||||
@@ -348,6 +395,8 @@
|
||||
private string ActiveTab { get; set; } = "map";
|
||||
private string SearchText { get; set; } = string.Empty;
|
||||
private string NewProjectName { get; set; } = string.Empty;
|
||||
private string ExportFileName { get; set; } = "Mappa";
|
||||
private string ExportFormat { get; set; } = "geojson";
|
||||
private string PoiName { get; set; } = string.Empty;
|
||||
private string SelectedProjectId { get; set; } = string.Empty;
|
||||
private string ProjectArchiveMessage { get; set; } = "Nessun progetto salvato.";
|
||||
@@ -374,6 +423,13 @@
|
||||
private bool ShowImportedMeasurements { get; set; }
|
||||
private bool ShowDrawingMeasurements { get; set; } = true;
|
||||
private bool ProjectBusy { get; set; }
|
||||
private bool ExportBusy { get; set; }
|
||||
private bool ExportImported { get; set; } = true;
|
||||
private bool ExportImportedSheets { get; set; } = true;
|
||||
private bool ExportCadastral { get; set; } = true;
|
||||
private bool ExportDrawings { get; set; } = true;
|
||||
private bool ExportPoi { get; set; } = true;
|
||||
private bool ExportTrail { get; set; } = true;
|
||||
private CancellationTokenSource? CatalogCancellation { get; set; }
|
||||
private CancellationTokenSource? GpsLookupCancellation { get; set; }
|
||||
private long LastGpsLookupAt;
|
||||
@@ -395,7 +451,7 @@
|
||||
{
|
||||
"cadastre" => "Ricerca catastale",
|
||||
"data" => "Dati e disegni",
|
||||
"projects" => "Archivio progetti",
|
||||
"projects" => "Salvataggio ed esportazione",
|
||||
"settings" => "Impostazioni",
|
||||
_ => string.Empty
|
||||
};
|
||||
@@ -404,7 +460,7 @@
|
||||
{
|
||||
"cadastre" => "Regione, Comune, Foglio, Particella",
|
||||
"data" => "File GIS, misure e POI",
|
||||
"projects" => "Salva e apri i tuoi lavori",
|
||||
"projects" => "Progetti e file GIS",
|
||||
"settings" => "Mappa, GPS e servizi ufficiali",
|
||||
_ => string.Empty
|
||||
};
|
||||
@@ -956,6 +1012,47 @@
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task ExportMapFile()
|
||||
{
|
||||
if (!ExportImported && !ExportImportedSheets && !ExportCadastral
|
||||
&& !ExportDrawings && !ExportPoi && !ExportTrail)
|
||||
{
|
||||
await JS.InvokeVoidAsync("lmeMap.showInfo", "Seleziona almeno un tipo di oggetto da esportare.");
|
||||
return;
|
||||
}
|
||||
|
||||
ExportBusy = true;
|
||||
try
|
||||
{
|
||||
var geoJson = await JS.InvokeAsync<string>("lmeMap.createMapExportGeoJson", new
|
||||
{
|
||||
includeImported = ExportImported,
|
||||
includeImportedSheets = ExportImportedSheets,
|
||||
includeCadastral = ExportCadastral,
|
||||
includeDrawings = ExportDrawings,
|
||||
includePoi = ExportPoi,
|
||||
includeTrail = ExportTrail
|
||||
});
|
||||
var exported = await MapExportService.CreateAsync(ExportFileName, ExportFormat, geoJson);
|
||||
await Share.Default.RequestAsync(new ShareFileRequest
|
||||
{
|
||||
Title = $"Salva o condividi {exported.FileName}",
|
||||
File = new ShareFile(exported.Path, exported.MimeType)
|
||||
});
|
||||
await JS.InvokeVoidAsync(
|
||||
"lmeMap.showInfo",
|
||||
$"File {exported.FileName} pronto: {exported.FeatureCount} oggetti esportati.");
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Esportazione non riuscita: {error.GetBaseException().Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
ExportBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveProject()
|
||||
{
|
||||
var name = NewProjectName.Trim();
|
||||
@@ -1018,6 +1115,7 @@
|
||||
var displayOptions = await JS.InvokeAsync<ProjectDisplayOptions>("lmeMap.loadProjectSnapshot", snapshot, project.Name);
|
||||
ApplyProjectDisplayOptions(displayOptions);
|
||||
NewProjectName = project.Name;
|
||||
ExportFileName = project.Name;
|
||||
IncludeCadastralParcels = project.IncludesCadastralParcels;
|
||||
ActiveTab = "map";
|
||||
await Task.Delay(30);
|
||||
|
||||
Reference in new issue
Block a user