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
+19
View File
@@ -192,3 +192,22 @@ a:visited {
input:invalid { input:invalid {
border-color: #ff6685; border-color: #ff6685;
} }
/* Building tech colors */
.cement-tech {
color: #efe91b;
}
.polygon-tech {
color: #ec973c;
}
.uncertain-tech {
color: #133cee;
}
.reticul-tech {
color: #10ee47;
}
.later-tech {
color: #dd11ef;
}
.mixed-tech {
color: #f0280f;
}
+6 -6
View File
@@ -130,12 +130,12 @@ GIS.buildingTechs = async function () {
let techs = new L.LayerGroup(); let techs = new L.LayerGroup();
for (let record of techsData) { for (let record of techsData) {
const marker = L.marker( const marker = L.marker(record.coordinates, {
record.coordinates, icon: Icons.techIcon(record.technique),
{icon: Icons.techs, label: record.technique} label: record.technique
) });
.bindTooltip(record.technique) marker.bindTooltip(record.technique);
.bindPopup(UI.createBuildingTechTable(record)); marker.bindPopup(UI.createBuildingTechTable(record));
techs.addLayer(marker); techs.addLayer(marker);
const markerLabel = `${record.coordinates[0]} ${record.coordinates[1]}`; const markerLabel = `${record.coordinates[0]} ${record.coordinates[1]}`;
+19 -1
View File
@@ -1,4 +1,14 @@
// Global leaflet // 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 * @namespace Icons
*/ */
@@ -59,6 +69,14 @@ Icons.reuse = L.icon(
Icons.camera = L.divIcon({className: 'fa fa-camera'}); 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; 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>Descrizione</th><td>${record.description}</td></tr>
<tr><th>Funzione</th><td>${record.function}</td></tr> <tr><th>Funzione</th><td>${record.function}</td></tr>
<tr><th>Materiale</th><td>${record.material}</td></tr> <tr><th>Materiale</th><td>${record.material}</td></tr>
;` `;
if (record.site) { if (record.site) {
table += html` table += html`