diff --git a/.env.development b/.env.development index 72113cc23..1fc607629 100644 --- a/.env.development +++ b/.env.development @@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=true NEXT_PUBLIC_BASE_PATH=/talas5 # Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH= # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.300 +NEXT_PUBLIC_APP_VERSION=1.1.301 diff --git a/.env.production b/.env.production index 74d1ec2a1..6e4d9a0b3 100644 --- a/.env.production +++ b/.env.production @@ -26,4 +26,4 @@ NEXT_PUBLIC_BASE_PATH=/talas5 # Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH= # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.300 \ No newline at end of file +NEXT_PUBLIC_APP_VERSION=1.1.301 \ No newline at end of file diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js index 0d3a3a8a3..0ceb7e5f8 100644 --- a/components/mainComponent/MapComponent.js +++ b/components/mainComponent/MapComponent.js @@ -96,6 +96,11 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const countdownActive = useSelector(state => state.polylineContextMenu.countdownActive); const isPolylineContextMenuOpen = useSelector(state => state.polylineContextMenu.isOpen); const polylineVisible = useSelector(selectPolylineVisible); + const GisSystemStatic = useSelector(selectGisSystemStatic); + // Prüfen, ob TALAS (IdSystem 1) erlaubt ist + const isTalasAllowed = Array.isArray(GisSystemStatic) + ? GisSystemStatic.some(system => system.IdSystem === 1 && system.Allow === 1) + : false; const isPoiTypLoaded = useSelector(state => state.poiTypes.status === "succeeded"); const statusMeasurements = useSelector(state => state.gisStationsMeasurements.status); @@ -107,7 +112,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { const zoomTrigger = useSelector(state => state.zoomTrigger.trigger); const poiReadTrigger = useSelector(state => state.poiReadFromDbTrigger.trigger); const GisStationsStaticDistrict = useSelector(selectGisStationsStaticDistrict); - const GisSystemStatic = useSelector(selectGisSystemStatic); const gisSystemStaticStatus = useSelector(state => state.gisSystemStatic.status); const polylineEventsDisabled = useSelector(state => state.polylineEventsDisabled.disabled); const mapLayersVisibility = useSelector(selectMapLayersState) || {}; @@ -310,71 +314,85 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { useEffect(() => { if (!map) return; - // vorherige Marker & Polylinien vollständig bereinigen + // Wenn TALAS nicht erlaubt ist, Polyline-Checkbox und Anzeige deaktivieren + if (!isTalasAllowed) { + if (polylineVisible) { + dispatch(setPolylineVisible(false)); + } + cleanupPolylinesForMemory(polylines, map); + setPolylines([]); + return; + } + // vorherige Marker & Polylinien vollständig bereinigen markers.forEach(marker => { marker.remove(); }); cleanupPolylinesForMemory(polylines, map); // Setze neue Marker und Polylinien mit den aktuellen Daten - const { markers: newMarkers, polylines: newPolylines } = setupPolylines( - map, - linePositions, - lineColors, - tooltipContents, - setNewCoords, - tempMarker, - currentZoom, - currentCenter, - polylineVisible // kommt aus Redux - ); + if (polylineVisible) { + const { markers: newMarkers, polylines: newPolylines } = setupPolylines( + map, + linePositions, + lineColors, + tooltipContents, + setNewCoords, + tempMarker, + currentZoom, + currentCenter, + polylineVisible // kommt aus Redux + ); - newPolylines.forEach((polyline, index) => { - const tooltipContent = - tooltipContents[`${linePositions[index].idLD}-${linePositions[index].idModul}`] || - "Die Linie ist noch nicht in Webservice vorhanden oder bekommt keine Daten"; + newPolylines.forEach((polyline, index) => { + const tooltipContent = + tooltipContents[`${linePositions[index].idLD}-${linePositions[index].idModul}`] || + "Die Linie ist noch nicht in Webservice vorhanden oder bekommt keine Daten"; - polyline.bindTooltip(tooltipContent, { - permanent: false, - direction: "auto", - sticky: true, - offset: [20, 0], - pane: "tooltipPane", - }); + polyline.bindTooltip(tooltipContent, { + permanent: false, + direction: "auto", + sticky: true, + offset: [20, 0], + pane: "tooltipPane", + }); - polyline.on("mouseover", e => { - const tooltip = polyline.getTooltip(); - if (tooltip) { - const mousePos = e.containerPoint; - const mapSize = map.getSize(); + polyline.on("mouseover", e => { + const tooltip = polyline.getTooltip(); + if (tooltip) { + const mousePos = e.containerPoint; + const mapSize = map.getSize(); - let direction = "right"; + let direction = "right"; - if (mousePos.x > mapSize.x - 100) { - direction = "left"; - } else if (mousePos.x < 100) { - direction = "right"; + if (mousePos.x > mapSize.x - 100) { + direction = "left"; + } else if (mousePos.x < 100) { + direction = "right"; + } + + if (mousePos.y > mapSize.y - 100) { + direction = "top"; + } else if (mousePos.y < 100) { + direction = "bottom"; + } + + tooltip.options.direction = direction; + polyline.openTooltip(e.latlng); } + }); - if (mousePos.y > mapSize.y - 100) { - direction = "top"; - } else if (mousePos.y < 100) { - direction = "bottom"; - } - - tooltip.options.direction = direction; - polyline.openTooltip(e.latlng); - } + polyline.on("mouseout", () => { + polyline.closeTooltip(); + }); }); - - polyline.on("mouseout", () => { - polyline.closeTooltip(); - }); - }); - cleanupMarkers(markers, oms); - setMarkers(newMarkers); - setPolylines(newPolylines); + cleanupMarkers(markers, oms); + setMarkers(newMarkers); + setPolylines(newPolylines); + } else { + cleanupPolylinesForMemory(polylines, map); + setPolylines([]); + } }, [ map, linePositions, @@ -384,6 +402,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { newCoords, tempMarker, polylineVisible, + isTalasAllowed, ]); //-------------------------------------------- diff --git a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js index cd4de84e0..0bfa597ed 100644 --- a/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js +++ b/components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js @@ -26,6 +26,11 @@ function MapLayersControlPanel() { const polylineVisible = useSelector(selectPolylineVisible); + // Prüfen, ob TALAS (IdSystem 1) erlaubt ist + const isTalasAllowed = Array.isArray(GisSystemStatic) + ? GisSystemStatic.some(system => system.IdSystem === 1 && system.Allow === 1) + : false; + const handlePolylineCheckboxChange = event => { const checked = event.target.checked; dispatch(setPolylineVisible(checked)); @@ -258,6 +263,7 @@ function MapLayersControlPanel() { checked={polylineVisible} // Zustand für Kabelstrecken onChange={handlePolylineCheckboxChange} id="polyline-checkbox" + disabled={!isTalasAllowed || editMode} />