@igo2/geo 19.0.0-next.7 → 19.0.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/fesm2022/igo2-geo.mjs
CHANGED
|
@@ -3036,7 +3036,8 @@ const jsonRegex = new RegExp(/(.*)?json(.*)?/gi);
|
|
|
3036
3036
|
* @param ogcFilters OgcFiltersOptions
|
|
3037
3037
|
* @returns A string representing the datasource options, based on filter and views
|
|
3038
3038
|
*/
|
|
3039
|
-
function buildUrl(options, extent, proj,
|
|
3039
|
+
function buildUrl(options, extent, proj, randomParam) {
|
|
3040
|
+
const ogcFilters = options.ogcFilters;
|
|
3040
3041
|
const paramsWFS = options.paramsWFS;
|
|
3041
3042
|
const queryStringValues = formatWFSQueryString(options, undefined, options.paramsWFS.srsName);
|
|
3042
3043
|
let igoFilters;
|
|
@@ -3367,9 +3368,8 @@ class WFSDataSource extends DataSource {
|
|
|
3367
3368
|
const currentExtent = extent
|
|
3368
3369
|
? olproj.transformExtent(extent, projection, wfsProj)
|
|
3369
3370
|
: undefined;
|
|
3370
|
-
const ogcFilters = this.ogcFilters;
|
|
3371
3371
|
paramsWFS.srsName = paramsWFS.srsName || projection.getCode();
|
|
3372
|
-
let url = buildUrl(this.options, currentExtent, wfsProj
|
|
3372
|
+
let url = buildUrl(this.options, currentExtent, wfsProj);
|
|
3373
3373
|
// Exportation want to fetch without extent/bbox restrictions
|
|
3374
3374
|
if (!extent && url.includes('bbox')) {
|
|
3375
3375
|
const [baseUrl, params] = url.split('?');
|
|
@@ -5649,10 +5649,8 @@ class VectorLayer extends Layer {
|
|
|
5649
5649
|
geoDBService;
|
|
5650
5650
|
layerDBService;
|
|
5651
5651
|
type = 'vector';
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
previousOgcFilters;
|
|
5655
|
-
xhrAccumulator = [];
|
|
5652
|
+
lastRequest;
|
|
5653
|
+
ongoingRequests = [];
|
|
5656
5654
|
watcher;
|
|
5657
5655
|
trackFeatureListenerId;
|
|
5658
5656
|
get browsable() {
|
|
@@ -5742,12 +5740,12 @@ class VectorLayer extends Layer {
|
|
|
5742
5740
|
if (wfsOptions?.type === 'wfs' &&
|
|
5743
5741
|
(wfsOptions.params || wfsOptions.paramsWFS)) {
|
|
5744
5742
|
loader = (extent, resolution, proj, success, failure) => {
|
|
5745
|
-
this.customWFSLoader(vectorSource, wfsOptions,
|
|
5743
|
+
this.customWFSLoader(vectorSource, wfsOptions, extent, resolution, proj, success, failure);
|
|
5746
5744
|
};
|
|
5747
5745
|
}
|
|
5748
5746
|
else {
|
|
5749
|
-
loader = (extent,
|
|
5750
|
-
this.customLoader(vectorSource, url, extent,
|
|
5747
|
+
loader = (extent, _resolution, proj, success, failure) => {
|
|
5748
|
+
this.customLoader(vectorSource, url, extent, proj, success, failure);
|
|
5751
5749
|
};
|
|
5752
5750
|
}
|
|
5753
5751
|
if (loader) {
|
|
@@ -5755,7 +5753,7 @@ class VectorLayer extends Layer {
|
|
|
5755
5753
|
}
|
|
5756
5754
|
}
|
|
5757
5755
|
else if (this.options.idbInfo?.storeToIdb && this.geoDBService) {
|
|
5758
|
-
const idbLoader = (extent,
|
|
5756
|
+
const idbLoader = (extent, _resolution, proj, success, failure) => {
|
|
5759
5757
|
this.customIDBLoader(vectorSource, olOptions.id, extent, proj, success, failure);
|
|
5760
5758
|
};
|
|
5761
5759
|
if (idbLoader) {
|
|
@@ -5893,7 +5891,7 @@ class VectorLayer extends Layer {
|
|
|
5893
5891
|
this.watcher.unsubscribe();
|
|
5894
5892
|
}
|
|
5895
5893
|
else {
|
|
5896
|
-
this.watcher.subscribe(() => void
|
|
5894
|
+
this.watcher.subscribe(() => void 0);
|
|
5897
5895
|
}
|
|
5898
5896
|
super.init(map);
|
|
5899
5897
|
}
|
|
@@ -5935,7 +5933,6 @@ class VectorLayer extends Layer {
|
|
|
5935
5933
|
* @internal
|
|
5936
5934
|
* @param vectorSource the vector source to be created
|
|
5937
5935
|
* @param options olOptions from source
|
|
5938
|
-
* @param interceptor the interceptor of the data
|
|
5939
5936
|
* @param extent the extent of the requested data
|
|
5940
5937
|
* @param resolution the current resolution
|
|
5941
5938
|
* @param proj the projection to retrieve the data
|
|
@@ -5943,45 +5940,57 @@ class VectorLayer extends Layer {
|
|
|
5943
5940
|
* @param failure failure callback
|
|
5944
5941
|
* @param randomParam random parameter to ensure cache is not causing problems in retrieving new data
|
|
5945
5942
|
*/
|
|
5946
|
-
customWFSLoader(vectorSource, options,
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5943
|
+
customWFSLoader(vectorSource, options, extent, resolution, proj, success, failure, randomParam) {
|
|
5944
|
+
const paramsWFS = options.paramsWFS;
|
|
5945
|
+
const wfsProj = this.getProjection(proj, paramsWFS);
|
|
5946
|
+
const currentExtent = olproj.transformExtent(extent, proj, wfsProj);
|
|
5947
|
+
if (this.lastRequest &&
|
|
5948
|
+
(this.lastRequest.extent !== currentExtent ||
|
|
5949
|
+
this.lastRequest.resolution !== resolution)) {
|
|
5950
|
+
this.abortRequests(vectorSource);
|
|
5951
|
+
}
|
|
5952
|
+
const url = buildUrl(options, currentExtent, wfsProj, randomParam);
|
|
5953
|
+
const request = {
|
|
5954
|
+
xhr: undefined,
|
|
5955
|
+
extent,
|
|
5956
|
+
resolution
|
|
5957
|
+
};
|
|
5958
|
+
const readOptions = {
|
|
5959
|
+
dataProjection: wfsProj,
|
|
5960
|
+
featureProjection: proj
|
|
5961
|
+
};
|
|
5962
|
+
if (paramsWFS.version === '2.0.0' &&
|
|
5963
|
+
paramsWFS.maxFeatures > defaultMaxFeatures) {
|
|
5964
|
+
this.batchGetFeatures(url, request, vectorSource, paramsWFS, readOptions, success, failure);
|
|
5965
|
+
}
|
|
5966
|
+
else {
|
|
5967
|
+
this.getFeatures(url, request, vectorSource, readOptions, success, failure);
|
|
5968
|
+
}
|
|
5969
|
+
}
|
|
5970
|
+
abortRequests(vectorSource) {
|
|
5971
|
+
vectorSource.removeLoadedExtent(this.lastRequest.extent);
|
|
5972
|
+
for (const request of this.ongoingRequests) {
|
|
5973
|
+
request.xhr?.abort();
|
|
5974
|
+
this.removeRequest(request);
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
getProjection(proj, params) {
|
|
5978
|
+
const newProj = params.srsName
|
|
5979
|
+
? new olProjection({ code: params.srsName })
|
|
5980
|
+
: proj;
|
|
5981
|
+
params.srsName = newProj.getCode();
|
|
5982
|
+
return newProj;
|
|
5983
|
+
}
|
|
5984
|
+
batchGetFeatures(url, request, vectorSource, paramsWFS, readOptions, success, failure) {
|
|
5985
|
+
const nbOfFeature = 1000;
|
|
5986
|
+
let startIndex = 0;
|
|
5987
|
+
while (startIndex < paramsWFS.maxFeatures) {
|
|
5988
|
+
let alteredUrl = url.replace('count=' + paramsWFS.maxFeatures, 'count=' + nbOfFeature);
|
|
5989
|
+
alteredUrl = alteredUrl.replace('startIndex=0', '0');
|
|
5990
|
+
alteredUrl += '&startIndex=' + startIndex;
|
|
5991
|
+
alteredUrl.replace(/&&/g, '&');
|
|
5992
|
+
this.getFeatures(alteredUrl, request, vectorSource, readOptions, success, failure);
|
|
5993
|
+
startIndex += nbOfFeature;
|
|
5985
5994
|
}
|
|
5986
5995
|
}
|
|
5987
5996
|
/**
|
|
@@ -5995,7 +6004,7 @@ class VectorLayer extends Layer {
|
|
|
5995
6004
|
* @param success success callback
|
|
5996
6005
|
* @param failure failure callback
|
|
5997
6006
|
*/
|
|
5998
|
-
getFeatures(
|
|
6007
|
+
getFeatures(url, request, vectorSource, readOptions, success, failure) {
|
|
5999
6008
|
const xhr = new XMLHttpRequest();
|
|
6000
6009
|
const alteredUrlWithKeyAuth = this.authInterceptor.alterUrlWithKeyAuth(url);
|
|
6001
6010
|
let modifiedUrl = url;
|
|
@@ -6007,7 +6016,8 @@ class VectorLayer extends Layer {
|
|
|
6007
6016
|
this.authInterceptor.interceptXhr(xhr, modifiedUrl);
|
|
6008
6017
|
}
|
|
6009
6018
|
const onError = () => {
|
|
6010
|
-
vectorSource.removeLoadedExtent(extent);
|
|
6019
|
+
vectorSource.removeLoadedExtent(request.extent);
|
|
6020
|
+
this.removeRequest(request);
|
|
6011
6021
|
failure();
|
|
6012
6022
|
};
|
|
6013
6023
|
xhr.onerror = onError;
|
|
@@ -6015,10 +6025,7 @@ class VectorLayer extends Layer {
|
|
|
6015
6025
|
if (xhr.status === 200 && xhr.responseText.length > 0) {
|
|
6016
6026
|
const features = vectorSource
|
|
6017
6027
|
.getFormat()
|
|
6018
|
-
.readFeatures(xhr.responseText,
|
|
6019
|
-
dataProjection,
|
|
6020
|
-
featureProjection
|
|
6021
|
-
});
|
|
6028
|
+
.readFeatures(xhr.responseText, readOptions);
|
|
6022
6029
|
if (features) {
|
|
6023
6030
|
vectorSource.addFeatures(features);
|
|
6024
6031
|
success(features);
|
|
@@ -6026,24 +6033,35 @@ class VectorLayer extends Layer {
|
|
|
6026
6033
|
else {
|
|
6027
6034
|
success([]);
|
|
6028
6035
|
}
|
|
6036
|
+
this.removeRequest(request);
|
|
6029
6037
|
}
|
|
6030
6038
|
else {
|
|
6031
6039
|
onError();
|
|
6032
6040
|
}
|
|
6033
6041
|
};
|
|
6034
|
-
|
|
6042
|
+
request.xhr = xhr;
|
|
6043
|
+
this.lastRequest = request;
|
|
6044
|
+
this.ongoingRequests.push(request);
|
|
6035
6045
|
xhr.send();
|
|
6036
6046
|
}
|
|
6047
|
+
removeRequest(request) {
|
|
6048
|
+
if (request === this.lastRequest) {
|
|
6049
|
+
this.lastRequest = undefined;
|
|
6050
|
+
}
|
|
6051
|
+
const index = this.ongoingRequests.indexOf(request);
|
|
6052
|
+
if (index > -1) {
|
|
6053
|
+
this.ongoingRequests.splice(index, 1);
|
|
6054
|
+
}
|
|
6055
|
+
}
|
|
6037
6056
|
/**
|
|
6038
6057
|
* Custom loader for vector layer.
|
|
6039
6058
|
* @internal
|
|
6040
6059
|
* @param vectorSource the vector source to be created
|
|
6041
6060
|
* @param url the url string or function to retrieve the data
|
|
6042
6061
|
* @param extent the extent of the requested data
|
|
6043
|
-
* @param resolution the current resolution
|
|
6044
6062
|
* @param projection the projection to retrieve the data
|
|
6045
6063
|
*/
|
|
6046
|
-
customLoader(vectorSource, url, extent,
|
|
6064
|
+
customLoader(vectorSource, url, extent, projection, success, failure) {
|
|
6047
6065
|
const xhr = new XMLHttpRequest();
|
|
6048
6066
|
let modifiedUrl = url;
|
|
6049
6067
|
if (typeof url !== 'function') {
|
|
@@ -21203,15 +21221,7 @@ class OptionsApiService extends OptionsService {
|
|
|
21203
21221
|
const request = this.http.get(this.urlApi, {
|
|
21204
21222
|
params
|
|
21205
21223
|
});
|
|
21206
|
-
return request.pipe(map((res) =>
|
|
21207
|
-
if (!res || !res.sourceOptions) {
|
|
21208
|
-
return {};
|
|
21209
|
-
}
|
|
21210
|
-
if (res.layerOptions) {
|
|
21211
|
-
res.sourceOptions._layerOptionsFromSource = res.layerOptions;
|
|
21212
|
-
}
|
|
21213
|
-
return res.sourceOptions;
|
|
21214
|
-
}));
|
|
21224
|
+
return request.pipe(map((res) => this.handleSourceOptions(res)));
|
|
21215
21225
|
}
|
|
21216
21226
|
getArcgisRestOptions(baseOptions, detailedContextUri) {
|
|
21217
21227
|
if (!this.urlApi) {
|
|
@@ -21230,15 +21240,20 @@ class OptionsApiService extends OptionsService {
|
|
|
21230
21240
|
const request = this.http.get(this.urlApi, {
|
|
21231
21241
|
params
|
|
21232
21242
|
});
|
|
21233
|
-
return request.pipe(map((res) =>
|
|
21234
|
-
|
|
21235
|
-
|
|
21236
|
-
|
|
21237
|
-
|
|
21238
|
-
|
|
21239
|
-
|
|
21240
|
-
|
|
21241
|
-
}
|
|
21243
|
+
return request.pipe(map((res) => this.handleSourceOptions(res)));
|
|
21244
|
+
}
|
|
21245
|
+
handleSourceOptions(res) {
|
|
21246
|
+
if (!res || !res.sourceOptions) {
|
|
21247
|
+
return {};
|
|
21248
|
+
}
|
|
21249
|
+
if (res.layerOptions) {
|
|
21250
|
+
res.sourceOptions._layerOptionsFromSource = res.layerOptions;
|
|
21251
|
+
}
|
|
21252
|
+
else {
|
|
21253
|
+
const { sourceOptions: _1, layerOptions: _2, ...restOptions } = res;
|
|
21254
|
+
res.sourceOptions._layerOptionsFromSource = restOptions;
|
|
21255
|
+
}
|
|
21256
|
+
return res.sourceOptions;
|
|
21242
21257
|
}
|
|
21243
21258
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: OptionsApiService, deps: [{ token: i1.HttpClient }, { token: 'options' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
21244
21259
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: OptionsApiService, providedIn: 'root' });
|
|
@@ -37556,7 +37571,7 @@ class EditionWorkspaceService {
|
|
|
37556
37571
|
refreshMap(layer, map) {
|
|
37557
37572
|
const wfsOlLayer = layer.dataSource.ol;
|
|
37558
37573
|
const loader = (extent, resolution, proj, success, failure) => {
|
|
37559
|
-
layer.customWFSLoader(layer.ol.getSource(), layer.options.sourceOptions,
|
|
37574
|
+
layer.customWFSLoader(layer.ol.getSource(), layer.options.sourceOptions, extent, resolution, proj, success, failure, true);
|
|
37560
37575
|
};
|
|
37561
37576
|
wfsOlLayer.setLoader(loader);
|
|
37562
37577
|
wfsOlLayer.refresh();
|