@igo2/geo 21.0.0-next.28 → 21.0.0-next.29
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 +82 -83
- package/fesm2022/igo2-geo.mjs.map +1 -1
- package/package.json +4 -4
- package/types/igo2-geo.d.ts +3 -5
package/fesm2022/igo2-geo.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import html2canvas from 'html2canvas';
|
|
|
20
20
|
import jsPDF, { jsPDF as jsPDF$1 } from 'jspdf';
|
|
21
21
|
import { autoTable } from 'jspdf-autotable';
|
|
22
22
|
import moment from 'moment';
|
|
23
|
-
import { Observable, of, combineLatest, BehaviorSubject, interval, tap, merge, fromEvent, firstValueFrom, Subject, forkJoin, map as map$1, catchError as catchError$1, debounceTime as debounceTime$1, switchMap, EMPTY, timer, filter as filter$1, take, from,
|
|
23
|
+
import { Observable, of, combineLatest, BehaviorSubject, interval, tap, merge, fromEvent, firstValueFrom, Subject, forkJoin, map as map$1, catchError as catchError$1, debounceTime as debounceTime$1, switchMap, EMPTY, timer, filter as filter$1, take, from, Subscription, pairwise, lastValueFrom, throwError, first as first$1, zip } from 'rxjs';
|
|
24
24
|
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
|
|
25
25
|
import { fetchImageFromDepotUrl, ImageErrorDirective, SecureImagePipe } from '@igo2/common/image';
|
|
26
26
|
import { saveAs } from 'file-saver';
|
|
@@ -11979,6 +11979,9 @@ function olLayerFeatureIsQueryable(olLayer) {
|
|
|
11979
11979
|
: layerIsQueryable(layer) && layerFeatureIsQueryable(layer);
|
|
11980
11980
|
}
|
|
11981
11981
|
|
|
11982
|
+
function isWmsDataSourceOptions(sourceOptions) {
|
|
11983
|
+
return sourceOptions.type === 'wms';
|
|
11984
|
+
}
|
|
11982
11985
|
class LayerLegendComponent {
|
|
11983
11986
|
capabilitiesService = inject(CapabilitiesService);
|
|
11984
11987
|
languageService = inject(LanguageService);
|
|
@@ -11998,12 +12001,10 @@ class LayerLegendComponent {
|
|
|
11998
12001
|
/**
|
|
11999
12002
|
* The available styles
|
|
12000
12003
|
*/
|
|
12001
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12002
12004
|
styles;
|
|
12003
12005
|
/**
|
|
12004
12006
|
* The style used to make the legend
|
|
12005
12007
|
*/
|
|
12006
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12007
12008
|
currentStyle;
|
|
12008
12009
|
/**
|
|
12009
12010
|
* The extent used to make the legend
|
|
@@ -12029,11 +12030,12 @@ class LayerLegendComponent {
|
|
|
12029
12030
|
let lastlLegend = this.layer().legend;
|
|
12030
12031
|
this.styles = this.listStyles();
|
|
12031
12032
|
const sourceOptions = this.layer().options.source?.options;
|
|
12032
|
-
|
|
12033
|
+
const wmsSourceOptions = sourceOptions && isWmsDataSourceOptions(sourceOptions)
|
|
12034
|
+
? sourceOptions
|
|
12035
|
+
: undefined;
|
|
12036
|
+
if (wmsSourceOptions?.params.STYLES) {
|
|
12033
12037
|
// if a styles is provided into the layers wms params
|
|
12034
|
-
this.currentStyle = this.styles
|
|
12035
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12036
|
-
(style) => style.name === sourceOptions.params.STYLES)?.name;
|
|
12038
|
+
this.currentStyle = this.styles?.find((style) => style.name === wmsSourceOptions.params.STYLES)?.name;
|
|
12037
12039
|
}
|
|
12038
12040
|
else if (!lastlLegend) {
|
|
12039
12041
|
// if no legend is manually provided
|
|
@@ -12058,7 +12060,7 @@ class LayerLegendComponent {
|
|
|
12058
12060
|
lastlLegend = layer.dataSource.getLegend(this.currentStyle, this.view);
|
|
12059
12061
|
}
|
|
12060
12062
|
if (this.updateLegendOnResolutionChange() ||
|
|
12061
|
-
|
|
12063
|
+
wmsSourceOptions?.contentDependentLegend) {
|
|
12062
12064
|
const state$ = layer.map.viewController.state$;
|
|
12063
12065
|
this.state$$ = state$.subscribe(() => this.onViewControllerStateChange());
|
|
12064
12066
|
}
|
|
@@ -12141,18 +12143,23 @@ class LayerLegendComponent {
|
|
|
12141
12143
|
}
|
|
12142
12144
|
return outLegends;
|
|
12143
12145
|
}
|
|
12144
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12145
12146
|
computeItemTitle(layerLegend) {
|
|
12146
|
-
const
|
|
12147
|
-
|
|
12148
|
-
|
|
12147
|
+
const layerLegendTitle = layerLegend.title ?? '';
|
|
12148
|
+
const sourceOptions = this.layer().dataSource.options;
|
|
12149
|
+
if (!isWmsDataSourceOptions(sourceOptions)) {
|
|
12150
|
+
return of(layerLegendTitle);
|
|
12149
12151
|
}
|
|
12150
|
-
const layers =
|
|
12151
|
-
const
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12152
|
+
const layers = sourceOptions.params.LAYERS.split(',');
|
|
12153
|
+
const layersName = layers.find((layer) => layer === layerLegendTitle) ?? layerLegendTitle;
|
|
12154
|
+
return this.capabilitiesService
|
|
12155
|
+
.getWMSOptions({
|
|
12156
|
+
...sourceOptions,
|
|
12157
|
+
params: {
|
|
12158
|
+
...sourceOptions.params,
|
|
12159
|
+
LAYERS: layersName
|
|
12160
|
+
}
|
|
12161
|
+
})
|
|
12162
|
+
.pipe(map((wmsDataSourceOptions) => {
|
|
12156
12163
|
return wmsDataSourceOptions._layerOptionsFromSource.title;
|
|
12157
12164
|
}));
|
|
12158
12165
|
}
|
|
@@ -21206,8 +21213,6 @@ class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy {
|
|
|
21206
21213
|
* Subscription to the store's OL source changes
|
|
21207
21214
|
*/
|
|
21208
21215
|
stores$$ = new Map();
|
|
21209
|
-
resolution$$ = [];
|
|
21210
|
-
empty$$;
|
|
21211
21216
|
constructor(options) {
|
|
21212
21217
|
super(options);
|
|
21213
21218
|
this.options = options;
|
|
@@ -21222,7 +21227,6 @@ class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy {
|
|
|
21222
21227
|
if (this.active === true) {
|
|
21223
21228
|
this.watchStore(featureStore);
|
|
21224
21229
|
}
|
|
21225
|
-
this.empty$$ = featureStore.empty$.subscribe(() => this.updateEntitiesInResolution(featureStore, featureStore.layer.map.viewController.getResolution()));
|
|
21226
21230
|
}
|
|
21227
21231
|
/**
|
|
21228
21232
|
* Unbind this strategy from a store and stop watching for Ol source changes
|
|
@@ -21230,10 +21234,7 @@ class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy {
|
|
|
21230
21234
|
*/
|
|
21231
21235
|
unbindStore(store) {
|
|
21232
21236
|
super.unbindStore(store);
|
|
21233
|
-
|
|
21234
|
-
if (this.active === true) {
|
|
21235
|
-
this.unwatchStore(featureStore);
|
|
21236
|
-
}
|
|
21237
|
+
this.unwatchStore(store);
|
|
21237
21238
|
}
|
|
21238
21239
|
/**
|
|
21239
21240
|
* Start watching all stores already bound to that strategy at once.
|
|
@@ -21257,12 +21258,15 @@ class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy {
|
|
|
21257
21258
|
if (this.stores$$.has(store)) {
|
|
21258
21259
|
return;
|
|
21259
21260
|
}
|
|
21260
|
-
this.updateEntitiesInResolution(store, store.
|
|
21261
|
-
|
|
21262
|
-
|
|
21261
|
+
this.updateEntitiesInResolution(store, store.map.viewController.getResolution());
|
|
21262
|
+
const subscription = new Subscription();
|
|
21263
|
+
subscription.add(store.map.viewController.resolution$
|
|
21264
|
+
.pipe(debounceTime$1(250))
|
|
21263
21265
|
.subscribe((res) => {
|
|
21264
21266
|
this.updateEntitiesInResolution(store, res);
|
|
21265
21267
|
}));
|
|
21268
|
+
subscription.add(store.empty$.subscribe(() => this.updateEntitiesInResolution(store, store.map.viewController.getResolution())));
|
|
21269
|
+
this.stores$$.set(store, subscription);
|
|
21266
21270
|
}
|
|
21267
21271
|
updateEntitiesInResolution(store, mapResolution) {
|
|
21268
21272
|
if ((mapResolution ?? 0) > store.layer.minResolution &&
|
|
@@ -21278,8 +21282,9 @@ class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy {
|
|
|
21278
21282
|
* @param store Feature store
|
|
21279
21283
|
*/
|
|
21280
21284
|
unwatchStore(store) {
|
|
21281
|
-
const
|
|
21282
|
-
if (
|
|
21285
|
+
const subscription = this.stores$$.get(store);
|
|
21286
|
+
if (subscription !== undefined) {
|
|
21287
|
+
subscription.unsubscribe();
|
|
21283
21288
|
this.stores$$.delete(store);
|
|
21284
21289
|
}
|
|
21285
21290
|
}
|
|
@@ -21287,11 +21292,7 @@ class FeatureStoreInMapResolutionStrategy extends EntityStoreStrategy {
|
|
|
21287
21292
|
* Stop watching for OL source changes in all stores.
|
|
21288
21293
|
*/
|
|
21289
21294
|
unwatchAll() {
|
|
21290
|
-
this.stores$$.
|
|
21291
|
-
this.resolution$$.map((state) => state.unsubscribe());
|
|
21292
|
-
if (this.empty$$) {
|
|
21293
|
-
this.empty$$.unsubscribe();
|
|
21294
|
-
}
|
|
21295
|
+
Array.from(this.stores$$.keys()).forEach((store) => this.unwatchStore(store));
|
|
21295
21296
|
}
|
|
21296
21297
|
}
|
|
21297
21298
|
|
|
@@ -35924,7 +35925,6 @@ class EditionWorkspace extends Workspace {
|
|
|
35924
35925
|
enabled: false
|
|
35925
35926
|
}
|
|
35926
35927
|
});
|
|
35927
|
-
this.map.layerController.remove(this.olDrawingLayer);
|
|
35928
35928
|
}
|
|
35929
35929
|
getDeleteUrl(feature) {
|
|
35930
35930
|
let url;
|
|
@@ -36367,8 +36367,7 @@ class EditionWorkspaceService {
|
|
|
36367
36367
|
layer.options.linkedLayers.links = clonedLinks;
|
|
36368
36368
|
layer.createLink();
|
|
36369
36369
|
let wks;
|
|
36370
|
-
|
|
36371
|
-
.createAsyncLayer({
|
|
36370
|
+
const options = {
|
|
36372
36371
|
title: layer.title,
|
|
36373
36372
|
parentId: layer.options.parentId,
|
|
36374
36373
|
visible: layer.visible,
|
|
@@ -36410,22 +36409,22 @@ class EditionWorkspaceService {
|
|
|
36410
36409
|
sourceFields: dataSource.options.sourceFields || undefined,
|
|
36411
36410
|
edition: dataSource.options.edition
|
|
36412
36411
|
}
|
|
36413
|
-
}
|
|
36414
|
-
|
|
36415
|
-
|
|
36416
|
-
if (!workspaceLayer)
|
|
36412
|
+
};
|
|
36413
|
+
this.layerService.createAsyncLayer(options).subscribe((createdLayer) => {
|
|
36414
|
+
if (!createdLayer)
|
|
36417
36415
|
return;
|
|
36416
|
+
const workspaceLayer = createdLayer;
|
|
36418
36417
|
map.layerController.add(workspaceLayer);
|
|
36419
|
-
|
|
36418
|
+
workspaceLayer.ol.setProperties({
|
|
36420
36419
|
linkedLayers: {
|
|
36421
|
-
linkId:
|
|
36420
|
+
linkId: workspaceLayer.options.linkedLayers.linkId,
|
|
36422
36421
|
links: clonedLinks
|
|
36423
36422
|
}
|
|
36424
36423
|
}, false);
|
|
36425
36424
|
workspaceLayer.dataSource.ol.refresh();
|
|
36426
36425
|
wks = new EditionWorkspace(this.configService, this.adding$, this.layerService, {
|
|
36427
36426
|
id: layer.id,
|
|
36428
|
-
title:
|
|
36427
|
+
title: workspaceLayer.title,
|
|
36429
36428
|
layer: workspaceLayer,
|
|
36430
36429
|
map,
|
|
36431
36430
|
entityStore: this.createFeatureStore(workspaceLayer, map),
|
|
@@ -36436,9 +36435,7 @@ class EditionWorkspaceService {
|
|
|
36436
36435
|
});
|
|
36437
36436
|
this.createTableTemplate(wks, workspaceLayer);
|
|
36438
36437
|
workspaceLayer.options.workspace.workspaceId = workspaceLayer.id;
|
|
36439
|
-
|
|
36440
|
-
wksConfig
|
|
36441
|
-
});
|
|
36438
|
+
workspaceLayer.options.workspace = Object.assign({}, workspaceLayer.options.workspace, { wksConfig });
|
|
36442
36439
|
delete dataSource.options.download;
|
|
36443
36440
|
});
|
|
36444
36441
|
return wks;
|
|
@@ -36765,47 +36762,49 @@ class EditionWorkspaceService {
|
|
|
36765
36762
|
// WORKAROUND to handle PostgrestApi specificity
|
|
36766
36763
|
const properties = this.parseFeature(feature, workspace.meta.tableTemplate.columns);
|
|
36767
36764
|
this.loading = true;
|
|
36768
|
-
|
|
36769
|
-
|
|
36770
|
-
|
|
36765
|
+
this.http
|
|
36766
|
+
.request(protocole, `${url}`, {
|
|
36767
|
+
body: properties,
|
|
36771
36768
|
headers: headers
|
|
36772
|
-
})
|
|
36773
|
-
|
|
36774
|
-
|
|
36775
|
-
|
|
36776
|
-
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
layer.
|
|
36783
|
-
|
|
36769
|
+
})
|
|
36770
|
+
.subscribe({
|
|
36771
|
+
next: () => {
|
|
36772
|
+
this.loading = false;
|
|
36773
|
+
this.cancelEdit(feature, workspace, true);
|
|
36774
|
+
this.messageService.success('igo.geo.workspace.modifySuccess');
|
|
36775
|
+
this.refreshMap(workspace.layer, workspace.layer.map);
|
|
36776
|
+
const relationLayers = [];
|
|
36777
|
+
workspace.layer.options.sourceOptions.relations?.forEach((relation) => {
|
|
36778
|
+
workspace.map.layerController.all.forEach((layer) => {
|
|
36779
|
+
if (isLayerItem(layer) && layer.title === relation.title) {
|
|
36780
|
+
relationLayers.push(layer);
|
|
36781
|
+
layer.dataSource.ol.refresh();
|
|
36782
|
+
}
|
|
36783
|
+
});
|
|
36784
36784
|
});
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
|
|
36792
|
-
|
|
36793
|
-
|
|
36794
|
-
|
|
36795
|
-
|
|
36796
|
-
|
|
36797
|
-
|
|
36798
|
-
|
|
36799
|
-
|
|
36785
|
+
this.relationLayers$.next(relationLayers);
|
|
36786
|
+
},
|
|
36787
|
+
error: (error) => {
|
|
36788
|
+
this.loading = false;
|
|
36789
|
+
error.error.caught = true;
|
|
36790
|
+
const messages = dataSourceOptions.edition.messages;
|
|
36791
|
+
if (messages) {
|
|
36792
|
+
let text;
|
|
36793
|
+
messages.forEach((message) => {
|
|
36794
|
+
const key = Object.keys(message)[0];
|
|
36795
|
+
if (error.error.message.includes(key)) {
|
|
36796
|
+
text = message[key];
|
|
36797
|
+
this.messageService.error(text);
|
|
36798
|
+
}
|
|
36799
|
+
});
|
|
36800
|
+
if (!text) {
|
|
36801
|
+
this.messageService.error('igo.geo.workspace.addError');
|
|
36800
36802
|
}
|
|
36801
|
-
}
|
|
36802
|
-
|
|
36803
|
+
}
|
|
36804
|
+
else {
|
|
36803
36805
|
this.messageService.error('igo.geo.workspace.addError');
|
|
36804
36806
|
}
|
|
36805
36807
|
}
|
|
36806
|
-
else {
|
|
36807
|
-
this.messageService.error('igo.geo.workspace.addError');
|
|
36808
|
-
}
|
|
36809
36808
|
});
|
|
36810
36809
|
}
|
|
36811
36810
|
cleanFeatureProperties(feature, dataSourceOptions) {
|