From 1ed1227ded26b722813b8dc56fd4858f602416a3 Mon Sep 17 00:00:00 2001 From: sanguu516 Date: Tue, 2 Apr 2024 14:09:21 +0900 Subject: [PATCH] approvals edit --- .../flight/flightApprovalsContainer.js | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/containers/flight/flightApprovalsContainer.js b/src/containers/flight/flightApprovalsContainer.js index 06a780ac..a979a591 100644 --- a/src/containers/flight/flightApprovalsContainer.js +++ b/src/containers/flight/flightApprovalsContainer.js @@ -217,16 +217,22 @@ export default function FlightApprovalsContainer() { } }, [map]); + useEffect(() => { + if (mapObject) { + console.log('>>>', mapObject.getSource('preview')); + } + }, [mapObject]); + const handlerMapInit = () => { - map.on('style.load', () => { - map.addSource('preview', { + mapObject.on('style.load', () => { + mapObject.addSource('preview', { type: 'geojson', data: previewGeo2 }); - map.addLayer(layerPolyline('preview')); - map.addLayer(layerPolygon('preview')); - map.addLayer(layerBuffer('preview')); - map.addLayer(layerWayPoint('preview')); + mapObject.addLayer(layerPolyline('preview')); + mapObject.addLayer(layerPolygon('preview')); + mapObject.addLayer(layerBuffer('preview')); + mapObject.addLayer(layerWayPoint('preview')); setDrawObj(draw); map.dragRotate.disable(); @@ -269,7 +275,7 @@ export default function FlightApprovalsContainer() { const point = []; if (areas.areaType === 'LINE') { lineString.geometry.coordinates = paths; - previewGeo2features.push(lineString); + previewGeo2.features.push(lineString); //버퍼 생성 if (areas.bufferCoordList) { @@ -291,10 +297,10 @@ export default function FlightApprovalsContainer() { const wayPoint = handlerCreatePoint(p, i, areas.areaType); point.push(wayPoint); }); - previewGeo2features = previewGeo2features.filter( + previewGeo2.features = previewGeo2.features.filter( geo => geo.properties.id !== 'point' ); - point.forEach(p => previewGeo2features.push(p)); + point.forEach(p => previewGeo2.features.push(p)); //지도 줌 좌표 설정 fitZoomPaths = paths.concat();