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} */}