From 8ed8129a347f461b8fc9389b369247108589870a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?junh=5Feee=28=EC=9D=B4=EC=A4=80=ED=9D=AC=29?= Date: Fri, 2 Aug 2024 15:05:44 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AF=B8=EC=82=AC=EC=9A=A9=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20=EC=A2=8C=ED=91=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/mapbox/MapBoxMap.js | 96 -------------------------- test/coordTest.js | 57 +++++++++++++++ 2 files changed, 57 insertions(+), 96 deletions(-) create mode 100644 test/coordTest.js diff --git a/src/components/map/mapbox/MapBoxMap.js b/src/components/map/mapbox/MapBoxMap.js index 358198d2..8f1a0c69 100644 --- a/src/components/map/mapbox/MapBoxMap.js +++ b/src/components/map/mapbox/MapBoxMap.js @@ -106,65 +106,6 @@ export default function MapBoxMap({ handlerDrawObjInit }) { features: [] }); - // 공역 수정 작업 - // useEffect(() => { - // const line = turf.lineString([ - // [0, 0], - // [0, 0] - // ]); - - // if (line.geometry.coordinates.length > 0) { - // const coordList = []; - // line.geometry.coordinates.map(coord => { - // coordList.push({ - // planAreacoordSno: 0, - // planAreaSno: 0, - // lat: coord[1], - // lon: coord[0], - // createUserId: '', - // createDt: '' - // }); - // }); - // const rq = { - // planAreaSno: 0, - // planSno: 0, - // areaType: 'LINE', - // fltMethod: '', - // fltMothoeRm: '', - // bufferZone: 367, - // concatBufferZone: 0, - // fltElev: 0, - // createUserId: '', - // createDt: '', - // updateUserId: '', - // updateDt: '', - // coordList: coordList - // }; - - // dispatch(AreaBufferList([rq])).then(res => { - // const buffer = res.payload[0].bufferCoordList; - // const bufferCoord = []; - - // buffer.map(bf => { - // bufferCoord.push([bf.lon, bf.lat]); - // }); - // console.log(bufferCoord, '-----bufferCoord'); - // }); - // } - - // const linee = turf.lineString([ - // [126.773741386, 37.5677930496, 18.59], - // [126.7461278299, 37.5840418952, 82.81], - // [126.6355487467, 37.6489641997, 381.99] - // ]); - // const circle = turf.lineString([ - // [126.70986209199998, 37.60272668099992], - // [126.71112399499998, 37.604222307999976], - // ]); - // const intersect = turf.lineIntersect(linee, circle); - // console.log(intersect, '----intersect'); - // }, []); - // 지도 초기 셋팅 useLayoutEffect(() => { mapBoxMapInit(); @@ -174,46 +115,9 @@ export default function MapBoxMap({ handlerDrawObjInit }) { useEffect(() => { if (mapObject) { handlerCreateAirSpace(mapObject); - handlerCreateOperation(mapObject); } }, [mapState?.areaType]); - // 운항과 레이어 추가 - const handlerCreateOperation = map => { - // if (map.getLayer('operationLayer')) { - // map.removeLayer('operationLayer-center'); - // map.removeLayer('operationLayer-circle'); - // map.removeSource('operationLayer'); - // } - // map.addSource('operationLayer', { - // type: 'geojson', - // data: {} - // }); - // map.addLayer({ - // id: 'operation-center', - // type: 'circle', - // source: 'operationLayer', - // paint: { - // 'circle-radius': 5, - // 'circle-color': '#8a1c05', - // 'circle-stroke-color': '#000000', - // 'circle-stroke-width': 1 - // }, - // filter: ['in', '$type', 'Point'] - // }); - // map.addLayer({ - // id: 'operation-circle', - // type: 'fill', - // source: 'operationLayer', - // layout: {}, - // paint: { - // 'fill-color': '#8a1c05', - // 'fill-opacity': 0.5, - // 'fill-outline-color': '#000000' - // }, - // filter: ['in', '$type', 'Polygon'] - // }); - }; // 공역 생성 const handlerCreateAirSpace = ( map, diff --git a/test/coordTest.js b/test/coordTest.js new file mode 100644 index 00000000..1e21703c --- /dev/null +++ b/test/coordTest.js @@ -0,0 +1,57 @@ +import * as turf from '@turf/turf'; + +const handlerTest = () => { + const line = turf.lineString([ + [0, 0], + [0, 0] + ]); + + if (line.geometry.coordinates.length > 0) { + const coordList = []; + line.geometry.coordinates.map(coord => { + coordList.push({ + planAreacoordSno: 0, + planAreaSno: 0, + lat: coord[1], + lon: coord[0], + createUserId: '', + createDt: '' + }); + }); + const rq = { + planAreaSno: 0, + planSno: 0, + areaType: 'LINE', + fltMethod: '', + fltMothoeRm: '', + bufferZone: 367, + concatBufferZone: 0, + fltElev: 0, + createUserId: '', + createDt: '', + updateUserId: '', + updateDt: '', + coordList: coordList + }; + + // dispatch(AreaBufferList([rq])).then(res => { + // const buffer = res.payload[0].bufferCoordList; + // const bufferCoord = []; + + // buffer.map(bf => { + // bufferCoord.push([bf.lon, bf.lat]); + // }); + // }); + } + + const linee = turf.lineString([ + [126.773741386, 37.5677930496, 18.59], + [126.7461278299, 37.5840418952, 82.81], + [126.6355487467, 37.6489641997, 381.99] + ]); + const circle = turf.lineString([ + [126.70986209199998, 37.60272668099992], + [126.71112399499998, 37.604222307999976] + ]); + const intersect = turf.lineIntersect(linee, circle); +};