From c8ac4ebdb783829abff1e1bd3a262e850b781a4f Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 14 Jun 2024 13:20:09 +0200 Subject: [PATCH] clear: delete comments and previos code --- components/MapComponent.js | 68 +------------------------------------- 1 file changed, 1 insertion(+), 67 deletions(-) diff --git a/components/MapComponent.js b/components/MapComponent.js index dfbd324ce..ead011182 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -2082,9 +2082,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { sonstigeMarkers, ulafMarkers, ]); - + //--------------------------------------------------------- //LINESTRING (53.151257 8.190471,53.161601 8.129359,53.19802 8.092366,53.244065 8.014003,53.252539 7.954265) - const [lineColors, setLineColors] = useState({}); // API-Aufruf, um Farben der Linien abzurufen @@ -2139,66 +2138,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { }); }, []); - // Karte-Linien Zeichnen - /* const blueCircleIcon = new L.Icon({ - iconUrl: "path_to_your_blue_circle_image", // Provide the path to your blue circle image - iconSize: [10, 10], // Set the size of the icon - iconAnchor: [5, 5], // Set the anchor point so the icon is centered - className: "leaflet-div-icon", - }); - - useEffect(() => { - if (!map) return; - - linePositions.forEach((lineData) => { - if (lineData.coordinates.length > 0) { - const color = lineColors[lineData.idModul] || "#000000"; // Standardfarbe schwarz, wenn keine Farbe gefunden - const polyline = L.polyline(lineData.coordinates, { color }).addTo(map); - //--------------------------------------------------------- - // Erstellt einen verschiebbaren Marker - const draggableMarker = L.circleMarker(lineData.coordinates[0], { - icon: blueCircleIcon, - draggable: true, // Ermöglicht das Verschieben des Markers - }).addTo(map); - - const updatePolyline = () => { - polyline.setLatLngs( - lineData.coordinates.map((coord) => { - if (coord === lineData.coordinates[0]) { - return draggableMarker.getLatLng(); - } - return coord; - }) - ); - }; - - // Event Listener für 'dragend' um die neue Position zu erfassen - draggableMarker.on("drag", updatePolyline); - const group = new L.featureGroup([draggableMarker, polyline]); - map.fitBounds(group.getBounds().pad(0.5)); // Adds padding around the group - //--------------------------------------------------------- - L.circleMarker(lineData.coordinates[lineData.coordinates.length - 1], { - radius: 5, - fillColor: "#0000FF", - color: "#0000FF", - weight: 1, - opacity: 1, - fillOpacity: 0.8, - }).addTo(map); - - for (let i = 1; i < lineData.coordinates.length - 1; i++) { - L.circleMarker(lineData.coordinates[i], { - radius: 3, - fillColor: "#FFFF00", - color: "#FFFF00", - weight: 1, - opacity: 1, - fillOpacity: 0.8, - }).addTo(map); - } - } - }); - }, [map, linePositions, lineColors]); */ //--------------------------------------------------------- // Custom circle icon for draggable markers const circleIcon = L.divIcon({ @@ -2207,11 +2146,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { iconSize: [25, 25], iconAnchor: [5, 5], }); - //const[polylines, setPolylines] = useState([]); - /* useEffect(() => { - if (!map) return; - }, [map, linePositions, lineColors]); */ - //--------------------------------------------------------- // Function to initialize markers and polylines useEffect(() => {