Browse Source

지도 검색 - 기초작업

feature/auth
junh_eee 2 years ago
parent
commit
cefa35620e
  1. 53
      src/components/basis/flight/plan/FlightPlanAreaMap.js
  2. 14
      test/pav-warning.js

53
src/components/basis/flight/plan/FlightPlanAreaMap.js

@ -3,6 +3,7 @@ import {
Card, Card,
CardBody, CardBody,
Button, Button,
Input
} from 'reactstrap'; } from 'reactstrap';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { FeatureAirZone } from '../../../map/naver/feature/FeatureAirZone'; import { FeatureAirZone } from '../../../map/naver/feature/FeatureAirZone';
@ -23,6 +24,7 @@ const FlightPlanAreaMap = (props) => {
const [mode, setMode] = useState(); const [mode, setMode] = useState();
const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList); const [mapAreaCoordList, setMapAreaCoordList] = useState(initFlightBas.initDetail.areaList);
const [searchData, setSearchData] = useState();
useEffect(() => { useEffect(() => {
NaverMapInit(); NaverMapInit();
@ -50,20 +52,6 @@ const FlightPlanAreaMap = (props) => {
}, [areaCoordList]); }, [areaCoordList]);
const search = (latlng) => {
naver.maps.Service.reverseGeocode({
coords: latlng,
orders: [
naver.maps.Service.OrderType.ADDR,
naver.maps.Service.OrderType.ROAD_ADDR
].join(',')
}, )
}
const ModeInit = () => { const ModeInit = () => {
setMode(mapControl.drawType) setMode(mapControl.drawType)
} }
@ -136,6 +124,18 @@ const FlightPlanAreaMap = (props) => {
setMapAreaCoordList(areaList); setMapAreaCoordList(areaList);
} }
const handleSearch = () => {
console.log(searchData, 'encoding')
}
const handleChange = e => {
const {name, value} = e.target;
if(name=='searchInput') {
setSearchData(encodeURI(value));
}
}
return ( return (
<Card className='mb-0'> <Card className='mb-0'>
<CardBody> <CardBody>
@ -160,13 +160,6 @@ const FlightPlanAreaMap = (props) => {
handleConfirm={props.handleConfirm} handleConfirm={props.handleConfirm}
/> : null} /> : null}
{/* <Button.Ripple
color='primary'
className='area-button'
onClick = {e => props.handleConfirm(mapAreaCoordList)}
>
확인
</Button.Ripple> */}
<Button.Ripple <Button.Ripple
color='primary' color='primary'
className='area-button' className='area-button'
@ -180,6 +173,24 @@ const FlightPlanAreaMap = (props) => {
> >
초기화 초기화
</Button.Ripple> </Button.Ripple>
<Input
type='text'
id='searchInput'
name='searchInput'
className='area-input'
placeholder='검색명을 입력하세요.'
onChange={handleChange}
// bsSize='sm'
/>
<Button.Ripple
// className='mr-1'
className='area-button'
color='primary'
onClick={handleSearch}
// size='sm'
>
검색
</Button.Ripple>
</div> </div>
</div> </div>

14
test/pav-warning.js

@ -1,18 +1,21 @@
const {getConnection, writeData} = require("./pav-client") const {getConnection, writeData} = require("./pav-client")
const {getCoordsFormBetweenCoord, dumyData} = require("./pav-utils") const {getCoordsFormBetweenCoord, dumyData} = require("./pav-utils")
// const host = "192.168.0.24" const host = "192.168.0.28"
// const host = "localhost" // const host = "localhost"
const host = "211.43.13.240" // const host = "211.43.13.240"
const port = 8082 const port = 8082
// 기본정보 // 기본정보
const prefix = 'TEST-DRON-W-' const prefix = 'TEST-DRON-W'
const pathSampleCoord = [ const pathSampleCoord = [
[37.5215, 126.6050], [37.5215, 126.6050],
[37.5215, 126.6082], [37.5215, 126.6082],
[37.5210, 126.6082],
// [37.5210, 126.6082],
[37.5210, 126.6182],
[37.5210, 126.6057], [37.5210, 126.6057],
[37.5205, 126.6057], [37.5205, 126.6057],
[37.5205, 126.6082], [37.5205, 126.6082],
@ -38,7 +41,8 @@ const getCoords = (coords) => {
} }
const getClient = () => { const getClient = () => {
const dronName = prefix + '001'; // const dronName = prefix + '001';
const dronName = prefix + '008';
const client = {}; const client = {};
client.dronName = dronName client.dronName = dronName

Loading…
Cancel
Save