Compare commits

...
6 Commits
Author SHA1 Message Date
livio b388711dcf Fix mobile panel safe area 2026-09-28 21:01:08 +02:00
livio 41405bcc4f Speed up Android test packages 2026-09-28 20:29:51 +02:00
livio 9b4ff9e188 Always retain KML lines and points 2026-09-28 20:29:21 +02:00
livio c0adc27cf5 Use existing Base signing certificate 2026-09-28 19:55:22 +02:00
livio 3dfeef54ea Release 0.4.8 with Android file imports 2026-09-28 19:42:26 +02:00
livio b600412285 Fix layer search cursor and refresh project revisions 2026-09-25 22:44:54 +02:00
12 changed files with 413 additions and 40 deletions

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@
"Rinomina cambia il nome del progetto selezionato senza alterarne contenuti e revisioni. Duplica crea invece una copia modificabile, utile prima di una variante importante o quando ricevi un progetto in sola lettura.",
"Archivia nasconde logicamente i lavori conclusi senza eliminarli; Ripristina li riporta tra quelli attivi. Elimina rimuove invece il progetto dall'archivio.",
"Condividi modificabile consente al destinatario di continuare il lavoro; Condividi in sola lettura protegge l'originale e richiede una duplicazione per modificarlo.",
"Revisioni: seleziona una data e usa Apri revisione per consultarne lo stato oppure Confronta per vedere le differenze con la versione corrente.",
"Revisioni: la prima viene creata quando salvi per la seconda volta un progetto gia esistente. L'elenco si aggiorna anche dopo i salvataggi automatici; seleziona una data e usa Apri revisione oppure Confronta.",
"Backup: Crea backup raccoglie tutti i progetti in un file trasferibile. Ripristina backup ricarica un archivio completo; Importa progetto aggiunge invece un singolo progetto condiviso."
],
"tools" =>
+124 -3
View File
@@ -10,6 +10,7 @@
@inject MapExportService MapExportService
@inject CloudSyncService CloudSyncService
@inject AppUpdateService AppUpdateService
@inject IncomingFileService IncomingFiles
@implements IAsyncDisposable
<PageTitle>LME Mappe Catastali</PageTitle>
@@ -374,6 +375,14 @@
}
</select>
</label>
@if (!string.IsNullOrWhiteSpace(SelectedProjectId) && ProjectVersions.Count == 0)
{
<small class="field-help">Non ci sono ancora revisioni: la prima viene creata quando salvi nuovamente un progetto già esistente.</small>
}
else if (ProjectVersions.Count > 0)
{
<small class="field-help">@ProjectVersions.Count revisioni disponibili, ordinate dalla più recente.</small>
}
<div class="button-row">
<button class="secondary-command" @onclick="LoadProjectVersion" disabled="@(string.IsNullOrWhiteSpace(SelectedVersionId))">Apri revisione</button>
<button class="secondary-command" @onclick="CompareProjectVersion" disabled="@(string.IsNullOrWhiteSpace(SelectedVersionId))">Confronta</button>
@@ -689,6 +698,7 @@
private bool SyncBusy { get; set; }
private string SyncStatus { get; set; } = "Sincronizzazione non configurata.";
private bool UpdateBusy { get; set; }
private bool MapReady { get; set; }
private string UpdateStatus { get; set; } = $"Versione installata: {AppUpdateService.CurrentVersion}";
private string UpdateDownloadUrl { get; set; } = string.Empty;
private string UpdateReleaseNotes { get; set; } = string.Empty;
@@ -746,6 +756,7 @@
protected override async Task OnInitializedAsync()
{
IncomingFiles.FileAvailable += OnIncomingFileAvailable;
LoadFlagPreferences();
try
@@ -789,12 +800,14 @@
{
MapCallbackReference = DotNetObjectReference.Create(this);
await JS.InvokeVoidAsync("lmeMap.init", MapCallbackReference);
MapReady = true;
await ApplyFlagPreferencesToMapAsync();
await ApplyAdvancedOptions();
await CenterOnInitialLocationAsync();
await MigrateLegacyProjectAsync();
var offlineCount = await JS.InvokeAsync<int>("lmeMap.getOfflineTileStats");
OfflineStatus = offlineCount == 0 ? "Nessuna tessera salvata." : $"{offlineCount} tessere disponibili offline.";
await ProcessIncomingFilesAsync();
await InvokeAsync(StateHasChanged);
}
}
@@ -905,6 +918,7 @@
await JS.InvokeVoidAsync("lmeMap.clearLegacyProjectSnapshot");
await RefreshProjectsAsync();
SelectedProjectId = migrated.Id;
await RefreshProjectVersionsAsync(true);
await InvokeAsync(StateHasChanged);
}
catch
@@ -1366,6 +1380,7 @@
{
SelectedProjectId = string.Empty;
}
await RefreshProjectVersionsAsync();
ProjectArchiveMessage = Projects.Count == 0
? "Nessun progetto salvato."
: $"{Projects.Count} {(Projects.Count == 1 ? "progetto salvato" : "progetti salvati")} nell'archivio interno.";
@@ -1380,10 +1395,18 @@
{
SelectedProjectId = args.Value?.ToString() ?? string.Empty;
ProjectFolder = SelectedProject?.Folder ?? string.Empty;
SelectedVersionId = string.Empty;
await RefreshProjectVersionsAsync(true);
}
private async Task RefreshProjectVersionsAsync(bool resetSelection = false)
{
ProjectVersions = string.IsNullOrWhiteSpace(SelectedProjectId)
? []
: await ProjectStorageService.GetVersionsAsync(SelectedProjectId);
if (resetSelection || ProjectVersions.All(version => version.Id != SelectedVersionId))
{
SelectedVersionId = string.Empty;
}
}
private Task UndoMapChange() => JS.InvokeVoidAsync("lmeMap.undoMapChange").AsTask();
@@ -1405,6 +1428,7 @@
await RefreshProjectsAsync();
SelectedProjectId = copy.Id;
ProjectFolder = copy.Folder;
await RefreshProjectVersionsAsync(true);
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto duplicato: {copy.Name}.");
}
@@ -1424,6 +1448,7 @@
var renamed = await ProjectStorageService.RenameAsync(project.Id, requestedName);
await RefreshProjectsAsync();
SelectedProjectId = renamed.Id;
await RefreshProjectVersionsAsync();
NewProjectName = renamed.Name;
if (!HasUnsavedChanges)
{
@@ -1472,7 +1497,11 @@
private async Task RestoreBackup()
{
var file = await FilePicker.Default.PickAsync(new PickOptions { PickerTitle = "Scegli backup LME" });
var file = await FilePicker.Default.PickAsync(new PickOptions
{
PickerTitle = "Scegli backup LME (.lmebackup.zip)",
FileTypes = BackupPickerFileTypes
});
if (file is null) return;
var path = await CopyPickedFileToCacheAsync(file);
var count = await ProjectStorageService.RestoreBackupAsync(path);
@@ -1482,12 +1511,17 @@
private async Task ImportProject()
{
var file = await FilePicker.Default.PickAsync(new PickOptions { PickerTitle = "Scegli progetto LME" });
var file = await FilePicker.Default.PickAsync(new PickOptions
{
PickerTitle = "Scegli progetto LME (.lmeproject.json)",
FileTypes = ProjectPickerFileTypes
});
if (file is null) return;
var path = await CopyPickedFileToCacheAsync(file);
var imported = await ProjectStorageService.ImportProjectAsync(path);
await RefreshProjectsAsync();
SelectedProjectId = imported.Id;
await RefreshProjectVersionsAsync(true);
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto importato: {imported.Name}.");
}
@@ -1500,6 +1534,91 @@
return path;
}
private void OnIncomingFileAvailable()
{
if (MapReady) _ = InvokeAsync(ProcessIncomingFilesAsync);
}
private async Task ProcessIncomingFilesAsync()
{
while (IncomingFiles.TryDequeue(out var incoming) && incoming is not null)
{
try
{
var lowerName = incoming.FileName.ToLowerInvariant();
if (lowerName.EndsWith(".kml", StringComparison.Ordinal)
|| lowerName.EndsWith(".kmz", StringComparison.Ordinal)
|| lowerName.EndsWith(".geojson", StringComparison.Ordinal)
|| await IsGeoJsonAsync(incoming.Path))
{
var content = Convert.ToBase64String(await File.ReadAllBytesAsync(incoming.Path));
await JS.InvokeAsync<string>("lmeMap.importExternalGisFile", incoming.FileName, content, incoming.ContentType);
continue;
}
if (lowerName.EndsWith(".zip", StringComparison.Ordinal))
{
var count = await ProjectStorageService.RestoreBackupAsync(incoming.Path);
await RefreshProjectsAsync();
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Backup aperto: {count} progetti ripristinati.");
continue;
}
if (lowerName.EndsWith(".json", StringComparison.Ordinal))
{
var imported = await ProjectStorageService.ImportProjectAsync(incoming.Path);
await RefreshProjectsAsync();
SelectedProjectId = imported.Id;
await RefreshProjectVersionsAsync(true);
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto aperto: {imported.Name}.");
continue;
}
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Formato non riconosciuto: {incoming.FileName}.");
}
catch (Exception error)
{
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Impossibile aprire {incoming.FileName}: {error.GetBaseException().Message}");
}
finally
{
try { File.Delete(incoming.Path); } catch { }
}
}
}
private static async Task<bool> IsGeoJsonAsync(string path)
{
if (!Path.GetExtension(path).Equals(".json", StringComparison.OrdinalIgnoreCase)) return false;
try
{
await using var stream = File.OpenRead(path);
using var document = await System.Text.Json.JsonDocument.ParseAsync(stream);
if (!document.RootElement.TryGetProperty("type", out var typeProperty)) return false;
var type = typeProperty.GetString();
return type is "Feature" or "FeatureCollection" or "Point" or "MultiPoint"
or "LineString" or "MultiLineString" or "Polygon" or "MultiPolygon"
or "GeometryCollection";
}
catch { return false; }
}
private static readonly FilePickerFileType ProjectPickerFileTypes = new(new Dictionary<DevicePlatform, IEnumerable<string>>
{
[DevicePlatform.Android] = ["application/json", "text/json", "text/plain", "application/octet-stream"],
[DevicePlatform.WinUI] = [".json"],
[DevicePlatform.iOS] = ["public.json", "public.data"],
[DevicePlatform.macOS] = ["public.json", "public.data"]
});
private static readonly FilePickerFileType BackupPickerFileTypes = new(new Dictionary<DevicePlatform, IEnumerable<string>>
{
[DevicePlatform.Android] = ["application/zip", "application/x-zip-compressed", "application/octet-stream"],
[DevicePlatform.WinUI] = [".zip"],
[DevicePlatform.iOS] = ["public.zip-archive", "public.data"],
[DevicePlatform.macOS] = ["public.zip-archive", "public.data"]
});
private async Task LoadProjectVersion()
{
if (SelectedProject is null || string.IsNullOrWhiteSpace(SelectedVersionId)) return;
@@ -1588,6 +1707,7 @@
existing?.Id);
await RefreshProjectsAsync();
SelectedProjectId = saved.Id;
await RefreshProjectVersionsAsync();
NewProjectName = saved.Name;
await JS.InvokeVoidAsync("lmeMap.setProjectReadOnly", false);
await JS.InvokeVoidAsync("lmeMap.markProjectSaved");
@@ -2099,6 +2219,7 @@
public ValueTask DisposeAsync()
{
IncomingFiles.FileAvailable -= OnIncomingFileAvailable;
CancelCatalogWork();
LocationService.StopTracking();
GpsLookupCancellation?.Cancel();
+13 -5
View File
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net10.0-android;net10.0-ios;net10.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net10.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->
@@ -28,8 +28,8 @@
<ApplicationId>com.companyname.lmemappecatastaliapp</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>0.4.6</ApplicationDisplayVersion>
<ApplicationVersion>41</ApplicationVersion>
<ApplicationDisplayVersion>0.4.10</ApplicationDisplayVersion>
<ApplicationVersion>45</ApplicationVersion>
<Version>$(ApplicationDisplayVersion)</Version>
<!-- To develop, package, and publish an app to the Microsoft Store, see: https://aka.ms/MauiTemplateUnpackaged -->
@@ -43,6 +43,14 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release' and $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<AndroidTargetSdkVersion>36</AndroidTargetSdkVersion>
<AndroidPackageFormat>aab</AndroidPackageFormat>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#075E54" />
@@ -64,7 +72,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.12" />
<PackageReference Include="Parquet.Net" Version="6.1.0" />
</ItemGroup>
+1
View File
@@ -26,6 +26,7 @@ public static class MauiProgram
builder.Services.AddSingleton<MapExportService>();
builder.Services.AddSingleton<CloudSyncService>();
builder.Services.AddSingleton<AppUpdateService>();
builder.Services.AddSingleton(IncomingFileService.Shared);
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
+93 -2
View File
@@ -1,10 +1,101 @@
using Android.App;
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Database;
using Android.OS;
using Android.Provider;
using Android.Views;
using AndroidX.Core.View;
using LMEMappeCatastaliApp.Services;
namespace LMEMappeCatastaliApp;
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/json")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/geo+json")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/geojson")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/vnd.google-earth.kml+xml")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/vnd.google-earth.kmz")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/xml")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "text/xml")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/zip")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/x-zip-compressed")]
[IntentFilter([Intent.ActionView], Categories = [Intent.CategoryDefault, Intent.CategoryBrowsable], DataMimeType = "application/octet-stream")]
public class MainActivity : MauiAppCompatActivity
{
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
ApplySystemBarInsets();
QueueViewedFile(Intent);
}
private void ApplySystemBarInsets()
{
var content = FindViewById<Android.Views.View>(Android.Resource.Id.Content);
if (content is null) return;
ViewCompat.SetOnApplyWindowInsetsListener(content, new SystemBarInsetsListener(content));
ViewCompat.RequestApplyInsets(content);
}
protected override void OnNewIntent(Intent? intent)
{
base.OnNewIntent(intent);
Intent = intent;
QueueViewedFile(intent);
}
private void QueueViewedFile(Intent? intent)
{
if (intent?.Action == Android.Content.Intent.ActionView && intent.Data is not null)
{
_ = CopyViewedFileAsync(intent);
}
}
private async Task CopyViewedFileAsync(Intent intent)
{
try
{
var uri = intent.Data!;
var fileName = ReadDisplayName(uri) ?? $"file-{Guid.NewGuid():N}";
fileName = string.Concat(fileName.Select(character => Path.GetInvalidFileNameChars().Contains(character) ? '_' : character));
var directory = Path.Combine(FileSystem.CacheDirectory, "Incoming");
Directory.CreateDirectory(directory);
var path = Path.Combine(directory, $"{Guid.NewGuid():N}-{fileName}");
await using var input = ContentResolver!.OpenInputStream(uri)
?? throw new IOException("Impossibile leggere il file selezionato.");
await using var output = File.Create(path);
await input.CopyToAsync(output);
IncomingFileService.Shared.Enqueue(new IncomingFile(path, fileName, intent.Type));
}
catch (Exception error)
{
System.Diagnostics.Debug.WriteLine($"Apertura file LME non riuscita: {error}");
}
}
private string? ReadDisplayName(Android.Net.Uri uri)
{
if (uri.Scheme == ContentResolver.SchemeFile) return Path.GetFileName(uri.Path);
using ICursor? cursor = ContentResolver?.Query(uri, [IOpenableColumns.DisplayName], null, null, null);
if (cursor is null || !cursor.MoveToFirst()) return null;
var index = cursor.GetColumnIndex(IOpenableColumns.DisplayName);
return index >= 0 ? cursor.GetString(index) : null;
}
private sealed class SystemBarInsetsListener(Android.Views.View content) : Java.Lang.Object, IOnApplyWindowInsetsListener
{
private readonly int _left = content.PaddingLeft;
private readonly int _top = content.PaddingTop;
private readonly int _right = content.PaddingRight;
public WindowInsetsCompat? OnApplyWindowInsets(Android.Views.View? view, WindowInsetsCompat? insets)
{
if (view is null || insets is null) return insets;
var systemBars = insets.GetInsets(WindowInsetsCompat.Type.SystemBars());
view.SetPadding(_left, _top, _right, systemBars?.Bottom ?? 0);
return insets;
}
}
}
+21
View File
@@ -2,6 +2,27 @@
App .NET MAUI Blazor Hybrid per Android, iOS, Mac Catalyst e Windows, pensata per consultare mappe catastali e lavorare sul campo con GPS.
## Versione 0.4.10
- I pannelli mobili rispettano la barra di navigazione Android e mantengono il pulsante Help completamente raggiungibile tramite scorrimento.
## Versione 0.4.9
- Linee e punti KML/KMZ vengono sempre importati, anche quando il documento viene riconosciuto come catastale; il filtro particelle separa soltanto i poligoni di foglio o cornice.
## Versione 0.4.8
- Aggiornamento a .NET 10 e target Android API 36.
- KML e KMZ generici conservano punti, linee e poligoni; il filtro particelle viene applicato soltanto ai file riconosciuti come catastali.
- Android propone LME tra le app disponibili per aprire KML, KMZ, GeoJSON, progetti JSON e backup ZIP.
- I selettori file Android mostrano correttamente progetti condivisi e backup con estensione composta.
## Versione 0.4.7
- La ricerca nel pannello Layer conserva correttamente posizione e selezione del cursore durante il filtraggio; digitando `pio` il testo non viene piu invertito in `oip`.
- L'elenco revisioni viene aggiornato dopo salvataggi manuali e automatici, rinomina, importazione e selezione del progetto.
- Il pannello Progetti mostra quante revisioni sono disponibili e spiega quando un progetto appena creato non possiede ancora versioni precedenti.
## Versione 0.4.6
- `Mostra cornice/layer del foglio` carica dal WFS ufficiale AdE il vero confine `CP:CadastralZoning` di ciascun foglio delle particelle.
+20
View File
@@ -0,0 +1,20 @@
using System.Collections.Concurrent;
namespace LMEMappeCatastaliApp.Services;
public sealed class IncomingFileService
{
private readonly ConcurrentQueue<IncomingFile> _files = new();
public static IncomingFileService Shared { get; } = new();
public event Action? FileAvailable;
public void Enqueue(IncomingFile file)
{
_files.Enqueue(file);
MainThread.BeginInvokeOnMainThread(() => FileAvailable?.Invoke());
}
public bool TryDequeue(out IncomingFile? file) => _files.TryDequeue(out file);
}
public sealed record IncomingFile(string Path, string FileName, string? ContentType);
+1 -1
View File
@@ -85,7 +85,7 @@ public sealed class MapExportService
{
var root = new XElement("gpx",
new XAttribute("version", "1.1"),
new XAttribute("creator", "LME Mappe Catastali 0.4.6"),
new XAttribute("creator", "LME Mappe Catastali 0.4.7"),
new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
new XElement("metadata", new XElement("name", name)));
foreach (var feature in features.EnumerateArray())
+6
View File
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.401",
"rollForward": "latestPatch"
}
}
+52
View File
@@ -0,0 +1,52 @@
param([string]$Configuration = "Release")
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
$dotnet = Join-Path $env:USERPROFILE ".dotnet10\dotnet.exe"
$androidSdk = Join-Path $env:LOCALAPPDATA "Android\Sdk"
$keyStore = Join-Path $env:LOCALAPPDATA "Xamarin\Mono for Android\debug.keystore"
$outputDirectory = Join-Path $projectRoot "artifacts\android-test"
$projectPath = Join-Path $projectRoot "LMEMappeCatastaliApp.csproj"
[xml]$projectXml = Get-Content -Raw -LiteralPath $projectPath
$appVersion = ($projectXml.Project.PropertyGroup | Where-Object ApplicationDisplayVersion | Select-Object -First 1).ApplicationDisplayVersion
foreach ($requiredPath in @($dotnet, $androidSdk, $keyStore)) {
if (-not (Test-Path -LiteralPath $requiredPath)) { throw "Componente richiesto non trovato: $requiredPath" }
}
New-Item -ItemType Directory -Force -Path $outputDirectory | Out-Null
$packages = [System.Collections.Generic.List[System.IO.FileInfo]]::new()
foreach ($format in @("apk", "aab")) {
$publishArguments = @(
"publish", $projectPath,
"-f", "net10.0-android",
"-c", $Configuration,
"-p:AndroidSdkDirectory=$androidSdk",
"-p:AndroidPackageFormat=$format",
"-p:RunAOTCompilation=false",
"-p:AndroidKeyStore=true",
"-p:AndroidSigningKeyStore=$keyStore",
"-p:AndroidSigningKeyAlias=androiddebugkey",
"-p:AndroidSigningStorePass=android",
"-p:AndroidSigningKeyPass=android"
)
& $dotnet @publishArguments
if ($LASTEXITCODE -ne 0) { throw "Pubblicazione Android $format non riuscita." }
$publishDirectory = Join-Path $projectRoot "bin\$Configuration\net10.0-android\publish"
$package = Get-ChildItem -LiteralPath $publishDirectory -Filter "*-Signed.$format" -File |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
if ($null -eq $package) { throw "Nessun pacchetto $format firmato prodotto." }
$destination = Join-Path $outputDirectory "LME-Mappe-Catastali-$appVersion.$format"
Copy-Item -LiteralPath $package.FullName -Destination $destination -Force
$packages.Add((Get-Item -LiteralPath $destination))
}
$packages | ForEach-Object {
$hash = Get-FileHash -Algorithm SHA256 -LiteralPath $_.FullName
"$($hash.Hash.ToLowerInvariant()) $($_.Name)"
} | Set-Content -LiteralPath (Join-Path $outputDirectory "SHA256SUMS.txt") -Encoding ascii
$packages | Select-Object Name, Length, LastWriteTime
+8 -1
View File
@@ -1276,6 +1276,8 @@ input[type="checkbox"] {
z-index: 1100;
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
width: min(430px, calc(100% - 48px));
border-left: 1px solid var(--line);
background: var(--panel);
@@ -1328,10 +1330,15 @@ h2 {
}
.panel-content {
flex: 1 1 auto;
min-height: 0;
display: grid;
align-content: start;
gap: 12px;
overflow-y: auto;
padding: 15px 16px 24px;
overscroll-behavior: contain;
padding: 15px 16px max(32px, calc(24px + env(safe-area-inset-bottom)));
scroll-padding-bottom: max(32px, calc(24px + env(safe-area-inset-bottom)));
}
.panel-section {
+73 -27
View File
@@ -167,6 +167,7 @@ window.lmeMap = {
clearOfflineTiles,
getOfflineTileStats,
resize,
importExternalGisFile,
showInfo: setInfo
};
@@ -737,29 +738,7 @@ function bindFileImport() {
if (file.size > 100 * 1024 * 1024) throw new Error("file superiore a 100 MB; suddividilo prima dell'importazione");
setInfo(`Analisi di ${file.name} (${(file.size / 1024 / 1024).toFixed(1)} MB)...`);
await new Promise(resolve => window.setTimeout(resolve, 20));
const result = await readGisFile(file);
rememberMapChange();
const geojson = result.geojson;
const parcelLayer = addImportedFeatures(geojson);
const sheetGeojson = result.sheetGeojson || emptyFeatureCollection();
const sheetLayer = addImportedSheetFeatures(sheetGeojson);
applyImportedSheetVisibility();
fitLayer(geojson.features.length ? parcelLayer : sheetLayer);
refreshImportedMeasurements();
const featureCount = geojson.features.length;
const sheetCount = sheetGeojson.features.length;
const ignored = result.ignoredCount
? `; esclusi ${result.ignoredCount} elementi del foglio o non particella`
: "";
const includedSheets = sheetCount
? `; ${sheetCount} elementi foglio ${lmeState.importedSheetsVisible ? "visibili" : "nascosti"}`
: "";
const reprojected = result.reprojected ? "; coordinate Web Mercator convertite" : "";
const warnings = result.validationWarnings ? `; ${result.validationWarnings} geometrie da verificare` : "";
setInfo(`Caricato ${file.name}: ${featureCount} particelle/elementi${includedSheets}${ignored}${reprojected}${warnings}.`);
updateGpsInsideState();
refreshLayerManager();
finishMapChange();
await importGisFile(file);
} catch (error) {
setInfo(`File non leggibile: ${error.message}`);
} finally {
@@ -769,6 +748,41 @@ function bindFileImport() {
lmeState.fileImportBound = true;
}
async function importExternalGisFile(fileName, base64Content, mimeType) {
const binary = atob(base64Content);
const bytes = new Uint8Array(binary.length);
for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
const file = new File([bytes], fileName, { type: mimeType || "application/octet-stream" });
if (file.size > 100 * 1024 * 1024) throw new Error("file superiore a 100 MB; suddividilo prima dell'importazione");
setInfo(`Analisi di ${file.name} (${(file.size / 1024 / 1024).toFixed(1)} MB)...`);
await new Promise(resolve => window.setTimeout(resolve, 20));
return importGisFile(file);
}
async function importGisFile(file) {
const result = await readGisFile(file);
rememberMapChange();
const geojson = result.geojson;
const parcelLayer = addImportedFeatures(geojson);
const sheetGeojson = result.sheetGeojson || emptyFeatureCollection();
const sheetLayer = addImportedSheetFeatures(sheetGeojson);
applyImportedSheetVisibility();
fitLayer(geojson.features.length ? parcelLayer : sheetLayer);
refreshImportedMeasurements();
const featureCount = geojson.features.length;
const sheetCount = sheetGeojson.features.length;
const ignored = result.ignoredCount ? `; esclusi ${result.ignoredCount} elementi del foglio o non particella` : "";
const includedSheets = sheetCount ? `; ${sheetCount} elementi foglio ${lmeState.importedSheetsVisible ? "visibili" : "nascosti"}` : "";
const reprojected = result.reprojected ? "; coordinate Web Mercator convertite" : "";
const warnings = result.validationWarnings ? `; ${result.validationWarnings} geometrie da verificare` : "";
const message = `Caricato ${file.name}: ${featureCount} particelle/elementi${includedSheets}${ignored}${reprojected}${warnings}.`;
setInfo(message);
updateGpsInsideState();
refreshLayerManager();
finishMapChange();
return message;
}
async function readGisFile(file) {
const lowerName = file.name.toLowerCase();
@@ -985,17 +999,27 @@ function normalizeKmlFiles(files) {
throw new Error("KML senza geometrie utilizzabili");
}
if (!looksLikeCadastralKml(features)) {
return {
geojson: { type: "FeatureCollection", features },
sheetGeojson: emptyFeatureCollection(),
ignoredCount: 0,
reprojected: false
};
}
const polygonParts = splitKmlPolygonFeatures(features);
const parcels = filterKmlParcelFeatures(polygonParts);
const parcelSet = new Set(parcels);
const sheetParts = polygonParts.filter(feature => !parcelSet.has(feature));
const nonPolygonFeatures = features.filter(feature => geometryPolygons(feature.geometry).length === 0);
const optionalFeatures = [...sheetParts, ...nonPolygonFeatures];
if (!parcels.length && !(lmeState.includeKmlSheetLayer && optionalFeatures.length)) {
const importedFeatures = [...parcels, ...nonPolygonFeatures];
const optionalFeatures = sheetParts;
if (!importedFeatures.length && !(lmeState.includeKmlSheetLayer && optionalFeatures.length)) {
throw new Error("nessuna particella trovata; attiva 'includi layer del foglio' per importare gli altri elementi");
}
return {
geojson: { type: "FeatureCollection", features: parcels },
geojson: { type: "FeatureCollection", features: importedFeatures },
sheetGeojson: {
type: "FeatureCollection",
features: lmeState.includeKmlSheetLayer ? optionalFeatures : []
@@ -1005,6 +1029,22 @@ function normalizeKmlFiles(files) {
};
}
function looksLikeCadastralKml(features) {
return features.some(feature => {
const properties = feature?.properties || {};
const name = String(properties.name || properties.Name || properties.LABEL || "").trim();
const context = [
name,
properties.layer,
properties.Layer,
properties.type,
properties.Tipo,
properties._lmeFolder
].filter(Boolean).join(" ").toLowerCase();
return /\b(particell|mappal|catast|foglio|parcel|cadastral)\w*/i.test(context);
});
}
function kmlTextToGeoJson(text, sourceName) {
const xml = new DOMParser().parseFromString(text, "text/xml");
if (xml.getElementsByTagName("parsererror").length) {
@@ -2019,9 +2059,15 @@ function renderLayerSelectionToolbar() {
</div>`;
const search = toolbar.querySelector("input");
search.addEventListener("input", () => {
const selectionStart = search.selectionStart ?? search.value.length;
const selectionEnd = search.selectionEnd ?? selectionStart;
lmeState.managerSearchText = search.value;
refreshLayerManager();
requestAnimationFrame(() => document.querySelector(".layer-selection-toolbar input")?.focus());
const replacement = document.querySelector(".layer-selection-toolbar input");
if (replacement) {
replacement.focus({ preventScroll: true });
replacement.setSelectionRange(selectionStart, selectionEnd);
}
});
toolbar.querySelectorAll("button").forEach(button => button.addEventListener("click", () => {
const records = [...lmeState.managerSelectedObjectIds]