forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathothers_a0mapPrint.html
More file actions
83 lines (80 loc) · 3.22 KB
/
others_a0mapPrint.html
File metadata and controls
83 lines (80 loc) · 3.22 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
<!--********************************************************************
* 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"/>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7,IE=9,IE=10,IE=11"/>
<title data-i18n="resources.title_a0mapPrint"></title>
<style type="text/css">
.editPane {
position: absolute;
right: 180px;
top: 10px;
text-align: center;
background: #FFF;
z-index: 1000;
}
</style>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div class='panel panel-primary editPane' id='editPane' style="z-index: 99999">
<div class='panel-heading'>
<h5 class='panel-title text-center' data-i18n="resources.text_a0mapPrint"></h5>
</div>
<div class='panel-body' id='params'>
<p></p>
<div align='center' class='button-group'>
<input type='button' id='btn1' class='btn btn-primary' data-i18n="[value]resources.btn_a0Print"
onclick="doLargeFormatPrint()"/>
</div>
</div>
</div>
<div id="map" style="margin:0 auto;width: 100%;height: 100%; position: relative;"></div>
<script type="text/javascript" include="bootstrap,widgets.alert" src="../js/include-web.js"></script>
<script type="text/javascript" exclude="iclient-classic" include="LargeFormatPrints"
src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
var map, layer;
host = window.isLocal ? window.server : "https://iserver.supermap.io",
url = host + "/iserver/services/map-china400/rest/maps/China";
//定义layer图层,TiledDynamicRESTLayer:分块动态 REST 图层
layer = new SuperMap.Layer.TiledDynamicRESTLayer("China", url, {
transparent: true,
cacheEnabled: true
}, {maxResolution: "auto", useCanvas: false});
//为图层初始化完毕添加addLayer()事件
layer.events.on({"layerInitialized": addLayer});
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.LayerSwitcher(),
new SuperMap.Control.OverviewMap(),
new SuperMap.Control.ScaleLine(),
new SuperMap.Control.Zoom(),
new SuperMap.Control.Navigation({
dragPanOptions: {
enableKinetic: true
}
})
]
});
function addLayer() {
map.addLayers([layer]);
map.setCenter(new SuperMap.LonLat(9733502.481499, 4614406.969325), 4);
}
//A0大幅打印
function doLargeFormatPrint() {
var broz = SuperMap.Browser.name;
if (broz == 'msie' && parseInt(SuperMap.Browser.version) < 9) {
widgets.alert.showAlert(resources.msg_supportPrint, false);
return;
}
//map.div.style.display = "none";
var center = map.getCenter();
var scale = map.getScale();
LargeFormatPrint && LargeFormatPrint.excute(url, "3857", scale, center, "A0", map);
}
</script>
</body>
</html>