-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswiperControl.html
More file actions
101 lines (85 loc) · 3.52 KB
/
swiperControl.html
File metadata and controls
101 lines (85 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link href="https://developer.geon.kr/js/odf/odf.css" rel="stylesheet">
<script type="text/javascript" src="https://developer.geon.kr/js/odf/odf.min.js"></script>
</head>
<body>
<div id="map" style="height:550px;"></div>
<div style="margin-top: 15px;">
<input type="button" id="changeStrictMode" class="onoffBtn toggle" onclick="changeStrictMode()" value="strict모드 변경">
</div>
</body>
<script>
/* 맵객체 생성 (외부에서 사용할 때는 proxyURL, proxyParam 옵션이 필요합니다.) */
var mapContainer = document.getElementById('map');
var coord = new odf.Coordinate(199312.9996,551784.6924);
var mapOption = {
center : coord,
zoom : 11,
projection : 'EPSG:5186',
//proxyURL: 'proxyUrl.jsp',
//proxyParam: 'url',
vWorldURL : 'https://gsapi.geon.kr/map/api/vworld/wmts',
basemap : {
vWorld : ['vWorldBase', 'vWorldWhite', 'vWorldMidnight', 'vWorldHybrid', 'vWorldSatellite'],
},
};
var map = new odf.Map(mapContainer, mapOption);
var basemapControl = new odf.BasemapControl();
basemapControl.setMap(map);
var wfsLayer = odf.LayerFactory.produce('geoserver', {
method : 'get',
server : 'https://geoserver.geon.kr/geoserver',
layer : 'geonpaas:L100000254',
service : 'wfs',
});
wfsLayer.setMap(map);
map.setCenter([192396.63847319243, 534166.8213405443]);
map.setZoom(14);
//스와이퍼 컨트롤 추가
var swiperControl = new odf.SwiperControl({
/**기존 사용중이던 레이어를 swiper레이어로 이용
- true : 현재 지도에서 사용중인 레이어를 왼쪽 영영에 표출(기본값)
- false : 왼쪽/오른쪽 영역 표출 레이어 직접 지정
*/
useOriginalLayerFlag : true,//원본레이어를 왼쪽영역에 나타낼지 여부, 기본값 true
/** 엄격한 모드 사용 여부
※ useOriginalLayerFlag 값이 true 일경우에만 적용
- true : 배경지도를 제외한 레이어를 왼쪽 영역에만 표출
- false : 배경지도를 제외한 레이어를 모든 영역에 표출(기본값)
*/
swipeStrictFlag : false,
// 스와이퍼 컨트롤의 슬라이더 너비 (픽셀)
// default값 100. 최소 0, 최대 2000
size : 200,
/**스와이퍼로 나타낼 레이어 배열
- [레이어1, 레이어2, ...] : useOriginalLayerFlag가 true일때 이와 같은 양식 적용.
오른쪽 영역에 표출할 레이어 목록 정의
- [[레이어1, 레이어2, ...],[레이어5, 레이어6, ...]] : useOriginalLayerFlag가 false일때 이와 같은 양식 적용.
[왼쪽 영역에 표출할 레이어 배열, 오른쪽 영역에 표출할 레이어 배열]
*/
layers : [ basemapControl.getBaseLayer('vSatellite') ],
});
swiperControl.setMap(map);
//layers 값 셋팅
//swiperControl.setLayers([ basemapControl.getBaseLayer('vHybrid') ]);
//SwiperControl의 슬라이더 값 셋팅
//swiperControl.setSliderValue(30/*셋팅할 슬라이더 값 (0~100사이의 숫자)*/);
//SwiperControl의 슬라이더 값 조회
//console.log(swiperControl.getSliderValue());
//SwiperControl에 엄격모드 적용
//swiperControl.setSwipeStrictFlag(true);
//슬라이더 적용 여부 정의
//swiperControl.setState(true/*슬라이더 적용 여부(true=>적용/false=>미적용)*/);
//슬라이더 적용 여부 조회
//console.log(swiperControl.getState());
var strictMode = false;
function changeStrictMode() {
//SwiperControl에 엄격모드 적용
swiperControl.setSwipeStrictFlag(strictMode);
strictMode = !strictMode;
}
</script>
</html>