Building tech points colour

This commit is contained in:
2026-09-11 15:07:29 +02:00
parent f9af09ef0a
commit 8c1a608bf9
4 changed files with 45 additions and 8 deletions
+6 -6
View File
@@ -130,12 +130,12 @@ GIS.buildingTechs = async function () {
let techs = new L.LayerGroup();
for (let record of techsData) {
const marker = L.marker(
record.coordinates,
{icon: Icons.techs, label: record.technique}
)
.bindTooltip(record.technique)
.bindPopup(UI.createBuildingTechTable(record));
const marker = L.marker(record.coordinates, {
icon: Icons.techIcon(record.technique),
label: record.technique
});
marker.bindTooltip(record.technique);
marker.bindPopup(UI.createBuildingTechTable(record));
techs.addLayer(marker);
const markerLabel = `${record.coordinates[0]} ${record.coordinates[1]}`;
+19 -1
View File
@@ -1,4 +1,14 @@
// Global leaflet
// See app.css - Building tech colors
const buildingTechColors = {
"Opera cementizia" : "cement-tech",
"Opera poligonale" : "polygon-tech",
"Opera incerta" : "uncertain-tech",
"Opera reticolata" : "reticul-tech",
"Opera laterizia" : "later-tech",
"Opera mista" : "mixed-tech",
};
/**
* @namespace Icons
*/
@@ -59,6 +69,14 @@ Icons.reuse = L.icon(
Icons.camera = L.divIcon({className: 'fa fa-camera'});
Icons.techs = L.divIcon({className: 'fa fa-circle has-text-link-45'});
/**
* Assigns a different color to the icon
* based on building tech type
* @param {string} techType The type (name) of the building tech
*/
Icons.techIcon = (techType) => {
const colorClass = buildingTechColors[techType] ?? "has-text-link-45";
return L.divIcon({className: `fa fa-circle ${colorClass}`});
}
export default Icons;
+1 -1
View File
@@ -284,7 +284,7 @@ UI.createBuildingTechTable = function(record) {
<tr><th>Descrizione</th><td>${record.description}</td></tr>
<tr><th>Funzione</th><td>${record.function}</td></tr>
<tr><th>Materiale</th><td>${record.material}</td></tr>
;`
`;
if (record.site) {
table += html`