-
Notifications
You must be signed in to change notification settings - Fork 288
Expand file tree
/
Copy path03_themeRange.html
More file actions
80 lines (79 loc) · 3.2 KB
/
03_themeRange.html
File metadata and controls
80 lines (79 loc) · 3.2 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
<!--********************************************************************
* Copyright© 2000 - 2025 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_themeRange"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</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" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
var map, themeService, themeRange, themeParameters, themeLayer,
url = host + "/iserver/services/map-china/rest/maps/China";
map = L.map('map', {
center: [30, 84],
maxZoom: 18,
zoom: 4
});
new L.supermap.TiledMapLayer(url, {noWrap: true, transparent: true}).addTo(map);
createTheme();
function createTheme() {
themeService = new L.supermap.ThemeService(url);
var themeRangeItem1 = new L.supermap.ThemeRangeItem({
start: 0,
end: 500000000000,
style: new L.supermap.ServerStyle({
fillForeColor: new L.supermap.ServerColor(211, 255, 250),
lineColor: new L.supermap.ServerColor(179, 209, 193),
lineWidth: 0.1
})
});
var themeRangeItem2 = new L.supermap.ThemeRangeItem({
start: 500000000000,
end: 1000000000000,
style: new L.supermap.ServerStyle({
fillForeColor: new L.supermap.ServerColor(178, 218, 199),
lineColor: new L.supermap.ServerColor(179, 209, 193),
lineWidth: 0.1
})
});
var themeRangeItem3 = new L.supermap.ThemeRangeItem({
start: 1000000000000,
end: 3000000000000,
style: new L.supermap.ServerStyle({
fillForeColor: new L.supermap.ServerColor(58, 178, 166),
lineColor: new L.supermap.ServerColor(179, 209, 193),
lineWidth: 0.1
})
});
themeRange = new L.supermap.ThemeRange({
rangeExpression: "SMAREA",
rangeMode: L.supermap.RangeMode.EQUALINTERVAL,
items: [themeRangeItem1, themeRangeItem2, themeRangeItem3]
});
themeParameters = new L.supermap.ThemeParameters({
datasetNames: ["Province_R"],
dataSourceNames: ["China"],
joinItems: null,
themes: [themeRange]
});
themeService.getThemeInfo(themeParameters).then(function (serviceResult) {
var result = serviceResult.result;
if (result && result.newResourceID) {
themeLayer = new L.supermap.TiledMapLayer(url, {
noWrap: true,
cacheEnabled: false,
transparent: true,
layersID: result.newResourceID
}).addTo(map);
}
});
}
</script>
</body>
</html>