diff --git a/app.js b/app.js index e0792f2..f66f7f1 100644 --- a/app.js +++ b/app.js @@ -334,33 +334,75 @@ document.addEventListener('DOMContentLoaded', async () => { function updateLegend() { if (!legendContent) return; - let html = '
Anlagen-Geometrien
'; + let html = ''; + if (state.turbines.length > 0) { - html += ` -
Rotorfläche
-
Techn. Abstand (Ellipse)
-
Techn. Abstand (Circle)
-
Auflastenradius
-
Fundament
-
Kranstellfläche (KSF)
- `; - } else { - html += '
Keine Anlagen gesetzt
'; + html += '
Anlagen & Geometrien
'; + html += '
WEA Standort
'; + html += '
Rotorfläche
'; + if (state.showAuxiliary) { + html += ` +
Techn. Abstand (Ellipse)
+
Techn. Abstand (Kreis)
+
Auflastenradius
+
Fundament
+
Kranstellfläche (KSF)
+ `; + } + if (document.getElementById('checkShowProximity') && document.getElementById('checkShowProximity').checked) { + html += '
Abstandslinien (WEA)
'; + } } - html += '
Sicherungsstand (ALKIS)
'; - Object.keys(STATUS_MAP).forEach(status => { - const data = STATUS_MAP[status]; - html += ` -
- -
-
${status}
-
${data.desc}
+ // ALKIS Status + const checkShowOwners = document.getElementById('checkShowOwners'); + if (checkShowOwners && checkShowOwners.checked) { + html += '
Sicherungsstand (ALKIS)
'; + Object.keys(STATUS_MAP).forEach(status => { + const data = STATUS_MAP[status]; + html += ` +
+ +
+
${status}
+
${data.desc}
+
-
- `; - }); + `; + }); + } + + // Outline + const checkShowOwnersOutline = document.getElementById('checkShowOwnersOutline'); + if (checkShowOwnersOutline && checkShowOwnersOutline.checked) { + html += '
Flurstücke (Umriss)
'; + } + + // Check other layers + let otherLayersHtml = ''; + if (typeof overlays !== 'undefined' && state.map) { + Object.keys(overlays).forEach(layerName => { + if (state.map.hasLayer(overlays[layerName])) { + if (layerName === 'Hilfs-Geometrien' || layerName.includes('Abstände') || layerName.includes('ALKIS') || layerName.includes('Umriss') || layerName.startsWith('Variante')) return; + let color = '#9b59b6'; + if (state.bakedData && state.bakedData[layerName] && state.bakedData[layerName].style) { + color = state.bakedData[layerName].style.color || state.bakedData[layerName].style.fillColor || color; + } else if (layerName === 'Gebietsumring (DB)') { + color = '#00aaff'; + } else if (layerName === 'Artennachweis') { + color = '#ff4444'; + } + otherLayersHtml += `
${layerName}
`; + } + }); + } + if (otherLayersHtml) { + html += '
Weitere Layer
' + otherLayersHtml; + } + + if (!html) { + html = '
Keine aktiven Layer
'; + } legendContent.innerHTML = html; } @@ -675,6 +717,7 @@ document.addEventListener('DOMContentLoaded', async () => { } }); }); + updateLegend(); }; } @@ -690,6 +733,7 @@ document.addEventListener('DOMContentLoaded', async () => { state.map.removeLayer(proxLayer); } } + updateLegend(); }; } @@ -705,6 +749,7 @@ document.addEventListener('DOMContentLoaded', async () => { state.map.removeLayer(ownerLayer); } } + updateLegend(); }; } @@ -719,6 +764,7 @@ document.addEventListener('DOMContentLoaded', async () => { state.map.removeLayer(outlineLayer); } } + updateLegend(); }; } diff --git a/index.html b/index.html index 74d69fd..ee0e67e 100644 --- a/index.html +++ b/index.html @@ -210,10 +210,10 @@
-
+