forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroler_zoomBox.html
More file actions
48 lines (45 loc) · 1.97 KB
/
controler_zoomBox.html
File metadata and controls
48 lines (45 loc) · 1.97 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
<!--********************************************************************
* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title data-i18n="resources.title_zoomBox"></title>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
var map, layerWorld;
var url = host + "/iserver/services/map-world/rest/maps/World";
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.Navigation()]
}, notice());
function notice() {
widgets.alert.showAlert(resources.msg_zoomBox,true,300,false,0.8);
}
//初始化拉框缩放控件类
zoombox = new SuperMap.Control.ZoomBox({
keyMask: SuperMap.Handler.MOD_SHIFT, "autoActivate": true //设置keyMask属性,使同时按住Shift绘矩形框
});
//是否将该控件设置为拉框缩小,默认为false,拉框放大
zoombox.out = false;
map.addControl(zoombox);//添加控件
//获取图层服务地址
layerWorld = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
transparent: true,
cacheEnabled: true
}, {maxResolution: "auto"});
layerWorld.events.on({"layerInitialized": addLayer});
//添加地图图层、拉框缩放控件到map
function addLayer() {
map.addLayer(layerWorld);
map.setCenter(new SuperMap.LonLat(0, 0), 1);
}
</script>
</body>
</html>