clear: delete comments and previos code
This commit is contained in:
@@ -2082,9 +2082,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
sonstigeMarkers,
|
sonstigeMarkers,
|
||||||
ulafMarkers,
|
ulafMarkers,
|
||||||
]);
|
]);
|
||||||
|
//---------------------------------------------------------
|
||||||
//LINESTRING (53.151257 8.190471,53.161601 8.129359,53.19802 8.092366,53.244065 8.014003,53.252539 7.954265)
|
//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({});
|
const [lineColors, setLineColors] = useState({});
|
||||||
|
|
||||||
// API-Aufruf, um Farben der Linien abzurufen
|
// 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
|
// Custom circle icon for draggable markers
|
||||||
const circleIcon = L.divIcon({
|
const circleIcon = L.divIcon({
|
||||||
@@ -2207,11 +2146,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
iconSize: [25, 25],
|
iconSize: [25, 25],
|
||||||
iconAnchor: [5, 5],
|
iconAnchor: [5, 5],
|
||||||
});
|
});
|
||||||
//const[polylines, setPolylines] = useState([]);
|
|
||||||
/* useEffect(() => {
|
|
||||||
if (!map) return;
|
|
||||||
}, [map, linePositions, lineColors]); */
|
|
||||||
//---------------------------------------------------------
|
|
||||||
|
|
||||||
// Function to initialize markers and polylines
|
// Function to initialize markers and polylines
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user