Fix: redrawPoline.js und POI hinzufgen auf die Karte in Kontextmenü
This commit is contained in:
@@ -7,12 +7,12 @@ DB_NAME=talas_v5
|
|||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
# Public Settings (Client braucht IP/Domain)
|
# 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_ENABLE_GEOCODER=true
|
||||||
NEXT_PUBLIC_USE_MOCK_API=false
|
NEXT_PUBLIC_USE_MOCK_API=false
|
||||||
NEXT_PUBLIC_DEBUG_LOG=true
|
NEXT_PUBLIC_DEBUG_LOG=true
|
||||||
|
|
||||||
# für Polylines/kabelstecken -> in Konextmenü "Station öffnen" "
|
# für Polylines/kabelstecken -> in Konextmenü "Station öffnen" "
|
||||||
NEXT_PUBLIC_BASE_URL=http://192.168.10.33/talas5/devices/
|
NEXT_PUBLIC_BASE_URL=http://10.10.0.70/talas5/devices/
|
||||||
NEXT_PUBLIC_API_BASE_URL=http://192.168.10.33/talas5/ClientData/WebServiceMap.asmx
|
NEXT_PUBLIC_API_BASE_URL=http://10.10.0.70/talas5/ClientData/WebServiceMap.asmx
|
||||||
NEXT_PUBLIC_API_PORT_3000=http://192.168.10.33:3000
|
NEXT_PUBLIC_API_PORT_3000=http://10.10.0.70:3000
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// /config/appVersion
|
// /config/appVersion
|
||||||
export const APP_VERSION = "1.1.39";
|
export const APP_VERSION = "1.1.40";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// /utils/markerUtils.js
|
// /utils/markerUtils.js
|
||||||
import circleIcon from "../components/CircleIcon";
|
import circleIcon from "../components/CircleIcon";
|
||||||
import { saveLineData, redrawPolyline } from "./mapUtils";
|
import { saveLineData } from "./mapUtils";
|
||||||
|
import { redrawPolyline } from "./mapUtils";
|
||||||
import L from "leaflet";
|
import L from "leaflet";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
@@ -9,10 +10,7 @@ export const insertNewMarker = (closestPoints, newPoint, lineData, map) => {
|
|||||||
icon: circleIcon,
|
icon: circleIcon,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
lineData.coordinates.splice(closestPoints[2], 0, [
|
lineData.coordinates.splice(closestPoints[2], 0, [newPoint.lat, newPoint.lng]);
|
||||||
newPoint.lat,
|
|
||||||
newPoint.lng,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Hier direkt speichern nach Einfügen
|
// Hier direkt speichern nach Einfügen
|
||||||
saveLineData(lineData);
|
saveLineData(lineData);
|
||||||
@@ -39,9 +37,7 @@ export const removeMarker = (marker, lineData, currentZoom, currentCenter) => {
|
|||||||
//localStorage.setItem("mapCenter", JSON.stringify(currentCenter));
|
//localStorage.setItem("mapCenter", JSON.stringify(currentCenter));
|
||||||
|
|
||||||
// Find the index of the coordinate that matches the marker's position
|
// Find the index of the coordinate that matches the marker's position
|
||||||
const index = lineData.coordinates.findIndex((coord) =>
|
const index = lineData.coordinates.findIndex((coord) => L.latLng(coord[0], coord[1]).equals(marker.getLatLng()));
|
||||||
L.latLng(coord[0], coord[1]).equals(marker.getLatLng())
|
|
||||||
);
|
|
||||||
|
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
// Remove the coordinate from the line data
|
// Remove the coordinate from the line data
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// /utils/poiUtils.js
|
// /utils/poiUtils.js
|
||||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon.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 L from "leaflet";
|
||||||
import "leaflet.smooth_marker_bouncing";
|
import "leaflet.smooth_marker_bouncing";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
|||||||
35
utils/redrawPolyline.js
Normal file
35
utils/redrawPolyline.js
Normal file
@@ -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 });
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -7,7 +7,7 @@ import { parsePoint } from "./geometryUtils";
|
|||||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
||||||
import startIcon from "../components/gisPolylines/icons/StartIcon";
|
import startIcon from "../components/gisPolylines/icons/StartIcon";
|
||||||
import endIcon from "../components/gisPolylines/icons/EndIcon";
|
import endIcon from "../components/gisPolylines/icons/EndIcon";
|
||||||
import { redrawPolyline } from "./mapUtils";
|
import { redrawPolyline } from "./redrawPolyline";
|
||||||
import { openInNewTab } from "../utils/openInNewTab";
|
import { openInNewTab } from "../utils/openInNewTab";
|
||||||
import { disablePolylineEvents, enablePolylineEvents } from "./setupPolylines"; // Importiere die Funktionen
|
import { disablePolylineEvents, enablePolylineEvents } from "./setupPolylines"; // Importiere die Funktionen
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { parsePoint } from "./geometryUtils";
|
|||||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
||||||
import startIcon from "../components/gisPolylines/icons/StartIcon";
|
import startIcon from "../components/gisPolylines/icons/StartIcon";
|
||||||
import endIcon from "../components/gisPolylines/icons/EndIcon";
|
import endIcon from "../components/gisPolylines/icons/EndIcon";
|
||||||
import { redrawPolyline } from "./mapUtils";
|
import { redrawPolyline } from "./redrawPolyline";
|
||||||
import { openInNewTab } from "./openInNewTab";
|
import { openInNewTab } from "./openInNewTab";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { polylineLayerVisibleState } from "../redux/slices/polylineLayerVisibleSlice";
|
import { polylineLayerVisibleState } from "../redux/slices/polylineLayerVisibleSlice";
|
||||||
|
|||||||
Reference in New Issue
Block a user