Skip to content

Commit 9622dbb

Browse files
committed
1.修改打包逻辑(leafletjs打包进SuperMapiClient,将leaflet css和img单独打包使用,参考example下leaflet示例)
2.SuperMap服务结果直接转GeoJSON,去除转客户端步骤,提升速度 review by caoxinke
1 parent 450c82d commit 9622dbb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+591
-4235
lines changed
File renamed without changes.

examples/css/bootstrap.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/leaflet/01_layerService.html

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>SuperMap 图层信息</title>
6-
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.css"/>
7-
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
8-
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.js"></script>
6+
<link rel="stylesheet" href="../css/bootstrap.min.css">
7+
<link rel="stylesheet" href="../../dist/leaflet.css">
98
<script type="text/javascript" src="../../dist/SuperMapiClient9.js"></script>
109
<script type="text/javascript">
1110
var map, infowin,
12-
wms = "http://support.supermap.com.cn:8090/iserver/services/map-world/wms111/World",
1311
url = "http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World";
1412
function init() {
1513
map = L.map('map', {
@@ -19,12 +17,7 @@
1917
maxZoom: 18,
2018
zoom: 2
2119
});
22-
L.tileLayer.wms(wms, {
23-
noWrap: true,
24-
layers: 'World',
25-
format: 'image/png',
26-
transparent: true
27-
}).addTo(map);
20+
L.supermap.tiledMapLayer(url).addTo(map);
2821
}
2922

3023
function layerService() {

examples/leaflet/01_mapQueryByBounds.html

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
<html>
33
<head>
44
<title>地图bounds查询</title>
5-
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.css"/>
6-
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
7-
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.js"></script>
5+
<link rel="stylesheet" href="../css/bootstrap.min.css">
6+
<link rel="stylesheet" href="../../dist/leaflet.css">
87
<script type="text/javascript" src="../../dist/SuperMapiClient9.js"></script>
98
<script type="text/javascript">
109
var map, polygon, resultLayer,
11-
wms = "http://support.supermap.com.cn:8090/iserver/services/map-world/wms111/World",
1210
url = "http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World";
1311
function init() {
1412
map = L.map('map', {
@@ -18,23 +16,17 @@
1816
maxZoom: 18,
1917
zoom: 1
2018
});
21-
L.tileLayer.wms(wms, {
22-
noWrap: true,
23-
layers: 'World',
24-
format: 'image/png',
25-
transparent: true
26-
}).addTo(map);
19+
L.supermap.tiledMapLayer(url).addTo(map);
2720
polygon = L.polygon([[0, 0], [39, 0], [39, 116], [0, 116], [0, 0]]);
2821
}
2922
function query() {
3023
clearLayer();
3124
polygon.addTo(map);
3225
L.supermap.queryByBoundsService(url, {
3326
name: "Capitals@World.1",
34-
queryBounds: polygon.getBounds(),
35-
27+
queryBounds: polygon.getBounds()
3628
}).on("complete", function (info) {
37-
resultLayer = L.geoJSON(info.result).addTo(map);
29+
resultLayer = L.geoJSON(info.data).addTo(map);
3830
});
3931
}
4032
function clearLayer() {

examples/leaflet/01_mapService.html

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,21 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>SuperMap 地图信息</title>
6-
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.css"/>
7-
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
8-
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.js"></script>
6+
<link rel="stylesheet" href="../css/bootstrap.min.css">
7+
<link rel="stylesheet" href="../../dist/leaflet.css">
98
<script type="text/javascript" src="../../dist/SuperMapiClient9.js"></script>
109
<script type="text/javascript">
1110
var map, infowin,
12-
wms = "http://support.supermap.com.cn:8090/iserver/services/map-world/wms111/World",
1311
url = "http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World";
1412
function init() {
1513
map = L.map('map', {
1614
preferCanvas: true,
1715
crs: L.CRS.EPSG4326,
1816
center: {lon: 0, lat: 0},
1917
maxZoom: 18,
20-
zoom: 1
18+
zoom: 2
2119
});
22-
L.tileLayer.wms(wms, {
23-
noWrap: true,
24-
layers: 'World',
25-
format: 'image/png',
26-
transparent: true
27-
}).addTo(map);
20+
L.supermap.tiledMapLayer(url).addTo(map);
2821
}
2922

3023
function mapService() {
@@ -33,9 +26,14 @@
3326
projection: "4326"
3427
}).on("complete", function (result) {
3528
if (!infowin) {
36-
infowin = L.popup({maxWidth:400});
29+
infowin = L.popup({maxWidth: 400});
3730
}
38-
infowin.setLatLng(map.getCenter()).setContent(JSON.stringify(result.data,null,2)).openOn(map);
31+
var innerHTML = "(map信息太多,只打印一部分)" + "<br><br>";
32+
innerHTML += "地图名:" + JSON.stringify(result.data.name, null, 2) + "<br>";
33+
innerHTML += "中心点:" + JSON.stringify(result.data.center, null, 2) + "<br>";
34+
innerHTML += "Bounds:" + JSON.stringify(result.data.bounds, null, 2) + "<br>";
35+
36+
infowin.setLatLng(map.getCenter()).setContent(innerHTML).openOn(map);
3937
});
4038
}
4139
function closeInfoWin() {

examples/leaflet/01_tiledMapLayer.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>SuperMap REST 地图服务底图</title>
6-
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.css"/>
7-
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
8-
<script type="text/javascript" src="http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.js"></script>
6+
<link rel="stylesheet" href="../css/bootstrap.min.css">
7+
<link rel="stylesheet" href="../../dist/leaflet.css">
98
<script type="text/javascript" src="../../dist/SuperMapiClient9.js"></script>
109
<script type="text/javascript">
11-
var map,url = "http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World";
10+
var map, url = "http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World";
1211
function init() {
1312
map = L.map('map', {
1413
crs: L.CRS.EPSG4326,
@@ -22,9 +21,6 @@
2221
</script>
2322
</head>
2423
<body onload="init()" style=" margin: 0;overflow: hidden;background: #fff;">
25-
<div id="toolbar" style="padding-top: 10px; padding-bottom: 10px;">
26-
<div style="text-align: center">SuperMap REST 地图服务底图</div>
27-
</div>
2824
<div id="map" style="margin:0 auto;position: relative; height: 510px;border: 1px solid #3473b7;"></div>
2925
</body>
3026
</html>

0 commit comments

Comments
 (0)