diff --git a/.env.local b/.env.local index b05b3eea6..ffea95242 100644 --- a/.env.local +++ b/.env.local @@ -7,12 +7,12 @@ DB_NAME=talas_v5 DB_PORT=3306 # Public Settings (Client braucht IP/Domain) -NEXT_PUBLIC_SERVER_URL="http://192.168.10.33" # oder evtl. später https://nodemap.firma.de +NEXT_PUBLIC_SERVER_URL="http://10.10.0.70" # oder evtl. später https://nodemap.firma.de NEXT_PUBLIC_ENABLE_GEOCODER=true NEXT_PUBLIC_USE_MOCK_API=false NEXT_PUBLIC_DEBUG_LOG=true # für Polylines/kabelstecken -> in Konextmenü "Station öffnen" " -NEXT_PUBLIC_BASE_URL=http://192.168.10.33/talas5/devices/ -NEXT_PUBLIC_API_BASE_URL=http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx -NEXT_PUBLIC_API_PORT_3000=http://192.168.10.33:3000 +NEXT_PUBLIC_BASE_URL=http://10.10.0.70/talas5/devices/ +NEXT_PUBLIC_API_BASE_URL=http://10.10.0.70/talas5/ClientData/WebServiceMap.asmx +NEXT_PUBLIC_API_PORT_3000=http://10.10.0.70:3000 diff --git a/config/appVersion.js b/config/appVersion.js index 02654aa4d..01e16d777 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.39"; +export const APP_VERSION = "1.1.40"; diff --git a/utils/markerUtils.js b/utils/markerUtils.js index da7417e3b..5c2b2b9ff 100644 --- a/utils/markerUtils.js +++ b/utils/markerUtils.js @@ -1,6 +1,7 @@ // /utils/markerUtils.js import circleIcon from "../components/CircleIcon"; -import { saveLineData, redrawPolyline } from "./mapUtils"; +import { saveLineData } from "./mapUtils"; +import { redrawPolyline } from "./mapUtils"; import L from "leaflet"; import { toast } from "react-toastify"; @@ -9,10 +10,7 @@ export const insertNewMarker = (closestPoints, newPoint, lineData, map) => { icon: circleIcon, draggable: true, }).addTo(map); - lineData.coordinates.splice(closestPoints[2], 0, [ - newPoint.lat, - newPoint.lng, - ]); + lineData.coordinates.splice(closestPoints[2], 0, [newPoint.lat, newPoint.lng]); // Hier direkt speichern nach Einfügen saveLineData(lineData); @@ -39,9 +37,7 @@ export const removeMarker = (marker, lineData, currentZoom, currentCenter) => { //localStorage.setItem("mapCenter", JSON.stringify(currentCenter)); // Find the index of the coordinate that matches the marker's position - const index = lineData.coordinates.findIndex((coord) => - L.latLng(coord[0], coord[1]).equals(marker.getLatLng()) - ); + const index = lineData.coordinates.findIndex((coord) => L.latLng(coord[0], coord[1]).equals(marker.getLatLng())); if (index !== -1) { // Remove the coordinate from the line data diff --git a/utils/poiUtils.js b/utils/poiUtils.js index 229e10a0b..d5dcd5d39 100644 --- a/utils/poiUtils.js +++ b/utils/poiUtils.js @@ -1,6 +1,7 @@ // /utils/poiUtils.js import circleIcon from "../components/gisPolylines/icons/CircleIcon.js"; -import { saveLineData, redrawPolyline } from "./mapUtils.js"; +import { saveLineData } from "./mapUtils.js"; +import { redrawPolyline } from "./redrawPolyline.js"; import L from "leaflet"; import "leaflet.smooth_marker_bouncing"; import { toast } from "react-toastify"; diff --git a/utils/redrawPolyline.js b/utils/redrawPolyline.js new file mode 100644 index 000000000..5dbfa7325 --- /dev/null +++ b/utils/redrawPolyline.js @@ -0,0 +1,35 @@ +// utils/redrawPolyline.js +export const redrawPolyline = (lineData, lineColors, tooltipContents, map) => { + if (!lineData || !lineColors || !tooltipContents || !map) { + console.error("Invalid parameters for redrawPolyline"); + return; + } + + if (!lineData.coordinates || !Array.isArray(lineData.coordinates)) { + console.error("Invalid coordinates in lineData"); + return; + } + + const color = lineColors[lineData.idModul] || "#000000"; + const tooltipContent = tooltipContents[lineData.idModul] || "Standard-Tooltip-Inhalt"; + + if (lineData.polyline) map.removeLayer(lineData.polyline); + + lineData.polyline = L.polyline(lineData.coordinates, { + color: color, + }).addTo(map); + + lineData.polyline.bindTooltip(tooltipContent, { + permanent: false, + direction: "auto", + }); + + lineData.polyline.on("mouseover", () => { + lineData.polyline.setStyle({ weight: 10 }); + lineData.polyline.bringToFront(); + }); + + lineData.polyline.on("mouseout", () => { + lineData.polyline.setStyle({ weight: 5 }); + }); +}; diff --git a/utils/setupPOIs.js b/utils/setupPOIs.js index b4885bbfc..3a8225d77 100644 --- a/utils/setupPOIs.js +++ b/utils/setupPOIs.js @@ -7,7 +7,7 @@ import { parsePoint } from "./geometryUtils"; import circleIcon from "../components/gisPolylines/icons/CircleIcon"; import startIcon from "../components/gisPolylines/icons/StartIcon"; import endIcon from "../components/gisPolylines/icons/EndIcon"; -import { redrawPolyline } from "./mapUtils"; +import { redrawPolyline } from "./redrawPolyline"; import { openInNewTab } from "../utils/openInNewTab"; import { disablePolylineEvents, enablePolylineEvents } from "./setupPolylines"; // Importiere die Funktionen diff --git a/utils/setupPolylines.js b/utils/setupPolylines.js index d3e780525..9a50800a4 100644 --- a/utils/setupPolylines.js +++ b/utils/setupPolylines.js @@ -8,7 +8,7 @@ import { parsePoint } from "./geometryUtils"; import circleIcon from "../components/gisPolylines/icons/CircleIcon"; import startIcon from "../components/gisPolylines/icons/StartIcon"; import endIcon from "../components/gisPolylines/icons/EndIcon"; -import { redrawPolyline } from "./mapUtils"; +import { redrawPolyline } from "./redrawPolyline"; import { openInNewTab } from "./openInNewTab"; import { toast } from "react-toastify"; import { polylineLayerVisibleState } from "../redux/slices/polylineLayerVisibleSlice";