1- import React , { useState } from "react" ;
1+ import React , { useRef , useState } from "react" ;
22import {
33 CustomCircle ,
44 CustomMarker ,
5+ CustomPolyLine ,
56 CustomPolygon ,
7+ CustomRectangle ,
68} from "./lib/Map/layer/annotation" ;
7- import InnerText from "./lib/Map/Text" ;
8- import FullScreenFeature from "./lib/Map/control/FullScreenFeature" ;
9- import ControlSection from "./lib/Map/control/layout/ControlSection" ;
10- import ZoomFeature from "./lib/Map/control/ZoomFeature" ;
11- import CompassWheel from "./lib/Map/control/CompassWheel" ;
12- import { TileLayer } from "./lib/Map/layer/tileLayer" ;
13- import { ImageOveray , LayerGroup } from "./lib/Map" ;
14- import DrawingTools from "./lib/Map/control/DrawingTools" ;
9+ import { InnerText } from "./lib/Map/Text" ;
10+ import { FullScreenFeature } from "./lib/Map/control/FullScreenFeature" ;
11+ import { ControlSection } from "./lib/Map/control/layout/ControlSection" ;
12+ import { ZoomFeature } from "./lib/Map/control/ZoomFeature" ;
13+ import { CompassWheel } from "./lib/Map/control/CompassWheel" ;
14+ import { ImageOverlay , LayerGroup , MapContainer , fromLonLat } from "./lib/Map" ;
15+ import { DrawingTools } from "./lib/Map/control/DrawingTools" ;
1516import { getProfileFromFeature } from "./lib/Map/utils/utils" ;
16- import CustomMultiPoint from "./lib/Map/layer/annotation/MultiPoint" ;
17+ import { CustomMultiPoint } from "./lib/Map/layer/annotation/MultiPoint" ;
1718import { icon } from "./lib" ;
19+ import { Map , View } from "ol" ;
1820
19- icon . marker = "images/marker-icon.png" ;
21+ icon . marker = "/images/marker-basic.png" ;
22+ icon . selected = "/images/marker-selected.png" ;
2023
2124function App ( ) {
2225 const [ isShown , setIsShown ] = useState ( true ) ;
@@ -25,68 +28,107 @@ function App() {
2528 setIsShown ( ( prev ) => ! prev ) ;
2629 }
2730
31+ const ref = useRef < Map > ( null ) ;
32+
2833 return (
2934 < div className = "App" >
30- { /* <GeoJsonLayer geoJson={geoJsonSample} /> */ }
31- { /* <TileLayer url="https://tgxe79f6wl.execute-api.ap-northeast-2.amazonaws.com/dev/dev-drone-square-bucket/public/1/manifold/orthomosaic_tiles/{z}/{x}/{y}.png" /> */ }
32- < ImageOveray
33- imageUrl = "images/compass.png"
34- bounds = { [
35- [ 126.841384 , 35.191316 ] ,
36- [ 126.841584 , 35.191516 ] ,
37- ] }
38- />
39- { /* <CustomCircle center={[126.841242, 35.190518]} r[adius={20}>
35+ < MapContainer ref = { ref } isAbledSelection >
36+ { /* <GeoJsonLayer geoJson={geoJsonSample} /> */ }
37+ { /* <TileLayer url="https://tgxe79f6wl.execute-api.ap-northeast-2.amazonaws.com/dev/dev-drone-square-bucket/public/1/manifold/orthomosaic_tiles/{z}/{x}/{y}.png" /> */ }
38+ < ImageOverlay
39+ imageUrl = "images/compass.png"
40+ bounds = { [
41+ [ 126.841384 , 35.191316 ] ,
42+ [ 126.841584 , 35.191516 ] ,
43+ ] }
44+ />
45+ { /* <CustomCircle center={[126.841242, 35.190518]} r[adius={20}>
4046 <InnerText size={27} color="red" outline={false}>
4147 hello1
4248 </InnerText>
4349 </CustomCircle> */ }
44- < LayerGroup zIndex = { 1 } >
45- < CustomCircle center = { [ 126.841884 , 35.191516 ] } radius = { 20 } color = "RED" >
46- < InnerText > Circle1</ InnerText >
47- </ CustomCircle >
48- </ LayerGroup >
49- < LayerGroup zIndex = { 2 } >
50- < CustomCircle center = { [ 126.841784 , 35.191406 ] } radius = { 20 } color = "BLUE" >
51- < InnerText > Circle2</ InnerText >
52- </ CustomCircle >
53- </ LayerGroup >
54- { isShown && (
55- < >
56- < LayerGroup zIndex = { 2 } >
57- < CustomMultiPoint
58- onClick = { ( event ) =>
59- console . log ( "event" , getProfileFromFeature ( event . annotation ) )
60- }
61- positions = { [
62- [ 126.843684 , 35.190616 ] ,
63- [ 126.840476 , 35.190219 ] ,
64- [ 126.840604 , 35.190133 ] ,
65- [ 126.841268 , 35.190381 ] ,
66- ] }
67- >
68- < InnerText > multi</ InnerText >
69- </ CustomMultiPoint >
70- < CustomPolygon
71- onClick = { ( event ) =>
72- console . log ( "event" , getProfileFromFeature ( event . annotation ) )
73- }
74- positions = { [
75- [
76- [ 126.840884 , 35.190816 ] ,
77- [ 126.840676 , 35.190419 ] ,
78- [ 126.840804 , 35.190333 ] ,
79- [ 126.841068 , 35.190581 ] ,
80- [ 126.840884 , 35.190816 ] ,
81- ] ,
82- ] }
83- >
84- < InnerText > hello2</ InnerText >
85- </ CustomPolygon >
86- </ LayerGroup >
87- </ >
88- ) }
89- { /* <CustomTextMarker center={[126.841711, 35.190274]}>
50+ < LayerGroup zIndex = { 1 } >
51+ < CustomMarker selected center = { [ 126.841384 , 35.191516 ] } >
52+ < InnerText outline > Marker</ InnerText >
53+ </ CustomMarker >
54+ < CustomMarker center = { [ 126.841084 , 35.191516 ] } >
55+ < InnerText outline > Marker</ InnerText >
56+ </ CustomMarker >
57+ < CustomCircle
58+ center = { [ 126.841884 , 35.191516 ] }
59+ radius = { 20 }
60+ color = "RED"
61+ >
62+ < InnerText isPopup > Circle1</ InnerText >
63+ </ CustomCircle >
64+ </ LayerGroup >
65+ < LayerGroup zIndex = { 0 } >
66+ < CustomCircle
67+ center = { [ 126.841784 , 35.191406 ] }
68+ radius = { 20 }
69+ color = "BLUE"
70+ >
71+ < InnerText > Circle2</ InnerText >
72+ </ CustomCircle >
73+ </ LayerGroup >
74+ { isShown && (
75+ < >
76+ < LayerGroup zIndex = { 2 } >
77+ < CustomMultiPoint
78+ onClick = { ( event ) =>
79+ console . log ( "event" , getProfileFromFeature ( event . annotation ) )
80+ }
81+ positions = { [
82+ [ 126.843684 , 35.190616 ] ,
83+ [ 126.840476 , 35.190219 ] ,
84+ [ 126.840604 , 35.190133 ] ,
85+ [ 126.841268 , 35.190381 ] ,
86+ ] }
87+ >
88+ < InnerText > multi</ InnerText >
89+ </ CustomMultiPoint >
90+ < CustomPolygon
91+ onClick = { ( event ) =>
92+ console . log ( "event" , getProfileFromFeature ( event . annotation ) )
93+ }
94+ positions = { [
95+ [
96+ [ 126.840884 , 35.190816 ] ,
97+ [ 126.840676 , 35.190419 ] ,
98+ [ 126.840804 , 35.190333 ] ,
99+ [ 126.841068 , 35.190581 ] ,
100+ [ 126.840884 , 35.190816 ] ,
101+ ] ,
102+ ] }
103+ >
104+ < InnerText isPopup > hello2</ InnerText >
105+ </ CustomPolygon >
106+ < CustomPolyLine
107+ positions = { [
108+ [ 126.840684 , 35.190816 ] ,
109+ [ 126.840476 , 35.190419 ] ,
110+ [ 126.840604 , 35.190333 ] ,
111+ [ 126.840868 , 35.190581 ] ,
112+ ] }
113+ >
114+ < InnerText isPopup > hello2</ InnerText >
115+ </ CustomPolyLine >
116+ < CustomRectangle
117+ positions = { [
118+ [
119+ [ 126.840684 , 35.190219 ] ,
120+ [ 126.840476 , 35.190219 ] ,
121+ [ 126.840476 , 35.190133 ] ,
122+ [ 126.840684 , 35.190133 ] ,
123+ ] ,
124+ ] }
125+ >
126+ < InnerText isPopup > hello2</ InnerText >
127+ </ CustomRectangle >
128+ </ LayerGroup >
129+ </ >
130+ ) }
131+ { /* <CustomTextMarker center={[126.841711, 35.190274]}>
90132 <InnerText outline>Text</InnerText>
91133 </CustomTextMarker>
92134 <CustomMarker center={[127.9745613, 37.3336563]}>
@@ -106,24 +148,22 @@ function App() {
106148 <InnerText>hello2</InnerText>
107149 </CustomRectangle> */ }
108150
109- { /* <CustomPolyLine
110- positions={[
111- [126.840884, 35.190816],
112- [126.840676, 35.190419],
113- [126.840804, 35.190333],
114- [126.841068, 35.190581],
115- ]}
151+ < CompassWheel />
152+ < ControlSection >
153+ < ZoomFeature />
154+ < FullScreenFeature />
155+ < DrawingTools onCanvas />
156+ </ ControlSection >
157+ </ MapContainer >
158+ < button
159+ onClick = { ( ) => {
160+ ref . current ?. setView (
161+ new View ( { center : fromLonLat ( [ 126.840884 , 35.190816 ] ) , zoom : 10 } )
162+ ) ;
163+ } }
116164 >
117- <InnerText>hello2</InnerText>
118- </CustomPolyLine> */ }
119-
120- < CompassWheel />
121- < ControlSection >
122- < ZoomFeature />
123- < FullScreenFeature />
124- < DrawingTools onCanvas />
125- </ ControlSection >
126- < button onClick = { off } > off</ button >
165+ off
166+ </ button >
127167 </ div >
128168 ) ;
129169}
0 commit comments