fix: Git Konflikte gelöst, jetzt geht mit der Anzeige von zwei Linien auf die Map
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
// components/MapComponent.js
|
// components/MapComponent.js
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
|
|
||||||
>>>>>>> neuer-branch
|
|
||||||
import React, {
|
import React, {
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
@@ -10,10 +7,6 @@ import React, {
|
|||||||
useMemo,
|
useMemo,
|
||||||
useCallback,
|
useCallback,
|
||||||
} from "react";
|
} from "react";
|
||||||
<<<<<<< HEAD
|
|
||||||
//import ReactDOM from "react-dom/client"; // Import from 'react-dom/client'
|
|
||||||
=======
|
|
||||||
>>>>>>> neuer-branch
|
|
||||||
import { MapContainer, TileLayer, Polyline, LayerGroup } from "react-leaflet";
|
import { MapContainer, TileLayer, Polyline, LayerGroup } from "react-leaflet";
|
||||||
|
|
||||||
import L, { marker } from "leaflet";
|
import L, { marker } from "leaflet";
|
||||||
@@ -55,16 +48,7 @@ const plusRoundIcon = L.icon({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||||
<<<<<<< HEAD
|
|
||||||
/* const linePositions = lineCoordinates || [
|
|
||||||
[52.505, 8],
|
|
||||||
[52, 8.5],
|
|
||||||
[51.5, 8],
|
|
||||||
[52.505, 8],
|
|
||||||
]; */
|
|
||||||
=======
|
|
||||||
const [menuItemAdded, setMenuItemAdded] = useState(false);
|
const [menuItemAdded, setMenuItemAdded] = useState(false);
|
||||||
>>>>>>> neuer-branch
|
|
||||||
|
|
||||||
const poiLayerVisible = useRecoilValue(poiLayerVisibleState);
|
const poiLayerVisible = useRecoilValue(poiLayerVisibleState);
|
||||||
|
|
||||||
@@ -150,8 +134,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const zoomTrigger = useRecoilValue(zoomTriggerState);
|
const zoomTrigger = useRecoilValue(zoomTriggerState);
|
||||||
const offlineTileLayer = "/mapTiles/{z}/{x}/{y}.png";
|
const offlineTileLayer = "/mapTiles/{z}/{x}/{y}.png";
|
||||||
//const onlineTileLayer = "/mapTiles/{z}/{x}/{y}.png";
|
//const onlineTileLayer = "/mapTiles/{z}/{x}/{y}.png";
|
||||||
const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
//const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
|
||||||
//const onlineTileLayer = "http://localhost:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server
|
const onlineTileLayer = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server
|
||||||
// Create map layers
|
// Create map layers
|
||||||
const TALAS = new L.layerGroup();
|
const TALAS = new L.layerGroup();
|
||||||
const ECI = new L.layerGroup();
|
const ECI = new L.layerGroup();
|
||||||
@@ -168,12 +152,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const lineLayer = new L.LayerGroup();
|
const lineLayer = new L.LayerGroup();
|
||||||
|
|
||||||
const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false);
|
const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false);
|
||||||
<<<<<<< HEAD
|
|
||||||
const baseUrl = "http://localhost/talas5/devices/";
|
|
||||||
=======
|
|
||||||
const baseUrl = "http://10.10.0.13/talas5/devices/";
|
const baseUrl = "http://10.10.0.13/talas5/devices/";
|
||||||
//const baseUrl = "http://localhost/talas5/devices/";
|
//const baseUrl = "http://localhost/talas5/devices/";
|
||||||
>>>>>>> neuer-branch
|
|
||||||
const [isPoiTypLoaded, setIsPoiTypLoaded] = useState(false);
|
const [isPoiTypLoaded, setIsPoiTypLoaded] = useState(false);
|
||||||
const [poiTypMap, setPoiTypMap] = useState(new Map());
|
const [poiTypMap, setPoiTypMap] = useState(new Map());
|
||||||
const [showPopup, setShowPopup] = useState(false);
|
const [showPopup, setShowPopup] = useState(false);
|
||||||
@@ -186,15 +166,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
|
|
||||||
const handleAddStation = (stationData) => {
|
const handleAddStation = (stationData) => {
|
||||||
// Station-Daten speichern oder API-Aufruf durchführen
|
// Station-Daten speichern oder API-Aufruf durchführen
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("Neue Station:", userRights.includes(56));
|
|
||||||
|
|
||||||
console.log("Neue Station:", stationData);
|
|
||||||
=======
|
|
||||||
//console.log("Neue Station:", userRights.includes(56));
|
//console.log("Neue Station:", userRights.includes(56));
|
||||||
|
|
||||||
//console.log("Neue Station:", stationData);
|
//console.log("Neue Station:", stationData);
|
||||||
>>>>>>> neuer-branch
|
|
||||||
setShowAddStationPopup(false);
|
setShowAddStationPopup(false);
|
||||||
closePopup(); // Schließt das Popup nach dem Hinzufügen
|
closePopup(); // Schließt das Popup nach dem Hinzufügen
|
||||||
};
|
};
|
||||||
@@ -366,11 +340,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
); // Keine Abhängigkeiten, da `hasRights` als Parameter übergeben wird */
|
); // Keine Abhängigkeiten, da `hasRights` als Parameter übergeben wird */
|
||||||
const addStationCallback = useCallback(
|
const addStationCallback = useCallback(
|
||||||
(event) => {
|
(event) => {
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("Benutzerrechte zum Zeitpunkt des Aufrufs:", hasRights);
|
|
||||||
=======
|
|
||||||
//console.log("Benutzerrechte zum Zeitpunkt des Aufrufs:", hasRights);
|
//console.log("Benutzerrechte zum Zeitpunkt des Aufrufs:", hasRights);
|
||||||
>>>>>>> neuer-branch
|
|
||||||
if (hasRights) {
|
if (hasRights) {
|
||||||
setPopupCoordinates(event.latlng);
|
setPopupCoordinates(event.latlng);
|
||||||
setShowPopup(true);
|
setShowPopup(true);
|
||||||
@@ -384,11 +354,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
draggable: true,
|
draggable: true,
|
||||||
progress: undefined,
|
progress: undefined,
|
||||||
});
|
});
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("Benutzer hat keine Berechtigung zum Hinzufügen.");
|
|
||||||
=======
|
|
||||||
console.error("Benutzer hat keine Berechtigung zum Hinzufügen.");
|
console.error("Benutzer hat keine Berechtigung zum Hinzufügen.");
|
||||||
>>>>>>> neuer-branch
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[hasRights]
|
[hasRights]
|
||||||
@@ -755,11 +721,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const port = url.port; // Gibt den Port zurück, leer wenn Standardport verwendet wird
|
const port = url.port; // Gibt den Port zurück, leer wenn Standardport verwendet wird
|
||||||
const protocol = url.protocol; // "http:" oder "https:"
|
const protocol = url.protocol; // "http:" oder "https:"
|
||||||
//const serverURL = `${protocol}//${hostname}`;
|
//const serverURL = `${protocol}//${hostname}`;
|
||||||
<<<<<<< HEAD
|
|
||||||
const serverURL = "http://localhost"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse)
|
|
||||||
=======
|
|
||||||
const serverURL = "http://10.10.0.13"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse)
|
const serverURL = "http://10.10.0.13"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse)
|
||||||
>>>>>>> neuer-branch
|
|
||||||
//const serverURL = "http://localhost:3000";
|
//const serverURL = "http://localhost:3000";
|
||||||
|
|
||||||
const params = new URL(window.location.href).searchParams;
|
const params = new URL(window.location.href).searchParams;
|
||||||
@@ -781,26 +743,16 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const userRightsIds = rightsArray.map((right) => right.IdRight);
|
const userRightsIds = rightsArray.map((right) => right.IdRight);
|
||||||
setUserRights(userRightsIds); // Speichert die Rechte in den Zustand
|
setUserRights(userRightsIds); // Speichert die Rechte in den Zustand
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("Benutzerrechte:", rightsArray);
|
|
||||||
console.log("Benutzerrechte IDs:", userRightsIds);
|
|
||||||
console.log("Benutzerrechte in if :", userRightsIds.includes(56));
|
|
||||||
=======
|
|
||||||
//console.log("Benutzerrechte:", rightsArray);
|
//console.log("Benutzerrechte:", rightsArray);
|
||||||
//console.log("Benutzerrechte IDs:", userRightsIds);
|
//console.log("Benutzerrechte IDs:", userRightsIds);
|
||||||
//console.log("Benutzerrechte in if :", userRightsIds.includes(56));
|
//console.log("Benutzerrechte in if :", userRightsIds.includes(56));
|
||||||
>>>>>>> neuer-branch
|
|
||||||
setHasRights(userRightsIds.includes(56));
|
setHasRights(userRightsIds.includes(56));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("Aktualisierter Status von hasRights: ", hasRights);
|
|
||||||
=======
|
|
||||||
//console.log("Aktualisierter Status von hasRights: ", hasRights);
|
//console.log("Aktualisierter Status von hasRights: ", hasRights);
|
||||||
>>>>>>> neuer-branch
|
|
||||||
}, [hasRights]); // Dieser Effekt läuft jedes Mal, wenn sich `hasRights` ändert.
|
}, [hasRights]); // Dieser Effekt läuft jedes Mal, wenn sich `hasRights` ändert.
|
||||||
|
|
||||||
// Überprüfen der Benutzerrechte beim Initialisieren der Komponente
|
// Überprüfen der Benutzerrechte beim Initialisieren der Komponente
|
||||||
@@ -1181,21 +1133,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
}
|
}
|
||||||
}, [map]); */
|
}, [map]); */
|
||||||
<<<<<<< HEAD
|
|
||||||
const addItemsToMapContextMenu = () => {
|
|
||||||
console.log("contextMenuItems hasRights:", hasRights);
|
|
||||||
|
|
||||||
map.contextmenu.addItem({
|
|
||||||
text: "POI hinzufügen",
|
|
||||||
icon: "img/add_station.png",
|
|
||||||
className: "background-red",
|
|
||||||
callback: (event) => addStationCallback(event, hasRights),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
//--------------------------------------------------
|
|
||||||
useEffect(() => {
|
|
||||||
if (map && poiLayerRef.current && isPoiTypLoaded) {
|
|
||||||
=======
|
|
||||||
|
|
||||||
const addItemsToMapContextMenu = () => {
|
const addItemsToMapContextMenu = () => {
|
||||||
if (!menuItemAdded) {
|
if (!menuItemAdded) {
|
||||||
@@ -1214,22 +1151,13 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (map && poiLayerRef.current && isPoiTypLoaded && !menuItemAdded) {
|
if (map && poiLayerRef.current && isPoiTypLoaded && !menuItemAdded) {
|
||||||
>>>>>>> neuer-branch
|
|
||||||
addItemsToMapContextMenu();
|
addItemsToMapContextMenu();
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
map,
|
map,
|
||||||
<<<<<<< HEAD
|
|
||||||
locations,
|
|
||||||
onLocationUpdate,
|
|
||||||
poiReadTrigger,
|
|
||||||
isPoiTypLoaded,
|
|
||||||
userRights,
|
|
||||||
=======
|
|
||||||
poiLayerRef,
|
poiLayerRef,
|
||||||
isPoiTypLoaded,
|
isPoiTypLoaded,
|
||||||
menuItemAdded, // Hinzufügen zu den Abhängigkeiten, um den Effekt korrekt zu steuern
|
menuItemAdded, // Hinzufügen zu den Abhängigkeiten, um den Effekt korrekt zu steuern
|
||||||
>>>>>>> neuer-branch
|
|
||||||
]);
|
]);
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
@@ -1242,11 +1170,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const response = await fetch("/api/poi-icons");
|
const response = await fetch("/api/poi-icons");
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
setPoiData(data);
|
setPoiData(data);
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("poiData icons:", data);
|
|
||||||
=======
|
|
||||||
//console.log("poiData icons:", data);
|
//console.log("poiData icons:", data);
|
||||||
>>>>>>> neuer-branch
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchPoiData();
|
fetchPoiData();
|
||||||
@@ -1261,11 +1185,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const { latitude, longitude } = parsePoint(location.position);
|
const { latitude, longitude } = parsePoint(location.position);
|
||||||
const poiTypName = poiTypMap.get(location.idPoiTyp) || "Unbekannt";
|
const poiTypName = poiTypMap.get(location.idPoiTyp) || "Unbekannt";
|
||||||
const deviceName = await fetchDeviceNameById(location.idLD);
|
const deviceName = await fetchDeviceNameById(location.idLD);
|
||||||
<<<<<<< HEAD
|
|
||||||
console.log("location.icon:", location);
|
|
||||||
=======
|
|
||||||
//console.log("location.icon:", location);
|
//console.log("location.icon:", location);
|
||||||
>>>>>>> neuer-branch
|
|
||||||
|
|
||||||
// Check if user has the right to drag the marker
|
// Check if user has the right to drag the marker
|
||||||
const canDrag = userRights ? userRights.includes(56) : false; // Check if userRights is not null before using includes
|
const canDrag = userRights ? userRights.includes(56) : false; // Check if userRights is not null before using includes
|
||||||
@@ -1774,7 +1694,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
|
|
||||||
// Funktion zum Ein- und Ausblenden der TALAS-Marker basierend auf dem Zustand von mapLayersVisibility.TALAS
|
// Funktion zum Ein- und Ausblenden der TALAS-Marker basierend auf dem Zustand von mapLayersVisibility.TALAS
|
||||||
|
|
||||||
/* useEffect(() => {
|
useEffect(() => {
|
||||||
if (!map || !talasMarkers) return;
|
if (!map || !talasMarkers) return;
|
||||||
|
|
||||||
const toggleLayer = (isVisible) => {
|
const toggleLayer = (isVisible) => {
|
||||||
@@ -1790,7 +1710,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
|
|
||||||
// Apply visibility state to the TALAS layer
|
// Apply visibility state to the TALAS layer
|
||||||
toggleLayer(mapLayersVisibility.TALAS);
|
toggleLayer(mapLayersVisibility.TALAS);
|
||||||
}, [map, talasMarkers, mapLayersVisibility.TALAS]); */
|
}, [map, talasMarkers, mapLayersVisibility.TALAS]);
|
||||||
|
|
||||||
//------------------------------------------ */
|
//------------------------------------------ */
|
||||||
// Funktion zum Ein- und Ausblenden der ECI-Marker basierend auf dem Zustand von mapLayersVisibility.ECI
|
// Funktion zum Ein- und Ausblenden der ECI-Marker basierend auf dem Zustand von mapLayersVisibility.ECI
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ import { createProxyMiddleware } from "http-proxy-middleware";
|
|||||||
|
|
||||||
export default createProxyMiddleware({
|
export default createProxyMiddleware({
|
||||||
//target: "http://192.168.10.58:3001",
|
//target: "http://192.168.10.58:3001",
|
||||||
<<<<<<< HEAD
|
|
||||||
target: "http://10.10.0.13", // Ziel-URL des Proxys, GET //talas5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict?idMap=10&idUser=484 504 in 20ms
|
|
||||||
=======
|
|
||||||
target: "http://10.10.0.13", // Ziel-URL des Proxys
|
target: "http://10.10.0.13", // Ziel-URL des Proxys
|
||||||
>>>>>>> neuer-branch
|
|
||||||
//target: "http://localhost", // Ziel-URL des Proxys
|
//target: "http://localhost", // Ziel-URL des Proxys
|
||||||
//target: "http://192.168.10.187:3000", // Ziel-URL des Proxys
|
//target: "http://192.168.10.187:3000", // Ziel-URL des Proxys
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user