Skip to content

Commit fcbacbd

Browse files
Merge branch 'v11.0.0' of https://github.com/SuperMap/iClient-JavaScript into v11.0.0
2 parents b4d3aeb + 0f5ef20 commit fcbacbd

29 files changed

+1557
-318
lines changed

build/jsdocs/template/typeLinkExt.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var olapi = "https://openlayers.org/en/v6.14.1/apidoc/";
2-
var lfapi = "https://leafletjs.com/reference-1.7.1.html";
2+
var lfapi = "https://leafletjs.com/index.html";
33
var mbglapi = "https://www.mapbox.com/mapbox-gl-js/api/";
44
var mapv = "https://github.com/huiyan-fe/mapv/blob/master/src/";
55
var classicapi="https://iclient.supermap.io/web/libs/iclient8c/apidoc/files/SuperMap"
@@ -69,6 +69,7 @@ var typeLinks = {
6969
"L.Rectangle": lfapi + '#rectangle',
7070
'L.LatLngBounds': lfapi+ '#latlngbounds',
7171
'L.Map': lfapi + '#map-example',
72+
'L.MapOptions': lfapi + '#map-option',
7273
'L.Evented':lfapi +'#evented',
7374
'L.Browser':lfapi +'#browser',
7475

examples/leaflet/01_overlayTiledMapLayer.html

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,48 @@
33
*********************************************************************-->
44
<!DOCTYPE html>
55
<html>
6-
<head>
7-
<meta charset="UTF-8">
6+
<head>
7+
<meta charset="UTF-8" />
88
<title data-i18n="resources.text_mapOverlay"></title>
99
<script type="text/javascript" src="../js/include-web.js"></script>
10-
</head>
11-
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
12-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
13-
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14-
<script type="text/javascript">
15-
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
16-
var map, urlWorld = host + "/iserver/services/map-world/rest/maps/World",
17-
urlJinjing = host + "/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图";
18-
map = L.map('map', {
19-
crs: L.CRS.EPSG4326,
20-
center: [40, 118],
21-
maxZoom: 18,
22-
zoom: 6
23-
});
10+
</head>
11+
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
12+
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
13+
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14+
<script type="text/javascript">
15+
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
16+
var map,
17+
urlWorld = host + '/iserver/services/map-world/rest/maps/World',
18+
urlJinjing = host + '/iserver/services/map-jingjin/rest/maps/京津地区人口分布图_专题图';
2419

25-
new L.supermap.TiledMapLayer(urlWorld).addTo(map);
26-
new L.supermap.TiledMapLayer(urlJinjing, {
27-
transparent: true,
28-
opacity: 0.6
29-
}).addTo(map);
30-
</script>
31-
</body>
20+
// 方式一:1.调用 L.supermap.initMap,根据 SuperMap iServer 地图服务的地图信息,创建地图和底图
21+
// 2.调用 L.supermap.TiledMapLayer 创建叠加图层
22+
L.supermap.initMap(urlWorld, { mapOptions: { center: [40, 118], zoom: 7 } }).then(({ map }) => {
23+
new L.supermap.TiledMapLayer(urlJinjing, {
24+
transparent: true,
25+
opacity: 0.6
26+
}).addTo(map);
27+
});
28+
/*
29+
// 方式二:1.调用 L.supermap.MapService,获取 SuperMap iServer 地图服务的地图信息
30+
// 2.调用 L.supermap.crsFromMapJSON 创建 CRS
31+
// 3.调用 L.map 创建地图
32+
// 4.调用 L.supermap.TiledMapLayer 创建底图和叠加图层
33+
new L.supermap.MapService(urlWorld).getMapInfo((res) => {
34+
var crs = L.supermap.crsFromMapJSON(res.result);
35+
map = L.map('map', {
36+
crs: crs,
37+
center: [40, 118],
38+
maxZoom: 18,
39+
zoom: 7
40+
});
41+
new L.supermap.TiledMapLayer(urlWorld).addTo(map);
42+
new L.supermap.TiledMapLayer(urlJinjing, {
43+
transparent: true,
44+
opacity: 0.6
45+
}).addTo(map);
46+
});
47+
*/
48+
</script>
49+
</body>
3250
</html>

examples/leaflet/01_tiledMapLayer3857.html

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,44 @@
33
*********************************************************************-->
44
<!DOCTYPE html>
55
<html>
6-
<head>
7-
<meta charset="UTF-8">
6+
<head>
7+
<meta charset="UTF-8" />
88
<title data-i18n="resources.title_tiledMapLayer3857"></title>
99
<script type="text/javascript" src="../js/include-web.js"></script>
10-
</head>
11-
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
12-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
13-
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14-
<script type="text/javascript">
15-
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
16-
var map, url = host + "/iserver/services/map-china400/rest/maps/China";
17-
map = L.map('map', {
18-
center: [0, 0],
19-
maxZoom: 18,
20-
zoom: 1
21-
});
22-
new L.supermap.TiledMapLayer(url).addTo(map);
23-
</script>
24-
</body>
25-
</html>
10+
</head>
11+
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
12+
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
13+
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14+
<script type="text/javascript">
15+
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
16+
var map,
17+
url = host + '/iserver/services/map-china400/rest/maps/China';
18+
url = 'http://172.16.14.44:8090/iserver/services/map-china400/rest/maps/China';
19+
20+
// 方式一:1.调用 L.supermap.initMap,根据 SuperMap iServer 地图服务的地图信息,创建地图和底图
21+
L.supermap.initMap(url, { mapOptions: { zoom: 0 } });
22+
/*
23+
// 方式二:1.调用 L.supermap.MapService,获取 SuperMap iServer 地图服务的地图信息
24+
// 2.调用 L.supermap.crsFromMapJSON 创建 CRS
25+
// 3.调用 L.map 创建地图
26+
// 4.调用 L.supermap.TiledMapLayer 创建底图
27+
new L.supermap.MapService(url).getMapInfo((res) => {
28+
var crs = L.supermap.crsFromMapJSON(res.result);
29+
map = L.map('map', {
30+
crs: crs,
31+
center: [0, 0],
32+
maxZoom: 18,
33+
zoom: 1
34+
});
35+
new L.supermap.TiledMapLayer(url).addTo(map);
36+
});
37+
*/
38+
// map = L.map('map', {
39+
// center: [36.03133177633048, 136.40625000000054],
40+
// maxZoom: 18,
41+
// zoom: 0
42+
// });
43+
// new L.supermap.TiledMapLayer(url).addTo(map);
44+
</script>
45+
</body>
46+
</html>

examples/leaflet/01_tiledMapLayer4326.html

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,39 @@
33
*********************************************************************-->
44
<!DOCTYPE html>
55
<html>
6-
<head>
7-
<meta charset="UTF-8">
6+
<head>
7+
<meta charset="UTF-8" />
88
<title data-i18n="resources.title_tiledMapLayer4326"></title>
99
<script type="text/javascript" src="../js/include-web.js"></script>
10-
</head>
11-
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
12-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
13-
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14-
<script type="text/javascript">
15-
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
16-
var map, url = host + "/iserver/services/map-world/rest/maps/World";
17-
map = L.map('map', {
18-
crs: L.CRS.EPSG4326,
19-
center: [0, 0],
20-
maxZoom: 18,
21-
zoom: 1
22-
});
23-
new L.supermap.TiledMapLayer(url).addTo(map);
10+
</head>
11+
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
12+
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
13+
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14+
<script type="text/javascript">
15+
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
16+
var map,
17+
url = host + '/iserver/services/map-world/rest/maps/World';
2418

25-
</script>
26-
</body>
27-
</html>
19+
// 方式一:1.调用 L.supermap.initMap,根据 SuperMap iServer 地图服务的地图信息,创建地图和底图
20+
L.supermap.initMap(url);
21+
/*
22+
// 方式二:1.调用 L.supermap.MapService,获取 SuperMap iServer 地图服务的地图信息
23+
// 2.调用 L.supermap.crsFromMapJSON 创建 CRS
24+
// 3.调用 L.map 创建地图
25+
// 4.调用 L.supermap.TiledMapLayer 创建底图
26+
new L.supermap.MapService(url).getMapInfo((res) => {
27+
var def = `GEOGCS["GCS_China_2000",DATUM["D_China_2000",SPHEROID["CGCS2000",6378137.0,298.257222101,AUTHORITY["EPSG","7044"]]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["DEGREE",0.017453292519943295],AUTHORITY["EPSG","4490"]]`;
28+
Proj4js.defs('EPSG:4490', def);
29+
var crs = L.supermap.crsFromMapJSON(res.result);
30+
map = L.map('map', {
31+
crs: crs,
32+
center: [23.909946174843483, 17.607615853850504],
33+
maxZoom: 18,
34+
zoom: 0
35+
});
36+
new L.supermap.TiledMapLayer(url).addTo(map);
37+
});
38+
*/
39+
</script>
40+
</body>
41+
</html>

examples/leaflet/01_tiledMapLayerNonEarth.html

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,37 @@
33
*********************************************************************-->
44
<!DOCTYPE html>
55
<html>
6-
<head>
7-
<meta charset="UTF-8">
6+
<head>
7+
<meta charset="UTF-8" />
88
<title data-i18n="resources.title_tiledMapLayerNonEarth"></title>
99
<script type="text/javascript" src="../js/include-web.js"></script>
10-
</head>
11-
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
12-
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
13-
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14-
<script type="text/javascript">
15-
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
16-
var map, url = host + "/iserver/services/map-changchun/rest/maps/长春市区图";
17-
map = L.map('map', {
18-
crs: new L.supermap.CRS.NonEarthCRS({
19-
bounds: L.bounds([48.4, -7668.25], [8958.85, -55.58]),
20-
origin: L.point(48.4, -55.58)
21-
}),
22-
center: [-4500, 4000],
23-
maxZoom: 18,
24-
zoom: 1
25-
});
26-
new L.supermap.TiledMapLayer(url, {noWrap: true}).addTo(map);
27-
</script>
28-
</body>
10+
</head>
11+
<body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
12+
<div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
13+
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
14+
<script type="text/javascript">
15+
var host = window.isLocal ? window.server : 'https://iserver.supermap.io';
16+
var map,
17+
url = host + '/iserver/services/map-changchun/rest/maps/长春市区图';
18+
19+
// 方式一:1.调用 L.supermap.initMap,根据 SuperMap iServer 地图服务的地图信息,创建地图和底图
20+
L.supermap.initMap(url, { layerOptions: { noWrap: true } });
21+
/*
22+
// 方式二:1.调用 L.supermap.MapService,获取 SuperMap iServer 地图服务的地图信息
23+
// 2.调用 L.supermap.crsFromMapJSON 创建 CRS
24+
// 3.调用 L.map 创建地图
25+
// 4.调用 L.supermap.TiledMapLayer 创建底图
26+
new L.supermap.MapService(url).getMapInfo((res) => {
27+
var crs = L.supermap.crsFromMapJSON(res.result);
28+
map = L.map('map', {
29+
crs: crs,
30+
center: [-4500, 4000],
31+
maxZoom: 18,
32+
zoom: 1
33+
});
34+
new L.supermap.TiledMapLayer(url, { noWrap: true }).addTo(map);
35+
});
36+
*/
37+
</script>
38+
</body>
2939
</html>

examples/leaflet/imageService.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ <h4 class="modal-title" id="myModalLabel"></h4>
764764
}
765765

766766
function query() {
767+
clearSearchResult();
767768
var postData = {};
768769
if (provinceId != -1) {
769770
postData.bbox = provinceBbox;

examples/mapboxgl/imageService.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ <h4 class="modal-title" id="myModalLabel"></h4>
830830
return value;
831831
}
832832
function query() {
833+
clearSearchResult();
833834
var postData = {};
834835
if (provinceId != -1) {
835836
postData.bbox = provinceBbox;

examples/openlayers/imageService.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ <h4 class="modal-title" id="myModalLabel"></h4>
942942
}
943943

944944
function query() {
945+
clearSearchResult();
945946
var postData = {};
946947
if (provinceId != -1) {
947948
postData['bbox'] = provinceBbox;

src/common/iServer/EditFeaturesService.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {Util} from '../commontypes/Util';
55
import {EditType} from '../REST';
66
import {CommonServiceBase} from './CommonServiceBase';
77
import {EditFeaturesParameters} from './EditFeaturesParameters';
8+
import { FetchRequest } from '../util/FetchRequest';
89

910
/**
1011
* @class EditFeaturesService
@@ -90,9 +91,16 @@ export class EditFeaturesService extends CommonServiceBase {
9091
jsonParameters = EditFeaturesParameters.toJsonParameters(params);
9192
if (editType === EditType.DELETE) {
9293
ids = Util.toJSON(params.IDs);
93-
me.url = Util.urlAppend(me.url, Util.getParameterString({ids}));
94-
method = "DELETE";
9594
jsonParameters = ids;
95+
var urlWithIds = Util.urlAppend(me.url, Util.getParameterString({ids}))
96+
if(FetchRequest.urlIsLong(urlWithIds)) {
97+
me.url = Util.urlAppend(me.url, Util.getParameterString({_method: 'DELETE'}));
98+
method = "POST";
99+
} else{
100+
me.url = urlWithIds;
101+
method = "DELETE";
102+
}
103+
96104
} else if (editType === EditType.UPDATE) {
97105
method = "PUT";
98106
} else {

src/common/util/FetchRequest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export var FetchRequest = {
369369
if (!this.urlIsLong(url)) {
370370
return this._fetch(url, params, options, type);
371371
} else {
372-
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
372+
return this._postSimulatie(type, url.substring(0, url.indexOf('?')), Util.getParameters(url), options);
373373
}
374374
},
375375
/**
@@ -394,7 +394,7 @@ export var FetchRequest = {
394394
return RequestJSONPPromise.DELETE(config);
395395
}
396396
if (this.urlIsLong(url)) {
397-
return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
397+
return this._postSimulatie(type, url.substring(0, url.indexOf('?')), Util.getParameters(url), options);
398398
}
399399
return this._fetch(url, params, options, type);
400400
},

0 commit comments

Comments
 (0)