@geogirafe/lib-geoportal 1.3.0-dev.3018313151 → 1.3.0-dev.3053452205

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.
Files changed (43) hide show
  1. package/README.md +3 -2
  2. package/api/apigeogirafeapp.js +3 -1
  3. package/assets/i18n/de.json +1 -0
  4. package/assets/i18n/en.json +1 -0
  5. package/assets/i18n/fr.json +1 -0
  6. package/assets/i18n/it.json +1 -0
  7. package/assets/icons/streetview-marker-mapillary.svg +1 -0
  8. package/components/layout/component.d.ts +5 -0
  9. package/components/map-grid/component.d.ts +4 -0
  10. package/components/map-grid/component.js +6 -0
  11. package/components/print/tools/MFPEncoder.d.ts +22 -10
  12. package/components/print/tools/MFPEncoder.js +75 -43
  13. package/components/streetview/component.d.ts +9 -2
  14. package/components/streetview/component.js +20 -8
  15. package/components/streetview/google.js +1 -1
  16. package/components/streetview/mapillary.d.ts +8 -0
  17. package/components/streetview/mapillary.js +20 -0
  18. package/components/streetview/style.css +16 -0
  19. package/components/streetview/tools/googleprovider.js +9 -2
  20. package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
  21. package/components/streetview/tools/mapillaryprovider.js +150 -0
  22. package/models/layers/grouplayer.d.ts +3 -3
  23. package/models/layers/grouplayer.js +5 -48
  24. package/package.json +1 -1
  25. package/templates/iframe.html +1 -0
  26. package/templates/index.html +1 -0
  27. package/templates/mobile.html +1 -0
  28. package/templates/public/about.json +1 -1
  29. package/tools/app/geogirafeapp-mobile.js +2 -0
  30. package/tools/app/geogirafeapp.js +2 -0
  31. package/tools/configuration/girafeconfig.js +1 -8
  32. package/tools/configuration/streetviewconfig.d.ts +12 -1
  33. package/tools/configuration/streetviewconfig.js +26 -4
  34. package/tools/main.d.ts +3 -2
  35. package/tools/main.js +1 -1
  36. package/tools/state/layout.d.ts +5 -0
  37. package/tools/state/layout.js +2 -1
  38. package/tools/state/streetview.d.ts +1 -1
  39. package/tools/state/streetview.js +1 -1
  40. package/tools/tests/wmswfsmanagermocking.d.ts +2 -2
  41. package/tools/tests/wmswfsmanagermocking.js +68 -61
  42. package/tools/wms/wmsclient.d.ts +164 -26
  43. package/tools/wms/wmsclient.js +415 -233
@@ -1,12 +1,31 @@
1
1
  import { Image as ImageLayer } from 'ol/layer.js';
2
2
  import Feature from 'ol/Feature.js';
3
3
  import ImageWMS from 'ol/source/ImageWMS.js';
4
- import { Map } from 'ol';
4
+ import { Map as OlMap } from 'ol';
5
5
  import LayerWms from '../../models/layers/layerwms.js';
6
6
  import SelectionParam from '../../models/selectionparam.js';
7
7
  import WfsFilter from '../wfs/wfsfilter.js';
8
8
  import ServerOgc from '../../models/serverogc.js';
9
9
  import IGirafeContext from '../context/icontext.js';
10
+ export interface PairedLayer {
11
+ layerWmsArray: LayerWms[];
12
+ oLayer: ImageLayer<ImageWMS>;
13
+ }
14
+ interface LayerInfo {
15
+ opacity: number;
16
+ hasFilter: string | undefined;
17
+ hasTimeRestriction: string | undefined;
18
+ swip: boolean;
19
+ }
20
+ export interface GroupLayerInfo extends LayerInfo {
21
+ zIndexes: number[];
22
+ names: string[];
23
+ }
24
+ /**
25
+ * Abstract class for WMS client.
26
+ * This class is responsible for linking the WMS layers to OL layers on the map and
27
+ * more generally, to their linked OGC server.
28
+ */
10
29
  export default abstract class WmsClient {
11
30
  private readonly map;
12
31
  private readonly ogcServer;
@@ -16,41 +35,151 @@ export default abstract class WmsClient {
16
35
  private readonly wmsGetFeatureInfo;
17
36
  private capabilityPromise;
18
37
  private capabilities;
38
+ private readonly basemapLayers;
39
+ private readonly groupedLayers;
40
+ private readonly debounceUpdateLayers;
41
+ private readonly layersToUpdate;
42
+ constructor(ogcServer: ServerOgc, map: OlMap, context: IGirafeContext);
19
43
  private get state();
20
44
  private get audienceExcludedPaths();
21
- private layers;
22
- private olayer?;
23
- private independentLayers;
24
- private basemapLayers;
25
- constructor(ogcServer: ServerOgc, map: Map, context: IGirafeContext);
26
- removeAllBasemapLayers(): void;
27
- addLayer(layerWms: LayerWms): void;
28
- private addLayerInternal;
29
- createImageWMSSource(layerList?: LayerWms[]): ImageWMS;
30
45
  abstract getOpenLayerLayerNames(layerList: LayerWms[]): string[];
46
+ /**
47
+ * Add a new basemap layer to the map.
48
+ */
31
49
  addBasemapLayer(layerWms: LayerWms): void;
50
+ /**
51
+ * Remove every basemap layer from the map.
52
+ */
53
+ removeAllBasemapLayers(): void;
54
+ /**
55
+ * Add a new layer to the map.
56
+ * The expected "activeState" is already "on"!
57
+ * This is expected to be immediate.
58
+ */
59
+ addLayer(layerWms: LayerWms): void;
60
+ /**
61
+ * Remove a layer from the map.
62
+ * The expected "activeState" is already "off"!
63
+ * This is expected to be immediate.
64
+ */
32
65
  removeLayer(layerWms: LayerWms): void;
33
- layerExists(layerWms: LayerWms): boolean;
34
- private layerInStandardLayers;
35
- private layerIsIndependentLayer;
36
- private layerIsBasemapLayer;
37
- getOLayer(layerWms: LayerWms): ImageLayer<ImageWMS> | null;
66
+ /**
67
+ * Change the opacity of layers on the map.
68
+ * This can come from a group of layers and will be delayed.
69
+ */
38
70
  changeOpacity(layerWms: LayerWms): void;
71
+ /**
72
+ * Change the filter of a layer on the map.
73
+ */
39
74
  changeFilter(layerWms: LayerWms): void;
75
+ /**
76
+ * Change the time restriction of layers on the map.
77
+ * This can come from a group of layers and will be delayed.
78
+ */
40
79
  changeTimeRestriction(layerWms: LayerWms): void;
80
+ /**
81
+ * Change the Swiper of a layer on the map.
82
+ * This is expected to be immediate.
83
+ */
41
84
  prepareSwipe(layerWms: LayerWms): void;
42
- private manageLayerOptions;
43
- private makeLayerIndependent;
44
- private updateLayerFilter;
45
85
  /**
46
- * MapServer wants 1 filter per underlying WFS queryLayer, all included in parentheses
47
- * QGIS-server wants 1 filter per underlying WFS queryLayer, each in its own in parentheses
48
- *
49
- * MapServer: (<filter>...</filter><filter>...</filter>)
50
- * QGIS-server: (<filter>...</filter>)(<filter>...</filter>)
86
+ * Refresh the Z-Index of every layer on the map.
51
87
  */
52
- static buildFilterQuery(layerWms: LayerWms): string;
88
+ refreshZIndexes(): void;
89
+ /**
90
+ * @returns true if a matching (OL) layer exists on the map, false otherwise.
91
+ */
92
+ layerExists(layerWms: LayerWms): boolean;
93
+ /**
94
+ * @returns the (OL) layer associated with the given layerWms if the layer exists on the map.
95
+ * The resulting layer MUST NOT be edited. Edit the model instead.
96
+ */
97
+ getOLayer(layerWms: LayerWms): ImageLayer<ImageWMS> | null;
98
+ /**
99
+ * @returns The array of LayerWms, indicating which layer are grouped together.
100
+ */
101
+ getLayerWmsArrays(): LayerWms[][];
102
+ /**
103
+ * Update layer but with a small debounce to wait on other layers with similar changes.
104
+ * Useful to update multiple layers at once and avoid multiple rendering
105
+ * of the (OL) layer (avoid a blinking effect).
106
+ * @param layerWms
107
+ * @private
108
+ */
109
+ private updateLayerDebounced;
110
+ /**
111
+ * Update layers directly, without debounce.
112
+ * @private
113
+ */
114
+ private updateLayerDirect;
115
+ /**
116
+ * Update, change, or add new groups of layers (GroupLayerInfo => PairedLayers (OL and LayerWms)).
117
+ * @param layerWmsArray layerWms with the assumption that they can be grouped together.
118
+ * @private
119
+ */
120
+ private updateGroupedLayers;
121
+ /**
122
+ * Find a GroupLayerInfo that matches at least one layer of the provided array.
123
+ * @returns The existing GroupLayerInfo (key of the list of existing layers) or undefined.
124
+ * @private
125
+ */
126
+ private findExistingGroupLayerInfo;
127
+ /**
128
+ * Returns a LayerInfo (opacity, hasFilter, etc.) of a LayerWms.
129
+ * It's not possible to request multiple layer with a filter, therefore
130
+ * a unique string is passed as "hasFilter" info if the layer has an active
131
+ * filter on it.
132
+ * @returns the LayerInfo of a LayerWms.
133
+ * @private
134
+ */
135
+ private getLayerWmsInfo;
136
+ /**
137
+ * @returns {boolean} Returns true if the two LayerInfo objects are identical; otherwise, false.
138
+ */
139
+ private isLayerInfoIdentical;
140
+ /**
141
+ * @returns {GroupLayerInfo} Returns a GroupLayerInfo object containing the LayerInfo and zIndexes.
142
+ * @private
143
+ */
144
+ private getGroupedLayerInfo;
145
+ /**
146
+ * Deletes the group and remove the matching OL layer from the map.
147
+ * @private
148
+ */
149
+ private removeGroupedLayers;
150
+ /**
151
+ * Creates a new group, create and add an OL layer to the map.
152
+ * @private
153
+ */
154
+ private addNewGroupedLayers;
155
+ /**
156
+ * For all provided layers, delete the group and remove the matching OL layer from the map.
157
+ * Create then new groups (and new ol layers) with all layers in the impacted groups.
158
+ * @private
159
+ */
160
+ private deleteGroupsAndCallUpdateOnLayers;
161
+ /**
162
+ * Compare the LayerGroupInfo and the properties of the contained layer to update the OL layer.
163
+ * Then, update the LayerGroupInfo then to match again the state of the contained layers.
164
+ * @private
165
+ */
166
+ private updateLayerGroup;
167
+ /**
168
+ * Regroup same groups if needed.
169
+ * Iterate on every group in the order (z-index) and regroup consecutive groups sharing the same properties.
170
+ * @private
171
+ */
172
+ private regroupSameGroups;
173
+ /**
174
+ * @returns a newly created ol layer with the right properties and options.
175
+ * @private
176
+ */
177
+ private createOlLayer;
178
+ private manageLayerOptions;
179
+ private layerIsBasemapLayer;
180
+ private updateLayerFilter;
53
181
  private updateTimeRestriction;
182
+ private createImageWMSSource;
54
183
  selectFeatures(extent: number[]): void;
55
184
  /**
56
185
  * Selects features based on the specified query and prepares selection parameters.
@@ -61,11 +190,19 @@ export default abstract class WmsClient {
61
190
  }>[]>;
62
191
  private getFeatureInfoUrl;
63
192
  private handleGetFeatureInfoResponse;
64
- refreshZIndexes(): void;
65
193
  getWmsCapabilities(params?: URLSearchParams): Promise<Record<string, unknown>>;
194
+ /**
195
+ * MapServer wants 1 filter per underlying WFS queryLayer, all included in parentheses
196
+ * QGIS server wants 1 filter per underlying WFS queryLayer, each in its own in parentheses
197
+ *
198
+ * MapServer: (<filter>...</filter><filter>...</filter>)
199
+ * QGIS-server: (<filter>...</filter>)(<filter>...</filter>)
200
+ */
201
+ static buildFilterQuery(layerWms: LayerWms): string;
66
202
  }
67
203
  export declare class WmsClientQgis extends WmsClient {
68
- /** QGIS-server does not filter on a WMS layer made from multiple underlying WFS queryLayers
204
+ /**
205
+ * QGIS server does not filter on a WMS layer made from multiple underlying WFS queryLayers
69
206
  * Solution: directly query the queryLayers
70
207
  */
71
208
  getOpenLayerLayerNames(layerList: LayerWms[]): string[];
@@ -77,3 +214,4 @@ export declare class WmsClientMapServer extends WmsClient {
77
214
  }
78
215
  export declare const WmsClientDefault: typeof WmsClientQgis;
79
216
  export declare const WmsClientGeoServer: typeof WmsClientMapServer;
217
+ export {};