GMA Marker aktualisiert sich

This commit is contained in:
ISA
2024-11-27 12:15:55 +01:00
parent db9c57f90e
commit 9c4c646d55
47 changed files with 39 additions and 43 deletions

View File

@@ -1,31 +1,31 @@
#.env.local
#je nach dem Mysql Server, ob localhost freigegeben ist oder die IP Adresse des Servers, manchmal die beide und manchmal nur eine
DB_HOST=10.10.0.13
DB_USER=root
DB_PASSWORD="root#$"
DB_NAME=talas_v5
DB_PORT=3306
#########################
NEXT_PUBLIC_BASE_URL="http://10.10.0.13/talas5/devices/"
NEXT_PUBLIC_SERVER_URL="http://10.10.0.13"
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.13"
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#########################
#DB_HOST=10.10.0.70
#DB_HOST=10.10.0.13
#DB_USER=root
#DB_PASSWORD="root#$"
#DB_NAME=talas_v5
#DB_PORT=3306
#########################
#NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
#NEXT_PUBLIC_BASE_URL="http://10.10.0.13/talas5/devices/"
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.13"
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.13"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#########################
DB_HOST=10.10.0.70
DB_USER=root
DB_PASSWORD="root#$"
DB_NAME=talas_v5
DB_PORT=3306
#########################
#device nur Verlinkung wenn die gleiche DB ist
NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#########################
@@ -42,4 +42,4 @@ NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"
######################### online
#NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"

View File

@@ -392,7 +392,6 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
//console.log("priorityConfig in MapComponent2: ", priorityConfig);
useEffect(() => {
if (gisSystemStaticLoaded && map) {
createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig); // GMA-System
createAndSetDevices(1, setTalasMarkers, GisSystemStatic, priorityConfig); // TALAS-System
createAndSetDevices(2, setEciMarkers, GisSystemStatic, priorityConfig); // ECI-System
@@ -679,7 +678,7 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
useEffect(() => {
if (!map) return; // Stelle sicher, dass die Karte initialisiert ist
const updateGmaData = async () => {
try {
const fetchOptions = {
@@ -688,51 +687,47 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
Connection: "close",
},
};
// Aktualisiere die Messdaten
await fetchGisStationsMeasurements(mapGisStationsMeasurementsUrl, setGisStationsMeasurements, fetchOptions);
await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStationsStatusDistrict, fetchOptions);
// Aktualisiere die Marker-Layer
useGmaMarkersLayer(map, gmaMarkers, GisStationsMeasurements, layers.MAP_LAYERS.GMA, oms);
} catch (error) {
console.error("Fehler beim Aktualisieren der GMA-Daten:", error);
}
};
// Initialer Datenabruf
updateGmaData();
// Setze ein Intervall, um die Daten alle 5 Sekunden zu aktualisieren
const intervalId = setInterval(() => {
updateGmaData();
}, 5000);
// Cleanup-Funktion, um das Intervall zu entfernen, wenn die Komponente entladen wird
return () => clearInterval(intervalId);
}, [map, gmaMarkers, layers.MAP_LAYERS.GMA, oms, mapGisStationsMeasurementsUrl,mapGisStationsStatusDistrictUrl]);
}, [map, gmaMarkers, layers.MAP_LAYERS.GMA, oms, mapGisStationsMeasurementsUrl, mapGisStationsStatusDistrictUrl]);
//---------------------------------
const markerLayerRef = useRef(null);
useEffect(() => {
if (!gisSystemStaticLoaded || !map) return; // Sicherstellen, dass alle Abhängigkeiten geladen sind
// Initialisiere die LayerGroup, falls noch nicht vorhanden
if (!markerLayerRef.current) {
markerLayerRef.current = new L.LayerGroup().addTo(map);
}
const updateMarkers = () => {
// Alte Marker entfernen
markerLayerRef.current.clearLayers();
// Neue Marker für jedes System erstellen
/* createAndSetDevices(11, (markers) => {
/* createAndSetDevices(11, (markers) => {
setGmaMarkers(markers);
markers.forEach((marker) => marker.addTo(markerLayerRef.current)); // Marker zur LayerGroup hinzufügen
}, GisSystemStatic, priorityConfig);
@@ -740,15 +735,15 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
createAndSetDevices(11, setGmaMarkers, GisSystemStatic, priorityConfig);
// Füge hier weitere `createAndSetDevices`-Aufrufe für andere Systeme ein
};
// Initiales Update der Marker
updateMarkers();
// Setze ein Intervall, um die Marker alle 10 Sekunden zu aktualisieren
const intervalId = setInterval(() => {
updateMarkers();
}, 10000); // 10 Sekunden
// Aufräumen bei Komponentenentladung
return () => {
clearInterval(intervalId);
@@ -758,10 +753,9 @@ await fetchGisStationsStatusDistrict(mapGisStationsStatusDistrictUrl, setGisStat
};
}, [gisSystemStaticLoaded, map, GisSystemStatic, priorityConfig]);
//---------------------------------------
//---------------------------------------
//-----------------
//-----------------
return (
<>
<ToastContainer />

View File

@@ -15,6 +15,7 @@ const useMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms) => {
let measurements = {};
let area_name = marker.options.areaName;
let idLD = marker.options.idLD;
relevantMeasurements.forEach((m) => {
measurements[m.Na] = m.Val;
@@ -27,6 +28,7 @@ const useMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms) => {
const rlf = measurements["RLF"] || "---";
console.log(`Station oder Bereich ${area_name} - LT: ${lt}, FBT: ${fbt}, GT: ${gt}, RLF: ${rlf}`);
console.log(`Station idLD: ${idLD} `);
// Tooltip für den Marker binden
marker.bindTooltip(

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{
"name": "16.09.2024 NodeMap",
"name": "nodeMap",
"lockfileVersion": 3,
"requires": true,
"packages": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB