From 43dc3a8359b59baa2ada4b825f8c45cac37c88ee 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: Thu, 19 Oct 2023 16:12:54 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EB=B9=84=ED=96=89=EA=B5=AC=EC=97=AD=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=EC=A2=8C=ED=91=9C=20=ED=91=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/mapbox/draw/LaancDrawControl.js | 6 +- src/views/laanc/LaancAreaMap.js | 184 ++++++------------ 2 files changed, 60 insertions(+), 130 deletions(-) diff --git a/src/components/map/mapbox/draw/LaancDrawControl.js b/src/components/map/mapbox/draw/LaancDrawControl.js index c1adf6e..7517a32 100644 --- a/src/components/map/mapbox/draw/LaancDrawControl.js +++ b/src/components/map/mapbox/draw/LaancDrawControl.js @@ -47,10 +47,6 @@ export const LaancDrawControl = props => { // if (areaType !== drawType) drawInit(); }, [mapControl.drawType]); - // useEffect(() => { - // console.log(props.areaCoordList[0], '-----------'); - // }, [props.areaCoordList]); - useEffect(() => { if (mapObject) { mapObject.on('draw.update', handlerUpdateSetting); @@ -331,6 +327,7 @@ export const LaancDrawControl = props => { const obj = drawObj .getAll() .features.filter(obj => obj.properties.id !== 'BUFFER'); + props.setViewCoordObj(obj); if (obj.length > 1) { props.handlerAddChange('overAdd', true); } else { @@ -473,6 +470,7 @@ export const LaancDrawControl = props => { props.handlerAddChange('isAddable', false); props.handlerAddChange('isViewAdd', false); props.handlerAddChange('overAdd', false); + props.setViewCoordObj([]); drawObj.deleteAll(); handlerRemoveAllMarker(); return; diff --git a/src/views/laanc/LaancAreaMap.js b/src/views/laanc/LaancAreaMap.js index a1a96fb..a42a5a5 100644 --- a/src/views/laanc/LaancAreaMap.js +++ b/src/views/laanc/LaancAreaMap.js @@ -319,7 +319,46 @@ export default function LaancAreaMap({
- {mapObject ? ( + {mapObject && viewCoordObj.length > 0 ? ( +
+ {viewCoordObj?.map((obj, i) => { + const coord = + obj.properties.id === 'LINE' + ? obj.geometry.coordinates + : obj.geometry.coordinates[0]; + + // console.log(coord, '>>>>>>>>>.'); + return ( +
+
비행구역 {i + 1}
+
+ {coord?.map((co, idx) => { + if (idx + 1 < coord.length) { + const fCoord = FormattingCoord(co); + const current = fCoord.join(', '); + const next = FormattingCoord( + coord[idx + 1].join(', ') + ); + // console.log(coord[idx + 1], '---next'); + + return ( +
+ + {current} + / + {next} + +
+ ); + } + })} +
+
+ ); + })} +
+ ) : null} + {/* {mapObject ? (
{drawObj.getAll().features.length > 1 ? drawObj @@ -335,140 +374,33 @@ export default function LaancAreaMap({
비행구역 {i + 1}
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778, 34,55557778 - -
-
- - 12,55557778, 34,55557778 - - / - - 12,55557778,{''} 34,55557778 - -
- {/* {coord?.map(co => { - const fCoord = FormattingCoord(co); - if (fCoord) { + {coord?.map((co, idx) => { + if (idx + 1 < coord.length) { + const fCoord = FormattingCoord(co); + const current = fCoord.join(', '); + const next = FormattingCoord( + coord[idx + 1] + ).join(', '); + return ( - - {fCoord[0]}, {fCoord[1]} - +
+ + {current} + / + {next} + +
); } - })} */} + return null; + })}
); }) : null}
- ) : null} + ) : null} */}