fix: Kabelstrecken-Checkbox und Anzeige an TALAS Allow-Status gekoppelt
- Checkbox für Kabelstrecken (polylines) wird deaktiviert, wenn TALAS (IdSystem: 1) Allow: 0 ist - Polylinien werden auf der Karte nur angezeigt, wenn Allow: 1 für TALAS gesetzt ist - Synchronisation zwischen UI
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
NEXT_PUBLIC_APP_VERSION=1.1.301
|
||||
@@ -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,
|
||||
]);
|
||||
|
||||
//--------------------------------------------
|
||||
|
||||
@@ -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}
|
||||
/>
|
||||
<label htmlFor="polyline-checkbox" className="text-sm ml-2">
|
||||
Kabelstrecken
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "nodemap",
|
||||
"version": "1.1.300",
|
||||
"version": "1.1.301",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nodemap",
|
||||
"version": "1.1.300",
|
||||
"version": "1.1.301",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nodemap",
|
||||
"version": "1.1.300",
|
||||
"version": "1.1.301",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.13.3",
|
||||
"@emotion/styled": "^11.13.0",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"IdSystem": 1,
|
||||
"Name": "TALAS",
|
||||
"Longname": "Talas Meldestationen",
|
||||
"Allow": 1,
|
||||
"Allow": 0,
|
||||
"Icon": 1
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user