Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f480ce23ca | ||
|
|
00053e4d5f | ||
|
|
cfba1b998b | ||
|
|
f1224b21c4 |
No files matched your search
@@ -0,0 +1,115 @@
|
|||||||
|
<details class="menu-help">
|
||||||
|
<summary>
|
||||||
|
<span aria-hidden="true">?</span>
|
||||||
|
<strong>Guida rapida</strong>
|
||||||
|
</summary>
|
||||||
|
<div class="menu-help-content">
|
||||||
|
<p>@Introduction</p>
|
||||||
|
<ol>
|
||||||
|
@foreach (var instruction in Instructions)
|
||||||
|
{
|
||||||
|
<li>@instruction</li>
|
||||||
|
}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[Parameter, EditorRequired]
|
||||||
|
public string Topic { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
private string Introduction => Topic switch
|
||||||
|
{
|
||||||
|
"layers" => "Qui controlli visibilita, ordine, selezione e organizzazione di tutti gli oggetti presenti sulla mappa.",
|
||||||
|
"cadastre" => "Trova una particella nel catalogo catastale e mostrane il confine ufficiale sulla mappa.",
|
||||||
|
"data" => "Importa file GIS, crea disegni e misure oppure aggiungi punti di interesse.",
|
||||||
|
"save" => "Esporta gli elementi della mappa in un file compatibile con altre applicazioni GIS e GPS.",
|
||||||
|
"projects" => "Salva il lavoro completo, riaprilo, organizzalo e recupera revisioni o copie di sicurezza.",
|
||||||
|
"tools" => "Consulta e gestisci gli oggetti in modo avanzato, controlla le coordinate e prepara mappe offline.",
|
||||||
|
"settings" => "Personalizza mappa, salvataggi, GPS, sincronizzazione e servizi esterni.",
|
||||||
|
_ => "Consulta le indicazioni essenziali per usare questo pannello."
|
||||||
|
};
|
||||||
|
|
||||||
|
private IReadOnlyList<string> Instructions => Topic switch
|
||||||
|
{
|
||||||
|
"layers" =>
|
||||||
|
[
|
||||||
|
"Visibilita: usa la casella di una categoria o di un gruppo per mostrare o nascondere tutti i suoi contenuti; la casella del singolo oggetto agisce solo su quello.",
|
||||||
|
"Gerarchia: premi la freccia accanto alla maniglia per aprire un gruppo. Il rientro, il carattere e la tonalita indicano se una riga e figlia, nipote o di livello successivo.",
|
||||||
|
"Selezione multipla: attiva il flag sulle righe desiderate. Esempio: seleziona tre poligoni per esportare solo quelli oppure per bloccarli con una sola operazione.",
|
||||||
|
"Rinomina e attributi: Rinomina modifica il nome mostrato e salvato nei progetti e nei file esportati; Attributi apre un editor multilinea per consultare o correggere i dati associati.",
|
||||||
|
"Colori: espandi un padre o un figlio e usa gli editor di linea e riempimento. Puoi scegliere il colore, prelevarlo con il contagocce se supportato, oppure inserire e copiare i valori HEX, RGB e HSL; sul padre viene applicato a tutto il gruppo.",
|
||||||
|
"Blocco: il lucchetto impedisce modifiche e spostamenti involontari. Sblocca l'oggetto prima di usare la matita o gli strumenti geometrici.",
|
||||||
|
"Sposta nel gruppo cambia l'appartenenza. Esempio: trasferisci un poligono da Disegni e POI a Progetti e dati importati, oppure in un nuovo sottogruppo chiamato Rilievo nord.",
|
||||||
|
"Sposta geometria cambia invece le coordinate dell'oggetto, per esempio 100 metri verso nord; non modifica il gruppo di appartenenza.",
|
||||||
|
"Rimuovi dal progetto nasconde l'elemento e lo esclude dai salvataggi successivi; Elimina lo sposta nel cestino. Usa gli strumenti avanzati per ripristinare l'ultima rimozione o svuotare definitivamente il cestino.",
|
||||||
|
"Ordine: trascina la maniglia di una riga verso l'alto o il basso per cambiare la sovrapposizione sulla mappa."
|
||||||
|
],
|
||||||
|
"cadastre" =>
|
||||||
|
[
|
||||||
|
"Compila i campi nell'ordine Regione, Comune, Foglio e Particella: ogni scelta carica l'elenco necessario al campo successivo.",
|
||||||
|
"Esempio: scegli Campania, il Comune, il foglio 12 e la particella 345, poi premi Mostra particella sulla mappa.",
|
||||||
|
"Il confine ufficiale viene evidenziato sulla mappa. Se Centra e zooma quando seleziono un oggetto e attivo nelle Impostazioni, la mappa lo inquadra automaticamente.",
|
||||||
|
"Se la particella e gia presente tra disegni, progetti o file GeoJSON, KML e KMZ, l'app riconosce il riferimento catastale o la geometria e riutilizza l'oggetto esistente senza duplicarlo.",
|
||||||
|
"Se un oggetto gia presente era nascosto, viene reso nuovamente visibile. La visibilita generale dei contorni evidenziati e dei dati importati resta controllabile dal pannello Layer.",
|
||||||
|
"Quando il servizio ufficiale non restituisce subito il confine, attendi il completamento indicato nel pannello e riprova mantenendo gli stessi dati selezionati."
|
||||||
|
],
|
||||||
|
"data" =>
|
||||||
|
[
|
||||||
|
"Importazione: premi Carica KML, KMZ o GeoJSON e scegli il file dal dispositivo. I nomi e gli attributi riconosciuti vengono mantenuti.",
|
||||||
|
"Per KML e KMZ, Includi anche il layer del foglio importa pure cornici e riquadri generali; disattivalo quando vuoi conservare soltanto le particelle riconosciute.",
|
||||||
|
"Usa Mostra dati importati e Mostra cornice per controllare separatamente la visibilita. Inquadra dati porta la mappa sull'estensione completa del file.",
|
||||||
|
"Disegno: premi Mostra strumenti sulla mappa, torna alla mappa e scegli linea, poligono, rettangolo, cerchio o POI nella barra Leaflet.",
|
||||||
|
"Modifica ed eliminazione possono agire sull'oggetto selezionato o su tutti i disegni. Prima seleziona sulla mappa la linea o il poligono interessato, poi scegli l'ambito dal piccolo comando accanto alla matita o al cestino.",
|
||||||
|
"Annulla e Ripristina coprono disegni, spostamenti, rinomine ed eliminazioni recenti. Recupera ultimo autosalvataggio ricarica invece l'ultima copia locale creata automaticamente.",
|
||||||
|
"Esempio POI: porta il centro della mappa sull'ingresso di un terreno, scrivi Cancello nord e premi Aggiungi POI al centro mappa.",
|
||||||
|
"Per rinominare, bloccare o trasferire un oggetto in un altro gruppo, apri Layer e usa i comandi della relativa riga."
|
||||||
|
],
|
||||||
|
"save" =>
|
||||||
|
[
|
||||||
|
"Inserisci un nome riconoscibile, per esempio Rilievo particelle 12-345, poi scegli il formato in base all'uso previsto.",
|
||||||
|
"GeoJSON e adatto ai software GIS e conserva geometrie, nomi e attributi; KML e KMZ sono adatti a Google Earth, con KMZ piu compatto per invio e archiviazione.",
|
||||||
|
"GPX e pensato per dispositivi e applicazioni GPS; PDF crea un rapporto consultabile e stampabile invece di un file vettoriale modificabile.",
|
||||||
|
"Attiva solo le categorie da includere. Esempio: per consegnare disegni e particelle importate senza la traccia GPS, lascia attive quelle due voci e disattiva Traccia GPS.",
|
||||||
|
"Solo oggetti selezionati esporta esclusivamente le righe contrassegnate nel pannello Layer. Se non devi filtrare manualmente, lascia questa opzione disattivata.",
|
||||||
|
"Premi Esporta e salva file e scegli la cartella o l'app di destinazione proposta dal dispositivo.",
|
||||||
|
"Nomi rinominati e attributi vengono salvati in GeoJSON, KML e KMZ. Gli sfondi satellitari, stradali e WMS non vengono incorporati nei file vettoriali."
|
||||||
|
],
|
||||||
|
"projects" =>
|
||||||
|
[
|
||||||
|
"Nuovo progetto: inserisci un nome, scegli se includere i contorni catastali evidenziati e premi Salva progetto. Vengono conservati oggetti, gruppi, nomi, attributi e opzioni di visualizzazione.",
|
||||||
|
"Aggiornamento: dopo aver aperto un progetto, usa di nuovo Salva progetto con lo stesso nome per aggiornarlo. Se nelle Impostazioni attivi Aggiorna automaticamente il progetto aperto, le modifiche vengono registrate dopo 3 secondi di inattivita.",
|
||||||
|
"Cartelle: seleziona un progetto, scrivi per esempio Cantieri 2026 e premi Sposta per organizzarlo nell'archivio; questa operazione non sposta le geometrie sulla mappa.",
|
||||||
|
"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.",
|
||||||
|
"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" =>
|
||||||
|
[
|
||||||
|
"Tabella oggetti: apre una vista ordinata di particelle, file importati e disegni. Usa i flag per selezionare piu righe, il lucchetto per proteggerle e la matita per modificare i metadati.",
|
||||||
|
"Copia metadati: nella maschera Metadati oggetto scegli Copia da e l'oggetto sorgente. Attiva Importa anche i valori per copiare nomi e contenuti; disattivalo per creare soltanto gli stessi campi, lasciandoli vuoti o mantenendo i valori gia presenti.",
|
||||||
|
"Coordinate WGS84 e UTM: scegli un punto sulla mappa per leggere latitudine e longitudine oppure le coordinate metriche UTM, utili per rilievi e confronti tecnici.",
|
||||||
|
"Registro operazioni: mostra in ordine cronologico disegni, modifiche, rinomine, spostamenti ed eliminazioni, cosi puoi capire cosa e cambiato durante la sessione.",
|
||||||
|
"Cestino: Ripristina ultima rimozione recupera l'elemento eliminato piu recente. Svuota cestino elimina definitivamente tutti gli elementi rimossi e non consente ulteriori recuperi.",
|
||||||
|
"Mappe offline: prima inquadra sulla mappa la zona che ti servira sul campo, quindi scegli quanti livelli di zoom aggiuntivi scaricare. Valori maggiori offrono piu dettaglio ma richiedono piu spazio e tempo.",
|
||||||
|
"Esempio offline: inquadra il cantiere e le strade di accesso, imposta 2 livelli aggiuntivi e premi Scarica area visibile mentre hai connessione.",
|
||||||
|
"Usa mappe offline seleziona lo sfondo salvato localmente; Svuota archivio libera lo spazio occupato dalle tessere scaricate."
|
||||||
|
],
|
||||||
|
"settings" =>
|
||||||
|
[
|
||||||
|
"Mappa e sfondo: scegli la cartografia di base e regola Trasparenza catasto per leggere meglio confini e immagini sottostanti. Esempio: riducila quando le linee coprono dettagli del terreno.",
|
||||||
|
"Autosalvataggio locale dopo ogni modifica: se attivo, ogni disegno, modifica, rinomina o eliminazione aggiorna immediatamente una copia di recupero nel dispositivo. Per usarla apri Dati e disegni e premi Recupera ultimo autosalvataggio.",
|
||||||
|
"Aggiorna automaticamente il progetto aperto: funziona solo dopo aver aperto o salvato un progetto modificabile. Dopo una modifica attende 3 secondi senza altre operazioni e aggiorna quel progetto; un progetto in sola lettura non viene mai sovrascritto.",
|
||||||
|
"Backup automatico: scegli Giornaliero o Settimanale. Alla successiva pressione di Salva progetto, se e trascorso l'intervallo, viene creata una copia interna di tutti i progetti; l'app conserva le 10 copie automatiche piu recenti. Disattivato non crea nuove copie programmate.",
|
||||||
|
"Esempio consigliato: lascia attivo l'autosalvataggio locale, attiva l'aggiornamento del progetto aperto durante i rilievi e imposta un backup giornaliero. Prima di modifiche importanti crea anche un backup manuale dal menu Progetti.",
|
||||||
|
"Aggancio ai vertici: avvicinando un nuovo vertice a uno esistente, l'app lo allinea entro la distanza in pixel scelta. Aumenta la distanza su schermi piccoli; riducila quando ci sono molti vertici ravvicinati.",
|
||||||
|
"Centra e zooma quando seleziono un oggetto: attivalo per inquadrare automaticamente ogni elemento scelto; disattivalo se vuoi mantenere ferma la vista mentre lavori dall'elenco Layer.",
|
||||||
|
"WebDAV: inserisci indirizzo, utente e password applicazione, salva la configurazione, poi usa Invia al cloud per caricare il backup o Scarica dal cloud per ripristinare quello remoto.",
|
||||||
|
"GPS e percorso: Mostra punto visualizza posizione e precisione; Registra traccia memorizza il cammino; distanza e avvisi aiutano a controllare l'avvicinamento e l'attraversamento del confine selezionato.",
|
||||||
|
"Google Maps e Azure Maps richiedono le rispettive chiavi solo quando scegli quegli sfondi. Controlla nuova versione confronta la versione installata con l'ultima pubblicata e mostra le relative modifiche."
|
||||||
|
],
|
||||||
|
_ => []
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
<input type="checkbox" @bind="ShowSelectedParcels" @bind:after="ApplySelectedParcelsVisibility" />
|
<input type="checkbox" @bind="ShowSelectedParcels" @bind:after="ApplySelectedParcelsVisibility" />
|
||||||
<span>
|
<span>
|
||||||
<strong>Particelle catastali evidenziate</strong>
|
<strong>Particelle catastali evidenziate</strong>
|
||||||
<small>Contorni rossi ottenuti da ricerca o GPS</small>
|
<small>Contorni ottenuti da ricerca o GPS</small>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="map-layer-option">
|
<label class="map-layer-option">
|
||||||
@@ -102,6 +102,7 @@
|
|||||||
<button class="danger-command" @onclick="ClearSelectedParcels">Elimina definitivamente le particelle selezionate</button>
|
<button class="danger-command" @onclick="ClearSelectedParcels">Elimina definitivamente le particelle selezionate</button>
|
||||||
<button class="danger-command" @onclick="ClearMapElements">Pulisci elementi mappa</button>
|
<button class="danger-command" @onclick="ClearMapElements">Pulisci elementi mappa</button>
|
||||||
</div>
|
</div>
|
||||||
|
<MenuHelp Topic="layers" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,6 +190,7 @@
|
|||||||
<strong>Mappa pubblica ufficiale</strong>
|
<strong>Mappa pubblica ufficiale</strong>
|
||||||
<p>I confini visualizzati arrivano dai servizi WMS/WFS open data dell'Agenzia delle Entrate e non richiedono CAPTCHA.</p>
|
<p>I confini visualizzati arrivano dai servizi WMS/WFS open data dell'Agenzia delle Entrate e non richiedono CAPTCHA.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<MenuHelp Topic="cadastre" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
else if (ActiveTab == "data")
|
else if (ActiveTab == "data")
|
||||||
@@ -253,6 +255,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<button class="primary-command" @onclick="AddProjectMarker">Aggiungi POI al centro mappa</button>
|
<button class="primary-command" @onclick="AddProjectMarker">Aggiungi POI al centro mappa</button>
|
||||||
</section>
|
</section>
|
||||||
|
<MenuHelp Topic="data" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
else if (ActiveTab == "save")
|
else if (ActiveTab == "save")
|
||||||
@@ -289,7 +292,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<label class="toggle-line project-save-option">
|
<label class="toggle-line project-save-option">
|
||||||
<input type="checkbox" @bind="ExportCadastral" @bind:after="SaveFlagPreferences" />
|
<input type="checkbox" @bind="ExportCadastral" @bind:after="SaveFlagPreferences" />
|
||||||
<span>Particelle catastali rosse e GPS</span>
|
<span>Particelle catastali evidenziate e GPS</span>
|
||||||
</label>
|
</label>
|
||||||
<label class="toggle-line project-save-option">
|
<label class="toggle-line project-save-option">
|
||||||
<input type="checkbox" @bind="ExportDrawings" @bind:after="SaveFlagPreferences" />
|
<input type="checkbox" @bind="ExportDrawings" @bind:after="SaveFlagPreferences" />
|
||||||
@@ -310,6 +313,7 @@
|
|||||||
<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>
|
<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>
|
||||||
|
|
||||||
|
<MenuHelp Topic="save" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
else if (ActiveTab == "projects")
|
else if (ActiveTab == "projects")
|
||||||
@@ -323,7 +327,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<label class="toggle-line project-save-option">
|
<label class="toggle-line project-save-option">
|
||||||
<input type="checkbox" @bind="IncludeCadastralParcels" @bind:after="SaveFlagPreferences" />
|
<input type="checkbox" @bind="IncludeCadastralParcels" @bind:after="SaveFlagPreferences" />
|
||||||
<span>Includi le particelle catastali rosse</span>
|
<span>Includi le particelle catastali evidenziate</span>
|
||||||
</label>
|
</label>
|
||||||
<button class="primary-command" @onclick="SaveProject" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(NewProjectName))">Salva progetto</button>
|
<button class="primary-command" @onclick="SaveProject" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(NewProjectName))">Salva progetto</button>
|
||||||
</section>
|
</section>
|
||||||
@@ -350,6 +354,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="project-command-stack">
|
<div class="project-command-stack">
|
||||||
<button class="secondary-command" @onclick="UpdateProjectFolder" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">Sposta</button>
|
<button class="secondary-command" @onclick="UpdateProjectFolder" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">Sposta</button>
|
||||||
|
<button class="secondary-command" @onclick="RenameProject" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId) || SelectedProject?.IsReadOnly == true)">Rinomina</button>
|
||||||
<button class="secondary-command" @onclick="DuplicateProject" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">Duplica</button>
|
<button class="secondary-command" @onclick="DuplicateProject" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">Duplica</button>
|
||||||
<button class="secondary-command" @onclick="ToggleProjectArchive" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">@(SelectedProject?.IsArchived == true ? "Ripristina" : "Archivia")</button>
|
<button class="secondary-command" @onclick="ToggleProjectArchive" disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">@(SelectedProject?.IsArchived == true ? "Ripristina" : "Archivia")</button>
|
||||||
<button class="secondary-command" @onclick='() => ShareProject(false)' disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">Condividi modificabile</button>
|
<button class="secondary-command" @onclick='() => ShareProject(false)' disabled="@(ProjectBusy || string.IsNullOrWhiteSpace(SelectedProjectId))">Condividi modificabile</button>
|
||||||
@@ -405,6 +410,7 @@
|
|||||||
<span>Mostra misure dei disegni</span>
|
<span>Mostra misure dei disegni</span>
|
||||||
</label>
|
</label>
|
||||||
</section>
|
</section>
|
||||||
|
<MenuHelp Topic="projects" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
else if (ActiveTab == "tools")
|
else if (ActiveTab == "tools")
|
||||||
@@ -436,6 +442,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<small class="field-help">@OfflineStatus</small>
|
<small class="field-help">@OfflineStatus</small>
|
||||||
</section>
|
</section>
|
||||||
|
<MenuHelp Topic="tools" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
else if (ActiveTab == "settings")
|
else if (ActiveTab == "settings")
|
||||||
@@ -587,6 +594,7 @@
|
|||||||
<button class="secondary-command" @onclick="ExportCadastralImage">Mostra vista WMS corrente</button>
|
<button class="secondary-command" @onclick="ExportCadastralImage">Mostra vista WMS corrente</button>
|
||||||
<footer>Dati catastali: Agenzia delle Entrate, licenza CC BY 4.0. App indipendente.</footer>
|
<footer>Dati catastali: Agenzia delle Entrate, licenza CC BY 4.0. App indipendente.</footer>
|
||||||
</section>
|
</section>
|
||||||
|
<MenuHelp Topic="settings" />
|
||||||
</section>
|
</section>
|
||||||
}
|
}
|
||||||
</aside>
|
</aside>
|
||||||
@@ -1093,8 +1101,16 @@
|
|||||||
var label = $"{municipality.Name} - foglio {DisplaySheet(SelectedSheet)}, particella {parcel.Number}";
|
var label = $"{municipality.Name} - foglio {DisplaySheet(SelectedSheet)}, particella {parcel.Number}";
|
||||||
CatalogBusy = true;
|
CatalogBusy = true;
|
||||||
CatalogMessage = "Scarico il confine dal servizio ufficiale AdE...";
|
CatalogMessage = "Scarico il confine dal servizio ufficiale AdE...";
|
||||||
var xml = await OfficialCadastreService.GetParcelsNearAsync(parcel.Latitude, parcel.Longitude, 8);
|
ShowSelectedParcels = true;
|
||||||
await JS.InvokeVoidAsync("lmeMap.displayOfficialParcel", xml, parcel.Latitude, parcel.Longitude, parcel.Number, label, true);
|
SaveFlagPreferences();
|
||||||
|
await JS.InvokeVoidAsync("lmeMap.setSelectedParcelsVisible", true);
|
||||||
|
var xml = await OfficialCadastreService.GetParcelsNearAsync(parcel.Latitude, parcel.Longitude, 30);
|
||||||
|
var displayResult = await JS.InvokeAsync<string>("lmeMap.displayOfficialParcel", xml, parcel.Latitude, parcel.Longitude, parcel.Number, label, true);
|
||||||
|
if (displayResult == "imported")
|
||||||
|
{
|
||||||
|
ShowImportedData = true;
|
||||||
|
SaveFlagPreferences();
|
||||||
|
}
|
||||||
ActiveTab = "map";
|
ActiveTab = "map";
|
||||||
await Task.Delay(30);
|
await Task.Delay(30);
|
||||||
await JS.InvokeVoidAsync("lmeMap.resize");
|
await JS.InvokeVoidAsync("lmeMap.resize");
|
||||||
@@ -1388,6 +1404,39 @@
|
|||||||
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto duplicato: {copy.Name}.");
|
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto duplicato: {copy.Name}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task RenameProject()
|
||||||
|
{
|
||||||
|
if (SelectedProject is not { } project) return;
|
||||||
|
var requestedName = await JS.InvokeAsync<string?>("lmeMap.promptProjectName", project.Name);
|
||||||
|
if (string.IsNullOrWhiteSpace(requestedName)
|
||||||
|
|| string.Equals(requestedName.Trim(), project.Name, StringComparison.CurrentCulture))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectBusy = true;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var renamed = await ProjectStorageService.RenameAsync(project.Id, requestedName);
|
||||||
|
await RefreshProjectsAsync();
|
||||||
|
SelectedProjectId = renamed.Id;
|
||||||
|
NewProjectName = renamed.Name;
|
||||||
|
if (!HasUnsavedChanges)
|
||||||
|
{
|
||||||
|
ExportFileName = renamed.Name;
|
||||||
|
}
|
||||||
|
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto rinominato: {renamed.Name}.");
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
await JS.InvokeVoidAsync("lmeMap.showInfo", $"Progetto non rinominato: {error.GetBaseException().Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ProjectBusy = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task UpdateProjectFolder()
|
private async Task UpdateProjectFolder()
|
||||||
{
|
{
|
||||||
if (SelectedProject is null) return;
|
if (SelectedProject is null) return;
|
||||||
@@ -1543,8 +1592,8 @@
|
|||||||
await JS.InvokeVoidAsync(
|
await JS.InvokeVoidAsync(
|
||||||
"lmeMap.showInfo",
|
"lmeMap.showInfo",
|
||||||
IncludeCadastralParcels
|
IncludeCadastralParcels
|
||||||
? $"Progetto salvato: {saved.Name}, incluse le particelle rosse."
|
? $"Progetto salvato: {saved.Name}, incluse le particelle catastali evidenziate."
|
||||||
: $"Progetto salvato: {saved.Name}, senza particelle rosse.");
|
: $"Progetto salvato: {saved.Name}, senza particelle catastali evidenziate.");
|
||||||
}
|
}
|
||||||
catch (Exception error)
|
catch (Exception error)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
<ApplicationId>com.companyname.lmemappecatastaliapp</ApplicationId>
|
<ApplicationId>com.companyname.lmemappecatastaliapp</ApplicationId>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>0.4.1</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>0.4.5</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>36</ApplicationVersion>
|
<ApplicationVersion>40</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 -->
|
||||||
|
|||||||
@@ -2,6 +2,38 @@
|
|||||||
|
|
||||||
App .NET MAUI Blazor Hybrid per Android, iOS, Mac Catalyst e Windows, pensata per consultare mappe catastali e lavorare sul campo con GPS.
|
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.5
|
||||||
|
|
||||||
|
- Corretto il layout del pannello Layer sui telefoni e sui foldable: checkbox, lucchetto, ordinamento e freccia di espansione non si sovrappongono e restano allineati.
|
||||||
|
- La tabella oggetti include un comando dedicato per modificare i metadati di ciascun elemento.
|
||||||
|
- L'editor metadati permette di copiare i campi da un altro oggetto, scegliendo se importare anche i valori oppure soltanto i nomi.
|
||||||
|
- Il pannello Progetti consente di rinominare un progetto duplicato o esistente senza perdere contenuti, identita e revisioni.
|
||||||
|
- La barra Leaflet include una guida completa con istruzioni ed esempi concreti per disegno, modifica, eliminazione, riparazione, fori e confronto confini.
|
||||||
|
|
||||||
|
## Versione 0.4.4
|
||||||
|
|
||||||
|
- I comandi `Rinomina`, `Sposta nel gruppo` e `Rimuovi` occupano una riga completa e restano visibili anche nei pannelli Layer molto stretti.
|
||||||
|
- `Sposta nel gruppo` e disponibile per padri e figli di disegni, dati importati, cornici, fogli importati e particelle evidenziate dalla ricerca catastale.
|
||||||
|
- Editor distinti per linea e riempimento su gruppi e singoli oggetti, con contagocce dove supportato e valori modificabili HEX, RGB e HSL.
|
||||||
|
- Copia HEX per riutilizzare esattamente un colore su altri oggetti; stili conservati nei progetti e negli export.
|
||||||
|
- Rimossi dai menu i riferimenti al colore rosso fisso delle particelle catastali.
|
||||||
|
- Nei progetti in sola lettura anche il trasferimento tra gruppi viene correttamente disabilitato.
|
||||||
|
|
||||||
|
## Versione 0.4.3
|
||||||
|
|
||||||
|
- `Mostra particella sulla mappa` riattiva sempre il layer dei confini rossi e lo porta in primo piano.
|
||||||
|
- Una particella gia evidenziata o temporaneamente nascosta viene recuperata senza creare duplicati.
|
||||||
|
- Deduplicazione estesa alle particelle presenti in progetti e file GeoJSON, KML e KMZ, tramite riferimenti catastali o confronto geometrico.
|
||||||
|
- Ricerca WFS ampliata per rendere piu affidabile il recupero dei confini di particelle estese o irregolari.
|
||||||
|
- Guida rapida collassabile in fondo a Layer e a ogni pannello operativo, con istruzioni specifiche per le relative funzioni.
|
||||||
|
|
||||||
|
## Versione 0.4.2
|
||||||
|
|
||||||
|
- Nuovo comando `Sposta nel gruppo` visibile accanto a Rinomina e Rimuovi per padri, sottogruppi e singoli oggetti.
|
||||||
|
- Scelta della categoria e del sottogruppo di destinazione, con possibilita di creare un nuovo gruppo.
|
||||||
|
- I disegni possono essere organizzati in sottogruppi come i dati importati.
|
||||||
|
- `Sposta geometria` resta separato e continua a traslare gli oggetti in metri verso nord, sud, est o ovest.
|
||||||
|
|
||||||
## Versione 0.4.1
|
## Versione 0.4.1
|
||||||
|
|
||||||
- Pannelli operativi allineati a destra, con ricerca lasciata nella posizione precedente.
|
- Pannelli operativi allineati a destra, con ricerca lasciata nella posizione precedente.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public sealed class MapExportService
|
|||||||
{
|
{
|
||||||
var root = new XElement("gpx",
|
var root = new XElement("gpx",
|
||||||
new XAttribute("version", "1.1"),
|
new XAttribute("version", "1.1"),
|
||||||
new XAttribute("creator", "LME Mappe Catastali 0.4.1"),
|
new XAttribute("creator", "LME Mappe Catastali 0.4.5"),
|
||||||
new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
|
new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
|
||||||
new XElement("metadata", new XElement("name", name)));
|
new XElement("metadata", new XElement("name", name)));
|
||||||
foreach (var feature in features.EnumerateArray())
|
foreach (var feature in features.EnumerateArray())
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public sealed class OfficialCadastreService
|
|||||||
["SRSNAME"] = "urn:ogc:def:crs:EPSG::6706",
|
["SRSNAME"] = "urn:ogc:def:crs:EPSG::6706",
|
||||||
["BBOX"] = bbox,
|
["BBOX"] = bbox,
|
||||||
["REQUEST"] = "GetFeature",
|
["REQUEST"] = "GetFeature",
|
||||||
["COUNT"] = "20"
|
["COUNT"] = "100"
|
||||||
};
|
};
|
||||||
|
|
||||||
var url = WfsEndpoint + "?" + string.Join("&", query.Select(item =>
|
var url = WfsEndpoint + "?" + string.Join("&", query.Select(item =>
|
||||||
|
|||||||
@@ -147,6 +147,36 @@ public sealed class ProjectStorageService
|
|||||||
finally { _gate.Release(); }
|
finally { _gate.Release(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<MapProjectSummary> RenameAsync(string projectId, string name)
|
||||||
|
{
|
||||||
|
var normalizedName = NormalizeName(name);
|
||||||
|
await _gate.WaitAsync();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var files = await ReadProjectFilesAsync();
|
||||||
|
var project = files.FirstOrDefault(item => item.Document.Id == projectId)
|
||||||
|
?? throw new FileNotFoundException("Il progetto selezionato non esiste piu'.");
|
||||||
|
if (project.Document.AccessMode == "readonly")
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Il progetto e' in sola lettura. Duplicalo per modificarlo.");
|
||||||
|
}
|
||||||
|
if (files.Any(item => item.Document.Id != projectId
|
||||||
|
&& string.Equals(item.Document.Name, normalizedName, StringComparison.CurrentCultureIgnoreCase)))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Esiste gia' un progetto chiamato '{normalizedName}'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
project.Document.Name = normalizedName;
|
||||||
|
project.Document.UpdatedAt = DateTimeOffset.UtcNow;
|
||||||
|
await File.WriteAllTextAsync(
|
||||||
|
project.Path,
|
||||||
|
JsonSerializer.Serialize(project.Document, _jsonOptions),
|
||||||
|
new UTF8Encoding(false));
|
||||||
|
return project.Document.ToSummary();
|
||||||
|
}
|
||||||
|
finally { _gate.Release(); }
|
||||||
|
}
|
||||||
|
|
||||||
public async Task UpdateOrganizationAsync(string projectId, string? folder = null, bool? isArchived = null)
|
public async Task UpdateOrganizationAsync(string projectId, string? folder = null, bool? isArchived = null)
|
||||||
{
|
{
|
||||||
await _gate.WaitAsync();
|
await _gate.WaitAsync();
|
||||||
|
|||||||
+231
-7
@@ -306,6 +306,73 @@ input[type="checkbox"] {
|
|||||||
padding-top: 9px;
|
padding-top: 9px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-help {
|
||||||
|
margin-top: 4px;
|
||||||
|
border: 1px solid #c8d3d8;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #f7fafb;
|
||||||
|
color: var(--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help summary {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-height: 40px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
list-style: none;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help summary > span {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border: 1px solid #82949d;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #42535c;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help summary::after {
|
||||||
|
margin-left: auto;
|
||||||
|
content: "\25BE";
|
||||||
|
color: #52636b;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: transform 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help[open] summary::after {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help-content {
|
||||||
|
padding: 10px 12px 12px;
|
||||||
|
border-top: 1px solid #d8e0e4;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help-content p {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help-content ol {
|
||||||
|
margin: 0;
|
||||||
|
padding-left: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-help-content li + li {
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.layer-tree-section {
|
.layer-tree-section {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
@@ -417,6 +484,54 @@ input[type="checkbox"] {
|
|||||||
padding: 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layer-color-editor {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
display: grid;
|
||||||
|
gap: 5px;
|
||||||
|
padding: 6px;
|
||||||
|
border: 1px solid #cbd5da;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: rgba(255, 255, 255, 0.82);
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-editor > header {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) 46px auto;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-editor > header input[type="color"] {
|
||||||
|
width: 46px;
|
||||||
|
min-height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-editor button {
|
||||||
|
min-height: 28px;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 3px 6px;
|
||||||
|
font-size: 9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-formats {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-formats label {
|
||||||
|
grid-template-columns: 30px minmax(0, 1fr);
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-formats input {
|
||||||
|
font-family: Consolas, "Courier New", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-color-copy {
|
||||||
|
justify-self: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
.layer-photo-picker {
|
.layer-photo-picker {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 32px;
|
min-height: 32px;
|
||||||
@@ -503,11 +618,11 @@ input[type="checkbox"] {
|
|||||||
.layer-manager-block > summary,
|
.layer-manager-block > summary,
|
||||||
.layer-manager-object > summary {
|
.layer-manager-object > summary {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 28px 28px minmax(0, 1fr) 50px;
|
grid-template-columns: 28px 28px minmax(0, 1fr) minmax(28px, auto);
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"handle expand title count"
|
"handle expand title count"
|
||||||
". . visibility moves"
|
"visibility lock moves moves"
|
||||||
". . actions moves";
|
"actions actions actions actions";
|
||||||
align-items: start;
|
align-items: start;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
min-height: 38px;
|
min-height: 38px;
|
||||||
@@ -518,7 +633,6 @@ input[type="checkbox"] {
|
|||||||
|
|
||||||
.layer-expand-button {
|
.layer-expand-button {
|
||||||
grid-area: expand;
|
grid-area: expand;
|
||||||
grid-row: 1 / span 3;
|
|
||||||
align-self: center;
|
align-self: center;
|
||||||
justify-self: center;
|
justify-self: center;
|
||||||
width: 28px;
|
width: 28px;
|
||||||
@@ -558,8 +672,9 @@ input[type="checkbox"] {
|
|||||||
grid-area: actions;
|
grid-area: actions;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(0, 1fr);
|
grid-template-columns: minmax(0, 1fr);
|
||||||
width: min(130px, 100%);
|
width: 100%;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layer-manager-group > summary > input,
|
.layer-manager-group > summary > input,
|
||||||
@@ -573,6 +688,7 @@ input[type="checkbox"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.layer-rename-button,
|
.layer-rename-button,
|
||||||
|
.layer-membership-button,
|
||||||
.layer-remove-button {
|
.layer-remove-button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-height: 28px;
|
min-height: 28px;
|
||||||
@@ -592,6 +708,16 @@ input[type="checkbox"] {
|
|||||||
background: #d9eee7;
|
background: #d9eee7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layer-membership-button {
|
||||||
|
border-color: #bfdbfe;
|
||||||
|
background: #eff6ff;
|
||||||
|
color: #1d4ed8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-membership-button:active {
|
||||||
|
background: #dbeafe;
|
||||||
|
}
|
||||||
|
|
||||||
.layer-remove-button {
|
.layer-remove-button {
|
||||||
border-color: #fecaca;
|
border-color: #fecaca;
|
||||||
background: #fff1f2;
|
background: #fff1f2;
|
||||||
@@ -606,6 +732,7 @@ input[type="checkbox"] {
|
|||||||
grid-area: moves;
|
grid-area: moves;
|
||||||
display: inline-grid;
|
display: inline-grid;
|
||||||
grid-template-columns: 24px 24px;
|
grid-template-columns: 24px 24px;
|
||||||
|
justify-self: end;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,12 +778,12 @@ input[type="checkbox"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.layer-inline-lock {
|
.layer-inline-lock {
|
||||||
grid-area: visibility;
|
grid-area: lock;
|
||||||
justify-self: center;
|
justify-self: center;
|
||||||
width: 28px;
|
width: 28px;
|
||||||
min-width: 28px;
|
min-width: 28px;
|
||||||
min-height: 24px;
|
min-height: 24px;
|
||||||
margin-left: 26px;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
@@ -669,6 +796,7 @@ input[type="checkbox"] {
|
|||||||
|
|
||||||
.project-readonly .leaflet-draw,
|
.project-readonly .leaflet-draw,
|
||||||
.project-readonly .layer-rename-button,
|
.project-readonly .layer-rename-button,
|
||||||
|
.project-readonly .layer-membership-button,
|
||||||
.project-readonly .layer-remove-button,
|
.project-readonly .layer-remove-button,
|
||||||
.project-readonly .layer-inline-lock,
|
.project-readonly .layer-inline-lock,
|
||||||
.project-readonly .layer-object-tools,
|
.project-readonly .layer-object-tools,
|
||||||
@@ -827,6 +955,7 @@ input[type="checkbox"] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.layer-manager-object > summary .layer-rename-button,
|
.layer-manager-object > summary .layer-rename-button,
|
||||||
|
.layer-manager-object > summary .layer-membership-button,
|
||||||
.layer-manager-object > summary .layer-remove-button {
|
.layer-manager-object > summary .layer-remove-button {
|
||||||
min-height: 24px;
|
min-height: 24px;
|
||||||
font-size: 9px;
|
font-size: 9px;
|
||||||
@@ -918,6 +1047,49 @@ input[type="checkbox"] {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(170px, 1fr) auto;
|
||||||
|
grid-template-areas:
|
||||||
|
"heading heading"
|
||||||
|
"source source"
|
||||||
|
"toggle action"
|
||||||
|
"hint hint";
|
||||||
|
align-items: end;
|
||||||
|
gap: 8px 12px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #f5f8f9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel > strong {
|
||||||
|
grid-area: heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel > label:first-child {
|
||||||
|
grid-area: source;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel > .toggle-line {
|
||||||
|
grid-area: toggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel > button {
|
||||||
|
grid-area: action;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel > label:first-child select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel > small {
|
||||||
|
grid-area: hint;
|
||||||
|
color: var(--muted);
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
.attribute-editor-row {
|
.attribute-editor-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 2fr) 36px;
|
grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 2fr) 36px;
|
||||||
@@ -982,6 +1154,47 @@ input[type="checkbox"] {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.leaflet-help {
|
||||||
|
display: grid;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-help > p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-help-list {
|
||||||
|
display: grid;
|
||||||
|
gap: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-help-list > div {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 42px minmax(0, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-help-list dt {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 900;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-help-list dd {
|
||||||
|
margin: 0;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-help-list dd strong {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.gps-overlay {
|
.gps-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 72px;
|
top: 72px;
|
||||||
@@ -1532,6 +1745,17 @@ footer {
|
|||||||
align-self: center;
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attribute-copy-panel {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
grid-template-areas:
|
||||||
|
"heading"
|
||||||
|
"source"
|
||||||
|
"toggle"
|
||||||
|
"action"
|
||||||
|
"hint";
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
.gps-overlay {
|
.gps-overlay {
|
||||||
top: 68px;
|
top: 68px;
|
||||||
right: 8px;
|
right: 8px;
|
||||||
|
|||||||
+482
-56
@@ -132,6 +132,7 @@ window.lmeMap = {
|
|||||||
setProjectReadOnly,
|
setProjectReadOnly,
|
||||||
restoreAutosave,
|
restoreAutosave,
|
||||||
compareProjectSnapshots,
|
compareProjectSnapshots,
|
||||||
|
promptProjectName,
|
||||||
setAdvancedOptions,
|
setAdvancedOptions,
|
||||||
createMapExportGeoJson,
|
createMapExportGeoJson,
|
||||||
createProjectSnapshot,
|
createProjectSnapshot,
|
||||||
@@ -367,7 +368,7 @@ function displayOfficialParcel(xmlText, latitude, longitude, parcel, label, shou
|
|||||||
const lon = Number(longitude);
|
const lon = Number(longitude);
|
||||||
if (!Number.isFinite(lat) || !Number.isFinite(lon)) {
|
if (!Number.isFinite(lat) || !Number.isFinite(lon)) {
|
||||||
setInfo("Coordinate della particella non valide.");
|
setInfo("Coordinate della particella non valide.");
|
||||||
return;
|
return "invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -389,27 +390,66 @@ function displayOfficialParcel(xmlText, latitude, longitude, parcel, label, shou
|
|||||||
lmeState.map.setView([lat, lon], 20);
|
lmeState.map.setView([lat, lon], 20);
|
||||||
}
|
}
|
||||||
setInfo("Posizione trovata, ma il servizio WFS dell'Agenzia non ha restituito il confine. Riprova tra poco.");
|
setInfo("Posizione trovata, ma il servizio WFS dell'Agenzia non ha restituito il confine. Riprova tra poco.");
|
||||||
return;
|
return "missing";
|
||||||
}
|
}
|
||||||
|
|
||||||
const ref = feature.properties?.NATIONALCADASTRALREFERENCE || feature.properties?.INSPIREID_LOCALID || label;
|
const ref = feature.properties?.NATIONALCADASTRALREFERENCE || feature.properties?.INSPIREID_LOCALID || label;
|
||||||
const targetGroup = normalizedParcel ? lmeState.selectedParcelsLayer : lmeState.gpsParcelLayer;
|
const targetGroup = normalizedParcel ? lmeState.selectedParcelsLayer : lmeState.gpsParcelLayer;
|
||||||
|
if (normalizedParcel) {
|
||||||
|
lmeState.selectedParcelsVisible = true;
|
||||||
|
lmeState.managerHiddenCategories.delete("selectedParcels");
|
||||||
|
if (!lmeState.map.hasLayer(targetGroup)) {
|
||||||
|
targetGroup.addTo(lmeState.map);
|
||||||
|
}
|
||||||
|
targetGroup.bringToFront();
|
||||||
|
}
|
||||||
if (!normalizedParcel) {
|
if (!normalizedParcel) {
|
||||||
targetGroup.clearLayers();
|
targetGroup.clearLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingLayer = normalizedParcel
|
const existingLayer = normalizedParcel
|
||||||
? findParcelLayerByReference(targetGroup, ref)
|
? findParcelLayerByReference(targetGroup, ref) || restoreHiddenParcelLayerByReference(ref)
|
||||||
: null;
|
: null;
|
||||||
if (existingLayer) {
|
if (existingLayer) {
|
||||||
|
applyStyleFromProperties(existingLayer);
|
||||||
|
targetGroup.bringToFront();
|
||||||
if (shouldFit) {
|
if (shouldFit) {
|
||||||
fitLayer(existingLayer);
|
fitLayer(existingLayer);
|
||||||
}
|
}
|
||||||
setText("parcelState", `Particella selezionata: ${ref}`);
|
setText("parcelState", `Particella selezionata: ${ref}`);
|
||||||
setInfo(`La particella ${ref} e' gia evidenziata sulla mappa.`);
|
setInfo(`La particella ${ref} e' gia evidenziata sulla mappa.`);
|
||||||
return;
|
updateGpsInsideState();
|
||||||
|
refreshLayerManager();
|
||||||
|
return "selected";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const importedRecord = normalizedParcel ? findImportedParcelRecord(feature, ref) : null;
|
||||||
|
if (importedRecord) {
|
||||||
|
restoreManagedRecordVisibility(importedRecord);
|
||||||
|
lmeState.importedVisible = true;
|
||||||
|
lmeState.managerHiddenCategories.delete("imported");
|
||||||
|
if (!lmeState.map.hasLayer(lmeState.imported)) {
|
||||||
|
lmeState.imported.addTo(lmeState.map);
|
||||||
|
}
|
||||||
|
lmeState.imported.bringToFront();
|
||||||
|
if (shouldFit) {
|
||||||
|
fitLayer(importedRecord.layer);
|
||||||
|
}
|
||||||
|
setText("parcelState", `Particella gia presente nei dati importati: ${ref}`);
|
||||||
|
setInfo(`La particella ${ref} e' gia presente in un progetto o file importato: nessun duplicato aggiunto.`);
|
||||||
|
refreshLayerManager();
|
||||||
|
return "imported";
|
||||||
|
}
|
||||||
|
|
||||||
|
feature.properties = {
|
||||||
|
...(feature.properties || {}),
|
||||||
|
_lmeParcelReference: String(ref || label || normalizedParcel),
|
||||||
|
_lmeColor: feature.properties?._lmeColor || "#ef4444",
|
||||||
|
_lmeFillColor: feature.properties?._lmeFillColor || "#fbbf24",
|
||||||
|
_lmeWeight: Number(feature.properties?._lmeWeight) || 4,
|
||||||
|
_lmeOpacity: Number.isFinite(Number(feature.properties?._lmeOpacity)) ? Number(feature.properties._lmeOpacity) : 1,
|
||||||
|
_lmeFillOpacity: Number.isFinite(Number(feature.properties?._lmeFillOpacity)) ? Number(feature.properties._lmeFillOpacity) : 0.26
|
||||||
|
};
|
||||||
const layer = L.geoJSON(feature, {
|
const layer = L.geoJSON(feature, {
|
||||||
pane: normalizedParcel ? "selectedParcelsPane" : "gpsParcelsPane",
|
pane: normalizedParcel ? "selectedParcelsPane" : "gpsParcelsPane",
|
||||||
style: normalizedParcel
|
style: normalizedParcel
|
||||||
@@ -418,6 +458,9 @@ function displayOfficialParcel(xmlText, latitude, longitude, parcel, label, shou
|
|||||||
}).addTo(targetGroup);
|
}).addTo(targetGroup);
|
||||||
layer.lmeParcelReference = ref;
|
layer.lmeParcelReference = ref;
|
||||||
layer.bindPopup(`<strong>${escapeHtml(ref)}</strong>`);
|
layer.bindPopup(`<strong>${escapeHtml(ref)}</strong>`);
|
||||||
|
if (normalizedParcel) {
|
||||||
|
targetGroup.bringToFront();
|
||||||
|
}
|
||||||
if (shouldFit) {
|
if (shouldFit) {
|
||||||
fitLayer(layer);
|
fitLayer(layer);
|
||||||
}
|
}
|
||||||
@@ -429,9 +472,12 @@ function displayOfficialParcel(xmlText, latitude, longitude, parcel, label, shou
|
|||||||
} else {
|
} else {
|
||||||
setText("parcelState", `Dentro particella AdE: ${ref}`);
|
setText("parcelState", `Dentro particella AdE: ${ref}`);
|
||||||
}
|
}
|
||||||
|
updateGpsInsideState();
|
||||||
refreshLayerManager();
|
refreshLayerManager();
|
||||||
|
return normalizedParcel ? "added" : "gps";
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setInfo(`Geometria catastale non leggibile: ${error.message}`);
|
setInfo(`Geometria catastale non leggibile: ${error.message}`);
|
||||||
|
return "error";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,12 +486,13 @@ function normalizeParcel(parcel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findParcelLayerByReference(group, reference) {
|
function findParcelLayerByReference(group, reference) {
|
||||||
|
const expected = normalizeParcelReference(reference);
|
||||||
let match = null;
|
let match = null;
|
||||||
group.eachLayer(layer => {
|
group.eachLayer(layer => {
|
||||||
if (match) {
|
if (match) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (layer.lmeParcelReference === reference) {
|
if (parcelLayerMatchesReference(layer, expected)) {
|
||||||
match = layer;
|
match = layer;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -456,6 +503,74 @@ function findParcelLayerByReference(group, reference) {
|
|||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function restoreHiddenParcelLayerByReference(reference) {
|
||||||
|
const expected = normalizeParcelReference(reference);
|
||||||
|
const entry = [...lmeState.managerHiddenObjects.entries()].find(([, record]) =>
|
||||||
|
record.categoryKey === "selectedParcels" && parcelLayerMatchesReference(record.layer, expected));
|
||||||
|
if (!entry) return null;
|
||||||
|
const [id, record] = entry;
|
||||||
|
lmeState.managerHiddenObjects.delete(id);
|
||||||
|
lmeState.managerHiddenObjectIds.delete(id);
|
||||||
|
lmeState.managerHiddenMeasurementSummaryIds.delete(id);
|
||||||
|
lmeState.managerHiddenMeasurementSideIds.delete(id);
|
||||||
|
record.parent?.addLayer?.(record.layer);
|
||||||
|
return record.layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parcelLayerMatchesReference(layer, normalizedReference) {
|
||||||
|
const properties = layer?.feature?.properties || {};
|
||||||
|
return [
|
||||||
|
layer?.lmeParcelReference,
|
||||||
|
properties._lmeParcelReference,
|
||||||
|
properties.NATIONALCADASTRALREFERENCE,
|
||||||
|
properties.INSPIREID_LOCALID
|
||||||
|
].some(value => normalizeParcelReference(value) === normalizedReference);
|
||||||
|
}
|
||||||
|
|
||||||
|
function findImportedParcelRecord(feature, reference) {
|
||||||
|
const category = layerManagerCategories().find(item => item.key === "imported");
|
||||||
|
if (!category) return null;
|
||||||
|
const normalizedReference = normalizeParcelReference(reference);
|
||||||
|
return managedRecordsForCategory(category).find(record =>
|
||||||
|
parcelLayerMatchesReference(record.layer, normalizedReference)
|
||||||
|
|| parcelGeometriesEquivalent(record.layer?.toGeoJSON?.(), feature)) || null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreManagedRecordVisibility(record) {
|
||||||
|
if (!record) return;
|
||||||
|
lmeState.managerHiddenObjects.delete(record.id);
|
||||||
|
lmeState.managerHiddenObjectIds.delete(record.id);
|
||||||
|
lmeState.managerHiddenMeasurementSummaryIds.delete(record.id);
|
||||||
|
lmeState.managerHiddenMeasurementSideIds.delete(record.id);
|
||||||
|
if (record.parent && !record.parent.hasLayer?.(record.layer)) {
|
||||||
|
record.parent.addLayer?.(record.layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parcelGeometriesEquivalent(candidate, target) {
|
||||||
|
const candidateType = candidate?.geometry?.type;
|
||||||
|
const targetType = target?.geometry?.type;
|
||||||
|
if (!["Polygon", "MultiPolygon"].includes(candidateType)
|
||||||
|
|| !["Polygon", "MultiPolygon"].includes(targetType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const candidateArea = turf.area(candidate);
|
||||||
|
const targetArea = turf.area(target);
|
||||||
|
if (!(candidateArea > 0) || !(targetArea > 0)) return false;
|
||||||
|
const areaRatio = Math.max(candidateArea, targetArea) / Math.min(candidateArea, targetArea);
|
||||||
|
if (areaRatio > 1.03) return false;
|
||||||
|
const overlap = turf.intersect(turf.featureCollection([candidate, target]));
|
||||||
|
return Boolean(overlap) && turf.area(overlap) / Math.min(candidateArea, targetArea) >= 0.985;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeParcelReference(reference) {
|
||||||
|
return String(reference || "").trim().toUpperCase().replace(/\s+/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
function resize() {
|
function resize() {
|
||||||
if (!lmeState.map) {
|
if (!lmeState.map) {
|
||||||
return;
|
return;
|
||||||
@@ -1184,7 +1299,7 @@ function drawingLayerLabel(layer, layerType) {
|
|||||||
function layerManagerCategories() {
|
function layerManagerCategories() {
|
||||||
return [
|
return [
|
||||||
{ key: "gpsPosition", label: "Posizione GPS", roots: [lmeState.gpsMarker, lmeState.gpsAccuracy].filter(Boolean) },
|
{ key: "gpsPosition", label: "Posizione GPS", roots: [lmeState.gpsMarker, lmeState.gpsAccuracy].filter(Boolean) },
|
||||||
{ key: "drawings", label: "Disegni e POI", roots: [lmeState.drawings].filter(Boolean) },
|
{ key: "drawings", label: "Disegni e POI", roots: [lmeState.drawings].filter(Boolean), blocks: true },
|
||||||
{ key: "gpsTrail", label: "Traccia GPS", roots: [lmeState.gpsTrail].filter(Boolean) },
|
{ key: "gpsTrail", label: "Traccia GPS", roots: [lmeState.gpsTrail].filter(Boolean) },
|
||||||
{ key: "gpsParcels", label: "Particella rilevata dal GPS", roots: [lmeState.gpsParcelLayer].filter(Boolean) },
|
{ key: "gpsParcels", label: "Particella rilevata dal GPS", roots: [lmeState.gpsParcelLayer].filter(Boolean) },
|
||||||
{ key: "selectedParcels", label: "Particelle catastali evidenziate", roots: [lmeState.selectedParcelsLayer].filter(Boolean) },
|
{ key: "selectedParcels", label: "Particelle catastali evidenziate", roots: [lmeState.selectedParcelsLayer].filter(Boolean) },
|
||||||
@@ -1382,11 +1497,15 @@ function managedObjectCanRemove(record) {
|
|||||||
return ["drawings", "imported", "importedSheets", "selectedParcels", "gpsParcels"].includes(record.categoryKey);
|
return ["drawings", "imported", "importedSheets", "selectedParcels", "gpsParcels"].includes(record.categoryKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
function layerManagerRowActions(renameButton, removeButton) {
|
function managedCategoryCanMove(categoryKey) {
|
||||||
if (!renameButton && !removeButton) {
|
return ["drawings", "imported", "importedSheets", "selectedParcels"].includes(categoryKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
function layerManagerRowActions(renameButton, moveButton, removeButton) {
|
||||||
|
if (!renameButton && !moveButton && !removeButton) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return `<span class="layer-row-actions">${renameButton}${removeButton}</span>`;
|
return `<span class="layer-row-actions">${renameButton}${moveButton}${removeButton}</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const layerManagerPalettes = [
|
const layerManagerPalettes = [
|
||||||
@@ -1472,9 +1591,92 @@ function removeManagedRecords(records, subject) {
|
|||||||
setInfo(`${records.length === 1 ? "Oggetto rimosso" : `${records.length} oggetti rimossi`} dal progetto.`);
|
setInfo(`${records.length === 1 ? "Oggetto rimosso" : `${records.length} oggetti rimossi`} dal progetto.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveManagedRecordsToCategory(records, targetCategory) {
|
function managedMoveDestinations() {
|
||||||
|
return layerManagerCategories()
|
||||||
|
.filter(category => ["drawings", "imported"].includes(category.key))
|
||||||
|
.map(category => {
|
||||||
|
const records = managedRecordsForCategory(category);
|
||||||
|
const groups = new Map();
|
||||||
|
records.forEach(record => {
|
||||||
|
if (!groups.has(record.source)) {
|
||||||
|
groups.set(record.source, managedBlockName(record.source, [record]));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!groups.size) {
|
||||||
|
groups.set("Progetto corrente", "Gruppo principale");
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
key: category.key,
|
||||||
|
name: managedCategoryName(category, records),
|
||||||
|
groups: [...groups].map(([source, name]) => ({ source, name }))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMoveManagedRecordsDialog(records, subject) {
|
||||||
if (lmeState.readOnly) { setInfo("Il progetto e' in sola lettura."); return; }
|
if (lmeState.readOnly) { setInfo("Il progetto e' in sola lettura."); return; }
|
||||||
const movable = records.filter(record => ["drawings", "imported"].includes(record.categoryKey));
|
if (!records.length || records.some(record => !managedCategoryCanMove(record.categoryKey))) {
|
||||||
|
setInfo("Questo oggetto o gruppo non puo essere spostato.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (records.some(record => record.layer?.feature?.properties?._lmeLocked)) {
|
||||||
|
setInfo("Sblocca prima tutti gli oggetti da spostare.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const destinations = managedMoveDestinations();
|
||||||
|
const categoryOptions = destinations.map(destination =>
|
||||||
|
`<option value="${escapeHtml(destination.key)}">${escapeHtml(destination.name)}</option>`).join("");
|
||||||
|
const dialog = showAppDialog("Sposta nel gruppo", `<form class="lme-edit-form move-group-form"><p>Cambia l'appartenenza di ${escapeHtml(subject)} senza modificarne la posizione sulla mappa.</p><label>Categoria<select name="category">${categoryOptions}</select></label><label>Gruppo esistente<select name="group"></select></label><label>Oppure crea un nuovo gruppo<input name="newGroup" type="text" maxlength="120" placeholder="Nome del nuovo gruppo"></label><div class="dialog-command-row"><button type="button" data-cancel>Annulla</button><button type="submit" class="primary-command">Sposta nel gruppo</button></div></form>`);
|
||||||
|
const form = dialog.querySelector("form");
|
||||||
|
const categorySelect = form.elements.category;
|
||||||
|
const groupSelect = form.elements.group;
|
||||||
|
const newGroupInput = form.elements.newGroup;
|
||||||
|
const sourceCategory = records.every(record => record.categoryKey === records[0].categoryKey)
|
||||||
|
? records[0].categoryKey
|
||||||
|
: "drawings";
|
||||||
|
const currentCategory = destinations.some(destination => destination.key === sourceCategory)
|
||||||
|
? sourceCategory
|
||||||
|
: "imported";
|
||||||
|
categorySelect.value = currentCategory;
|
||||||
|
const refreshGroups = () => {
|
||||||
|
const destination = destinations.find(item => item.key === categorySelect.value);
|
||||||
|
groupSelect.innerHTML = (destination?.groups || []).map(group =>
|
||||||
|
`<option value="${escapeHtml(group.source)}">${escapeHtml(group.name)}</option>`).join("");
|
||||||
|
const currentSource = records.every(record => record.source === records[0].source)
|
||||||
|
? records[0].source
|
||||||
|
: "";
|
||||||
|
if (destination?.key === currentCategory && currentSource
|
||||||
|
&& destination.groups.some(group => group.source === currentSource)) {
|
||||||
|
groupSelect.value = currentSource;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
categorySelect.addEventListener("change", refreshGroups);
|
||||||
|
refreshGroups();
|
||||||
|
dialog.querySelector("[data-cancel]").addEventListener("click", () => dialog.remove());
|
||||||
|
form.addEventListener("submit", event => {
|
||||||
|
event.preventDefault();
|
||||||
|
const destination = destinations.find(item => item.key === categorySelect.value);
|
||||||
|
if (!destination) return;
|
||||||
|
const requestedName = newGroupInput.value.trim().slice(0, 120);
|
||||||
|
const existingByName = requestedName
|
||||||
|
? destination.groups.find(group => group.name.toLocaleLowerCase("it") === requestedName.toLocaleLowerCase("it"))
|
||||||
|
: null;
|
||||||
|
const selectedGroup = destination.groups.find(group => group.source === groupSelect.value);
|
||||||
|
const target = existingByName || (requestedName
|
||||||
|
? { source: `Gruppo ${requestedName}`, name: requestedName }
|
||||||
|
: selectedGroup);
|
||||||
|
if (!target) {
|
||||||
|
setInfo("Scegli un gruppo di destinazione o inserisci il nome di un nuovo gruppo.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dialog.remove();
|
||||||
|
moveManagedRecordsToGroup(records, destination.key, target.source, target.name);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function moveManagedRecordsToGroup(records, targetCategory, targetSource, targetGroupName) {
|
||||||
|
if (lmeState.readOnly) { setInfo("Il progetto e' in sola lettura."); return; }
|
||||||
|
const movable = records.filter(record => managedCategoryCanMove(record.categoryKey));
|
||||||
if (!movable.length || !["drawings", "imported"].includes(targetCategory)) {
|
if (!movable.length || !["drawings", "imported"].includes(targetCategory)) {
|
||||||
setInfo("Questo gruppo non puo essere spostato.");
|
setInfo("Questo gruppo non puo essere spostato.");
|
||||||
return;
|
return;
|
||||||
@@ -1488,8 +1690,10 @@ function moveManagedRecordsToCategory(records, targetCategory) {
|
|||||||
const feature = record.layer.toGeoJSON();
|
const feature = record.layer.toGeoJSON();
|
||||||
feature.properties = {
|
feature.properties = {
|
||||||
...(feature.properties || {}),
|
...(feature.properties || {}),
|
||||||
_lmeSource: feature.properties?._lmeSource || "Progetto corrente"
|
_lmeSource: targetSource,
|
||||||
|
_lmeGroupName: targetGroupName
|
||||||
};
|
};
|
||||||
|
delete feature.properties._lmeManagerId;
|
||||||
return feature;
|
return feature;
|
||||||
});
|
});
|
||||||
movable.forEach(record => {
|
movable.forEach(record => {
|
||||||
@@ -1505,8 +1709,9 @@ function moveManagedRecordsToCategory(records, targetCategory) {
|
|||||||
refreshImportedMeasurements();
|
refreshImportedMeasurements();
|
||||||
refreshDrawingMeasurements();
|
refreshDrawingMeasurements();
|
||||||
refreshLayerManager();
|
refreshLayerManager();
|
||||||
finishMapChange(`Spostati ${features.length} oggetti in ${targetCategory === "drawings" ? "Disegni e POI" : "Progetti e dati importati"}.`);
|
const categoryName = targetCategory === "drawings" ? "Disegni e POI" : "Progetti e dati importati";
|
||||||
setInfo(`${features.length} oggetti spostati in ${targetCategory === "drawings" ? "Disegni e POI" : "Progetti e dati importati"}.`);
|
finishMapChange(`Spostati ${features.length} oggetti in ${categoryName} > ${targetGroupName}.`);
|
||||||
|
setInfo(`${features.length} oggetti spostati in ${categoryName} > ${targetGroupName}.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function managedObjectDetails(layer) {
|
function managedObjectDetails(layer) {
|
||||||
@@ -1614,7 +1819,10 @@ function renderLayerManagerCategory(category, records) {
|
|||||||
const removeButton = managedCategoryCanRemove(category, records)
|
const removeButton = managedCategoryCanRemove(category, records)
|
||||||
? `<button type="button" class="layer-remove-button" aria-label="Rimuovi gruppo dal progetto" title="Rimuovi dal progetto">Rimuovi</button>`
|
? `<button type="button" class="layer-remove-button" aria-label="Rimuovi gruppo dal progetto" title="Rimuovi dal progetto">Rimuovi</button>`
|
||||||
: "";
|
: "";
|
||||||
const rowActions = layerManagerRowActions(renameButton, removeButton);
|
const moveButton = records.length && managedCategoryCanMove(category.key)
|
||||||
|
? `<button type="button" class="layer-membership-button" aria-label="Sposta gruppo in un altro gruppo" title="Sposta nel gruppo">Sposta nel gruppo</button>`
|
||||||
|
: "";
|
||||||
|
const rowActions = layerManagerRowActions(renameButton, moveButton, removeButton);
|
||||||
group.classList.toggle("layer-manager-with-actions", Boolean(rowActions));
|
group.classList.toggle("layer-manager-with-actions", Boolean(rowActions));
|
||||||
const visibleCount = records.filter(record => !lmeState.managerHiddenObjectIds.has(record.id)).length;
|
const visibleCount = records.filter(record => !lmeState.managerHiddenObjectIds.has(record.id)).length;
|
||||||
const categoryVisible = !lmeState.managerHiddenCategories.has(category.key)
|
const categoryVisible = !lmeState.managerHiddenCategories.has(category.key)
|
||||||
@@ -1641,6 +1849,11 @@ function renderLayerManagerCategory(category, records) {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
removeManagedRecords(records, `il gruppo '${categoryName}'`);
|
removeManagedRecords(records, `il gruppo '${categoryName}'`);
|
||||||
});
|
});
|
||||||
|
group.querySelector(".layer-membership-button")?.addEventListener("click", event => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
showMoveManagedRecordsDialog(records, `il gruppo '${categoryName}'`);
|
||||||
|
});
|
||||||
bindManagedParentHighlight(group, `category:${category.key}`, records);
|
bindManagedParentHighlight(group, `category:${category.key}`, records);
|
||||||
const children = group.querySelector(".layer-manager-children");
|
const children = group.querySelector(".layer-manager-children");
|
||||||
if (records.length) children.appendChild(renderManagedGroupTools(records));
|
if (records.length) children.appendChild(renderManagedGroupTools(records));
|
||||||
@@ -1674,6 +1887,7 @@ function renderLayerManagerBlock(category, source, records) {
|
|||||||
const blockName = managedBlockName(source, records);
|
const blockName = managedBlockName(source, records);
|
||||||
const rowActions = layerManagerRowActions(
|
const rowActions = layerManagerRowActions(
|
||||||
`<button type="button" class="layer-rename-button" aria-label="Rinomina gruppo" title="Rinomina">Rinomina</button>`,
|
`<button type="button" class="layer-rename-button" aria-label="Rinomina gruppo" title="Rinomina">Rinomina</button>`,
|
||||||
|
`<button type="button" class="layer-membership-button" aria-label="Sposta gruppo in un altro gruppo" title="Sposta nel gruppo">Sposta nel gruppo</button>`,
|
||||||
`<button type="button" class="layer-remove-button" aria-label="Rimuovi gruppo dal progetto" title="Rimuovi dal progetto">Rimuovi</button>`);
|
`<button type="button" class="layer-remove-button" aria-label="Rimuovi gruppo dal progetto" title="Rimuovi dal progetto">Rimuovi</button>`);
|
||||||
block.classList.add("layer-manager-with-actions");
|
block.classList.add("layer-manager-with-actions");
|
||||||
const blockLocked = records.length > 0 && records.every(record => Boolean(record.layer?.feature?.properties?._lmeLocked));
|
const blockLocked = records.length > 0 && records.every(record => Boolean(record.layer?.feature?.properties?._lmeLocked));
|
||||||
@@ -1700,6 +1914,11 @@ function renderLayerManagerBlock(category, source, records) {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
removeManagedRecords(records, `il gruppo '${blockName}'`);
|
removeManagedRecords(records, `il gruppo '${blockName}'`);
|
||||||
});
|
});
|
||||||
|
block.querySelector(".layer-membership-button").addEventListener("click", event => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
showMoveManagedRecordsDialog(records, `il gruppo '${blockName}'`);
|
||||||
|
});
|
||||||
bindManagedParentHighlight(block, `block:${category.key}:${source}`, records);
|
bindManagedParentHighlight(block, `block:${category.key}:${source}`, records);
|
||||||
const children = block.querySelector(".layer-manager-children");
|
const children = block.querySelector(".layer-manager-children");
|
||||||
children.appendChild(renderManagedGroupTools(records));
|
children.appendChild(renderManagedGroupTools(records));
|
||||||
@@ -1724,7 +1943,10 @@ function renderLayerManagerObject(record, index) {
|
|||||||
const removeButton = managedObjectCanRemove(record)
|
const removeButton = managedObjectCanRemove(record)
|
||||||
? `<button type="button" class="layer-remove-button" aria-label="Rimuovi oggetto dal progetto" title="Rimuovi dal progetto">Rimuovi</button>`
|
? `<button type="button" class="layer-remove-button" aria-label="Rimuovi oggetto dal progetto" title="Rimuovi dal progetto">Rimuovi</button>`
|
||||||
: "";
|
: "";
|
||||||
const rowActions = layerManagerRowActions(renameButton, removeButton);
|
const moveButton = managedCategoryCanMove(record.categoryKey)
|
||||||
|
? `<button type="button" class="layer-membership-button" aria-label="Sposta oggetto in un altro gruppo" title="Sposta nel gruppo">Sposta nel gruppo</button>`
|
||||||
|
: "";
|
||||||
|
const rowActions = layerManagerRowActions(renameButton, moveButton, removeButton);
|
||||||
object.classList.toggle("layer-manager-with-actions", Boolean(rowActions));
|
object.classList.toggle("layer-manager-with-actions", Boolean(rowActions));
|
||||||
const objectName = managedObjectLabel(record, index);
|
const objectName = managedObjectLabel(record, index);
|
||||||
const locked = Boolean(record.layer?.feature?.properties?._lmeLocked);
|
const locked = Boolean(record.layer?.feature?.properties?._lmeLocked);
|
||||||
@@ -1743,6 +1965,11 @@ function renderLayerManagerObject(record, index) {
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
removeManagedRecords([record], `'${objectName}'`);
|
removeManagedRecords([record], `'${objectName}'`);
|
||||||
});
|
});
|
||||||
|
object.querySelector(".layer-membership-button")?.addEventListener("click", event => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
showMoveManagedRecordsDialog([record], `'${objectName}'`);
|
||||||
|
});
|
||||||
object.querySelector(".layer-inline-lock")?.addEventListener("click", event => {
|
object.querySelector(".layer-inline-lock")?.addEventListener("click", event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
@@ -1786,7 +2013,7 @@ function renderLayerSelectionToolbar() {
|
|||||||
toolbar.innerHTML = `<label>Cerca oggetti<input type="search" value="${escapeHtml(lmeState.managerSearchText)}" placeholder="Nome o gruppo"></label>
|
toolbar.innerHTML = `<label>Cerca oggetti<input type="search" value="${escapeHtml(lmeState.managerSearchText)}" placeholder="Nome o gruppo"></label>
|
||||||
<div class="layer-selection-summary"><strong>${selectedCount} selezionati</strong><button type="button" data-action="clear">Deseleziona</button></div>
|
<div class="layer-selection-summary"><strong>${selectedCount} selezionati</strong><button type="button" data-action="clear">Deseleziona</button></div>
|
||||||
<div class="layer-batch-actions">
|
<div class="layer-batch-actions">
|
||||||
<button type="button" data-action="duplicate">Duplica</button><button type="button" data-action="move">Sposta</button>
|
<button type="button" data-action="duplicate">Duplica</button><button type="button" data-action="move">Sposta geometria</button>
|
||||||
<button type="button" data-action="buffer">Buffer</button><button type="button" data-action="union">Unisci</button>
|
<button type="button" data-action="buffer">Buffer</button><button type="button" data-action="union">Unisci</button>
|
||||||
<button type="button" data-action="split">Dividi</button><button type="button" data-action="delete" class="danger-command">Rimuovi</button>
|
<button type="button" data-action="split">Dividi</button><button type="button" data-action="delete" class="danger-command">Rimuovi</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
@@ -1817,22 +2044,26 @@ function renderLayerSelectionToolbar() {
|
|||||||
function renderManagedGroupTools(records) {
|
function renderManagedGroupTools(records) {
|
||||||
const tools = document.createElement("div");
|
const tools = document.createElement("div");
|
||||||
tools.className = "layer-group-tools";
|
tools.className = "layer-group-tools";
|
||||||
const properties = records[0]?.layer?.feature?.properties || {};
|
const firstLayer = records[0]?.layer;
|
||||||
const sourceCategory = records[0]?.categoryKey;
|
const properties = firstLayer?.feature?.properties || {};
|
||||||
const membershipAction = sourceCategory === "drawings"
|
const lineColor = normalizedColor(properties._lmeColor || firstLayer?.options?.color, "#16806a");
|
||||||
? `<button type="button" data-group-action="membership">Sposta in Progetti e dati importati</button>`
|
const fillColor = normalizedColor(properties._lmeFillColor || firstLayer?.options?.fillColor, lineColor);
|
||||||
: sourceCategory === "imported"
|
|
||||||
? `<button type="button" data-group-action="membership">Sposta in Disegni e POI</button>`
|
|
||||||
: "";
|
|
||||||
tools.innerHTML = `<strong>Azioni gruppo</strong><span class="layer-group-totals">${escapeHtml(managedGroupTotals(records))}</span><div class="layer-style-controls">
|
tools.innerHTML = `<strong>Azioni gruppo</strong><span class="layer-group-totals">${escapeHtml(managedGroupTotals(records))}</span><div class="layer-style-controls">
|
||||||
<label>Colore<input type="color" value="${normalizedColor(properties._lmeColor, "#16806a")}"></label>
|
${managedColorEditorMarkup("color", "Colore linea", lineColor)}
|
||||||
<label>Spessore<input type="range" min="1" max="10" step="1" value="${Number(properties._lmeWeight) || 3}"></label>
|
${managedColorEditorMarkup("fillColor", "Colore riempimento", fillColor)}
|
||||||
<label>Opacita<input type="range" min="0.1" max="1" step="0.1" value="${Number(properties._lmeOpacity) || 1}"></label></div>
|
<label>Spessore<input type="range" data-field="weight" min="1" max="10" step="1" value="${Number(properties._lmeWeight) || Number(firstLayer?.options?.weight) || 3}"></label>
|
||||||
<div class="layer-compact-actions"><button type="button" data-group-action="select">Seleziona tutti</button><button type="button" data-group-action="lock">Blocca/sblocca</button><button type="button" data-group-action="labels">Etichette</button>${membershipAction}</div>`;
|
<label>Opacita<input type="range" data-field="opacity" min="0.1" max="1" step="0.1" value="${Number.isFinite(Number(properties._lmeOpacity)) ? Number(properties._lmeOpacity) : Number(firstLayer?.options?.opacity) || 1}"></label></div>
|
||||||
const inputs = tools.querySelectorAll("input");
|
<div class="layer-compact-actions"><button type="button" data-group-action="select">Seleziona tutti</button><button type="button" data-group-action="lock">Blocca/sblocca</button><button type="button" data-group-action="labels">Etichette</button></div>`;
|
||||||
inputs.forEach(input => input.addEventListener("change", () => {
|
const applyCurrentStyle = () => {
|
||||||
applyManagedStyle(records, { color: inputs[0].value, weight: Number(inputs[1].value), opacity: Number(inputs[2].value) });
|
applyManagedStyle(records, {
|
||||||
}));
|
color: tools.querySelector("[data-color-picker='color']").value,
|
||||||
|
fillColor: tools.querySelector("[data-color-picker='fillColor']").value,
|
||||||
|
weight: Number(tools.querySelector("[data-field='weight']").value),
|
||||||
|
opacity: Number(tools.querySelector("[data-field='opacity']").value)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
bindManagedColorEditors(tools, applyCurrentStyle);
|
||||||
|
tools.querySelectorAll("input[type='range']").forEach(input => input.addEventListener("change", applyCurrentStyle));
|
||||||
tools.querySelector("[data-group-action='select']").addEventListener("click", () => {
|
tools.querySelector("[data-group-action='select']").addEventListener("click", () => {
|
||||||
records.forEach(record => lmeState.managerSelectedObjectIds.add(record.id)); refreshLayerManager();
|
records.forEach(record => lmeState.managerSelectedObjectIds.add(record.id)); refreshLayerManager();
|
||||||
});
|
});
|
||||||
@@ -1845,8 +2076,6 @@ function renderManagedGroupTools(records) {
|
|||||||
const visible = !records.every(record => Boolean(record.layer?.feature?.properties?._lmeLabelVisible));
|
const visible = !records.every(record => Boolean(record.layer?.feature?.properties?._lmeLabelVisible));
|
||||||
updateManagedProperties(records, properties => { properties._lmeLabelVisible = visible; });
|
updateManagedProperties(records, properties => { properties._lmeLabelVisible = visible; });
|
||||||
});
|
});
|
||||||
tools.querySelector("[data-group-action='membership']")?.addEventListener("click", () =>
|
|
||||||
moveManagedRecordsToCategory(records, sourceCategory === "drawings" ? "imported" : "drawings"));
|
|
||||||
return tools;
|
return tools;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1869,18 +2098,15 @@ function renderManagedObjectTools(record) {
|
|||||||
const properties = record.layer.feature?.properties || (record.layer.feature = { type: "Feature", properties: {} }).properties;
|
const properties = record.layer.feature?.properties || (record.layer.feature = { type: "Feature", properties: {} }).properties;
|
||||||
const selected = lmeState.managerSelectedObjectIds.has(record.id);
|
const selected = lmeState.managerSelectedObjectIds.has(record.id);
|
||||||
const locked = Boolean(properties._lmeLocked);
|
const locked = Boolean(properties._lmeLocked);
|
||||||
const membershipAction = record.categoryKey === "drawings"
|
|
||||||
? `<button type="button" data-action="membership">Sposta in Progetti e dati importati</button>`
|
|
||||||
: record.categoryKey === "imported"
|
|
||||||
? `<button type="button" data-action="membership">Sposta in Disegni e POI</button>`
|
|
||||||
: "";
|
|
||||||
const tools = document.createElement("section");
|
const tools = document.createElement("section");
|
||||||
tools.className = "layer-object-tools";
|
tools.className = "layer-object-tools";
|
||||||
|
const lineColor = normalizedColor(properties._lmeColor || record.layer?.options?.color, "#f97316");
|
||||||
|
const fillColor = normalizedColor(properties._lmeFillColor || record.layer?.options?.fillColor, lineColor);
|
||||||
tools.innerHTML = `<label class="layer-manager-suboption"><input type="checkbox" data-field="selected" ${selected ? "checked" : ""}><span>Seleziona per azioni multiple</span></label>
|
tools.innerHTML = `<label class="layer-manager-suboption"><input type="checkbox" data-field="selected" ${selected ? "checked" : ""}><span>Seleziona per azioni multiple</span></label>
|
||||||
<label class="layer-manager-suboption"><input type="checkbox" data-field="locked" ${locked ? "checked" : ""}><span>Blocca modifiche e rimozione</span></label>
|
<label class="layer-manager-suboption"><input type="checkbox" data-field="locked" ${locked ? "checked" : ""}><span>Blocca modifiche e rimozione</span></label>
|
||||||
<label class="layer-manager-suboption"><input type="checkbox" data-field="label" ${properties._lmeLabelVisible ? "checked" : ""}><span>Etichetta permanente sulla mappa</span></label>
|
<label class="layer-manager-suboption"><input type="checkbox" data-field="label" ${properties._lmeLabelVisible ? "checked" : ""}><span>Etichetta permanente sulla mappa</span></label>
|
||||||
<div class="layer-style-controls"><label>Linea<input type="color" data-field="color" value="${normalizedColor(properties._lmeColor, "#f97316")}"></label>
|
<div class="layer-style-controls">${managedColorEditorMarkup("color", "Colore linea", lineColor)}
|
||||||
<label>Riempimento<input type="color" data-field="fillColor" value="${normalizedColor(properties._lmeFillColor, "#fb923c")}"></label>
|
${managedColorEditorMarkup("fillColor", "Colore riempimento", fillColor)}
|
||||||
<label>Spessore<input type="range" data-field="weight" min="1" max="10" step="1" value="${Number(properties._lmeWeight) || 3}"></label>
|
<label>Spessore<input type="range" data-field="weight" min="1" max="10" step="1" value="${Number(properties._lmeWeight) || 3}"></label>
|
||||||
<label>Opacita<input type="range" data-field="opacity" min="0.1" max="1" step="0.1" value="${Number(properties._lmeOpacity) || 1}"></label>
|
<label>Opacita<input type="range" data-field="opacity" min="0.1" max="1" step="0.1" value="${Number(properties._lmeOpacity) || 1}"></label>
|
||||||
<label>Riempimento %<input type="range" data-field="fillOpacity" min="0" max="0.8" step="0.05" value="${Number.isFinite(Number(properties._lmeFillOpacity)) ? Number(properties._lmeFillOpacity) : 0.2}"></label>
|
<label>Riempimento %<input type="range" data-field="fillOpacity" min="0" max="0.8" step="0.05" value="${Number.isFinite(Number(properties._lmeFillOpacity)) ? Number(properties._lmeFillOpacity) : 0.2}"></label>
|
||||||
@@ -1888,7 +2114,7 @@ function renderManagedObjectTools(record) {
|
|||||||
<label>Note<textarea data-field="notes" rows="2" maxlength="1000" placeholder="Note tecniche">${escapeHtml(properties._lmeNotes || "")}</textarea></label>
|
<label>Note<textarea data-field="notes" rows="2" maxlength="1000" placeholder="Note tecniche">${escapeHtml(properties._lmeNotes || "")}</textarea></label>
|
||||||
<label class="layer-photo-picker">Foto<input type="file" data-field="photo" accept="image/*"></label>
|
<label class="layer-photo-picker">Foto<input type="file" data-field="photo" accept="image/*"></label>
|
||||||
${properties._lmePhoto ? `<img class="layer-photo-preview" src="${properties._lmePhoto}" alt="Foto allegata"><button type="button" data-action="remove-photo">Rimuovi foto</button>` : ""}
|
${properties._lmePhoto ? `<img class="layer-photo-preview" src="${properties._lmePhoto}" alt="Foto allegata"><button type="button" data-action="remove-photo">Rimuovi foto</button>` : ""}
|
||||||
<div class="layer-compact-actions"><button type="button" data-action="attributes">Attributi</button><button type="button" data-action="duplicate">Duplica</button><button type="button" data-action="numeric">Coordinate</button><button type="button" data-action="inspect">WGS84 / UTM</button><button type="button" data-action="move">Sposta geometria</button><button type="button" data-action="buffer">Buffer</button>${membershipAction}</div>`;
|
<div class="layer-compact-actions"><button type="button" data-action="attributes">Attributi</button><button type="button" data-action="duplicate">Duplica</button><button type="button" data-action="numeric">Coordinate</button><button type="button" data-action="inspect">WGS84 / UTM</button><button type="button" data-action="move">Sposta geometria</button><button type="button" data-action="buffer">Buffer</button></div>`;
|
||||||
tools.querySelector("[data-field='selected']").addEventListener("change", event => {
|
tools.querySelector("[data-field='selected']").addEventListener("change", event => {
|
||||||
if (event.target.checked) lmeState.managerSelectedObjectIds.add(record.id);
|
if (event.target.checked) lmeState.managerSelectedObjectIds.add(record.id);
|
||||||
else lmeState.managerSelectedObjectIds.delete(record.id);
|
else lmeState.managerSelectedObjectIds.delete(record.id);
|
||||||
@@ -1896,14 +2122,16 @@ function renderManagedObjectTools(record) {
|
|||||||
});
|
});
|
||||||
tools.querySelector("[data-field='locked']").addEventListener("change", event => updateManagedProperties([record], value => { value._lmeLocked = event.target.checked; }));
|
tools.querySelector("[data-field='locked']").addEventListener("change", event => updateManagedProperties([record], value => { value._lmeLocked = event.target.checked; }));
|
||||||
tools.querySelector("[data-field='label']").addEventListener("change", event => updateManagedProperties([record], value => { value._lmeLabelVisible = event.target.checked; }));
|
tools.querySelector("[data-field='label']").addEventListener("change", event => updateManagedProperties([record], value => { value._lmeLabelVisible = event.target.checked; }));
|
||||||
tools.querySelectorAll(".layer-style-controls input,.layer-style-controls select").forEach(input => input.addEventListener("change", () => applyManagedStyle([record], {
|
const applyCurrentStyle = () => applyManagedStyle([record], {
|
||||||
color: tools.querySelector("[data-field='color']").value,
|
color: tools.querySelector("[data-color-picker='color']").value,
|
||||||
fillColor: tools.querySelector("[data-field='fillColor']").value,
|
fillColor: tools.querySelector("[data-color-picker='fillColor']").value,
|
||||||
weight: Number(tools.querySelector("[data-field='weight']").value),
|
weight: Number(tools.querySelector("[data-field='weight']").value),
|
||||||
opacity: Number(tools.querySelector("[data-field='opacity']").value),
|
opacity: Number(tools.querySelector("[data-field='opacity']").value),
|
||||||
fillOpacity: Number(tools.querySelector("[data-field='fillOpacity']").value),
|
fillOpacity: Number(tools.querySelector("[data-field='fillOpacity']").value),
|
||||||
dash: tools.querySelector("[data-field='dash']").value
|
dash: tools.querySelector("[data-field='dash']").value
|
||||||
})));
|
});
|
||||||
|
bindManagedColorEditors(tools, applyCurrentStyle);
|
||||||
|
tools.querySelectorAll(".layer-style-controls input[type='range'],.layer-style-controls select").forEach(input => input.addEventListener("change", applyCurrentStyle));
|
||||||
tools.querySelector("[data-field='notes']").addEventListener("change", event => updateManagedProperties([record], value => { value._lmeNotes = event.target.value.trim(); }));
|
tools.querySelector("[data-field='notes']").addEventListener("change", event => updateManagedProperties([record], value => { value._lmeNotes = event.target.value.trim(); }));
|
||||||
tools.querySelector("[data-field='photo']").addEventListener("change", async event => {
|
tools.querySelector("[data-field='photo']").addEventListener("change", async event => {
|
||||||
const file = event.target.files?.[0]; if (!file) return;
|
const file = event.target.files?.[0]; if (!file) return;
|
||||||
@@ -1918,8 +2146,6 @@ function renderManagedObjectTools(record) {
|
|||||||
tools.querySelector("[data-action='inspect']").addEventListener("click", () => showCoordinateInspectorForRecord(record));
|
tools.querySelector("[data-action='inspect']").addEventListener("click", () => showCoordinateInspectorForRecord(record));
|
||||||
tools.querySelector("[data-action='move']").addEventListener("click", () => moveManagedRecords([record]));
|
tools.querySelector("[data-action='move']").addEventListener("click", () => moveManagedRecords([record]));
|
||||||
tools.querySelector("[data-action='buffer']").addEventListener("click", () => bufferManagedRecords([record]));
|
tools.querySelector("[data-action='buffer']").addEventListener("click", () => bufferManagedRecords([record]));
|
||||||
tools.querySelector("[data-action='membership']")?.addEventListener("click", () =>
|
|
||||||
moveManagedRecordsToCategory([record], record.categoryKey === "drawings" ? "imported" : "drawings"));
|
|
||||||
return tools;
|
return tools;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1927,13 +2153,150 @@ function normalizedColor(value, fallback) {
|
|||||||
return /^#[0-9a-f]{6}$/i.test(String(value || "")) ? value : fallback;
|
return /^#[0-9a-f]{6}$/i.test(String(value || "")) ? value : fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function managedColorEditorMarkup(field, label, color) {
|
||||||
|
const formats = managedColorFormats(color);
|
||||||
|
return `<section class="layer-color-editor" data-color-editor="${field}">
|
||||||
|
<header><strong>${escapeHtml(label)}</strong><input type="color" data-color-picker="${field}" value="${formats.hex}" aria-label="Seleziona ${escapeHtml(label.toLocaleLowerCase("it"))}"><button type="button" data-color-eyedropper title="Preleva un colore dallo schermo">Preleva</button></header>
|
||||||
|
<div class="layer-color-formats">
|
||||||
|
<label>HEX<input type="text" data-color-format="hex" value="${formats.hex}" maxlength="7" spellcheck="false"></label>
|
||||||
|
<label>RGB<input type="text" data-color-format="rgb" value="${formats.rgb}" spellcheck="false"></label>
|
||||||
|
<label>HSL<input type="text" data-color-format="hsl" value="${formats.hsl}" spellcheck="false"></label>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="layer-color-copy" data-color-copy>Copia HEX</button>
|
||||||
|
</section>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindManagedColorEditors(container, onChanged) {
|
||||||
|
container.querySelectorAll("[data-color-editor]").forEach(editor => {
|
||||||
|
const picker = editor.querySelector("[data-color-picker]");
|
||||||
|
const formatInputs = [...editor.querySelectorAll("[data-color-format]")];
|
||||||
|
const sync = (color, notify) => {
|
||||||
|
const formats = managedColorFormats(color);
|
||||||
|
picker.value = formats.hex;
|
||||||
|
formatInputs.forEach(input => { input.value = formats[input.dataset.colorFormat]; });
|
||||||
|
if (notify) onChanged();
|
||||||
|
};
|
||||||
|
picker.addEventListener("change", () => sync(picker.value, true));
|
||||||
|
formatInputs.forEach(input => input.addEventListener("change", () => {
|
||||||
|
const parsed = parseManagedColor(input.value);
|
||||||
|
if (!parsed) {
|
||||||
|
sync(picker.value, false);
|
||||||
|
setInfo("Colore non valido. Usa HEX, rgb(r, g, b) oppure hsl(h, s%, l%).");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sync(parsed, true);
|
||||||
|
}));
|
||||||
|
const eyedropper = editor.querySelector("[data-color-eyedropper]");
|
||||||
|
if (typeof window.EyeDropper !== "function") {
|
||||||
|
eyedropper.hidden = true;
|
||||||
|
} else {
|
||||||
|
eyedropper.addEventListener("click", async () => {
|
||||||
|
try {
|
||||||
|
const result = await new window.EyeDropper().open();
|
||||||
|
if (result?.sRGBHex) sync(result.sRGBHex, true);
|
||||||
|
} catch (error) {
|
||||||
|
if (error?.name !== "AbortError") setInfo("Contagocce non disponibile su questo dispositivo.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
editor.querySelector("[data-color-copy]").addEventListener("click", async () => {
|
||||||
|
const value = picker.value.toUpperCase();
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(value);
|
||||||
|
setInfo(`Colore ${value} copiato. Puoi incollarlo nel campo HEX di un altro oggetto.`);
|
||||||
|
} catch {
|
||||||
|
const hexInput = editor.querySelector("[data-color-format='hex']");
|
||||||
|
hexInput.focus();
|
||||||
|
hexInput.select();
|
||||||
|
setInfo(`Selezionato ${value}: usa il comando Copia del dispositivo.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseManagedColor(value) {
|
||||||
|
const text = String(value || "").trim();
|
||||||
|
const shortHex = text.match(/^#([0-9a-f]{3})$/i);
|
||||||
|
if (shortHex) return `#${[...shortHex[1]].map(part => part + part).join("")}`.toUpperCase();
|
||||||
|
if (/^#[0-9a-f]{6}$/i.test(text)) return text.toUpperCase();
|
||||||
|
const rgb = text.match(/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})(?:\s*[,/]\s*[\d.]+)?\s*\)$/i);
|
||||||
|
if (rgb) {
|
||||||
|
const values = rgb.slice(1, 4).map(Number);
|
||||||
|
if (values.every(channel => channel >= 0 && channel <= 255)) return managedRgbToHex(...values);
|
||||||
|
}
|
||||||
|
const hsl = text.match(/^hsla?\(\s*(-?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%(?:\s*[,/]\s*[\d.]+)?\s*\)$/i);
|
||||||
|
if (hsl) {
|
||||||
|
const saturation = Number(hsl[2]); const lightness = Number(hsl[3]);
|
||||||
|
if (saturation >= 0 && saturation <= 100 && lightness >= 0 && lightness <= 100) {
|
||||||
|
return managedRgbToHex(...managedHslToRgb(Number(hsl[1]), saturation, lightness));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function managedColorFormats(color) {
|
||||||
|
const hex = normalizedColor(color, "#000000").toUpperCase();
|
||||||
|
const [red, green, blue] = [1, 3, 5].map(index => parseInt(hex.slice(index, index + 2), 16));
|
||||||
|
const redUnit = red / 255; const greenUnit = green / 255; const blueUnit = blue / 255;
|
||||||
|
const max = Math.max(redUnit, greenUnit, blueUnit); const min = Math.min(redUnit, greenUnit, blueUnit);
|
||||||
|
const lightness = (max + min) / 2; const delta = max - min;
|
||||||
|
let hue = 0; let saturation = 0;
|
||||||
|
if (delta) {
|
||||||
|
saturation = delta / (1 - Math.abs(2 * lightness - 1));
|
||||||
|
if (max === redUnit) hue = 60 * (((greenUnit - blueUnit) / delta) % 6);
|
||||||
|
else if (max === greenUnit) hue = 60 * ((blueUnit - redUnit) / delta + 2);
|
||||||
|
else hue = 60 * ((redUnit - greenUnit) / delta + 4);
|
||||||
|
}
|
||||||
|
if (hue < 0) hue += 360;
|
||||||
|
return {
|
||||||
|
hex,
|
||||||
|
rgb: `rgb(${red}, ${green}, ${blue})`,
|
||||||
|
hsl: `hsl(${managedColorDecimal(hue)}, ${managedColorDecimal(saturation * 100)}%, ${managedColorDecimal(lightness * 100)}%)`
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function managedColorDecimal(value) {
|
||||||
|
return String(Number(value.toFixed(2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function managedRgbToHex(red, green, blue) {
|
||||||
|
return `#${[red, green, blue].map(channel => Math.round(channel).toString(16).padStart(2, "0")).join("")}`.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
function managedHslToRgb(hue, saturation, lightness) {
|
||||||
|
const normalizedHue = ((hue % 360) + 360) % 360;
|
||||||
|
const saturationUnit = saturation / 100; const lightnessUnit = lightness / 100;
|
||||||
|
const chroma = (1 - Math.abs(2 * lightnessUnit - 1)) * saturationUnit;
|
||||||
|
const section = normalizedHue / 60; const intermediate = chroma * (1 - Math.abs(section % 2 - 1));
|
||||||
|
const values = section < 1 ? [chroma, intermediate, 0]
|
||||||
|
: section < 2 ? [intermediate, chroma, 0]
|
||||||
|
: section < 3 ? [0, chroma, intermediate]
|
||||||
|
: section < 4 ? [0, intermediate, chroma]
|
||||||
|
: section < 5 ? [intermediate, 0, chroma]
|
||||||
|
: [chroma, 0, intermediate];
|
||||||
|
const offset = lightnessUnit - chroma / 2;
|
||||||
|
return values.map(channel => Math.round((channel + offset) * 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
function editableManagedMetadataEntries(record) {
|
||||||
|
const properties = record?.layer?.feature?.properties || {};
|
||||||
|
const reserved = new Set(["name", "Name", "label", "LABEL"]);
|
||||||
|
return Object.entries(properties)
|
||||||
|
.filter(([key, value]) => !key.startsWith("_lme") && !reserved.has(key) && ["string", "number", "boolean"].includes(typeof value));
|
||||||
|
}
|
||||||
|
|
||||||
function editManagedAttributes(record) {
|
function editManagedAttributes(record) {
|
||||||
if (lmeState.readOnly) { setInfo("Il progetto e' in sola lettura."); return; }
|
if (lmeState.readOnly) { setInfo("Il progetto e' in sola lettura."); return; }
|
||||||
const properties = record.layer?.feature?.properties || {};
|
|
||||||
const reserved = new Set(["name", "Name", "label", "LABEL"]);
|
const reserved = new Set(["name", "Name", "label", "LABEL"]);
|
||||||
const entries = Object.entries(properties)
|
const entries = editableManagedMetadataEntries(record);
|
||||||
.filter(([key, value]) => !key.startsWith("_lme") && !reserved.has(key) && ["string", "number", "boolean"].includes(typeof value));
|
const sourceRecords = layerManagerCategories()
|
||||||
const dialog = showAppDialog("Attributi oggetto", `<div class="attribute-editor"><p>Ogni attributo viene salvato nel progetto e negli export GeoJSON, KML e KMZ.</p><div class="attribute-editor-rows"></div><button type="button" data-add-attribute>+ Aggiungi attributo</button><div class="dialog-command-row"><button type="button" data-cancel>Annulla</button><button type="button" class="primary-command" data-save-attributes>Salva attributi</button></div></div>`);
|
.flatMap(category => managedRecordsForCategory(category))
|
||||||
|
.filter(item => item.id !== record.id);
|
||||||
|
const sourceOptions = sourceRecords.map((item, index) =>
|
||||||
|
`<option value="${escapeHtml(item.id)}">${escapeHtml(managedObjectLabel(item, index))} - ${escapeHtml(item.source)}</option>`).join("");
|
||||||
|
const dialog = showAppDialog("Metadati oggetto", `<div class="attribute-editor"><p>Ogni metadato viene salvato nel progetto e negli export GeoJSON, KML e KMZ.</p>
|
||||||
|
<section class="attribute-copy-panel"><strong>Copia da un altro oggetto</strong><label>Oggetto sorgente<select data-copy-source ${sourceRecords.length ? "" : "disabled"}><option value="">Seleziona un oggetto</option>${sourceOptions}</select></label><label class="toggle-line"><input type="checkbox" data-copy-values checked><span>Importa anche i valori</span></label><small>Disattiva il flag per importare soltanto i nomi dei metadati con valore vuoto.</small><button type="button" data-copy-attributes ${sourceRecords.length ? "" : "disabled"}>Copia da</button></section>
|
||||||
|
<div class="attribute-editor-rows"></div><button type="button" data-add-attribute>+ Aggiungi metadato</button><div class="dialog-command-row"><button type="button" data-cancel>Annulla</button><button type="button" class="primary-command" data-save-attributes>Salva metadati</button></div></div>`);
|
||||||
const rows = dialog.querySelector(".attribute-editor-rows");
|
const rows = dialog.querySelector(".attribute-editor-rows");
|
||||||
const addRow = (key = "", value = "") => {
|
const addRow = (key = "", value = "") => {
|
||||||
const row = document.createElement("div");
|
const row = document.createElement("div");
|
||||||
@@ -1944,6 +2307,25 @@ function editManagedAttributes(record) {
|
|||||||
};
|
};
|
||||||
entries.forEach(([key, value]) => addRow(key, value));
|
entries.forEach(([key, value]) => addRow(key, value));
|
||||||
if (!entries.length) addRow();
|
if (!entries.length) addRow();
|
||||||
|
const sourceById = new Map(sourceRecords.map(item => [item.id, item]));
|
||||||
|
dialog.querySelector("[data-copy-attributes]")?.addEventListener("click", () => {
|
||||||
|
const source = sourceById.get(dialog.querySelector("[data-copy-source]").value);
|
||||||
|
if (!source) { setInfo("Seleziona l'oggetto da cui copiare i metadati."); return; }
|
||||||
|
const includeValues = dialog.querySelector("[data-copy-values]").checked;
|
||||||
|
const existingRows = new Map([...rows.querySelectorAll(".attribute-editor-row")]
|
||||||
|
.map(row => [row.querySelector("input").value.trim().toLocaleLowerCase("it"), row])
|
||||||
|
.filter(([key]) => key));
|
||||||
|
const sourceEntries = editableManagedMetadataEntries(source);
|
||||||
|
sourceEntries.forEach(([key, value]) => {
|
||||||
|
const existing = existingRows.get(key.toLocaleLowerCase("it"));
|
||||||
|
if (existing) {
|
||||||
|
if (includeValues) existing.querySelector("textarea").value = String(value);
|
||||||
|
} else {
|
||||||
|
addRow(key, includeValues ? value : "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setInfo(`${sourceEntries.length} metadati copiati${includeValues ? " con i valori" : " senza valori"}.`);
|
||||||
|
});
|
||||||
dialog.querySelector("[data-add-attribute]").addEventListener("click", () => addRow());
|
dialog.querySelector("[data-add-attribute]").addEventListener("click", () => addRow());
|
||||||
dialog.querySelector("[data-cancel]").addEventListener("click", () => dialog.remove());
|
dialog.querySelector("[data-cancel]").addEventListener("click", () => dialog.remove());
|
||||||
dialog.querySelector("[data-save-attributes]").addEventListener("click", () => {
|
dialog.querySelector("[data-save-attributes]").addEventListener("click", () => {
|
||||||
@@ -2049,6 +2431,16 @@ function showFormDialog(title, fields, submitLabel = "Salva") {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function promptProjectName(currentName) {
|
||||||
|
const result = await showFormDialog("Rinomina progetto", [{
|
||||||
|
name: "name",
|
||||||
|
label: "Nuovo nome",
|
||||||
|
value: currentName || "",
|
||||||
|
maxLength: 80
|
||||||
|
}], "Rinomina");
|
||||||
|
return result?.name?.trim() || null;
|
||||||
|
}
|
||||||
|
|
||||||
function showObjectTable() {
|
function showObjectTable() {
|
||||||
const records = layerManagerCategories().flatMap(category => managedRecordsForCategory(category));
|
const records = layerManagerCategories().flatMap(category => managedRecordsForCategory(category));
|
||||||
lmeState.managerRecords = new Map(records.map(record => [record.id, record]));
|
lmeState.managerRecords = new Map(records.map(record => [record.id, record]));
|
||||||
@@ -2057,9 +2449,9 @@ function showObjectTable() {
|
|||||||
const details = managedObjectDetails(record.layer);
|
const details = managedObjectDetails(record.layer);
|
||||||
const selected = lmeState.managerSelectedObjectIds.has(record.id);
|
const selected = lmeState.managerSelectedObjectIds.has(record.id);
|
||||||
const locked = Boolean(properties._lmeLocked);
|
const locked = Boolean(properties._lmeLocked);
|
||||||
return `<tr data-object-id="${escapeHtml(record.id)}"><td><input type="checkbox" data-select="${escapeHtml(record.id)}" ${selected ? "checked" : ""} aria-label="Seleziona ${escapeHtml(managedObjectLabel(record, index))}"></td><td><input type="checkbox" data-lock="${escapeHtml(record.id)}" ${locked ? "checked" : ""} ${lmeState.readOnly ? "disabled" : ""} aria-label="Blocca ${escapeHtml(managedObjectLabel(record, index))}"></td><td><button type="button" data-locate="${escapeHtml(record.id)}" title="Mostra sulla mappa" aria-label="Mostra sulla mappa">⌖</button></td><td>${escapeHtml(managedObjectLabel(record, index))}</td><td>${escapeHtml(managedCategoryName(layerManagerCategories().find(item => item.key === record.categoryKey) || { key: record.categoryKey, label: record.categoryKey }, [record]))}</td><td>${escapeHtml(properties.foglio || properties.FOGLIO || "")}</td><td>${escapeHtml(properties.particella || properties.PARTICELLA || properties.LABEL || "")}</td><td>${escapeHtml(details.slice(0, 2).join(" | "))}</td></tr>`;
|
return `<tr data-object-id="${escapeHtml(record.id)}"><td><input type="checkbox" data-select="${escapeHtml(record.id)}" ${selected ? "checked" : ""} aria-label="Seleziona ${escapeHtml(managedObjectLabel(record, index))}"></td><td><input type="checkbox" data-lock="${escapeHtml(record.id)}" ${locked ? "checked" : ""} ${lmeState.readOnly ? "disabled" : ""} aria-label="Blocca ${escapeHtml(managedObjectLabel(record, index))}"></td><td><button type="button" data-locate="${escapeHtml(record.id)}" title="Mostra sulla mappa" aria-label="Mostra sulla mappa">⌖</button></td><td><button type="button" data-attributes="${escapeHtml(record.id)}" title="Modifica metadati" aria-label="Modifica metadati di ${escapeHtml(managedObjectLabel(record, index))}" ${lmeState.readOnly ? "disabled" : ""}>✎</button></td><td>${escapeHtml(managedObjectLabel(record, index))}</td><td>${escapeHtml(managedCategoryName(layerManagerCategories().find(item => item.key === record.categoryKey) || { key: record.categoryKey, label: record.categoryKey }, [record]))}</td><td>${escapeHtml(properties.foglio || properties.FOGLIO || "")}</td><td>${escapeHtml(properties.particella || properties.PARTICELLA || properties.LABEL || "")}</td><td>${escapeHtml(details.slice(0, 2).join(" | "))}</td></tr>`;
|
||||||
}).join("");
|
}).join("");
|
||||||
const dialog = showAppDialog("Elenco oggetti e particelle", `<label class="object-table-search">Filtra<input type="search" placeholder="Nome, foglio, particella o gruppo"></label><div class="object-table-legend"><span>Seleziona più oggetti con i flag nella colonna Selez.</span><span>Il lucchetto impedisce modifiche e rimozioni.</span></div><div class="object-table-wrap"><table><thead><tr><th>Selez.</th><th>Blocca</th><th>Mappa</th><th>Nome</th><th>Gruppo</th><th>Foglio</th><th>Particella</th><th>Misure</th></tr></thead><tbody>${body || "<tr><td colspan='8'>Nessun oggetto</td></tr>"}</tbody></table></div>`);
|
const dialog = showAppDialog("Elenco oggetti e particelle", `<label class="object-table-search">Filtra<input type="search" placeholder="Nome, foglio, particella o gruppo"></label><div class="object-table-legend"><span>Seleziona più oggetti con i flag nella colonna Selez.</span><span>Il lucchetto impedisce modifiche e rimozioni; la matita modifica i metadati.</span></div><div class="object-table-wrap"><table><thead><tr><th>Selez.</th><th>Blocca</th><th>Mappa</th><th>Metadati</th><th>Nome</th><th>Gruppo</th><th>Foglio</th><th>Particella</th><th>Misure</th></tr></thead><tbody>${body || "<tr><td colspan='9'>Nessun oggetto</td></tr>"}</tbody></table></div>`);
|
||||||
const byId = new Map(records.map(record => [record.id, record]));
|
const byId = new Map(records.map(record => [record.id, record]));
|
||||||
dialog.querySelector("input[type='search']").addEventListener("input", event => {
|
dialog.querySelector("input[type='search']").addEventListener("input", event => {
|
||||||
const query = event.target.value.toLocaleLowerCase("it");
|
const query = event.target.value.toLocaleLowerCase("it");
|
||||||
@@ -2087,6 +2479,10 @@ function showObjectTable() {
|
|||||||
const record = byId.get(button.dataset.locate); if (!record) return;
|
const record = byId.get(button.dataset.locate); if (!record) return;
|
||||||
dialog.remove(); highlightManagedObject(record);
|
dialog.remove(); highlightManagedObject(record);
|
||||||
}));
|
}));
|
||||||
|
dialog.querySelectorAll("[data-attributes]").forEach(button => button.addEventListener("click", () => {
|
||||||
|
const record = byId.get(button.dataset.attributes); if (!record) return;
|
||||||
|
dialog.remove(); editManagedAttributes(record);
|
||||||
|
}));
|
||||||
return records.length;
|
return records.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2379,6 +2775,27 @@ function showGeometryResult(title, message, tone = "success") {
|
|||||||
showAppDialog(title, `<div class="geometry-result geometry-result-${tone}"><span aria-hidden="true">${icons[tone] || "i"}</span><p>${escapeHtml(message)}</p></div>`);
|
showAppDialog(title, `<div class="geometry-result geometry-result-${tone}"><span aria-hidden="true">${icons[tone] || "i"}</span><p>${escapeHtml(message)}</p></div>`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showLeafletToolbarHelp() {
|
||||||
|
showAppDialog("Guida strumenti mappa", `<div class="leaflet-help">
|
||||||
|
<p>Gli strumenti operano direttamente sulla mappa. Per le azioni su oggetti esistenti, seleziona prima le righe nel pannello Layer, nella tabella oggetti oppure tocca un oggetto sulla mappa.</p>
|
||||||
|
<dl class="leaflet-help-list">
|
||||||
|
<div><dt>+</dt><dd><strong>Ingrandisci</strong>Aumenta lo zoom mantenendo il centro attuale. Esempio: avvicinati a un vertice per posizionarlo con maggiore precisione.</dd></div>
|
||||||
|
<div><dt>−</dt><dd><strong>Riduci</strong>Allarga l'area visibile. Esempio: usalo per controllare insieme particelle appartenenti a fogli vicini.</dd></div>
|
||||||
|
<div><dt>●</dt><dd><strong>Punto di interesse</strong>Tocca la posizione da memorizzare. Esempio: segna un cancello, un cippo o il punto di accesso al fondo.</dd></div>
|
||||||
|
<div><dt>/</dt><dd><strong>Linea</strong>Tocca i vertici del percorso e termina con doppio tocco o sul primo comando della barra. Durante il disegno viene mostrata la distanza; utile per un fronte strada o una recinzione.</dd></div>
|
||||||
|
<div><dt>⬠</dt><dd><strong>Poligono</strong>Tocca almeno tre vertici e chiudi la figura. Esempio: delimita un'area di intervento; l'app calcola area e perimetro.</dd></div>
|
||||||
|
<div><dt>□</dt><dd><strong>Rettangolo</strong>Trascina tra due angoli opposti. Esempio: crea rapidamente l'ingombro rettangolare di un fabbricato.</dd></div>
|
||||||
|
<div><dt>○</dt><dd><strong>Cerchio</strong>Tocca il centro e trascina fino al raggio desiderato. Esempio: rappresenta una fascia di rispetto attorno a un pozzo.</dd></div>
|
||||||
|
<div><dt>✎</dt><dd><strong>Modifica disegni</strong>Premi la matita e scegli Solo selezionato oppure Tutti. Sposta i vertici e conferma con Salva; gli oggetti bloccati devono prima essere sbloccati.</dd></div>
|
||||||
|
<div><dt>▱</dt><dd><strong>Elimina disegni</strong>Premi il cestino e scegli Solo selezionato oppure Tutti. L'oggetto rimosso può essere recuperato con Annulla o dal cestino negli strumenti avanzati.</dd></div>
|
||||||
|
<div><dt>✓</dt><dd><strong>Controlla e ripara</strong>Verifica gli oggetti selezionati e prova a correggere coordinate duplicate o poligoni non validi. Esempio: usalo quando un contorno importato non si esporta o si riempie male; al termine compare un riepilogo.</dd></div>
|
||||||
|
<div><dt>◉</dt><dd><strong>Crea foro</strong>Seleziona esattamente due poligoni: prima l'area esterna, poi quella interna. Esempio: sottrai il cortile dal perimetro di un fabbricato o un'isola esclusa da un'area di lavoro.</dd></div>
|
||||||
|
<div><dt>⇄</dt><dd><strong>Confronta due confini</strong>Seleziona esattamente due poligoni. L'app crea il solo primo in rosso, il solo secondo in blu e la sovrapposizione in verde, mostrando le rispettive aree.</dd></div>
|
||||||
|
<div><dt>?</dt><dd><strong>Guida</strong>Riapre questa descrizione. I risultati di riparazione e confronto vengono mostrati anche in una finestra, così l'operazione non resta senza riscontro.</dd></div>
|
||||||
|
</dl>
|
||||||
|
</div>`);
|
||||||
|
}
|
||||||
|
|
||||||
function addGeometryToolsControl() {
|
function addGeometryToolsControl() {
|
||||||
if (lmeState.geometryToolsControl || !lmeState.map) return;
|
if (lmeState.geometryToolsControl || !lmeState.map) return;
|
||||||
const GeometryTools = L.Control.extend({
|
const GeometryTools = L.Control.extend({
|
||||||
@@ -2388,7 +2805,8 @@ function addGeometryToolsControl() {
|
|||||||
const actions = [
|
const actions = [
|
||||||
{ icon: "✓", title: "Controlla e ripara geometrie", run: validateAndRepairSelected },
|
{ icon: "✓", title: "Controlla e ripara geometrie", run: validateAndRepairSelected },
|
||||||
{ icon: "◉", title: "Crea foro da due poligoni", run: createHoleFromSelected },
|
{ icon: "◉", title: "Crea foro da due poligoni", run: createHoleFromSelected },
|
||||||
{ icon: "⇄", title: "Confronta due confini", run: compareSelectedGeometries }
|
{ icon: "⇄", title: "Confronta due confini", run: compareSelectedGeometries },
|
||||||
|
{ icon: "?", title: "Guida strumenti mappa", run: showLeafletToolbarHelp }
|
||||||
];
|
];
|
||||||
actions.forEach(action => {
|
actions.forEach(action => {
|
||||||
const button = L.DomUtil.create("a", "", container);
|
const button = L.DomUtil.create("a", "", container);
|
||||||
@@ -4139,7 +4557,14 @@ function loadProjectSnapshot(raw, projectName) {
|
|||||||
applyImportedSheetVisibility();
|
applyImportedSheetVisibility();
|
||||||
L.geoJSON(data.selectedParcels || emptyFeatureCollection(), {
|
L.geoJSON(data.selectedParcels || emptyFeatureCollection(), {
|
||||||
pane: "selectedParcelsPane",
|
pane: "selectedParcelsPane",
|
||||||
style: { color: "#ef4444", weight: 4, opacity: 1, fillColor: "#fbbf24", fillOpacity: 0.26 },
|
style: feature => ({
|
||||||
|
color: feature?.properties?._lmeColor || "#ef4444",
|
||||||
|
weight: Number(feature?.properties?._lmeWeight) || 4,
|
||||||
|
opacity: Number.isFinite(Number(feature?.properties?._lmeOpacity)) ? Number(feature.properties._lmeOpacity) : 1,
|
||||||
|
fillColor: feature?.properties?._lmeFillColor || "#fbbf24",
|
||||||
|
fillOpacity: Number.isFinite(Number(feature?.properties?._lmeFillOpacity)) ? Number(feature.properties._lmeFillOpacity) : 0.26,
|
||||||
|
dashArray: feature?.properties?._lmeDash || null
|
||||||
|
}),
|
||||||
onEachFeature: (feature, layer) => {
|
onEachFeature: (feature, layer) => {
|
||||||
const properties = feature?.properties || {};
|
const properties = feature?.properties || {};
|
||||||
const reference = properties.NATIONALCADASTRALREFERENCE
|
const reference = properties.NATIONALCADASTRALREFERENCE
|
||||||
@@ -4148,6 +4573,7 @@ function loadProjectSnapshot(raw, projectName) {
|
|||||||
|| "Particella catastale";
|
|| "Particella catastale";
|
||||||
layer.lmeParcelReference = reference;
|
layer.lmeParcelReference = reference;
|
||||||
layer.bindPopup(`<strong>${escapeHtml(reference)}</strong>`);
|
layer.bindPopup(`<strong>${escapeHtml(reference)}</strong>`);
|
||||||
|
applyStyleFromProperties(layer);
|
||||||
}
|
}
|
||||||
}).addTo(lmeState.selectedParcelsLayer);
|
}).addTo(lmeState.selectedParcelsLayer);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user