Skip to content

Commit 8512f2b

Browse files
committed
新增iclient8c示例。review by caoxinke.
1 parent d7815ba commit 8512f2b

File tree

455 files changed

+17934
-408
lines changed

Some content is hidden

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

455 files changed

+17934
-408
lines changed

dist/include-classic.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@
4444
if (inArray(includes, 'echarts')) {
4545
inputScript("http://cdn.bootcss.com/echarts/3.6.2/echarts.min.js");
4646
}
47+
if (inArray(includes, 'nanoscroller')) {
48+
inputCSS("http://iclient.supermap.io/libs/iclient8c/examples/css/nanoscroller.css");
49+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/jquery.nanoscroller.min.js");
50+
}
51+
if (inArray(includes, 'infoWindow')) {
52+
inputCSS("http://iclient.supermap.io/libs/iclient8c/examples/js/plugins/infoWindow/infoWindow.css");
53+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/plugins/infoWindow/InfoWindow.js");
54+
}
55+
if (inArray(includes, 'heatmapColorCSS')) {
56+
inputCSS("http://iclient.supermap.io/libs/iclient8c/examples/css/heatmap.css");
57+
}
58+
if (inArray(includes, 'responsive')) {
59+
inputCSS("http://iclient.supermap.io/libs/iclient8c/examples/css/bootstrap-responsive.min.css");
60+
}
4761
if (!inArray(excludes, 'iclient-classic')) {
4862
inputScript("../../dist/iclient-classic.min.js");
4963
}
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>缓冲区分析一</title>
6+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
7+
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
8+
<style type="text/css">
9+
body {
10+
margin: 0;
11+
overflow: hidden;
12+
background: #fff;
13+
width: 100%;
14+
height: 100%
15+
}
16+
17+
#map {
18+
position: absolute;
19+
width: 100%;
20+
height: 100%;
21+
border: 1px solid #3473b7;
22+
}
23+
24+
#toolbar {
25+
position: absolute;
26+
top: 10px;
27+
right: 10px;
28+
text-align: center;
29+
z-index: 100;
30+
border-radius: 4px;
31+
}
32+
</style>
33+
</head>
34+
<body>
35+
<div id="toolbar" class="panel panel-primary">
36+
<div class='panel-heading'>
37+
<h5 class='panel-title text-center'>缓冲区分析一</h5></div>
38+
<div class='panel-body content'>
39+
<input type="button" class="btn btn-default" value="缓冲区分析" onclick="bufferAnalystProcess()"/>
40+
<input type="button" class="btn btn-default" value="移除结果" onclick="removeResult()"/>
41+
</div>
42+
</div>
43+
<div id="map"></div>
44+
<script>
45+
var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
46+
var map, local, baseLayer, resultLayer, vectorLayer, spatialAnalystURL,
47+
points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
48+
new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
49+
new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
50+
new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
51+
new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
52+
roadLine = new SuperMap.Geometry.LineString(points),
53+
styleLine = {
54+
strokeColor: "blue",
55+
strokeWidth: 3,
56+
strokeLinecap: "round",
57+
strokeDashstyle: "solid"
58+
},
59+
styleRegion = {
60+
strokeColor: "#304DBE",
61+
strokeWidth: 2,
62+
pointerEvents: "visiblePainted",
63+
fillColor: "#304DBE",
64+
fillOpacity: 0.4
65+
},
66+
url1 = host + "/iserver/services/map-changchun/rest/maps/长春市区图",
67+
url2 = host + "/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst";
68+
69+
init();
70+
71+
function init() {
72+
map = new SuperMap.Map("map", {
73+
controls: [
74+
new SuperMap.Control.ScaleLine(),
75+
new SuperMap.Control.Zoom(),
76+
new SuperMap.Control.Navigation({
77+
dragPanOptions: {
78+
enableKinetic: true
79+
}
80+
})], units: "m"
81+
});
82+
map.addControl(new SuperMap.Control.LayerSwitcher(), new SuperMap.Pixel(42, 80));
83+
map.allOverlays = true;
84+
baseLayer = new SuperMap.Layer.TiledDynamicRESTLayer("Changchun", url1, {
85+
transparent: true,
86+
cacheEnabled: true
87+
}, {maxResolution: "auto"});
88+
baseLayer.events.on({"layerInitialized": addLayer});
89+
resultLayer = new SuperMap.Layer.Vector("缓冲区分析结果");
90+
vectorLayer = new SuperMap.Layer.Vector("vectorLine");
91+
92+
var featureLine = new SuperMap.Feature.Vector();
93+
featureLine.geometry = roadLine;
94+
featureLine.style = styleLine;
95+
vectorLayer.addFeatures(featureLine);
96+
}
97+
98+
function addLayer() {
99+
map.addLayers([baseLayer, resultLayer, vectorLayer]);
100+
map.setCenter(new SuperMap.LonLat(5105, -3375), 4);
101+
}
102+
103+
function bufferAnalystProcess() {
104+
resultLayer.removeAllFeatures();
105+
var bufferServiceByDatasets = new SuperMap.REST.BufferAnalystService(url2),
106+
bufferDistance = new SuperMap.REST.BufferDistance({
107+
value: 10
108+
}),
109+
bufferSetting = new SuperMap.REST.BufferSetting({
110+
endType: SuperMap.REST.BufferEndType.ROUND,
111+
leftDistance: bufferDistance,
112+
rightDistance: bufferDistance,
113+
semicircleLineSegment: 10
114+
}),
115+
filterParameter = new SuperMap.REST.FilterParameter({
116+
attributeFilter: "NAME='团结路'"
117+
}),
118+
dsBufferAnalystParameters = new SuperMap.REST.DatasetBufferAnalystParameters({
119+
dataset: "RoadLine2@Changchun",
120+
filterQueryParameter: filterParameter,
121+
bufferSetting: bufferSetting
122+
});
123+
bufferServiceByDatasets.events.on({
124+
"processCompleted": bufferAnalystCompleted,
125+
"processFailed": bufferAnalystFailed
126+
});
127+
bufferServiceByDatasets.processAsync(dsBufferAnalystParameters);
128+
}
129+
130+
function bufferAnalystCompleted(args) {
131+
resultLayer.addFeatures(args.result.recordset.features);
132+
}
133+
134+
function bufferAnalystFailed(args) {
135+
alert(args.error.errorMsg);
136+
}
137+
138+
function removeResult() {
139+
resultLayer.removeAllFeatures();
140+
}
141+
</script>
142+
143+
</body>
144+
</html>

0 commit comments

Comments
 (0)