Skip to content

Commit f3b5fa8

Browse files
committed
迁移部分iclient8示例到classic reviewBy zhurc
1 parent e7c560b commit f3b5fa8

File tree

202 files changed

+55103
-24
lines changed

Some content is hidden

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

202 files changed

+55103
-24
lines changed

dist/include-classic.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,35 @@
4444
if (inArray(includes, 'echarts')) {
4545
inputScript("http://cdn.bootcss.com/echarts/3.6.2/echarts.min.js");
4646
}
47-
4847
if (!inArray(excludes, 'iclient-classic')) {
4948
inputScript("../../dist/iclient-classic.min.js");
5049
}
50+
if (inArray(includes, 'tianditu')) {
51+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/layer/Tianditu.js");
52+
}
53+
if (inArray(includes, 'echarts-all')) {
54+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/echarts-all.js");
55+
}
56+
if (inArray(includes, 'baidu')) {
57+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/layer/Baidu.js");
58+
}
59+
if (inArray(includes, 'OSMBuildings-SuperMap')) {
60+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/OSMBuildings-SuperMap.js");
61+
}
62+
if (inArray(includes, 'D3WindMap')) {
63+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/D3WindMap.js");
64+
}
65+
if (inArray(includes, 'd3')) {
66+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/d3.v3.min.js");
67+
}
68+
if (inArray(includes, 'three')) {
69+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/third-party/Three/ThreeWebGL.js");
70+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/third-party/Three/ThreeExtras.js");
71+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/third-party/Three/RequestAnimationFrame.js");
72+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/third-party/Three/Detector.js");
73+
inputScript("http://iclient.supermap.io/libs/iclient8c/examples/js/third-party/globe.js");
74+
}
75+
5176
}
5277

5378
load();

examples/classic/OGC_GeoJSON.html

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>GeoJSON数据展示</title>
6+
</head>
7+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
8+
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
9+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
10+
<script type="text/javascript" exclude="iclient-classic" include="OSMBuildings-SuperMap"
11+
src="../../dist/include-classic.js"></script>
12+
<script type="text/javascript">
13+
var map, layer, osm, vLayer,
14+
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
15+
url = host + "/iserver/services/map-world/rest/maps/World";
16+
//初始化地图
17+
map = new SuperMap.Map("map", {
18+
controls: [
19+
new SuperMap.Control.Navigation(),
20+
new SuperMap.Control.MousePosition(),
21+
new SuperMap.Control.LayerSwitcher(),
22+
new SuperMap.Control.Zoom()
23+
]
24+
});
25+
26+
//初始化图层
27+
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null, {maxResolution: "auto"});
28+
vLayer = new SuperMap.Layer.Vector("vector");
29+
//监听图层信息加载完成事件
30+
layer.events.on({"layerInitialized": addLayer});
31+
//异步加载图层
32+
function addLayer() {
33+
map.addLayers([layer, vLayer]);
34+
map.setCenter(new SuperMap.LonLat(102.0, 0.5), 4);
35+
36+
//GeoJSON对象,也可以是一个字符串
37+
var geojson = {
38+
"type": "FeatureCollection",
39+
"features": [
40+
{
41+
"type": "Feature",
42+
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
43+
"properties": {"prop0": "value0"}
44+
},
45+
{
46+
"type": "Feature",
47+
"geometry": {
48+
"type": "LineString",
49+
"coordinates": [
50+
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
51+
]
52+
},
53+
"properties": {
54+
"prop0": "value0",
55+
"prop1": 0.0
56+
}
57+
},
58+
{
59+
"type": "Feature",
60+
"geometry": {
61+
"type": "Polygon",
62+
"coordinates": [
63+
[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
64+
[100.0, 1.0], [100.0, 0.0]]
65+
]
66+
},
67+
"properties": {
68+
"prop0": "value0",
69+
"prop1": {"this": "that"}
70+
}
71+
}
72+
]
73+
};
74+
//创建一个GeoJSON解析器
75+
var geojsonParse = new SuperMap.Format.GeoJSON();
76+
//将GeoJSON对象转化成要素数组
77+
var features = geojsonParse.read(geojson);
78+
//最后将要素数组加到矢量图层里面进行渲染
79+
vLayer.addFeatures(features);
80+
}
81+
</script>
82+
</body>
83+
</html>

examples/classic/OGC_kml.html

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>kml</title>
5+
<style type="text/css">
6+
.editPane {
7+
position: absolute;
8+
right: 10px;
9+
top: 10px;
10+
text-align: center;
11+
background: #FFF;
12+
z-index: 1000;
13+
width: 200px;
14+
display: inline-block;
15+
16+
}
17+
</style>
18+
</head>
19+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
20+
<div class='panel panel-primary editPane' id='editPane' style="z-index: 99999">
21+
<div class='panel-heading'>
22+
<h5 class='panel-title text-center'>kml</h5>
23+
</div>
24+
<div class='panel-body' id='params'>
25+
<p></p>
26+
<div align='center' class='button-group'>
27+
<input type='button' id='loadBt' class='btn btn-primary' value='加载' onclick="loadKml()"/>
28+
</div>
29+
</div>
30+
</div>
31+
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
32+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
33+
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
34+
<script>
35+
var map, layer, loaded = false,
36+
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
37+
url = host + "/iserver/services/map-china400/rest/maps/China";
38+
map = new SuperMap.Map("map", {
39+
controls: [
40+
new SuperMap.Control.ScaleLine(),
41+
new SuperMap.Control.Zoom(),
42+
new SuperMap.Control.LayerSwitcher(),
43+
new SuperMap.Control.MousePosition(),
44+
new SuperMap.Control.OverviewMap(),
45+
new SuperMap.Control.Navigation({
46+
dragPanOptions: {
47+
enableKinetic: true
48+
}
49+
})],
50+
projection: new SuperMap.Projection("EPSG:3857")
51+
});
52+
53+
layer = new SuperMap.Layer.TiledDynamicRESTLayer("China", url, {transparent: true}, {
54+
useCanvas: true,
55+
maxResolution: "auto"
56+
});
57+
layer.events.on({"layerInitialized": addLayer});
58+
59+
function addLayer() {
60+
var center = new SuperMap.LonLat(0, 0);
61+
map.addLayer(layer);
62+
map.setCenter(center, 1);
63+
}
64+
65+
function loadKml() {
66+
if (!loaded) {
67+
layer01 = new SuperMap.Layer.Vector("KML", {
68+
strategies: [new SuperMap.Strategy.Fixed()],
69+
protocol: new SuperMap.Protocol.HTTP({
70+
url: host + "/iserver/services/data-world/rest/data/datasources/World/datasets/Countries/features.kml", //"data/sichuang.kml",
71+
format: new SuperMap.Format.KML({
72+
extractStyles: true,
73+
extractAttributes: true,
74+
internalProjection: new SuperMap.Projection("EPSG:3857"), //所在地图的坐标系
75+
maxDepth: 2 //要解析外部链接文件时此值必须大于1
76+
})
77+
})
78+
});
79+
map.addLayer(layer01);
80+
layer01.events.on({"featuresadded": featuresadd});
81+
loaded = true;
82+
}
83+
}
84+
85+
function featuresadd() {
86+
var center = new SuperMap.LonLat(5000000, 8000000);
87+
map.setCenter(center, 1);
88+
}
89+
90+
</script>
91+
</body>
92+
</html>
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
<!DOCTYPE>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
5+
<title>WFS 查询</title>
6+
<style type="text/css">
7+
.editPane {
8+
position: absolute;
9+
right: 10px;
10+
top: 10px;
11+
text-align: center;
12+
background: #FFF;
13+
display: inline-block;
14+
z-index: 1000;
15+
}
16+
</style>
17+
</head>
18+
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
19+
<div class='panel panel-primary editPane' id='editPane' style="z-index: 99999">
20+
<div class='panel-heading'>
21+
<h5 class='panel-title text-center'>WFS 查询</h5>
22+
</div>
23+
<div class='panel-body' id='params'>
24+
<p></p>
25+
<div align='center' class='button-group'>
26+
<input type='button' id='btn1' class='btn btn-primary' value='多边形' onclick="drawGeometry()"/>
27+
<input type='button' id='btn2' class='btn btn-primary' value='清除' onclick="clearFeatures()"/>
28+
</div>
29+
</div>
30+
</div>
31+
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
32+
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
33+
<script type="text/javascript" exclude="iclient-classic" src="../../dist/include-classic.js"></script>
34+
<script type="text/javascript">
35+
var map, layer, vectorLayer, vectorLayer, vector_style, vector_style_select, myFilter, drawings = null, draw = null,
36+
host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090",
37+
url = host + "/iserver/services/map-world/rest/maps/World",
38+
url2 = host + "/iserver/services/data-world/wfs100";
39+
map = new SuperMap.Map("map", {
40+
controls: [
41+
new SuperMap.Control.LayerSwitcher(),
42+
new SuperMap.Control.ScaleLine(),
43+
new SuperMap.Control.Zoom(),
44+
new SuperMap.Control.Navigation({
45+
dragPanOptions: {
46+
enableKinetic: true
47+
}
48+
})]
49+
});
50+
51+
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, {
52+
transparent: true,
53+
cacheEnabled: true
54+
}, {maxResolution: "auto"});
55+
56+
vector_style = new SuperMap.Style({
57+
fillColor: '#669933',
58+
fillOpacity: 0.8,
59+
pointRadius: 8,
60+
strokeColor: '#aaee77',
61+
strokeWidth: 3
62+
});
63+
64+
vector_style_select = new SuperMap.Style({
65+
fillColor: '#000',
66+
fillOpacity: 0.9,
67+
fontColor: '#232323',
68+
strokeColor: '#ffffff'
69+
});
70+
71+
myFilter = new SuperMap.Filter.Comparison({
72+
type: SuperMap.Filter.Comparison.EQUAL_TO,
73+
property: "CAPITAL",
74+
value: ""
75+
});
76+
77+
vectorLayer = new SuperMap.Layer.Vector("World Capitals", {
78+
strategies: [new SuperMap.Strategy.BBOX()],
79+
protocol: new SuperMap.Protocol.WFS({
80+
version: "1.0.0",
81+
url: url2,
82+
featureType: "Capitals",
83+
featureNS: "http://www.supermap.com/World",
84+
featurePrefix: "World",
85+
geometryName: "the_geom"
86+
87+
//类似的ArcGIS请求参数设置(已验证返回数据)
88+
//version:"1.0.0",
89+
//url:"http://localhost:6080/arcgis/services/SampleWorldCities/MapServer/WFSServer",
90+
//featureType:"cities",
91+
//featureNS:"http://localhost:6080/arcgis/services/SampleWorldCities/MapServer/WFSServer",
92+
//featurePrefix:"SampleWorldCities",
93+
//geometryName:"shape"
94+
}),
95+
96+
//filter使用方式一:
97+
//filter: new SuperMap.Filter.Logical({
98+
// type: SuperMap.Filter.Logical.AND,
99+
// filters: [
100+
// new SuperMap.Filter.Comparison({
101+
// type: SuperMap.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
102+
// property: "SMID",
103+
// value: "50"
104+
// }),
105+
// new SuperMap.Filter.Comparison({
106+
// type: SuperMap.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
107+
// property: "SMID",
108+
// value: "60"
109+
// })
110+
// ]
111+
//}),
112+
113+
//filter使用方式二:
114+
filter: myFilter,
115+
styleMap: new SuperMap.StyleMap({
116+
'default': vector_style,
117+
'select': vector_style_select
118+
})
119+
});
120+
121+
var select_feature_control = new SuperMap.Control.SelectFeature(vectorLayer);
122+
map.addControl(select_feature_control);
123+
select_feature_control.activate();
124+
layer.events.on({"layerInitialized": addLayer});
125+
126+
//空间查询
127+
drawings = new SuperMap.Layer.Vector("drawings");
128+
map.addLayer(drawings);
129+
draw = new SuperMap.Control.DrawFeature(drawings, SuperMap.Handler.Polygon);
130+
map.addControl(draw);
131+
132+
function drawGeometry() {
133+
clearFeatures();
134+
draw.activate();
135+
draw.events.on({featureadded: drawCompleted});
136+
}
137+
138+
function clearFeatures() {
139+
vectorLayer.removeAllFeatures();
140+
drawings.removeAllFeatures();
141+
}
142+
143+
function addLayer() {
144+
map.addLayers([layer, vectorLayer]);
145+
map.setCenter(new SuperMap.LonLat(0, 0), 0);
146+
}
147+
148+
function drawCompleted(event) {
149+
vectorLayer.filter = new SuperMap.Filter.Spatial({
150+
type: SuperMap.Filter.Spatial.INTERSECTS,
151+
value: event.feature.geometry
152+
});
153+
vectorLayer.refresh({force: true});
154+
vectorLayer.filter = myFilter;
155+
draw.deactivate();
156+
}
157+
</script>
158+
</body>
159+
</html>

0 commit comments

Comments
 (0)