git commit -m "refactor: Gerätelayer dynamisch über IdSystem initialisiert
BREAKING CHANGE: Sichtbarkeit der Gerätegruppen basiert nun auf 'system-<IdSystem>' statt auf Namen wie 'SMSFunkmodem'. Statische Layer-Konfiguration im Redux-Slice entfernt."
This commit is contained in:
@@ -22,17 +22,19 @@ const useDynamicDeviceLayers = (map, GisSystemStatic, mapLayersVisibility, prior
|
||||
if (!map || GisSystemStatic.length === 0) return;
|
||||
|
||||
GisSystemStatic.forEach(({ Name, IdSystem }) => {
|
||||
if (!layerRefs.current[Name]) {
|
||||
layerRefs.current[Name] = new L.LayerGroup().addTo(map);
|
||||
const key = `system-${IdSystem}`; // ✅ Einheitlicher Key
|
||||
|
||||
if (!layerRefs.current[key]) {
|
||||
layerRefs.current[key] = new L.LayerGroup().addTo(map);
|
||||
}
|
||||
|
||||
createAndSetDevices(
|
||||
IdSystem,
|
||||
(newMarkers) => {
|
||||
setMarkerStates((prev) => ({ ...prev, [Name]: newMarkers }));
|
||||
setMarkerStates((prev) => ({ ...prev, [key]: newMarkers }));
|
||||
newMarkers.forEach((m) => {
|
||||
layerRefs.current[Name].addLayer(m);
|
||||
if (oms) oms.addMarker(m); // ✅ Marker bei OMS registrieren
|
||||
layerRefs.current[key].addLayer(m);
|
||||
if (oms) oms.addMarker(m);
|
||||
});
|
||||
checkOverlappingMarkers(map, newMarkers, plusRoundIcon, oms);
|
||||
},
|
||||
@@ -47,8 +49,8 @@ const useDynamicDeviceLayers = (map, GisSystemStatic, mapLayersVisibility, prior
|
||||
if (!map) return;
|
||||
const editMode = localStorage.getItem("editMode") === "true";
|
||||
|
||||
Object.entries(markerStates).forEach(([systemName, markers]) => {
|
||||
const isVisible = mapLayersVisibility[systemName];
|
||||
Object.entries(markerStates).forEach(([key, markers]) => {
|
||||
const isVisible = mapLayersVisibility[key];
|
||||
markers.forEach((marker) => {
|
||||
const hasLayer = map.hasLayer(marker);
|
||||
if (editMode || !isVisible) {
|
||||
|
||||
Reference in New Issue
Block a user