@provoly/dashboard 0.23.12 → 0.24.0
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/esm2022/lib/core/model/widget-map-manifest.interface.mjs +1 -1
- package/esm2022/lib/dashboard/store/dashboard.actions.mjs +3 -1
- package/esm2022/lib/dashboard/store/dashboard.effects.mjs +28 -1
- package/esm2022/lib/dashboard/store/wms.service.mjs +29 -1
- package/esm2022/widgets/widget-map/component/widget-map.component.mjs +14 -6
- package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +13 -5
- package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
- package/fesm2022/provoly-dashboard.mjs +57 -0
- package/fesm2022/provoly-dashboard.mjs.map +1 -1
- package/lib/core/model/widget-map-manifest.interface.d.ts +1 -0
- package/lib/dashboard/store/dashboard.actions.d.ts +20 -0
- package/lib/dashboard/store/dashboard.effects.d.ts +3 -0
- package/lib/dashboard/store/wms.service.d.ts +3 -0
- package/package.json +31 -31
|
@@ -3875,6 +3875,8 @@ const DashboardActions = {
|
|
|
3875
3875
|
resetWmsFeatures: createAction('[Widget map] Reset Wms layer features'),
|
|
3876
3876
|
getWmsFeatures: createAction('[Widget map] Get Wms layer features', props()),
|
|
3877
3877
|
addWmsFeatures: createAction('[Widget map] Set Wms layer features', props()),
|
|
3878
|
+
getWfsFeatures: createAction('[Widget map] Get wfs Features for point', props()),
|
|
3879
|
+
getWfsFeaturesForPointStackTooltips: createAction('[Widget map] Get wfs Features for showing stack tooltips', props()),
|
|
3878
3880
|
updateDisplayOptions: createAction('[Dashboard/Display] (bus) Update displayed dashboard management features', props()),
|
|
3879
3881
|
getCapability: createAction('[Widget map] Get Wms capability', props()),
|
|
3880
3882
|
updateCapability: createAction('[Widget map] Store Wms capability', props()),
|
|
@@ -10802,6 +10804,10 @@ class WmsService {
|
|
|
10802
10804
|
getWmsFeatures(url) {
|
|
10803
10805
|
return this.httpClient.get(url).pipe(map((json) => json));
|
|
10804
10806
|
}
|
|
10807
|
+
getWfsFeatures(wmsUrl, bbox) {
|
|
10808
|
+
const url = wfsUrlBuilder(wmsUrl, bbox);
|
|
10809
|
+
return this.httpClient.get(url).pipe(map((json) => json));
|
|
10810
|
+
}
|
|
10805
10811
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: WmsService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
10806
10812
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: WmsService, providedIn: 'root' }); }
|
|
10807
10813
|
}
|
|
@@ -10811,6 +10817,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
|
|
|
10811
10817
|
providedIn: 'root'
|
|
10812
10818
|
}]
|
|
10813
10819
|
}], ctorParameters: () => [{ type: i1$2.HttpClient }] });
|
|
10820
|
+
const wfsUrlBuilder = (wmsUrl, bbox, params) => {
|
|
10821
|
+
const wfsFragments = {
|
|
10822
|
+
service: 'WFS',
|
|
10823
|
+
version: '2.0.0',
|
|
10824
|
+
request: 'GetFeature',
|
|
10825
|
+
outputFormat: 'application/json',
|
|
10826
|
+
typeNames: undefined,
|
|
10827
|
+
cql_filter: `BBOX(geom,${bbox.join(',')})`,
|
|
10828
|
+
srsName: undefined,
|
|
10829
|
+
params: params ? `&${params.join('&')}` : ''
|
|
10830
|
+
};
|
|
10831
|
+
const base = wmsUrl.split('?')[0].replace('wms', 'wfs');
|
|
10832
|
+
const wmsUrlFragments = wmsUrl.split('&');
|
|
10833
|
+
wfsFragments['typeNames'] = wmsUrlFragments.find((param) => param.includes('LAYERS'))?.split('=')[1];
|
|
10834
|
+
wfsFragments['srsName'] = wmsUrlFragments.find((param) => param.toUpperCase().includes('CRS'))?.split('=')[1];
|
|
10835
|
+
wfsFragments['cql_filter'] += wmsUrlFragments.find((param) => param.toUpperCase().includes('CQL_FILTER'))
|
|
10836
|
+
? ' AND ' + wmsUrlFragments.find((param) => param.toUpperCase().includes('CQL_FILTER'))?.split('=')[1]
|
|
10837
|
+
: '';
|
|
10838
|
+
return (base +
|
|
10839
|
+
'?' +
|
|
10840
|
+
Object.entries(wfsFragments)
|
|
10841
|
+
.map(([key, value]) => (value ? `${key}=${value}` : ''))
|
|
10842
|
+
.join('&'));
|
|
10843
|
+
};
|
|
10814
10844
|
|
|
10815
10845
|
class DashboardEffects {
|
|
10816
10846
|
constructor(dashboardInitService, actions$, store, manifestService, itemService, titleService, translateService, snackBar, router, refreshService, toolboxManifestService, busService, searchService, pryDialog, wmsService, widgetFactoryService, i18nService) {
|
|
@@ -11157,6 +11187,33 @@ class DashboardEffects {
|
|
|
11157
11187
|
})
|
|
11158
11188
|
});
|
|
11159
11189
|
})));
|
|
11190
|
+
this.getWfsFeaturesForPointStack = createEffect(() => this.actions$.pipe(ofType(DashboardActions.getWfsFeaturesForPointStackTooltips), mergeMap$1((action) => combineLatest([of(action), this.wmsService.getWmsFeatures(action.url)])), mergeMap$1(([action, wmsJson]) => {
|
|
11191
|
+
// check if data is actually a stack of points
|
|
11192
|
+
if (wmsJson.features[0] &&
|
|
11193
|
+
wmsJson.features[0].properties.count &&
|
|
11194
|
+
wmsJson.features[0].properties.countunique &&
|
|
11195
|
+
wmsJson.features[0].properties.count > 1 &&
|
|
11196
|
+
wmsJson.features[0].properties.countunique === 1) {
|
|
11197
|
+
let envBBOXCoords = [...wmsJson.features[0].properties.envBBOX.matchAll(/\d+.\d+/g)].map((m) => m[0]);
|
|
11198
|
+
return this.wmsService
|
|
11199
|
+
.getWfsFeatures(action.url, envBBOXCoords)
|
|
11200
|
+
.pipe(map$1((wfsJson) => ({ action, json: wfsJson })));
|
|
11201
|
+
}
|
|
11202
|
+
// if data is not a stack just add features without calling wfs service
|
|
11203
|
+
return of({ action, json: wmsJson });
|
|
11204
|
+
}), map$1(({ action, json }) => DashboardActions.addWmsFeatures({
|
|
11205
|
+
features: json.features.map((feature) => ({
|
|
11206
|
+
id: feature.id,
|
|
11207
|
+
oClass: action.oClass,
|
|
11208
|
+
coordinates: action.coordinates,
|
|
11209
|
+
properties: Object.keys(feature.properties)
|
|
11210
|
+
.map((property) => ({ key: property, value: feature.properties[property] }))
|
|
11211
|
+
.filter((prop) => !!prop.value)
|
|
11212
|
+
}))
|
|
11213
|
+
})), catchError((error) => {
|
|
11214
|
+
console.error('Error while fetching WFS features', error);
|
|
11215
|
+
return of(DashboardActions.addWmsFeatures({ features: [] }));
|
|
11216
|
+
})));
|
|
11160
11217
|
this.addManifestMetadata = createEffect(() => this.actions$.pipe(ofType(DashboardActions.addManifestMetadata), mergeMap$1((action) => this.manifestService.addMetadata(action.presentationId, action.metadataId, action.value).pipe(map$1(() => DashboardActions.fetchManifestsList()), catchError((error) => {
|
|
11161
11218
|
if (error.status === 404) {
|
|
11162
11219
|
this.snackBar.open({
|