Skip to content

Commit c8619af

Browse files
committed
【feature】1) 新增配置参数,支持用户配置restData分批请求,单次请求个数
原因:DV-ISVJ-5665缺陷 (reviewed by songym)
1 parent 33eb231 commit c8619af

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const dpiConfig = {
9898
* @param {function} [options.mapSetting.overlays] - 地图的overlays
9999
* @param {function} [options.mapSetting.controls] - 地图的控件
100100
* @param {function} [options.mapSetting.interactions] - 地图控制的参数
101+
* @param {number} [options.restDataSingleRequestCount=1000] - 自定义restData分批请求,单次请求数量
101102
* @extends {ol.Observable}
102103
* @usage
103104
*/
@@ -130,6 +131,7 @@ export class WebMap extends Observable {
130131
this.events = new Events(this, null, ["updateDataflowFeature"], true);
131132
this.webMap = options.webMap;
132133
this.tileFormat = options.tileFormat && options.tileFormat.toLowerCase();
134+
this.restDataSingleRequestCount = options.restDataSingleRequestCount || 1000;
133135
this.createMap(options.mapSetting);
134136
if (this.webMap) {
135137
// webmap有可能是url地址,有可能是webmap对象
@@ -2163,7 +2165,7 @@ export class WebMap extends Observable {
21632165
that.layerAdded++;
21642166
that.sendMapToUser(layerLength);
21652167
that.errorCallback && that.errorCallback(err, 'getFeatureFaild', that.map)
2166-
}, that.baseProjection.split("EPSG:")[1]);
2168+
}, that.baseProjection.split("EPSG:")[1], this.restDataSingleRequestCount);
21672169
}
21682170

21692171
/**
@@ -2647,7 +2649,7 @@ export class WebMap extends Observable {
26472649
await that.addLayer(layerInfo, features, layerIndex);
26482650
}, function (err) {
26492651
that.errorCallback && that.errorCallback(err, 'autoUpdateFaild', that.map);
2650-
});
2652+
}, undefined, this.restDataSingleRequestCount);
26512653
}
26522654
}
26532655

src/openlayers/mapping/webmap/Util.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function getFeatureProperties(features) {
1616
return properties;
1717
}
1818

19-
export function getFeatureBySQL(url, datasetNames, serviceOptions, processCompleted, processFaild, targetEpsgCode) {
20-
getFeatureBySQLWithConcurrent(url, datasetNames, processCompleted, processFaild, serviceOptions, targetEpsgCode);
19+
export function getFeatureBySQL(url, datasetNames, serviceOptions, processCompleted, processFaild, targetEpsgCode, restDataSingleRequestCount) {
20+
getFeatureBySQLWithConcurrent(url, datasetNames, processCompleted, processFaild, serviceOptions, targetEpsgCode, restDataSingleRequestCount);
2121
}
2222
export function queryFeatureBySQL(
2323
url,
@@ -64,13 +64,14 @@ export function getFeatureBySQLWithConcurrent(
6464
processCompleted,
6565
processFailed,
6666
serviceOptions,
67-
targetEpsgCode
67+
targetEpsgCode,
68+
restDataSingleRequestCount
6869
) {
6970
let queryParameter = new FilterParameter({
7071
name: datasetNames.join().replace(':', '@')
7172
});
7273

73-
let maxFeatures = 100, // 每次请求数据量
74+
let maxFeatures = restDataSingleRequestCount || 1000, // 每次请求数据量
7475
firstResult, // 存储每次请求的结果
7576
allRequest = []; // 存储发出的请求Promise
7677

0 commit comments

Comments
 (0)